OSDN Git Service

BugTrack2/163: Correct typo. "filname" -> "filename"
[pukiwiki/pukiwiki.git] / plugin / stationary.inc.php
index 7c7bc97..e36883b 100644 (file)
@@ -1,5 +1,5 @@
 <?php
-// $Id: stationary.inc.php,v 1.3 2005/04/02 03:36:37 henoheno Exp $
+// $Id: stationary.inc.php,v 1.8 2006/02/07 06:26:42 teanan Exp $
 //
 // Stationary plugin
 // License: The same as PukiWiki
@@ -22,7 +22,7 @@ function plugin_stationary_init()
 // Convert-type plugin: #stationary or #stationary(foo)
 function plugin_stationary_convert()
 {
-       // If you don't want this to work at secure/productive site,
+       // If you don't want this work at secure/productive site,
        if (PKWK_SAFE_MODE) return ''; // Show nothing
 
        // If this plugin will write someting,
@@ -36,11 +36,11 @@ function plugin_stationary_convert()
        if (func_num_args()) {
                $args = func_get_args();
                foreach (array_keys($args) as $key)
-                       $args[$key] = htmlspecialchars(trim($args[$key]));
-               $result = '(' . join(',', $args) . ')';
+                       $args[$key] = trim($args[$key]);
+               $result = join(',', $args);
        }
 
-       return '#stationary' . $result . '<br/>';
+       return '#stationary(' . htmlspecialchars($result) . ')<br />';
 }
 
 // In-line type plugin: &stationary; or &stationary(foo); , or &stationary(foo){bar};
@@ -48,9 +48,15 @@ function plugin_stationary_inline()
 {
        if (PKWK_SAFE_MODE || PKWK_READONLY) return ''; // See above
 
-       $result = '&stationary(){};';
+       // {bar} is always exists, and already sanitized
+       $args = func_get_args();
+       $body = strip_autolink(array_pop($args)); // {bar}
 
-       return htmlspecialchars($result);
+       foreach (array_keys($args) as $key)
+               $args[$key] = trim($args[$key]);
+       $result = join(',', $args);
+
+       return '&amp;stationary(' . htmlspecialchars($result) . '){' . $body . '};';
 }
 
 // Action-type plugin: ?plugin=stationary&foo=bar