OSDN Git Service

Correct '<br/>' => '<br />'
[pukiwiki/pukiwiki.git] / plugin / stationary.inc.php
1 <?php
2 // $Id: stationary.inc.php,v 1.4 2005/04/02 06:33:39 henoheno Exp $
3 //
4 // Stationary plugin
5 // License: The same as PukiWiki
6
7 // Define someting like this
8 define('PLUGIN_STATIONARY_MAX', 10);
9
10 // Init someting
11 function plugin_stationary_init()
12 {
13         if (PKWK_SAFE_MODE || PKWK_READONLY) return; // Do nothing
14
15         $messages = array(
16                 '_plugin_stationary_A' => 'a',
17                 '_plugin_stationary_B' => array('C' => 'c', 'D'=>'d'),
18                 );
19         set_plugin_messages($messages);
20 }
21
22 // Convert-type plugin: #stationary or #stationary(foo)
23 function plugin_stationary_convert()
24 {
25         // If you don't want this to work at secure/productive site,
26         if (PKWK_SAFE_MODE) return ''; // Show nothing
27
28         // If this plugin will write someting,
29         if (PKWK_READONLY) return ''; // Show nothing
30
31         // Init
32         $args = array();
33         $result = '';
34
35         // Get arguments
36         if (func_num_args()) {
37                 $args = func_get_args();
38                 foreach (array_keys($args) as $key)
39                         $args[$key] = htmlspecialchars(trim($args[$key]));
40                 $result = '(' . join(',', $args) . ')';
41         }
42
43         return '#stationary' . $result . '<br />';
44 }
45
46 // In-line type plugin: &stationary; or &stationary(foo); , or &stationary(foo){bar};
47 function plugin_stationary_inline()
48 {
49         if (PKWK_SAFE_MODE || PKWK_READONLY) return ''; // See above
50
51         $result = '&stationary(){};';
52
53         return htmlspecialchars($result);
54 }
55
56 // Action-type plugin: ?plugin=stationary&foo=bar
57 function plugin_stationary_action()
58 {
59         // See above
60         if (PKWK_SAFE_MODE || PKWK_READONLY)
61                 die_message('PKWK_SAFE_MODE or PKWK_READONLY prohibits this');
62
63         $msg  = 'Message';
64         $body = 'Message body';
65
66         return array('msg'=>htmlspecialchars($msg), 'body'=>htmlspecialchars($body));
67 }
68 ?>