<?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
// 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,
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};
{
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 '&stationary(' . htmlspecialchars($result) . '){' . $body . '};';
}
// Action-type plugin: ?plugin=stationary&foo=bar