OSDN Git Service

BugTrack2/62: Do remove the whole design, 'Showing TrackBack-ping list by html'.
[pukiwiki/pukiwiki.git] / plugin / stationary.inc.php
1 <?php
2 // $Id: stationary.inc.php,v 1.6 2005/05/06 12:27:18 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 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] = trim($args[$key]);
40                 $result = join(',', $args);
41         }
42
43         return '#stationary(' . htmlspecialchars($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         // {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
54
55         foreach (array_keys($args) as $key)
56                 $args[$key] = trim($args[$key]);
57         $result = join(',', $args);
58
59         return '&stationary(' . htmlspecialchars($result) . '){' . $body . '};';
60 }
61
62 // Action-type plugin: ?plugin=stationary&foo=bar
63 function plugin_stationary_action()
64 {
65         // See above
66         if (PKWK_SAFE_MODE || PKWK_READONLY)
67                 die_message('PKWK_SAFE_MODE or PKWK_READONLY prohibits this');
68
69         $msg  = 'Message';
70         $body = 'Message body';
71
72         return array('msg'=>htmlspecialchars($msg), 'body'=>htmlspecialchars($body));
73 }
74 ?>