1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
| | !// Escapes
!class Link_escape extends Link
{
var $pattern;
var $plain,$param;
function Link_escape($start)
{
parent::Link($start);
}
function get_pattern()
{
$this->pattern = <<<EOD
&
( # (1) plain
- (\w+) # (2) plugin name
- (?:
- \(
- ((?:(?!\)[;{]).)*) # (3) parameter
- \)
- )?
+ ([-!"#$%&'()=~|\\`@+*;:<>?_,.\/}{\][ ^]) # (2) plugin name
)
EOD;
return <<<EOD
{$this->pattern}
-(?:
- \{
- ((?:(?R)|(?!};).)*) # (4) body
- \}
-)?
;
EOD;
}
function get_count()
{
- return 4;
+ return 2;
}
function set($arr, $page)
{
- list($all, $this->plain, $name, $this->param, $body) = $this->splice($arr);
+ list($all, $this->plain, $name) = $this->splice($arr);
// Re-get true plugin name and patameters (for PHP 4.1.2)
$matches = array();
if (preg_match('/^' . $this->pattern . '/x', $all, $matches)
&& $matches[1] != $this->plain)
list(, $this->plain, $name) = $matches;
+ $body = '';
- return parent::setParam($page, $name, $body, 'plugin');
+ return parent::setParam($page, $name, $body, 'escape');
}
function toString()
{
- $body = ($this->body == '') ? '' : make_link($this->body);
- $str = FALSE;
-
- // Try to call the plugin
- if (exist_plugin_inline($this->name))
- $str = do_plugin_inline($this->name, $this->param, $body);
-
- if ($str !== FALSE) {
- return $str; // Succeed
- } else {
- // No such plugin, or Failed
- $body = (($body == '') ? '' : '{' . $body . '}') . ';';
- return make_line_rules(htmlspecialchars('&' . $this->plain) . $body);
- }
+ return htmlspecialchars($this->name);
}
}
|