9 * LICENSE: This source file is licensed under the terms of the GNU General Public License.
11 * @package Magic3 Framework
12 * @author 平田直毅(Naoki Hirata) <naoki@aplo.co.jp>
13 * @copyright Copyright 2006-2008 Magic3 Project.
14 * @license http://www.gnu.org/copyleft/gpl.html GPL License
15 * @version SVN: $Id: stationary.inc.php 1128 2008-10-25 10:59:47Z fishbone $
16 * @link http://www.magic3.org
19 // Define someting like this
20 define('PLUGIN_STATIONARY_MAX', 10);
23 function plugin_stationary_init()
25 if (PKWK_SAFE_MODE || PKWK_READONLY) return; // Do nothing
28 '_plugin_stationary_A' => 'a',
29 '_plugin_stationary_B' => array('C' => 'c', 'D'=>'d'),
31 set_plugin_messages($messages);
34 // Convert-type plugin: #stationary or #stationary(foo)
35 function plugin_stationary_convert()
37 // If you don't want this work at secure/productive site,
38 if (PKWK_SAFE_MODE) return ''; // Show nothing
40 // If this plugin will write someting,
41 if (PKWK_READONLY) return ''; // Show nothing
48 if (func_num_args()) {
49 $args = func_get_args();
50 foreach (array_keys($args) as $key)
51 $args[$key] = trim($args[$key]);
52 $result = join(',', $args);
55 return '#stationary(' . htmlspecialchars($result) . ')<br />';
58 // In-line type plugin: &stationary; or &stationary(foo); , or &stationary(foo){bar};
59 function plugin_stationary_inline()
61 if (PKWK_SAFE_MODE || PKWK_READONLY) return ''; // See above
63 // {bar} is always exists, and already sanitized
64 $args = func_get_args();
65 $body = strip_autolink(array_pop($args)); // {bar}
67 foreach (array_keys($args) as $key)
68 $args[$key] = trim($args[$key]);
69 $result = join(',', $args);
71 return '&stationary(' . htmlspecialchars($result) . '){' . $body . '};';
74 // Action-type plugin: ?plugin=stationary&foo=bar
75 function plugin_stationary_action()
78 if (PKWK_SAFE_MODE || PKWK_READONLY)
79 die_message('PKWK_SAFE_MODE or PKWK_READONLY prohibits this');
82 $body = 'Message body';
84 return array('msg'=>htmlspecialchars($msg), 'body'=>htmlspecialchars($body));