@@ -29,47 +29,47 @@ discard block |
||
29 | 29 | */ |
30 | 30 | function PluginLoadTemplatesCompile(Compiler $compiler, $file) |
31 | 31 | { |
32 | - $file = substr($file, 1, - 1); |
|
32 | + $file = substr($file, 1, - 1); |
|
33 | 33 | |
34 | - if ($file === '') { |
|
35 | - return ''; |
|
36 | - } |
|
34 | + if ($file === '') { |
|
35 | + return ''; |
|
36 | + } |
|
37 | 37 | |
38 | - if (preg_match('#^([a-z]{2,}):(.*)$#i', $file, $m)) { |
|
39 | - // resource:identifier given, extract them |
|
40 | - $resource = $m[1]; |
|
41 | - $identifier = $m[2]; |
|
42 | - } else { |
|
43 | - // get the current template's resource |
|
44 | - $resource = $compiler->getDwoo()->getTemplate()->getResourceName(); |
|
45 | - $identifier = $file; |
|
46 | - } |
|
38 | + if (preg_match('#^([a-z]{2,}):(.*)$#i', $file, $m)) { |
|
39 | + // resource:identifier given, extract them |
|
40 | + $resource = $m[1]; |
|
41 | + $identifier = $m[2]; |
|
42 | + } else { |
|
43 | + // get the current template's resource |
|
44 | + $resource = $compiler->getDwoo()->getTemplate()->getResourceName(); |
|
45 | + $identifier = $file; |
|
46 | + } |
|
47 | 47 | |
48 | - $tpl = $compiler->getDwoo()->templateFactory($resource, $identifier); |
|
48 | + $tpl = $compiler->getDwoo()->templateFactory($resource, $identifier); |
|
49 | 49 | |
50 | - if ($tpl === null) { |
|
51 | - throw new CompilationException($compiler, 'Load Templates : Resource "' . $resource . ':' . $identifier . '" not found.'); |
|
52 | - } elseif ($tpl === false) { |
|
53 | - throw new CompilationException($compiler, 'Load Templates : Resource "' . $resource . '" does not support includes.'); |
|
54 | - } |
|
50 | + if ($tpl === null) { |
|
51 | + throw new CompilationException($compiler, 'Load Templates : Resource "' . $resource . ':' . $identifier . '" not found.'); |
|
52 | + } elseif ($tpl === false) { |
|
53 | + throw new CompilationException($compiler, 'Load Templates : Resource "' . $resource . '" does not support includes.'); |
|
54 | + } |
|
55 | 55 | |
56 | - $cmp = clone $compiler; |
|
57 | - $cmp->compile($compiler->getDwoo(), $tpl); |
|
58 | - foreach ($cmp->getTemplatePlugins() as $template => $args) { |
|
59 | - $compiler->addTemplatePlugin($template, $args['params'], $args['uuid'], $args['body']); |
|
60 | - } |
|
61 | - foreach ($cmp->getUsedPlugins() as $plugin => $type) { |
|
62 | - $compiler->addUsedPlugin($plugin, $type); |
|
63 | - } |
|
56 | + $cmp = clone $compiler; |
|
57 | + $cmp->compile($compiler->getDwoo(), $tpl); |
|
58 | + foreach ($cmp->getTemplatePlugins() as $template => $args) { |
|
59 | + $compiler->addTemplatePlugin($template, $args['params'], $args['uuid'], $args['body']); |
|
60 | + } |
|
61 | + foreach ($cmp->getUsedPlugins() as $plugin => $type) { |
|
62 | + $compiler->addUsedPlugin($plugin, $type); |
|
63 | + } |
|
64 | 64 | |
65 | - $out = '\'\';// checking for modification in ' . $resource . ':' . $identifier . "\r\n"; |
|
65 | + $out = '\'\';// checking for modification in ' . $resource . ':' . $identifier . "\r\n"; |
|
66 | 66 | |
67 | - $modCheck = $tpl->getIsModifiedCode(); |
|
67 | + $modCheck = $tpl->getIsModifiedCode(); |
|
68 | 68 | |
69 | - if ($modCheck) { |
|
70 | - $out .= 'if (!(' . $modCheck . ')) { ob_end_clean(); return false; }'; |
|
71 | - } else { |
|
72 | - $out .= 'try { |
|
69 | + if ($modCheck) { |
|
70 | + $out .= 'if (!(' . $modCheck . ')) { ob_end_clean(); return false; }'; |
|
71 | + } else { |
|
72 | + $out .= 'try { |
|
73 | 73 | $tpl = $this->templateFactory("' . $resource . '", "' . $identifier . '"); |
74 | 74 | } catch (Dwoo\Exception $e) { |
75 | 75 | $this->triggerError(\'Load Templates : Resource <em>' . $resource . '</em> was not added to Dwoo, can not extend <em>' . $identifier . '</em>\', E_USER_WARNING); |
@@ -79,7 +79,7 @@ discard block |
||
79 | 79 | elseif ($tpl === false) |
80 | 80 | $this->triggerError(\'Load Templates : Resource "' . $resource . '" does not support extends.\', E_USER_WARNING); |
81 | 81 | if ($tpl->getUid() != "' . $tpl->getUid() . '") { ob_end_clean(); return false; }'; |
82 | - } |
|
82 | + } |
|
83 | 83 | |
84 | - return $out; |
|
84 | + return $out; |
|
85 | 85 | } |
@@ -48,9 +48,9 @@ discard block |
||
48 | 48 | $tpl = $compiler->getDwoo()->templateFactory($resource, $identifier); |
49 | 49 | |
50 | 50 | if ($tpl === null) { |
51 | - throw new CompilationException($compiler, 'Load Templates : Resource "' . $resource . ':' . $identifier . '" not found.'); |
|
51 | + throw new CompilationException($compiler, 'Load Templates : Resource "'.$resource.':'.$identifier.'" not found.'); |
|
52 | 52 | } elseif ($tpl === false) { |
53 | - throw new CompilationException($compiler, 'Load Templates : Resource "' . $resource . '" does not support includes.'); |
|
53 | + throw new CompilationException($compiler, 'Load Templates : Resource "'.$resource.'" does not support includes.'); |
|
54 | 54 | } |
55 | 55 | |
56 | 56 | $cmp = clone $compiler; |
@@ -62,23 +62,23 @@ discard block |
||
62 | 62 | $compiler->addUsedPlugin($plugin, $type); |
63 | 63 | } |
64 | 64 | |
65 | - $out = '\'\';// checking for modification in ' . $resource . ':' . $identifier . "\r\n"; |
|
65 | + $out = '\'\';// checking for modification in '.$resource.':'.$identifier."\r\n"; |
|
66 | 66 | |
67 | 67 | $modCheck = $tpl->getIsModifiedCode(); |
68 | 68 | |
69 | 69 | if ($modCheck) { |
70 | - $out .= 'if (!(' . $modCheck . ')) { ob_end_clean(); return false; }'; |
|
70 | + $out .= 'if (!('.$modCheck.')) { ob_end_clean(); return false; }'; |
|
71 | 71 | } else { |
72 | 72 | $out .= 'try { |
73 | - $tpl = $this->templateFactory("' . $resource . '", "' . $identifier . '"); |
|
73 | + $tpl = $this->templateFactory("' . $resource.'", "'.$identifier.'"); |
|
74 | 74 | } catch (Dwoo\Exception $e) { |
75 | - $this->triggerError(\'Load Templates : Resource <em>' . $resource . '</em> was not added to Dwoo, can not extend <em>' . $identifier . '</em>\', E_USER_WARNING); |
|
75 | + $this->triggerError(\'Load Templates : Resource <em>' . $resource.'</em> was not added to Dwoo, can not extend <em>'.$identifier.'</em>\', E_USER_WARNING); |
|
76 | 76 | } |
77 | 77 | if ($tpl === null) |
78 | - $this->triggerError(\'Load Templates : Resource "' . $resource . ':' . $identifier . '" was not found.\', E_USER_WARNING); |
|
78 | + $this->triggerError(\'Load Templates : Resource "' . $resource.':'.$identifier.'" was not found.\', E_USER_WARNING); |
|
79 | 79 | elseif ($tpl === false) |
80 | - $this->triggerError(\'Load Templates : Resource "' . $resource . '" does not support extends.\', E_USER_WARNING); |
|
81 | -if ($tpl->getUid() != "' . $tpl->getUid() . '") { ob_end_clean(); return false; }'; |
|
80 | + $this->triggerError(\'Load Templates : Resource "' . $resource.'" does not support extends.\', E_USER_WARNING); |
|
81 | +if ($tpl->getUid() != "' . $tpl->getUid().'") { ob_end_clean(); return false; }'; |
|
82 | 82 | } |
83 | 83 | |
84 | 84 | return $out; |
@@ -29,5 +29,5 @@ |
||
29 | 29 | */ |
30 | 30 | function PluginStringFormatCompile(Compiler $compiler, $value, $format) |
31 | 31 | { |
32 | - return 'sprintf(' . $format . ',' . $value . ')'; |
|
32 | + return 'sprintf(' . $format . ',' . $value . ')'; |
|
33 | 33 | } |
@@ -29,5 +29,5 @@ |
||
29 | 29 | */ |
30 | 30 | function PluginStringFormatCompile(Compiler $compiler, $value, $format) |
31 | 31 | { |
32 | - return 'sprintf(' . $format . ',' . $value . ')'; |
|
32 | + return 'sprintf('.$format.','.$value.')'; |
|
33 | 33 | } |
@@ -29,5 +29,5 @@ |
||
29 | 29 | */ |
30 | 30 | function PluginDefaultCompile(Compiler $compiler, $value, $default = '') |
31 | 31 | { |
32 | - return '(($tmp = ' . $value . ')===null||$tmp===\'\' ? ' . $default . ' : $tmp)'; |
|
32 | + return '(($tmp = ' . $value . ')===null||$tmp===\'\' ? ' . $default . ' : $tmp)'; |
|
33 | 33 | } |
@@ -29,5 +29,5 @@ |
||
29 | 29 | */ |
30 | 30 | function PluginDefaultCompile(Compiler $compiler, $value, $default = '') |
31 | 31 | { |
32 | - return '(($tmp = ' . $value . ')===null||$tmp===\'\' ? ' . $default . ' : $tmp)'; |
|
32 | + return '(($tmp = '.$value.')===null||$tmp===\'\' ? '.$default.' : $tmp)'; |
|
33 | 33 | } |
@@ -29,5 +29,5 @@ |
||
29 | 29 | */ |
30 | 30 | function PluginAssignCompile(Compiler $compiler, $value, $var) |
31 | 31 | { |
32 | - return '$this->assignInScope(' . $value . ', ' . $var . ')'; |
|
32 | + return '$this->assignInScope(' . $value . ', ' . $var . ')'; |
|
33 | 33 | } |
@@ -29,5 +29,5 @@ |
||
29 | 29 | */ |
30 | 30 | function PluginAssignCompile(Compiler $compiler, $value, $var) |
31 | 31 | { |
32 | - return '$this->assignInScope(' . $value . ', ' . $var . ')'; |
|
32 | + return '$this->assignInScope('.$value.', '.$var.')'; |
|
33 | 33 | } |
@@ -36,93 +36,93 @@ |
||
36 | 36 | */ |
37 | 37 | function PluginMailto(Core $dwoo, $address, $text = null, $subject = null, $encode = null, $cc = null, $bcc = null, $newsgroups = null, $followupto = null, $extra = null) |
38 | 38 | { |
39 | - if (empty($address)) { |
|
40 | - return ''; |
|
41 | - } |
|
42 | - if (empty($text)) { |
|
43 | - $text = $address; |
|
44 | - } |
|
45 | - |
|
46 | - // build address string |
|
47 | - $address .= '?'; |
|
48 | - |
|
49 | - if (!empty($subject)) { |
|
50 | - $address .= 'subject=' . rawurlencode($subject) . '&'; |
|
51 | - } |
|
52 | - if (!empty($cc)) { |
|
53 | - $address .= 'cc=' . rawurlencode($cc) . '&'; |
|
54 | - } |
|
55 | - if (!empty($bcc)) { |
|
56 | - $address .= 'bcc=' . rawurlencode($bcc) . '&'; |
|
57 | - } |
|
58 | - if (!empty($newsgroups)) { |
|
59 | - $address .= 'newsgroups=' . rawurlencode($newsgroups) . '&'; |
|
60 | - } |
|
61 | - if (!empty($followupto)) { |
|
62 | - $address .= 'followupto=' . rawurlencode($followupto) . '&'; |
|
63 | - } |
|
64 | - |
|
65 | - $address = rtrim($address, '?&'); |
|
66 | - |
|
67 | - // output |
|
68 | - switch ($encode) { |
|
69 | - |
|
70 | - case 'none': |
|
71 | - case null: |
|
72 | - return '<a href="mailto:' . $address . '" ' . $extra . '>' . $text . '</a>'; |
|
73 | - |
|
74 | - case 'js': |
|
75 | - case 'javascript': |
|
76 | - $str = 'document.write(\'<a href="mailto:' . $address . '" ' . $extra . '>' . $text . '</a>\');'; |
|
77 | - $len = strlen($str); |
|
78 | - |
|
79 | - $out = ''; |
|
80 | - for ($i = 0; $i < $len; ++ $i) { |
|
81 | - $out .= '%' . bin2hex($str[$i]); |
|
82 | - } |
|
83 | - |
|
84 | - return '<script type="text/javascript">eval(unescape(\'' . $out . '\'));</script>'; |
|
85 | - |
|
86 | - break; |
|
87 | - case 'javascript_charcode': |
|
88 | - case 'js_charcode': |
|
89 | - case 'jscharcode': |
|
90 | - case 'jschar': |
|
91 | - $str = '<a href="mailto:' . $address . '" ' . $extra . '>' . $text . '</a>'; |
|
92 | - $len = strlen($str); |
|
93 | - |
|
94 | - $out = '<script type="text/javascript">' . "\n<!--\ndocument.write(String.fromCharCode("; |
|
95 | - for ($i = 0; $i < $len; ++ $i) { |
|
96 | - $out .= ord($str[$i]) . ','; |
|
97 | - } |
|
98 | - |
|
99 | - return rtrim($out, ',') . "));\n-->\n</script>\n"; |
|
100 | - |
|
101 | - break; |
|
102 | - |
|
103 | - case 'hex': |
|
104 | - if (strpos($address, '?') !== false) { |
|
105 | - $dwoo->triggerError('Mailto: Hex encoding is not possible with extra attributes, use one of : <em>js, jscharcode or none</em>.', E_USER_WARNING); |
|
106 | - } |
|
107 | - |
|
108 | - $out = '<a href="mailto:'; |
|
109 | - $len = strlen($address); |
|
110 | - for ($i = 0; $i < $len; ++ $i) { |
|
111 | - if (preg_match('#\w#', $address[$i])) { |
|
112 | - $out .= '%' . bin2hex($address[$i]); |
|
113 | - } else { |
|
114 | - $out .= $address[$i]; |
|
115 | - } |
|
116 | - } |
|
117 | - $out .= '" ' . $extra . '>'; |
|
118 | - $len = strlen($text); |
|
119 | - for ($i = 0; $i < $len; ++ $i) { |
|
120 | - $out .= '&#x' . bin2hex($text[$i]); |
|
121 | - } |
|
122 | - |
|
123 | - return $out . '</a>'; |
|
124 | - |
|
125 | - default: |
|
126 | - $dwoo->triggerError('Mailto: <em>encode</em> argument is invalid, it must be one of : <em>none (= no value), js, js_charcode or hex</em>', E_USER_WARNING); |
|
127 | - } |
|
39 | + if (empty($address)) { |
|
40 | + return ''; |
|
41 | + } |
|
42 | + if (empty($text)) { |
|
43 | + $text = $address; |
|
44 | + } |
|
45 | + |
|
46 | + // build address string |
|
47 | + $address .= '?'; |
|
48 | + |
|
49 | + if (!empty($subject)) { |
|
50 | + $address .= 'subject=' . rawurlencode($subject) . '&'; |
|
51 | + } |
|
52 | + if (!empty($cc)) { |
|
53 | + $address .= 'cc=' . rawurlencode($cc) . '&'; |
|
54 | + } |
|
55 | + if (!empty($bcc)) { |
|
56 | + $address .= 'bcc=' . rawurlencode($bcc) . '&'; |
|
57 | + } |
|
58 | + if (!empty($newsgroups)) { |
|
59 | + $address .= 'newsgroups=' . rawurlencode($newsgroups) . '&'; |
|
60 | + } |
|
61 | + if (!empty($followupto)) { |
|
62 | + $address .= 'followupto=' . rawurlencode($followupto) . '&'; |
|
63 | + } |
|
64 | + |
|
65 | + $address = rtrim($address, '?&'); |
|
66 | + |
|
67 | + // output |
|
68 | + switch ($encode) { |
|
69 | + |
|
70 | + case 'none': |
|
71 | + case null: |
|
72 | + return '<a href="mailto:' . $address . '" ' . $extra . '>' . $text . '</a>'; |
|
73 | + |
|
74 | + case 'js': |
|
75 | + case 'javascript': |
|
76 | + $str = 'document.write(\'<a href="mailto:' . $address . '" ' . $extra . '>' . $text . '</a>\');'; |
|
77 | + $len = strlen($str); |
|
78 | + |
|
79 | + $out = ''; |
|
80 | + for ($i = 0; $i < $len; ++ $i) { |
|
81 | + $out .= '%' . bin2hex($str[$i]); |
|
82 | + } |
|
83 | + |
|
84 | + return '<script type="text/javascript">eval(unescape(\'' . $out . '\'));</script>'; |
|
85 | + |
|
86 | + break; |
|
87 | + case 'javascript_charcode': |
|
88 | + case 'js_charcode': |
|
89 | + case 'jscharcode': |
|
90 | + case 'jschar': |
|
91 | + $str = '<a href="mailto:' . $address . '" ' . $extra . '>' . $text . '</a>'; |
|
92 | + $len = strlen($str); |
|
93 | + |
|
94 | + $out = '<script type="text/javascript">' . "\n<!--\ndocument.write(String.fromCharCode("; |
|
95 | + for ($i = 0; $i < $len; ++ $i) { |
|
96 | + $out .= ord($str[$i]) . ','; |
|
97 | + } |
|
98 | + |
|
99 | + return rtrim($out, ',') . "));\n-->\n</script>\n"; |
|
100 | + |
|
101 | + break; |
|
102 | + |
|
103 | + case 'hex': |
|
104 | + if (strpos($address, '?') !== false) { |
|
105 | + $dwoo->triggerError('Mailto: Hex encoding is not possible with extra attributes, use one of : <em>js, jscharcode or none</em>.', E_USER_WARNING); |
|
106 | + } |
|
107 | + |
|
108 | + $out = '<a href="mailto:'; |
|
109 | + $len = strlen($address); |
|
110 | + for ($i = 0; $i < $len; ++ $i) { |
|
111 | + if (preg_match('#\w#', $address[$i])) { |
|
112 | + $out .= '%' . bin2hex($address[$i]); |
|
113 | + } else { |
|
114 | + $out .= $address[$i]; |
|
115 | + } |
|
116 | + } |
|
117 | + $out .= '" ' . $extra . '>'; |
|
118 | + $len = strlen($text); |
|
119 | + for ($i = 0; $i < $len; ++ $i) { |
|
120 | + $out .= '&#x' . bin2hex($text[$i]); |
|
121 | + } |
|
122 | + |
|
123 | + return $out . '</a>'; |
|
124 | + |
|
125 | + default: |
|
126 | + $dwoo->triggerError('Mailto: <em>encode</em> argument is invalid, it must be one of : <em>none (= no value), js, js_charcode or hex</em>', E_USER_WARNING); |
|
127 | + } |
|
128 | 128 | } |
@@ -67,62 +67,62 @@ |
||
67 | 67 | // output |
68 | 68 | switch ($encode) { |
69 | 69 | |
70 | - case 'none': |
|
71 | - case null: |
|
72 | - return '<a href="mailto:' . $address . '" ' . $extra . '>' . $text . '</a>'; |
|
73 | - |
|
74 | - case 'js': |
|
75 | - case 'javascript': |
|
76 | - $str = 'document.write(\'<a href="mailto:' . $address . '" ' . $extra . '>' . $text . '</a>\');'; |
|
77 | - $len = strlen($str); |
|
78 | - |
|
79 | - $out = ''; |
|
80 | - for ($i = 0; $i < $len; ++ $i) { |
|
81 | - $out .= '%' . bin2hex($str[$i]); |
|
70 | + case 'none': |
|
71 | + case null: |
|
72 | + return '<a href="mailto:' . $address . '" ' . $extra . '>' . $text . '</a>'; |
|
73 | + |
|
74 | + case 'js': |
|
75 | + case 'javascript': |
|
76 | + $str = 'document.write(\'<a href="mailto:' . $address . '" ' . $extra . '>' . $text . '</a>\');'; |
|
77 | + $len = strlen($str); |
|
78 | + |
|
79 | + $out = ''; |
|
80 | + for ($i = 0; $i < $len; ++ $i) { |
|
81 | + $out .= '%' . bin2hex($str[$i]); |
|
82 | + } |
|
83 | + |
|
84 | + return '<script type="text/javascript">eval(unescape(\'' . $out . '\'));</script>'; |
|
85 | + |
|
86 | + break; |
|
87 | + case 'javascript_charcode': |
|
88 | + case 'js_charcode': |
|
89 | + case 'jscharcode': |
|
90 | + case 'jschar': |
|
91 | + $str = '<a href="mailto:' . $address . '" ' . $extra . '>' . $text . '</a>'; |
|
92 | + $len = strlen($str); |
|
93 | + |
|
94 | + $out = '<script type="text/javascript">' . "\n<!--\ndocument.write(String.fromCharCode("; |
|
95 | + for ($i = 0; $i < $len; ++ $i) { |
|
96 | + $out .= ord($str[$i]) . ','; |
|
97 | + } |
|
98 | + |
|
99 | + return rtrim($out, ',') . "));\n-->\n</script>\n"; |
|
100 | + |
|
101 | + break; |
|
102 | + |
|
103 | + case 'hex': |
|
104 | + if (strpos($address, '?') !== false) { |
|
105 | + $dwoo->triggerError('Mailto: Hex encoding is not possible with extra attributes, use one of : <em>js, jscharcode or none</em>.', E_USER_WARNING); |
|
106 | + } |
|
107 | + |
|
108 | + $out = '<a href="mailto:'; |
|
109 | + $len = strlen($address); |
|
110 | + for ($i = 0; $i < $len; ++ $i) { |
|
111 | + if (preg_match('#\w#', $address[$i])) { |
|
112 | + $out .= '%' . bin2hex($address[$i]); |
|
113 | + } else { |
|
114 | + $out .= $address[$i]; |
|
82 | 115 | } |
116 | + } |
|
117 | + $out .= '" ' . $extra . '>'; |
|
118 | + $len = strlen($text); |
|
119 | + for ($i = 0; $i < $len; ++ $i) { |
|
120 | + $out .= '&#x' . bin2hex($text[$i]); |
|
121 | + } |
|
83 | 122 | |
84 | - return '<script type="text/javascript">eval(unescape(\'' . $out . '\'));</script>'; |
|
123 | + return $out . '</a>'; |
|
85 | 124 | |
86 | - break; |
|
87 | - case 'javascript_charcode': |
|
88 | - case 'js_charcode': |
|
89 | - case 'jscharcode': |
|
90 | - case 'jschar': |
|
91 | - $str = '<a href="mailto:' . $address . '" ' . $extra . '>' . $text . '</a>'; |
|
92 | - $len = strlen($str); |
|
93 | - |
|
94 | - $out = '<script type="text/javascript">' . "\n<!--\ndocument.write(String.fromCharCode("; |
|
95 | - for ($i = 0; $i < $len; ++ $i) { |
|
96 | - $out .= ord($str[$i]) . ','; |
|
97 | - } |
|
98 | - |
|
99 | - return rtrim($out, ',') . "));\n-->\n</script>\n"; |
|
100 | - |
|
101 | - break; |
|
102 | - |
|
103 | - case 'hex': |
|
104 | - if (strpos($address, '?') !== false) { |
|
105 | - $dwoo->triggerError('Mailto: Hex encoding is not possible with extra attributes, use one of : <em>js, jscharcode or none</em>.', E_USER_WARNING); |
|
106 | - } |
|
107 | - |
|
108 | - $out = '<a href="mailto:'; |
|
109 | - $len = strlen($address); |
|
110 | - for ($i = 0; $i < $len; ++ $i) { |
|
111 | - if (preg_match('#\w#', $address[$i])) { |
|
112 | - $out .= '%' . bin2hex($address[$i]); |
|
113 | - } else { |
|
114 | - $out .= $address[$i]; |
|
115 | - } |
|
116 | - } |
|
117 | - $out .= '" ' . $extra . '>'; |
|
118 | - $len = strlen($text); |
|
119 | - for ($i = 0; $i < $len; ++ $i) { |
|
120 | - $out .= '&#x' . bin2hex($text[$i]); |
|
121 | - } |
|
122 | - |
|
123 | - return $out . '</a>'; |
|
124 | - |
|
125 | - default: |
|
126 | - $dwoo->triggerError('Mailto: <em>encode</em> argument is invalid, it must be one of : <em>none (= no value), js, js_charcode or hex</em>', E_USER_WARNING); |
|
125 | + default: |
|
126 | + $dwoo->triggerError('Mailto: <em>encode</em> argument is invalid, it must be one of : <em>none (= no value), js, js_charcode or hex</em>', E_USER_WARNING); |
|
127 | 127 | } |
128 | 128 | } |
@@ -47,19 +47,19 @@ discard block |
||
47 | 47 | $address .= '?'; |
48 | 48 | |
49 | 49 | if (!empty($subject)) { |
50 | - $address .= 'subject=' . rawurlencode($subject) . '&'; |
|
50 | + $address .= 'subject='.rawurlencode($subject).'&'; |
|
51 | 51 | } |
52 | 52 | if (!empty($cc)) { |
53 | - $address .= 'cc=' . rawurlencode($cc) . '&'; |
|
53 | + $address .= 'cc='.rawurlencode($cc).'&'; |
|
54 | 54 | } |
55 | 55 | if (!empty($bcc)) { |
56 | - $address .= 'bcc=' . rawurlencode($bcc) . '&'; |
|
56 | + $address .= 'bcc='.rawurlencode($bcc).'&'; |
|
57 | 57 | } |
58 | 58 | if (!empty($newsgroups)) { |
59 | - $address .= 'newsgroups=' . rawurlencode($newsgroups) . '&'; |
|
59 | + $address .= 'newsgroups='.rawurlencode($newsgroups).'&'; |
|
60 | 60 | } |
61 | 61 | if (!empty($followupto)) { |
62 | - $address .= 'followupto=' . rawurlencode($followupto) . '&'; |
|
62 | + $address .= 'followupto='.rawurlencode($followupto).'&'; |
|
63 | 63 | } |
64 | 64 | |
65 | 65 | $address = rtrim($address, '?&'); |
@@ -69,34 +69,34 @@ discard block |
||
69 | 69 | |
70 | 70 | case 'none': |
71 | 71 | case null: |
72 | - return '<a href="mailto:' . $address . '" ' . $extra . '>' . $text . '</a>'; |
|
72 | + return '<a href="mailto:'.$address.'" '.$extra.'>'.$text.'</a>'; |
|
73 | 73 | |
74 | 74 | case 'js': |
75 | 75 | case 'javascript': |
76 | - $str = 'document.write(\'<a href="mailto:' . $address . '" ' . $extra . '>' . $text . '</a>\');'; |
|
76 | + $str = 'document.write(\'<a href="mailto:'.$address.'" '.$extra.'>'.$text.'</a>\');'; |
|
77 | 77 | $len = strlen($str); |
78 | 78 | |
79 | 79 | $out = ''; |
80 | 80 | for ($i = 0; $i < $len; ++ $i) { |
81 | - $out .= '%' . bin2hex($str[$i]); |
|
81 | + $out .= '%'.bin2hex($str[$i]); |
|
82 | 82 | } |
83 | 83 | |
84 | - return '<script type="text/javascript">eval(unescape(\'' . $out . '\'));</script>'; |
|
84 | + return '<script type="text/javascript">eval(unescape(\''.$out.'\'));</script>'; |
|
85 | 85 | |
86 | 86 | break; |
87 | 87 | case 'javascript_charcode': |
88 | 88 | case 'js_charcode': |
89 | 89 | case 'jscharcode': |
90 | 90 | case 'jschar': |
91 | - $str = '<a href="mailto:' . $address . '" ' . $extra . '>' . $text . '</a>'; |
|
91 | + $str = '<a href="mailto:'.$address.'" '.$extra.'>'.$text.'</a>'; |
|
92 | 92 | $len = strlen($str); |
93 | 93 | |
94 | - $out = '<script type="text/javascript">' . "\n<!--\ndocument.write(String.fromCharCode("; |
|
94 | + $out = '<script type="text/javascript">'."\n<!--\ndocument.write(String.fromCharCode("; |
|
95 | 95 | for ($i = 0; $i < $len; ++ $i) { |
96 | - $out .= ord($str[$i]) . ','; |
|
96 | + $out .= ord($str[$i]).','; |
|
97 | 97 | } |
98 | 98 | |
99 | - return rtrim($out, ',') . "));\n-->\n</script>\n"; |
|
99 | + return rtrim($out, ',')."));\n-->\n</script>\n"; |
|
100 | 100 | |
101 | 101 | break; |
102 | 102 | |
@@ -109,18 +109,18 @@ discard block |
||
109 | 109 | $len = strlen($address); |
110 | 110 | for ($i = 0; $i < $len; ++ $i) { |
111 | 111 | if (preg_match('#\w#', $address[$i])) { |
112 | - $out .= '%' . bin2hex($address[$i]); |
|
112 | + $out .= '%'.bin2hex($address[$i]); |
|
113 | 113 | } else { |
114 | 114 | $out .= $address[$i]; |
115 | 115 | } |
116 | 116 | } |
117 | - $out .= '" ' . $extra . '>'; |
|
117 | + $out .= '" '.$extra.'>'; |
|
118 | 118 | $len = strlen($text); |
119 | 119 | for ($i = 0; $i < $len; ++ $i) { |
120 | - $out .= '&#x' . bin2hex($text[$i]); |
|
120 | + $out .= '&#x'.bin2hex($text[$i]); |
|
121 | 121 | } |
122 | 122 | |
123 | - return $out . '</a>'; |
|
123 | + return $out.'</a>'; |
|
124 | 124 | |
125 | 125 | default: |
126 | 126 | $dwoo->triggerError('Mailto: <em>encode</em> argument is invalid, it must be one of : <em>none (= no value), js, js_charcode or hex</em>', E_USER_WARNING); |
@@ -28,5 +28,5 @@ |
||
28 | 28 | */ |
29 | 29 | function PluginUpperCompile(Compiler $compiler, $value) |
30 | 30 | { |
31 | - return 'mb_strtoupper((string) ' . $value . ', $this->charset)'; |
|
31 | + return 'mb_strtoupper((string) ' . $value . ', $this->charset)'; |
|
32 | 32 | } |
@@ -28,5 +28,5 @@ |
||
28 | 28 | */ |
29 | 29 | function PluginUpperCompile(Compiler $compiler, $value) |
30 | 30 | { |
31 | - return 'mb_strtoupper((string) ' . $value . ', $this->charset)'; |
|
31 | + return 'mb_strtoupper((string) '.$value.', $this->charset)'; |
|
32 | 32 | } |
@@ -28,5 +28,5 @@ |
||
28 | 28 | */ |
29 | 29 | function PluginSafeCompile(Compiler $compiler, $var) |
30 | 30 | { |
31 | - return preg_replace('#\(is_string\(\$tmp=(.+)\) \? htmlspecialchars\(\$tmp, ENT_QUOTES, \$this->charset\) : \$tmp\)#', '$1', $var); |
|
31 | + return preg_replace('#\(is_string\(\$tmp=(.+)\) \? htmlspecialchars\(\$tmp, ENT_QUOTES, \$this->charset\) : \$tmp\)#', '$1', $var); |
|
32 | 32 | } |
@@ -28,5 +28,5 @@ |
||
28 | 28 | */ |
29 | 29 | function PluginOptionalCompile(Compiler $compiler, $value) |
30 | 30 | { |
31 | - return $value; |
|
31 | + return $value; |
|
32 | 32 | } |
@@ -34,61 +34,61 @@ |
||
34 | 34 | */ |
35 | 35 | class PluginCounter extends Plugin |
36 | 36 | { |
37 | - protected $counters = array(); |
|
37 | + protected $counters = array(); |
|
38 | 38 | |
39 | - /** |
|
40 | - * @param string $name |
|
41 | - * @param null $start |
|
42 | - * @param null $skip |
|
43 | - * @param null $direction |
|
44 | - * @param null $print |
|
45 | - * @param null $assign |
|
46 | - * |
|
47 | - * @return mixed |
|
48 | - */ |
|
49 | - public function process($name = 'default', $start = null, $skip = null, $direction = null, $print = null, $assign = null) |
|
50 | - { |
|
51 | - // init counter |
|
52 | - if (!isset($this->counters[$name])) { |
|
53 | - $this->counters[$name] = array( |
|
54 | - 'count' => $start === null ? 1 : (int)$start, |
|
55 | - 'skip' => $skip === null ? 1 : (int)$skip, |
|
56 | - 'print' => $print === null ? true : (bool)$print, |
|
57 | - 'assign' => $assign === null ? null : (string)$assign, |
|
58 | - 'direction' => strtolower($direction) === 'down' ? - 1 : 1, |
|
59 | - ); |
|
60 | - } // increment |
|
61 | - else { |
|
62 | - // override setting if present |
|
63 | - if ($skip !== null) { |
|
64 | - $this->counters[$name]['skip'] = (int)$skip; |
|
65 | - } |
|
39 | + /** |
|
40 | + * @param string $name |
|
41 | + * @param null $start |
|
42 | + * @param null $skip |
|
43 | + * @param null $direction |
|
44 | + * @param null $print |
|
45 | + * @param null $assign |
|
46 | + * |
|
47 | + * @return mixed |
|
48 | + */ |
|
49 | + public function process($name = 'default', $start = null, $skip = null, $direction = null, $print = null, $assign = null) |
|
50 | + { |
|
51 | + // init counter |
|
52 | + if (!isset($this->counters[$name])) { |
|
53 | + $this->counters[$name] = array( |
|
54 | + 'count' => $start === null ? 1 : (int)$start, |
|
55 | + 'skip' => $skip === null ? 1 : (int)$skip, |
|
56 | + 'print' => $print === null ? true : (bool)$print, |
|
57 | + 'assign' => $assign === null ? null : (string)$assign, |
|
58 | + 'direction' => strtolower($direction) === 'down' ? - 1 : 1, |
|
59 | + ); |
|
60 | + } // increment |
|
61 | + else { |
|
62 | + // override setting if present |
|
63 | + if ($skip !== null) { |
|
64 | + $this->counters[$name]['skip'] = (int)$skip; |
|
65 | + } |
|
66 | 66 | |
67 | - if ($direction !== null) { |
|
68 | - $this->counters[$name]['direction'] = strtolower($direction) === 'down' ? - 1 : 1; |
|
69 | - } |
|
67 | + if ($direction !== null) { |
|
68 | + $this->counters[$name]['direction'] = strtolower($direction) === 'down' ? - 1 : 1; |
|
69 | + } |
|
70 | 70 | |
71 | - if ($print !== null) { |
|
72 | - $this->counters[$name]['print'] = (bool)$print; |
|
73 | - } |
|
71 | + if ($print !== null) { |
|
72 | + $this->counters[$name]['print'] = (bool)$print; |
|
73 | + } |
|
74 | 74 | |
75 | - if ($assign !== null) { |
|
76 | - $this->counters[$name]['assign'] = (string)$assign; |
|
77 | - } |
|
75 | + if ($assign !== null) { |
|
76 | + $this->counters[$name]['assign'] = (string)$assign; |
|
77 | + } |
|
78 | 78 | |
79 | - if ($start !== null) { |
|
80 | - $this->counters[$name]['count'] = (int)$start; |
|
81 | - } else { |
|
82 | - $this->counters[$name]['count'] += ($this->counters[$name]['skip'] * $this->counters[$name]['direction']); |
|
83 | - } |
|
84 | - } |
|
79 | + if ($start !== null) { |
|
80 | + $this->counters[$name]['count'] = (int)$start; |
|
81 | + } else { |
|
82 | + $this->counters[$name]['count'] += ($this->counters[$name]['skip'] * $this->counters[$name]['direction']); |
|
83 | + } |
|
84 | + } |
|
85 | 85 | |
86 | - $out = $this->counters[$name]['count']; |
|
86 | + $out = $this->counters[$name]['count']; |
|
87 | 87 | |
88 | - if ($this->counters[$name]['assign'] !== null) { |
|
89 | - $this->core->assignInScope($out, $this->counters[$name]['assign']); |
|
90 | - } elseif ($this->counters[$name]['print'] === true) { |
|
91 | - return $out; |
|
92 | - } |
|
93 | - } |
|
88 | + if ($this->counters[$name]['assign'] !== null) { |
|
89 | + $this->core->assignInScope($out, $this->counters[$name]['assign']); |
|
90 | + } elseif ($this->counters[$name]['print'] === true) { |
|
91 | + return $out; |
|
92 | + } |
|
93 | + } |
|
94 | 94 | } |
@@ -51,35 +51,35 @@ |
||
51 | 51 | // init counter |
52 | 52 | if (!isset($this->counters[$name])) { |
53 | 53 | $this->counters[$name] = array( |
54 | - 'count' => $start === null ? 1 : (int)$start, |
|
55 | - 'skip' => $skip === null ? 1 : (int)$skip, |
|
56 | - 'print' => $print === null ? true : (bool)$print, |
|
57 | - 'assign' => $assign === null ? null : (string)$assign, |
|
58 | - 'direction' => strtolower($direction) === 'down' ? - 1 : 1, |
|
54 | + 'count' => $start === null ? 1 : (int) $start, |
|
55 | + 'skip' => $skip === null ? 1 : (int) $skip, |
|
56 | + 'print' => $print === null ? true : (bool) $print, |
|
57 | + 'assign' => $assign === null ? null : (string) $assign, |
|
58 | + 'direction' => strtolower($direction) === 'down' ? -1 : 1, |
|
59 | 59 | ); |
60 | 60 | } // increment |
61 | 61 | else { |
62 | 62 | // override setting if present |
63 | 63 | if ($skip !== null) { |
64 | - $this->counters[$name]['skip'] = (int)$skip; |
|
64 | + $this->counters[$name]['skip'] = (int) $skip; |
|
65 | 65 | } |
66 | 66 | |
67 | 67 | if ($direction !== null) { |
68 | - $this->counters[$name]['direction'] = strtolower($direction) === 'down' ? - 1 : 1; |
|
68 | + $this->counters[$name]['direction'] = strtolower($direction) === 'down' ? -1 : 1; |
|
69 | 69 | } |
70 | 70 | |
71 | 71 | if ($print !== null) { |
72 | - $this->counters[$name]['print'] = (bool)$print; |
|
72 | + $this->counters[$name]['print'] = (bool) $print; |
|
73 | 73 | } |
74 | 74 | |
75 | 75 | if ($assign !== null) { |
76 | - $this->counters[$name]['assign'] = (string)$assign; |
|
76 | + $this->counters[$name]['assign'] = (string) $assign; |
|
77 | 77 | } |
78 | 78 | |
79 | 79 | if ($start !== null) { |
80 | - $this->counters[$name]['count'] = (int)$start; |
|
80 | + $this->counters[$name]['count'] = (int) $start; |
|
81 | 81 | } else { |
82 | - $this->counters[$name]['count'] += ($this->counters[$name]['skip'] * $this->counters[$name]['direction']); |
|
82 | + $this->counters[$name]['count'] += ($this->counters[$name]['skip']*$this->counters[$name]['direction']); |
|
83 | 83 | } |
84 | 84 | } |
85 | 85 |