Passed
Push — master ( 020752...f1625c )
by David
05:47 queued 02:32
created
lib/Dwoo/Plugins/Blocks/PluginIf.php 1 patch
Switch Indentation   +153 added lines, -153 removed lines patch added patch discarded remove patch
@@ -70,164 +70,164 @@
 block discarded – undo
70 70
             }
71 71
             switch ($vmod) {
72 72
 
73
-                case 'and':
74
-                    if ($tokens[$k] === Compiler::T_UNQUOTED_STRING) {
75
-                        $p[] = '&&';
76
-                    } else {
77
-                        $p[] = $v;
78
-                    }
79
-                    break;
80
-                case 'or':
81
-                    if ($tokens[$k] === Compiler::T_UNQUOTED_STRING) {
82
-                        $p[] = '||';
83
-                    } else {
84
-                        $p[] = $v;
85
-                    }
86
-                    break;
87
-                case 'xor':
88
-                    if ($tokens[$k] === Compiler::T_UNQUOTED_STRING) {
89
-                        $p[] = '^';
90
-                    } else {
91
-                        $p[] = $v;
92
-                    }
93
-                    break;
94
-                case 'eq':
95
-                    if ($tokens[$k] === Compiler::T_UNQUOTED_STRING) {
96
-                        $p[] = '==';
97
-                    } else {
98
-                        $p[] = $v;
99
-                    }
100
-                    break;
101
-                case 'ne':
102
-                case 'neq':
103
-                    if ($tokens[$k] === Compiler::T_UNQUOTED_STRING) {
104
-                        $p[] = '!=';
105
-                    } else {
106
-                        $p[] = $v;
107
-                    }
108
-                    break;
109
-                case 'gte':
110
-                case 'ge':
111
-                    if ($tokens[$k] === Compiler::T_UNQUOTED_STRING) {
112
-                        $p[] = '>=';
113
-                    } else {
114
-                        $p[] = $v;
115
-                    }
116
-                    break;
117
-                case 'lte':
118
-                case 'le':
119
-                    if ($tokens[$k] === Compiler::T_UNQUOTED_STRING) {
120
-                        $p[] = '<=';
121
-                    } else {
122
-                        $p[] = $v;
123
-                    }
124
-                    break;
125
-                case 'gt':
126
-                    if ($tokens[$k] === Compiler::T_UNQUOTED_STRING) {
127
-                        $p[] = '>';
128
-                    } else {
129
-                        $p[] = $v;
130
-                    }
131
-                    break;
132
-                case 'lt':
133
-                    if ($tokens[$k] === Compiler::T_UNQUOTED_STRING) {
134
-                        $p[] = '<';
135
-                    } else {
136
-                        $p[] = $v;
137
-                    }
138
-                    break;
139
-                case 'mod':
140
-                    if ($tokens[$k] === Compiler::T_UNQUOTED_STRING) {
141
-                        $p[] = '%';
142
-                    } else {
143
-                        $p[] = $v;
144
-                    }
145
-                    break;
146
-                case 'not':
147
-                    if ($tokens[$k] === Compiler::T_UNQUOTED_STRING) {
148
-                        $p[] = '!';
149
-                    } else {
150
-                        $p[] = $v;
151
-                    }
152
-                    break;
153
-                case '<>':
73
+            case 'and':
74
+                if ($tokens[$k] === Compiler::T_UNQUOTED_STRING) {
75
+                    $p[] = '&&';
76
+                } else {
77
+                    $p[] = $v;
78
+                }
79
+                break;
80
+            case 'or':
81
+                if ($tokens[$k] === Compiler::T_UNQUOTED_STRING) {
82
+                    $p[] = '||';
83
+                } else {
84
+                    $p[] = $v;
85
+                }
86
+                break;
87
+            case 'xor':
88
+                if ($tokens[$k] === Compiler::T_UNQUOTED_STRING) {
89
+                    $p[] = '^';
90
+                } else {
91
+                    $p[] = $v;
92
+                }
93
+                break;
94
+            case 'eq':
95
+                if ($tokens[$k] === Compiler::T_UNQUOTED_STRING) {
96
+                    $p[] = '==';
97
+                } else {
98
+                    $p[] = $v;
99
+                }
100
+                break;
101
+            case 'ne':
102
+            case 'neq':
103
+                if ($tokens[$k] === Compiler::T_UNQUOTED_STRING) {
154 104
                     $p[] = '!=';
105
+                } else {
106
+                    $p[] = $v;
107
+                }
108
+                break;
109
+            case 'gte':
110
+            case 'ge':
111
+                if ($tokens[$k] === Compiler::T_UNQUOTED_STRING) {
112
+                    $p[] = '>=';
113
+                } else {
114
+                    $p[] = $v;
115
+                }
116
+                break;
117
+            case 'lte':
118
+            case 'le':
119
+                if ($tokens[$k] === Compiler::T_UNQUOTED_STRING) {
120
+                    $p[] = '<=';
121
+                } else {
122
+                    $p[] = $v;
123
+                }
124
+                break;
125
+            case 'gt':
126
+                if ($tokens[$k] === Compiler::T_UNQUOTED_STRING) {
127
+                    $p[] = '>';
128
+                } else {
129
+                    $p[] = $v;
130
+                }
131
+                break;
132
+            case 'lt':
133
+                if ($tokens[$k] === Compiler::T_UNQUOTED_STRING) {
134
+                    $p[] = '<';
135
+                } else {
136
+                    $p[] = $v;
137
+                }
138
+                break;
139
+            case 'mod':
140
+                if ($tokens[$k] === Compiler::T_UNQUOTED_STRING) {
141
+                    $p[] = '%';
142
+                } else {
143
+                    $p[] = $v;
144
+                }
145
+                break;
146
+            case 'not':
147
+                if ($tokens[$k] === Compiler::T_UNQUOTED_STRING) {
148
+                    $p[] = '!';
149
+                } else {
150
+                    $p[] = $v;
151
+                }
152
+                break;
153
+            case '<>':
154
+                $p[] = '!=';
155
+                break;
156
+            case '==':
157
+            case '!=':
158
+            case '>=':
159
+            case '<=':
160
+            case '>':
161
+            case '<':
162
+            case '===':
163
+            case '!==':
164
+            case '%':
165
+            case '!':
166
+            case '^':
167
+                $p[] = $vmod;
168
+                break;
169
+            case 'is':
170
+                if ($tokens[$k] !== Compiler::T_UNQUOTED_STRING) {
171
+                    $p[] = $v;
155 172
                     break;
156
-                case '==':
157
-                case '!=':
158
-                case '>=':
159
-                case '<=':
160
-                case '>':
161
-                case '<':
162
-                case '===':
163
-                case '!==':
164
-                case '%':
165
-                case '!':
166
-                case '^':
167
-                    $p[] = $vmod;
173
+                }
174
+                if (isset($params[$k + 1]) && strtolower(trim($params[$k + 1], '"\'')) === 'not' && $tokens[$k + 1] === Compiler::T_UNQUOTED_STRING) {
175
+                    $negate = true;
176
+                    next($params);
177
+                } else {
178
+                    $negate = false;
179
+                }
180
+                $ptr = 1 + (int)$negate;
181
+                if ($tokens[$k + $ptr] !== Compiler::T_UNQUOTED_STRING) {
168 182
                     break;
169
-                case 'is':
170
-                    if ($tokens[$k] !== Compiler::T_UNQUOTED_STRING) {
171
-                        $p[] = $v;
172
-                        break;
173
-                    }
174
-                    if (isset($params[$k + 1]) && strtolower(trim($params[$k + 1], '"\'')) === 'not' && $tokens[$k + 1] === Compiler::T_UNQUOTED_STRING) {
175
-                        $negate = true;
176
-                        next($params);
177
-                    } else {
178
-                        $negate = false;
179
-                    }
180
-                    $ptr = 1 + (int)$negate;
181
-                    if ($tokens[$k + $ptr] !== Compiler::T_UNQUOTED_STRING) {
182
-                        break;
183
-                    }
184
-                    if (!isset($params[$k + $ptr])) {
185
-                        $params[$k + $ptr] = '';
186
-                    } else {
187
-                        $params[$k + $ptr] = trim($params[$k + $ptr], '"\'');
188
-                    }
189
-                    switch ($params[$k + $ptr]) {
183
+                }
184
+                if (!isset($params[$k + $ptr])) {
185
+                    $params[$k + $ptr] = '';
186
+                } else {
187
+                    $params[$k + $ptr] = trim($params[$k + $ptr], '"\'');
188
+                }
189
+                switch ($params[$k + $ptr]) {
190 190
 
191
-                        case 'div':
192
-                            if (isset($params[$k + $ptr + 1]) && strtolower(trim($params[$k + $ptr + 1], '"\'')) === 'by') {
193
-                                $p[] = ' % ' . $params[$k + $ptr + 2] . ' ' . ($negate ? '!' : '=') . '== 0';
194
-                                next($params);
195
-                                next($params);
196
-                                next($params);
197
-                            } else {
198
-                                throw new CompilationException($compiler, 'If : Syntax error : syntax should be "if $a is [not] div by $b", found ' . $params[$k - 1] . ' is ' . ($negate ? 'not ' : '') . 'div ' . $params[$k + $ptr + 1] . ' ' . $params[$k + $ptr + 2]);
199
-                            }
200
-                            break;
201
-                        case 'even':
202
-                            $a = array_pop($p);
203
-                            if (isset($params[$k + $ptr + 1]) && strtolower(trim($params[$k + $ptr + 1], '"\'')) === 'by') {
204
-                                $b   = $params[$k + $ptr + 2];
205
-                                $p[] = '(' . $a . ' / ' . $b . ') % 2 ' . ($negate ? '!' : '=') . '== 0';
206
-                                next($params);
207
-                                next($params);
208
-                            } else {
209
-                                $p[] = $a . ' % 2 ' . ($negate ? '!' : '=') . '== 0';
210
-                            }
211
-                            next($params);
212
-                            break;
213
-                        case 'odd':
214
-                            $a = array_pop($p);
215
-                            if (isset($params[$k + $ptr + 1]) && strtolower(trim($params[$k + $ptr + 1], '"\'')) === 'by') {
216
-                                $b   = $params[$k + $ptr + 2];
217
-                                $p[] = '(' . $a . ' / ' . $b . ') % 2 ' . ($negate ? '=' : '!') . '== 0';
218
-                                next($params);
219
-                                next($params);
220
-                            } else {
221
-                                $p[] = $a . ' % 2 ' . ($negate ? '=' : '!') . '== 0';
222
-                            }
223
-                            next($params);
224
-                            break;
225
-                        default:
226
-                            throw new CompilationException($compiler, 'If : Syntax error : syntax should be "if $a is [not] (div|even|odd) [by $b]", found ' . $params[$k - 1] . ' is ' . $params[$k + $ptr + 1]);
227
-                    }
228
-                    break;
191
+                case 'div':
192
+                if (isset($params[$k + $ptr + 1]) && strtolower(trim($params[$k + $ptr + 1], '"\'')) === 'by') {
193
+                $p[] = ' % ' . $params[$k + $ptr + 2] . ' ' . ($negate ? '!' : '=') . '== 0';
194
+                next($params);
195
+                next($params);
196
+                next($params);
197
+                } else {
198
+                throw new CompilationException($compiler, 'If : Syntax error : syntax should be "if $a is [not] div by $b", found ' . $params[$k - 1] . ' is ' . ($negate ? 'not ' : '') . 'div ' . $params[$k + $ptr + 1] . ' ' . $params[$k + $ptr + 2]);
199
+                }
200
+                break;
201
+                case 'even':
202
+                $a = array_pop($p);
203
+                if (isset($params[$k + $ptr + 1]) && strtolower(trim($params[$k + $ptr + 1], '"\'')) === 'by') {
204
+                $b   = $params[$k + $ptr + 2];
205
+                $p[] = '(' . $a . ' / ' . $b . ') % 2 ' . ($negate ? '!' : '=') . '== 0';
206
+                next($params);
207
+                next($params);
208
+                } else {
209
+                $p[] = $a . ' % 2 ' . ($negate ? '!' : '=') . '== 0';
210
+                }
211
+                next($params);
212
+                break;
213
+                case 'odd':
214
+                $a = array_pop($p);
215
+                if (isset($params[$k + $ptr + 1]) && strtolower(trim($params[$k + $ptr + 1], '"\'')) === 'by') {
216
+                $b   = $params[$k + $ptr + 2];
217
+                $p[] = '(' . $a . ' / ' . $b . ') % 2 ' . ($negate ? '=' : '!') . '== 0';
218
+                next($params);
219
+                next($params);
220
+                } else {
221
+                $p[] = $a . ' % 2 ' . ($negate ? '=' : '!') . '== 0';
222
+                }
223
+                next($params);
224
+                break;
229 225
                 default:
230
-                    $p[] = $v;
226
+                throw new CompilationException($compiler, 'If : Syntax error : syntax should be "if $a is [not] (div|even|odd) [by $b]", found ' . $params[$k - 1] . ' is ' . $params[$k + $ptr + 1]);
227
+                }
228
+                    break;
229
+            default:
230
+                $p[] = $v;
231 231
             }
232 232
         }
233 233
 
Please login to merge, or discard this patch.
lib/Dwoo/Plugins/Blocks/PluginTextformat.php 1 patch
Switch Indentation   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -62,14 +62,14 @@
 block discarded – undo
62 62
 
63 63
         switch ($style) {
64 64
 
65
-            case 'email':
66
-                $wrap         = 72;
67
-                $indent_first = 0;
68
-                break;
69
-            case 'html':
70
-                $wrap_char   = '<br />';
71
-                $indent_char = $indent_char == "\t" ? '&nbsp;&nbsp;&nbsp;&nbsp;' : '&nbsp;';
72
-                break;
65
+        case 'email':
66
+            $wrap         = 72;
67
+            $indent_first = 0;
68
+            break;
69
+        case 'html':
70
+            $wrap_char   = '<br />';
71
+            $indent_char = $indent_char == "\t" ? '&nbsp;&nbsp;&nbsp;&nbsp;' : '&nbsp;';
72
+            break;
73 73
         }
74 74
 
75 75
         $this->wrap     = (int)$wrap;
Please login to merge, or discard this patch.
lib/Dwoo/Plugins/Blocks/PluginStrip.php 1 patch
Switch Indentation   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -67,12 +67,12 @@
 block discarded – undo
67 67
 
68 68
         $mode = trim($params['mode'], '"\'');
69 69
         switch ($mode) {
70
-            case 'js':
71
-            case 'javascript':
72
-                $content = preg_replace('#(?<!:)//\s[^\r\n]*|/\*.*?\*/#s', '', $content);
70
+        case 'js':
71
+        case 'javascript':
72
+            $content = preg_replace('#(?<!:)//\s[^\r\n]*|/\*.*?\*/#s', '', $content);
73 73
 
74
-            case 'default':
75
-            default:
74
+        case 'default':
75
+        default:
76 76
         }
77 77
         $content = preg_replace(array(
78 78
             "/\n/",
Please login to merge, or discard this patch.
lib/Dwoo/Plugins/Blocks/PluginAutoEscape.php 1 patch
Switch Indentation   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -56,22 +56,22 @@
 block discarded – undo
56 56
         $params = $compiler->getCompiledParams($params);
57 57
         switch (strtolower(trim((string)$params['enabled'], '"\''))) {
58 58
 
59
-            case 'on':
60
-            case 'true':
61
-            case 'enabled':
62
-            case 'enable':
63
-            case '1':
64
-                $enable = true;
65
-                break;
66
-            case 'off':
67
-            case 'false':
68
-            case 'disabled':
69
-            case 'disable':
70
-            case '0':
71
-                $enable = false;
72
-                break;
73
-            default:
74
-                throw new CompilationException($compiler, 'Auto_Escape : Invalid parameter (' . $params['enabled'] . '), valid parameters are "enable"/true or "disable"/false');
59
+        case 'on':
60
+        case 'true':
61
+        case 'enabled':
62
+        case 'enable':
63
+        case '1':
64
+            $enable = true;
65
+            break;
66
+        case 'off':
67
+        case 'false':
68
+        case 'disabled':
69
+        case 'disable':
70
+        case '0':
71
+            $enable = false;
72
+            break;
73
+        default:
74
+            throw new CompilationException($compiler, 'Auto_Escape : Invalid parameter (' . $params['enabled'] . '), valid parameters are "enable"/true or "disable"/false');
75 75
         }
76 76
 
77 77
         self::$stack[] = $compiler->getAutoEscape();
Please login to merge, or discard this patch.
lib/Dwoo/Plugins/Functions/PluginEscape.php 1 patch
Switch Indentation   +47 added lines, -47 removed lines patch added patch discarded remove patch
@@ -48,56 +48,56 @@
 block discarded – undo
48 48
         }
49 49
 
50 50
         switch ($format) {
51
-            case 'html':
52
-                return htmlspecialchars((string)$value, ENT_QUOTES, $charset);
53
-            case 'htmlall':
54
-                return htmlentities((string)$value, ENT_QUOTES, $charset);
55
-            case 'url':
56
-                return rawurlencode((string)$value);
57
-            case 'urlpathinfo':
58
-                return str_replace('%2F', '/', rawurlencode((string)$value));
59
-            case 'quotes':
60
-                return preg_replace("#(?<!\\\\)'#", "\\'", (string)$value);
61
-            case 'hex':
62
-                $out = '';
63
-                $cnt = strlen((string)$value);
64
-                for ($i = 0; $i < $cnt; ++ $i) {
65
-                    $out .= '%' . bin2hex((string)$value[$i]);
66
-                }
51
+        case 'html':
52
+            return htmlspecialchars((string)$value, ENT_QUOTES, $charset);
53
+        case 'htmlall':
54
+            return htmlentities((string)$value, ENT_QUOTES, $charset);
55
+        case 'url':
56
+            return rawurlencode((string)$value);
57
+        case 'urlpathinfo':
58
+            return str_replace('%2F', '/', rawurlencode((string)$value));
59
+        case 'quotes':
60
+            return preg_replace("#(?<!\\\\)'#", "\\'", (string)$value);
61
+        case 'hex':
62
+            $out = '';
63
+            $cnt = strlen((string)$value);
64
+            for ($i = 0; $i < $cnt; ++ $i) {
65
+                $out .= '%' . bin2hex((string)$value[$i]);
66
+            }
67 67
 
68
-                return $out;
69
-            case 'hexentity':
70
-                $out = '';
71
-                $cnt = strlen((string)$value);
72
-                for ($i = 0; $i < $cnt; ++ $i) {
73
-                    $out .= '&#x' . bin2hex((string)$value[$i]) . ';';
74
-                }
68
+            return $out;
69
+        case 'hexentity':
70
+            $out = '';
71
+            $cnt = strlen((string)$value);
72
+            for ($i = 0; $i < $cnt; ++ $i) {
73
+                $out .= '&#x' . bin2hex((string)$value[$i]) . ';';
74
+            }
75 75
 
76
-                return $out;
77
-            case 'javascript':
78
-            case 'js':
79
-                return strtr((string)$value,
80
-                    array(
81
-                        '\\' => '\\\\',
82
-                        "'"  => "\\'",
83
-                        '"'  => '\\"',
84
-                        "\r" => '\\r',
85
-                        "\n" => '\\n',
86
-                        '</' => '<\/'
87
-                    ));
88
-            case 'mail':
89
-                return str_replace(array(
90
-                    '@',
91
-                    '.'
76
+            return $out;
77
+        case 'javascript':
78
+        case 'js':
79
+            return strtr((string)$value,
80
+                array(
81
+                    '\\' => '\\\\',
82
+                    "'"  => "\\'",
83
+                    '"'  => '\\"',
84
+                    "\r" => '\\r',
85
+                    "\n" => '\\n',
86
+                    '</' => '<\/'
87
+                ));
88
+        case 'mail':
89
+            return str_replace(array(
90
+                '@',
91
+                '.'
92
+            ),
93
+                array(
94
+                    '&nbsp;(AT)&nbsp;',
95
+                    '&nbsp;(DOT)&nbsp;'
92 96
                 ),
93
-                    array(
94
-                        '&nbsp;(AT)&nbsp;',
95
-                        '&nbsp;(DOT)&nbsp;'
96
-                    ),
97
-                    (string)$value);
98
-            default:
99
-                $this->core->triggerError('Escape\'s format argument must be one of : html, htmlall, url, urlpathinfo, hex, hexentity, javascript, js or mail, "' . $format . '" given.',
100
-                    E_USER_WARNING);
97
+                (string)$value);
98
+        default:
99
+            $this->core->triggerError('Escape\'s format argument must be one of : html, htmlall, url, urlpathinfo, hex, hexentity, javascript, js or mail, "' . $format . '" given.',
100
+                E_USER_WARNING);
101 101
         }
102 102
     }
103 103
 }
104 104
\ No newline at end of file
Please login to merge, or discard this patch.
lib/Dwoo/Plugins/Functions/PluginMailto.php 1 patch
Switch Indentation   +54 added lines, -54 removed lines patch added patch discarded remove patch
@@ -82,63 +82,63 @@
 block discarded – undo
82 82
         // output
83 83
         switch ($encode) {
84 84
 
85
-            case 'none':
86
-            case null:
87
-                return '<a href="mailto:' . $address . '" ' . $extra . '>' . $text . '</a>';
88
-
89
-            case 'js':
90
-            case 'javascript':
91
-                $str = 'document.write(\'<a href="mailto:' . $address . '" ' . $extra . '>' . $text . '</a>\');';
92
-                $len = strlen($str);
93
-
94
-                $out = '';
95
-                for ($i = 0; $i < $len; ++ $i) {
96
-                    $out .= '%' . bin2hex($str[$i]);
85
+        case 'none':
86
+        case null:
87
+            return '<a href="mailto:' . $address . '" ' . $extra . '>' . $text . '</a>';
88
+
89
+        case 'js':
90
+        case 'javascript':
91
+            $str = 'document.write(\'<a href="mailto:' . $address . '" ' . $extra . '>' . $text . '</a>\');';
92
+            $len = strlen($str);
93
+
94
+            $out = '';
95
+            for ($i = 0; $i < $len; ++ $i) {
96
+                $out .= '%' . bin2hex($str[$i]);
97
+            }
98
+
99
+            return '<script type="text/javascript">eval(unescape(\'' . $out . '\'));</script>';
100
+
101
+            break;
102
+        case 'javascript_charcode':
103
+        case 'js_charcode':
104
+        case 'jscharcode':
105
+        case 'jschar':
106
+            $str = '<a href="mailto:' . $address . '" ' . $extra . '>' . $text . '</a>';
107
+            $len = strlen($str);
108
+
109
+            $out = '<script type="text/javascript">' . "\n<!--\ndocument.write(Str.fromCharCode(";
110
+            for ($i = 0; $i < $len; ++ $i) {
111
+                $out .= ord($str[$i]) . ',';
112
+            }
113
+
114
+            return rtrim($out, ',') . "));\n-->\n</script>\n";
115
+
116
+            break;
117
+
118
+        case 'hex':
119
+            if (strpos($address, '?') !== false) {
120
+                $this->core->triggerError('Mailto: Hex encoding is not possible with extra attributes, use one of : <em>js, jscharcode or none</em>.', E_USER_WARNING);
121
+            }
122
+
123
+            $out = '<a href="&#109;&#97;&#105;&#108;&#116;&#111;&#58;';
124
+            $len = strlen($address);
125
+            for ($i = 0; $i < $len; ++ $i) {
126
+                if (preg_match('#\w#', $address[$i])) {
127
+                    $out .= '%' . bin2hex($address[$i]);
128
+                } else {
129
+                    $out .= $address[$i];
97 130
                 }
131
+            }
132
+            $out .= '" ' . $extra . '>';
133
+            $len = strlen($text);
134
+            for ($i = 0; $i < $len; ++ $i) {
135
+                $out .= '&#x' . bin2hex($text[$i]);
136
+            }
98 137
 
99
-                return '<script type="text/javascript">eval(unescape(\'' . $out . '\'));</script>';
138
+            return $out . '</a>';
100 139
 
101
-                break;
102
-            case 'javascript_charcode':
103
-            case 'js_charcode':
104
-            case 'jscharcode':
105
-            case 'jschar':
106
-                $str = '<a href="mailto:' . $address . '" ' . $extra . '>' . $text . '</a>';
107
-                $len = strlen($str);
108
-
109
-                $out = '<script type="text/javascript">' . "\n<!--\ndocument.write(Str.fromCharCode(";
110
-                for ($i = 0; $i < $len; ++ $i) {
111
-                    $out .= ord($str[$i]) . ',';
112
-                }
113
-
114
-                return rtrim($out, ',') . "));\n-->\n</script>\n";
115
-
116
-                break;
117
-
118
-            case 'hex':
119
-                if (strpos($address, '?') !== false) {
120
-                    $this->core->triggerError('Mailto: Hex encoding is not possible with extra attributes, use one of : <em>js, jscharcode or none</em>.', E_USER_WARNING);
121
-                }
122
-
123
-                $out = '<a href="&#109;&#97;&#105;&#108;&#116;&#111;&#58;';
124
-                $len = strlen($address);
125
-                for ($i = 0; $i < $len; ++ $i) {
126
-                    if (preg_match('#\w#', $address[$i])) {
127
-                        $out .= '%' . bin2hex($address[$i]);
128
-                    } else {
129
-                        $out .= $address[$i];
130
-                    }
131
-                }
132
-                $out .= '" ' . $extra . '>';
133
-                $len = strlen($text);
134
-                for ($i = 0; $i < $len; ++ $i) {
135
-                    $out .= '&#x' . bin2hex($text[$i]);
136
-                }
137
-
138
-                return $out . '</a>';
139
-
140
-            default:
141
-                $this->core->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);
140
+        default:
141
+            $this->core->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);
142 142
         }
143 143
     }
144 144
 }
145 145
\ No newline at end of file
Please login to merge, or discard this patch.
lib/Dwoo/Compiler.php 1 patch
Switch Indentation   +50 added lines, -50 removed lines patch added patch discarded remove patch
@@ -769,13 +769,13 @@  discard block
 block discarded – undo
769 769
                         $search = array('{<\?.*?\?>}', '{<%.*?%>}');
770 770
                     }
771 771
                     switch ($this->securityPolicy->getPhpHandling()) {
772
-                        case SecurityPolicy::PHP_ALLOW:
773
-                            break;
774
-                        case SecurityPolicy::PHP_ENCODE:
775
-                            $tpl = preg_replace_callback($search, array($this, 'phpTagEncodingHelper'), $tpl);
776
-                            break;
777
-                        case SecurityPolicy::PHP_REMOVE:
778
-                            $tpl = preg_replace($search, '', $tpl);
772
+                    case SecurityPolicy::PHP_ALLOW:
773
+                        break;
774
+                    case SecurityPolicy::PHP_ENCODE:
775
+                        $tpl = preg_replace_callback($search, array($this, 'phpTagEncodingHelper'), $tpl);
776
+                        break;
777
+                    case SecurityPolicy::PHP_REMOVE:
778
+                        $tpl = preg_replace($search, '', $tpl);
779 779
                     }
780 780
                 }
781 781
             }
@@ -875,51 +875,51 @@  discard block
 block discarded – undo
875 875
             }
876 876
 
877 877
             switch ($type) {
878
-                case Core::CLASS_PLUGIN:
879
-                case Core::CLASS_PLUGIN + Core::BLOCK_PLUGIN:
880
-                    if (class_exists('Plugin' . $plugin) !== false) {
881
-                        $output .= "if (class_exists('" . "Plugin" . $plugin . "')===false)".
882
-                        "\n\t\$this->getLoader()->loadPlugin('Plugin$plugin');\n";
883
-                    } else {
884
-                        $output .= "if (class_exists('" . Core::NAMESPACE_PLUGINS_BLOCKS . "Plugin" . $plugin . "')===false)".
885
-                        "\n\t\$this->getLoader()->loadPlugin('Plugin$plugin');\n";
886
-                    }
887
-                    break;
888
-                case Core::CLASS_PLUGIN + Core::FUNC_PLUGIN:
889
-                    if (class_exists('Plugin' . $plugin) !== false) {
890
-                        $output .= "if (class_exists('" . "Plugin" . $plugin . "')===false)".
891
-                            "\n\t\$this->getLoader()->loadPlugin('Plugin$plugin');\n";
892
-                    } else {
893
-                        $output .= "if (class_exists('" . Core::NAMESPACE_PLUGINS_FUNCTIONS . "Plugin" . $plugin . "')===false)".
894
-                            "\n\t\$this->getLoader()->loadPlugin('Plugin$plugin');\n";
895
-                    }
896
-                    break;
897
-                case Core::FUNC_PLUGIN:
898
-                    if (function_exists('Plugin' . $plugin) !== false) {
899
-                        $output .= "if (function_exists('" . "Plugin" . $plugin . "')===false)".
878
+            case Core::CLASS_PLUGIN:
879
+            case Core::CLASS_PLUGIN + Core::BLOCK_PLUGIN:
880
+                if (class_exists('Plugin' . $plugin) !== false) {
881
+                    $output .= "if (class_exists('" . "Plugin" . $plugin . "')===false)".
882
+                    "\n\t\$this->getLoader()->loadPlugin('Plugin$plugin');\n";
883
+                } else {
884
+                    $output .= "if (class_exists('" . Core::NAMESPACE_PLUGINS_BLOCKS . "Plugin" . $plugin . "')===false)".
885
+                    "\n\t\$this->getLoader()->loadPlugin('Plugin$plugin');\n";
886
+                }
887
+                break;
888
+            case Core::CLASS_PLUGIN + Core::FUNC_PLUGIN:
889
+                if (class_exists('Plugin' . $plugin) !== false) {
890
+                    $output .= "if (class_exists('" . "Plugin" . $plugin . "')===false)".
900 891
                         "\n\t\$this->getLoader()->loadPlugin('Plugin$plugin');\n";
901
-                    } else {
902
-                        $output .= "if (function_exists('" . Core::NAMESPACE_PLUGINS_FUNCTIONS . "Plugin" . $plugin . "')===false)".
892
+                } else {
893
+                    $output .= "if (class_exists('" . Core::NAMESPACE_PLUGINS_FUNCTIONS . "Plugin" . $plugin . "')===false)".
903 894
                         "\n\t\$this->getLoader()->loadPlugin('Plugin$plugin');\n";
904
-                    }
905
-                    break;
906
-                case Core::SMARTY_MODIFIER:
907
-                    $output .= "if (function_exists('smarty_modifier_$plugin')===false)".
908
-                    "\n\t\$this->getLoader()->loadPlugin('$plugin');\n";
909
-                    break;
910
-                case Core::SMARTY_FUNCTION:
911
-                    $output .= "if (function_exists('smarty_function_$plugin')===false)".
912
-                    "\n\t\$this->getLoader()->loadPlugin('$plugin');\n";
913
-                    break;
914
-                case Core::SMARTY_BLOCK:
915
-                    $output .= "if (function_exists('smarty_block_$plugin')===false)".
916
-                    "\n\t\$this->getLoader()->loadPlugin('$plugin');\n";
917
-                    break;
918
-                case Core::PROXY_PLUGIN:
919
-                    $output .= $this->getCore()->getPluginProxy()->getLoader($plugin);
920
-                    break;
921
-                default:
922
-                    throw new CompilationException($this, 'Type error for ' . $plugin . ' with type' . $type);
895
+                }
896
+                break;
897
+            case Core::FUNC_PLUGIN:
898
+                if (function_exists('Plugin' . $plugin) !== false) {
899
+                    $output .= "if (function_exists('" . "Plugin" . $plugin . "')===false)".
900
+                    "\n\t\$this->getLoader()->loadPlugin('Plugin$plugin');\n";
901
+                } else {
902
+                    $output .= "if (function_exists('" . Core::NAMESPACE_PLUGINS_FUNCTIONS . "Plugin" . $plugin . "')===false)".
903
+                    "\n\t\$this->getLoader()->loadPlugin('Plugin$plugin');\n";
904
+                }
905
+                break;
906
+            case Core::SMARTY_MODIFIER:
907
+                $output .= "if (function_exists('smarty_modifier_$plugin')===false)".
908
+                "\n\t\$this->getLoader()->loadPlugin('$plugin');\n";
909
+                break;
910
+            case Core::SMARTY_FUNCTION:
911
+                $output .= "if (function_exists('smarty_function_$plugin')===false)".
912
+                "\n\t\$this->getLoader()->loadPlugin('$plugin');\n";
913
+                break;
914
+            case Core::SMARTY_BLOCK:
915
+                $output .= "if (function_exists('smarty_block_$plugin')===false)".
916
+                "\n\t\$this->getLoader()->loadPlugin('$plugin');\n";
917
+                break;
918
+            case Core::PROXY_PLUGIN:
919
+                $output .= $this->getCore()->getPluginProxy()->getLoader($plugin);
920
+                break;
921
+            default:
922
+                throw new CompilationException($this, 'Type error for ' . $plugin . ' with type' . $type);
923 923
             }
924 924
         }
925 925
 
Please login to merge, or discard this patch.