2 // $Id: stationary.inc.php,v 1.6 2005/05/06 12:27:18 henoheno Exp $
5 // License: The same as PukiWiki
7 // Define someting like this
8 define('PLUGIN_STATIONARY_MAX', 10);
11 function plugin_stationary_init()
13 if (PKWK_SAFE_MODE || PKWK_READONLY) return; // Do nothing
16 '_plugin_stationary_A' => 'a',
17 '_plugin_stationary_B' => array('C' => 'c', 'D'=>'d'),
19 set_plugin_messages($messages);
22 // Convert-type plugin: #stationary or #stationary(foo)
23 function plugin_stationary_convert()
25 // If you don't want this work at secure/productive site,
26 if (PKWK_SAFE_MODE) return ''; // Show nothing
28 // If this plugin will write someting,
29 if (PKWK_READONLY) return ''; // Show nothing
36 if (func_num_args()) {
37 $args = func_get_args();
38 foreach (array_keys($args) as $key)
39 $args[$key] = trim($args[$key]);
40 $result = join(',', $args);
43 return '#stationary(' . htmlspecialchars($result) . ')<br />';
46 // In-line type plugin: &stationary; or &stationary(foo); , or &stationary(foo){bar};
47 function plugin_stationary_inline()
49 if (PKWK_SAFE_MODE || PKWK_READONLY) return ''; // See above
51 // {bar} is always exists, and already sanitized
52 $args = func_get_args();
53 $body = strip_htmltag(array_pop($args)); // {bar}. strip_htmltag() is just for AutoLink insertion
55 foreach (array_keys($args) as $key)
56 $args[$key] = trim($args[$key]);
57 $result = join(',', $args);
59 return '&stationary(' . htmlspecialchars($result) . '){' . $body . '};';
62 // Action-type plugin: ?plugin=stationary&foo=bar
63 function plugin_stationary_action()
66 if (PKWK_SAFE_MODE || PKWK_READONLY)
67 die_message('PKWK_SAFE_MODE or PKWK_READONLY prohibits this');
70 $body = 'Message body';
72 return array('msg'=>htmlspecialchars($msg), 'body'=>htmlspecialchars($body));