@@ -52,17 +52,17 @@ |
||
52 | 52 | // $l = is link |
53 | 53 | for ($i = 0, $c = count($bits), $l = false; $i < $c; $i++, $l = !$l) { |
54 | 54 | if (!$l) { |
55 | - if ($bits[$i] === '') { |
|
55 | + if ($bits[ $i ] === '') { |
|
56 | 56 | continue; |
57 | 57 | } |
58 | - $token[] = new HTMLPurifier_Token_Text($bits[$i]); |
|
58 | + $token[ ] = new HTMLPurifier_Token_Text($bits[ $i ]); |
|
59 | 59 | } else { |
60 | - $token[] = new HTMLPurifier_Token_Start( |
|
60 | + $token[ ] = new HTMLPurifier_Token_Start( |
|
61 | 61 | 'a', |
62 | - array('href' => str_replace('%s', $bits[$i], $this->docURL)) |
|
62 | + array('href' => str_replace('%s', $bits[ $i ], $this->docURL)) |
|
63 | 63 | ); |
64 | - $token[] = new HTMLPurifier_Token_Text('%' . $bits[$i]); |
|
65 | - $token[] = new HTMLPurifier_Token_End('a'); |
|
64 | + $token[ ] = new HTMLPurifier_Token_Text('%'.$bits[ $i ]); |
|
65 | + $token[ ] = new HTMLPurifier_Token_End('a'); |
|
66 | 66 | } |
67 | 67 | } |
68 | 68 | } |
@@ -27,9 +27,9 @@ |
||
27 | 27 | */ |
28 | 28 | public function handleEnd(&$token) |
29 | 29 | { |
30 | - if (isset($token->start->attr['href'])) { |
|
31 | - $url = $token->start->attr['href']; |
|
32 | - unset($token->start->attr['href']); |
|
30 | + if (isset($token->start->attr[ 'href' ])) { |
|
31 | + $url = $token->start->attr[ 'href' ]; |
|
32 | + unset($token->start->attr[ 'href' ]); |
|
33 | 33 | $token = array($token, new HTMLPurifier_Token_Text(" ($url)")); |
34 | 34 | } else { |
35 | 35 | // nothing to display |
@@ -61,10 +61,10 @@ discard block |
||
61 | 61 | final public function parse($var, $type, $allow_null = false) |
62 | 62 | { |
63 | 63 | if (is_string($type)) { |
64 | - if (!isset(HTMLPurifier_VarParser::$types[$type])) { |
|
64 | + if (!isset(HTMLPurifier_VarParser::$types[ $type ])) { |
|
65 | 65 | throw new HTMLPurifier_VarParserException("Invalid type '$type'"); |
66 | 66 | } else { |
67 | - $type = HTMLPurifier_VarParser::$types[$type]; |
|
67 | + $type = HTMLPurifier_VarParser::$types[ $type ]; |
|
68 | 68 | } |
69 | 69 | } |
70 | 70 | $var = $this->parseImplementation($var, $type, $allow_null); |
@@ -161,7 +161,7 @@ discard block |
||
161 | 161 | protected function errorInconsistent($class, $type) |
162 | 162 | { |
163 | 163 | throw new HTMLPurifier_Exception( |
164 | - "Inconsistency in $class: " . HTMLPurifier_VarParser::getTypeName($type) . |
|
164 | + "Inconsistency in $class: ".HTMLPurifier_VarParser::getTypeName($type). |
|
165 | 165 | " not implemented" |
166 | 166 | ); |
167 | 167 | } |
@@ -174,7 +174,7 @@ discard block |
||
174 | 174 | protected function errorGeneric($var, $type) |
175 | 175 | { |
176 | 176 | $vtype = gettype($var); |
177 | - $this->error("Expected type " . HTMLPurifier_VarParser::getTypeName($type) . ", got $vtype"); |
|
177 | + $this->error("Expected type ".HTMLPurifier_VarParser::getTypeName($type).", got $vtype"); |
|
178 | 178 | } |
179 | 179 | |
180 | 180 | /** |
@@ -188,10 +188,10 @@ discard block |
||
188 | 188 | // Lazy load the alternative lookup table |
189 | 189 | $lookup = array_flip(HTMLPurifier_VarParser::$types); |
190 | 190 | } |
191 | - if (!isset($lookup[$type])) { |
|
191 | + if (!isset($lookup[ $type ])) { |
|
192 | 192 | return 'unknown'; |
193 | 193 | } |
194 | - return $lookup[$type]; |
|
194 | + return $lookup[ $type ]; |
|
195 | 195 | } |
196 | 196 | } |
197 | 197 |
@@ -78,7 +78,7 @@ discard block |
||
78 | 78 | */ |
79 | 79 | protected function styleCallback($matches) |
80 | 80 | { |
81 | - $this->_styleMatches[] = $matches[1]; |
|
81 | + $this->_styleMatches[ ] = $matches[ 1 ]; |
|
82 | 82 | } |
83 | 83 | |
84 | 84 | /** |
@@ -221,13 +221,13 @@ discard block |
||
221 | 221 | $delim = null; // guaranteed to be non-null after |
222 | 222 | // two loop iterations |
223 | 223 | for ($i = 0, $c = count($basic_selectors); $i < $c; $i++) { |
224 | - $x = $basic_selectors[$i]; |
|
224 | + $x = $basic_selectors[ $i ]; |
|
225 | 225 | if ($i % 2) { |
226 | 226 | // delimiter |
227 | 227 | if ($x === ' ') { |
228 | 228 | $delim = ' '; |
229 | 229 | } else { |
230 | - $delim = ' ' . $x . ' '; |
|
230 | + $delim = ' '.$x.' '; |
|
231 | 231 | } |
232 | 232 | } else { |
233 | 233 | // simple selector |
@@ -235,9 +235,9 @@ discard block |
||
235 | 235 | $sdelim = null; |
236 | 236 | $nx = null; |
237 | 237 | for ($j = 0, $cc = count($components); $j < $cc; $j++) { |
238 | - $y = $components[$j]; |
|
238 | + $y = $components[ $j ]; |
|
239 | 239 | if ($j === 0) { |
240 | - if ($y === '*' || isset($html_definition->info[$y = strtolower($y)])) { |
|
240 | + if ($y === '*' || isset($html_definition->info[ $y = strtolower($y) ])) { |
|
241 | 241 | $nx = $y; |
242 | 242 | } else { |
243 | 243 | // $nx stays null; this matters |
@@ -268,7 +268,7 @@ discard block |
||
268 | 268 | if ($nx === null) { |
269 | 269 | $nx = ''; |
270 | 270 | } |
271 | - $nx .= $sdelim . $y; |
|
271 | + $nx .= $sdelim.$y; |
|
272 | 272 | } |
273 | 273 | } |
274 | 274 | } |
@@ -276,7 +276,7 @@ discard block |
||
276 | 276 | if ($nsel === null) { |
277 | 277 | $nsel = $nx; |
278 | 278 | } else { |
279 | - $nsel .= $delim . $nx; |
|
279 | + $nsel .= $delim.$nx; |
|
280 | 280 | } |
281 | 281 | } else { |
282 | 282 | // delimiters to the left of invalid |
@@ -287,10 +287,10 @@ discard block |
||
287 | 287 | if ($nsel !== null) { |
288 | 288 | if (!empty($scopes)) { |
289 | 289 | foreach ($scopes as $s) { |
290 | - $new_selectors[] = "$s $nsel"; |
|
290 | + $new_selectors[ ] = "$s $nsel"; |
|
291 | 291 | } |
292 | 292 | } else { |
293 | - $new_selectors[] = $nsel; |
|
293 | + $new_selectors[ ] = $nsel; |
|
294 | 294 | } |
295 | 295 | } |
296 | 296 | } |
@@ -299,21 +299,21 @@ discard block |
||
299 | 299 | } |
300 | 300 | $selector = implode(', ', $new_selectors); |
301 | 301 | foreach ($style as $name => $value) { |
302 | - if (!isset($css_definition->info[$name])) { |
|
303 | - unset($style[$name]); |
|
302 | + if (!isset($css_definition->info[ $name ])) { |
|
303 | + unset($style[ $name ]); |
|
304 | 304 | continue; |
305 | 305 | } |
306 | - $def = $css_definition->info[$name]; |
|
306 | + $def = $css_definition->info[ $name ]; |
|
307 | 307 | $ret = $def->validate($value, $config, $context); |
308 | 308 | if ($ret === false) { |
309 | - unset($style[$name]); |
|
309 | + unset($style[ $name ]); |
|
310 | 310 | } else { |
311 | - $style[$name] = $ret; |
|
311 | + $style[ $name ] = $ret; |
|
312 | 312 | } |
313 | 313 | } |
314 | - $new_decls[$selector] = $style; |
|
314 | + $new_decls[ $selector ] = $style; |
|
315 | 315 | } |
316 | - $new_css[$k] = $new_decls; |
|
316 | + $new_css[ $k ] = $new_decls; |
|
317 | 317 | } |
318 | 318 | // remove stuff that shouldn't be used, could be reenabled |
319 | 319 | // after security risks are analyzed |
@@ -16,7 +16,7 @@ discard block |
||
16 | 16 | */ |
17 | 17 | public function preFilter($html, $config, $context) |
18 | 18 | { |
19 | - $pre_regex = '#<object[^>]+>.+?' . |
|
19 | + $pre_regex = '#<object[^>]+>.+?'. |
|
20 | 20 | '(?:http:)?//www.youtube.com/((?:v|cp)/[A-Za-z0-9\-_=]+).+?</object>#s'; |
21 | 21 | $pre_replace = '<span class="youtube-embed">\1</span>'; |
22 | 22 | return preg_replace($pre_regex, $pre_replace, $html); |
@@ -49,15 +49,15 @@ discard block |
||
49 | 49 | */ |
50 | 50 | protected function postFilterCallback($matches) |
51 | 51 | { |
52 | - $url = $this->armorUrl($matches[1]); |
|
53 | - return '<object width="425" height="350" type="application/x-shockwave-flash" ' . |
|
54 | - 'data="//www.youtube.com/' . $url . '">' . |
|
55 | - '<param name="movie" value="//www.youtube.com/' . $url . '"></param>' . |
|
56 | - '<!--[if IE]>' . |
|
57 | - '<embed src="//www.youtube.com/' . $url . '"' . |
|
58 | - 'type="application/x-shockwave-flash"' . |
|
59 | - 'wmode="transparent" width="425" height="350" />' . |
|
60 | - '<![endif]-->' . |
|
52 | + $url = $this->armorUrl($matches[ 1 ]); |
|
53 | + return '<object width="425" height="350" type="application/x-shockwave-flash" '. |
|
54 | + 'data="//www.youtube.com/'.$url.'">'. |
|
55 | + '<param name="movie" value="//www.youtube.com/'.$url.'"></param>'. |
|
56 | + '<!--[if IE]>'. |
|
57 | + '<embed src="//www.youtube.com/'.$url.'"'. |
|
58 | + 'type="application/x-shockwave-flash"'. |
|
59 | + 'wmode="transparent" width="425" height="350" />'. |
|
60 | + '<![endif]-->'. |
|
61 | 61 | '</object>'; |
62 | 62 | } |
63 | 63 | } |
@@ -86,7 +86,7 @@ |
||
86 | 86 | $content = array(); |
87 | 87 | |
88 | 88 | $tbody_mode = false; // if true, then we need to wrap any stray |
89 | - // <tr>s with a <tbody>. |
|
89 | + // <tr>s with a <tbody>. |
|
90 | 90 | |
91 | 91 | $ws_accum =& $initial_ws; |
92 | 92 |
@@ -96,71 +96,71 @@ discard block |
||
96 | 96 | continue; |
97 | 97 | } |
98 | 98 | switch ($node->name) { |
99 | - case 'tbody': |
|
100 | - $tbody_mode = true; |
|
101 | - // fall through |
|
102 | - case 'tr': |
|
103 | - $content[] = $node; |
|
104 | - $ws_accum =& $content; |
|
105 | - break; |
|
106 | - case 'caption': |
|
107 | - // there can only be one caption! |
|
108 | - if ($caption !== false) break; |
|
109 | - $caption = $node; |
|
110 | - $ws_accum =& $after_caption_ws; |
|
111 | - break; |
|
112 | - case 'thead': |
|
113 | - $tbody_mode = true; |
|
114 | - // XXX This breaks rendering properties with |
|
115 | - // Firefox, which never floats a <thead> to |
|
116 | - // the top. Ever. (Our scheme will float the |
|
117 | - // first <thead> to the top.) So maybe |
|
118 | - // <thead>s that are not first should be |
|
119 | - // turned into <tbody>? Very tricky, indeed. |
|
120 | - if ($thead === false) { |
|
121 | - $thead = $node; |
|
122 | - $ws_accum =& $after_thead_ws; |
|
123 | - } else { |
|
124 | - // Oops, there's a second one! What |
|
125 | - // should we do? Current behavior is to |
|
126 | - // transmutate the first and last entries into |
|
127 | - // tbody tags, and then put into content. |
|
128 | - // Maybe a better idea is to *attach |
|
129 | - // it* to the existing thead or tfoot? |
|
130 | - // We don't do this, because Firefox |
|
131 | - // doesn't float an extra tfoot to the |
|
132 | - // bottom like it does for the first one. |
|
133 | - $node->name = 'tbody'; |
|
134 | - $content[] = $node; |
|
135 | - $ws_accum =& $content; |
|
136 | - } |
|
137 | - break; |
|
138 | - case 'tfoot': |
|
139 | - // see above for some aveats |
|
140 | - $tbody_mode = true; |
|
141 | - if ($tfoot === false) { |
|
142 | - $tfoot = $node; |
|
143 | - $ws_accum =& $after_tfoot_ws; |
|
144 | - } else { |
|
145 | - $node->name = 'tbody'; |
|
99 | + case 'tbody': |
|
100 | + $tbody_mode = true; |
|
101 | + // fall through |
|
102 | + case 'tr': |
|
146 | 103 | $content[] = $node; |
147 | 104 | $ws_accum =& $content; |
148 | - } |
|
149 | - break; |
|
150 | - case 'colgroup': |
|
151 | - case 'col': |
|
152 | - $cols[] = $node; |
|
153 | - $ws_accum =& $cols; |
|
154 | - break; |
|
155 | - case '#PCDATA': |
|
156 | - // How is whitespace handled? We treat is as sticky to |
|
157 | - // the *end* of the previous element. So all of the |
|
158 | - // nonsense we have worked on is to keep things |
|
159 | - // together. |
|
160 | - if (!empty($node->is_whitespace)) { |
|
161 | - $ws_accum[] = $node; |
|
162 | - } |
|
163 | - break; |
|
105 | + break; |
|
106 | + case 'caption': |
|
107 | + // there can only be one caption! |
|
108 | + if ($caption !== false) break; |
|
109 | + $caption = $node; |
|
110 | + $ws_accum =& $after_caption_ws; |
|
111 | + break; |
|
112 | + case 'thead': |
|
113 | + $tbody_mode = true; |
|
114 | + // XXX This breaks rendering properties with |
|
115 | + // Firefox, which never floats a <thead> to |
|
116 | + // the top. Ever. (Our scheme will float the |
|
117 | + // first <thead> to the top.) So maybe |
|
118 | + // <thead>s that are not first should be |
|
119 | + // turned into <tbody>? Very tricky, indeed. |
|
120 | + if ($thead === false) { |
|
121 | + $thead = $node; |
|
122 | + $ws_accum =& $after_thead_ws; |
|
123 | + } else { |
|
124 | + // Oops, there's a second one! What |
|
125 | + // should we do? Current behavior is to |
|
126 | + // transmutate the first and last entries into |
|
127 | + // tbody tags, and then put into content. |
|
128 | + // Maybe a better idea is to *attach |
|
129 | + // it* to the existing thead or tfoot? |
|
130 | + // We don't do this, because Firefox |
|
131 | + // doesn't float an extra tfoot to the |
|
132 | + // bottom like it does for the first one. |
|
133 | + $node->name = 'tbody'; |
|
134 | + $content[] = $node; |
|
135 | + $ws_accum =& $content; |
|
136 | + } |
|
137 | + break; |
|
138 | + case 'tfoot': |
|
139 | + // see above for some aveats |
|
140 | + $tbody_mode = true; |
|
141 | + if ($tfoot === false) { |
|
142 | + $tfoot = $node; |
|
143 | + $ws_accum =& $after_tfoot_ws; |
|
144 | + } else { |
|
145 | + $node->name = 'tbody'; |
|
146 | + $content[] = $node; |
|
147 | + $ws_accum =& $content; |
|
148 | + } |
|
149 | + break; |
|
150 | + case 'colgroup': |
|
151 | + case 'col': |
|
152 | + $cols[] = $node; |
|
153 | + $ws_accum =& $cols; |
|
154 | + break; |
|
155 | + case '#PCDATA': |
|
156 | + // How is whitespace handled? We treat is as sticky to |
|
157 | + // the *end* of the previous element. So all of the |
|
158 | + // nonsense we have worked on is to keep things |
|
159 | + // together. |
|
160 | + if (!empty($node->is_whitespace)) { |
|
161 | + $ws_accum[] = $node; |
|
162 | + } |
|
163 | + break; |
|
164 | 164 | } |
165 | 165 | } |
166 | 166 | |
@@ -191,25 +191,25 @@ discard block |
||
191 | 191 | |
192 | 192 | foreach($content as $node) { |
193 | 193 | switch ($node->name) { |
194 | - case 'tbody': |
|
195 | - $current_tr_tbody = null; |
|
196 | - $ret[] = $node; |
|
197 | - break; |
|
198 | - case 'tr': |
|
199 | - if ($current_tr_tbody === null) { |
|
200 | - $current_tr_tbody = new HTMLPurifier_Node_Element('tbody'); |
|
201 | - $ret[] = $current_tr_tbody; |
|
202 | - } |
|
203 | - $current_tr_tbody->children[] = $node; |
|
204 | - break; |
|
205 | - case '#PCDATA': |
|
206 | - assert($node->is_whitespace); |
|
207 | - if ($current_tr_tbody === null) { |
|
194 | + case 'tbody': |
|
195 | + $current_tr_tbody = null; |
|
208 | 196 | $ret[] = $node; |
209 | - } else { |
|
197 | + break; |
|
198 | + case 'tr': |
|
199 | + if ($current_tr_tbody === null) { |
|
200 | + $current_tr_tbody = new HTMLPurifier_Node_Element('tbody'); |
|
201 | + $ret[] = $current_tr_tbody; |
|
202 | + } |
|
210 | 203 | $current_tr_tbody->children[] = $node; |
211 | - } |
|
212 | - break; |
|
204 | + break; |
|
205 | + case '#PCDATA': |
|
206 | + assert($node->is_whitespace); |
|
207 | + if ($current_tr_tbody === null) { |
|
208 | + $ret[] = $node; |
|
209 | + } else { |
|
210 | + $current_tr_tbody->children[] = $node; |
|
211 | + } |
|
212 | + break; |
|
213 | 213 | } |
214 | 214 | } |
215 | 215 | } else { |
@@ -88,11 +88,11 @@ discard block |
||
88 | 88 | $tbody_mode = false; // if true, then we need to wrap any stray |
89 | 89 | // <tr>s with a <tbody>. |
90 | 90 | |
91 | - $ws_accum =& $initial_ws; |
|
91 | + $ws_accum = & $initial_ws; |
|
92 | 92 | |
93 | 93 | foreach ($children as $node) { |
94 | 94 | if ($node instanceof HTMLPurifier_Node_Comment) { |
95 | - $ws_accum[] = $node; |
|
95 | + $ws_accum[ ] = $node; |
|
96 | 96 | continue; |
97 | 97 | } |
98 | 98 | switch ($node->name) { |
@@ -100,14 +100,14 @@ discard block |
||
100 | 100 | $tbody_mode = true; |
101 | 101 | // fall through |
102 | 102 | case 'tr': |
103 | - $content[] = $node; |
|
104 | - $ws_accum =& $content; |
|
103 | + $content[ ] = $node; |
|
104 | + $ws_accum = & $content; |
|
105 | 105 | break; |
106 | 106 | case 'caption': |
107 | 107 | // there can only be one caption! |
108 | 108 | if ($caption !== false) break; |
109 | 109 | $caption = $node; |
110 | - $ws_accum =& $after_caption_ws; |
|
110 | + $ws_accum = & $after_caption_ws; |
|
111 | 111 | break; |
112 | 112 | case 'thead': |
113 | 113 | $tbody_mode = true; |
@@ -119,7 +119,7 @@ discard block |
||
119 | 119 | // turned into <tbody>? Very tricky, indeed. |
120 | 120 | if ($thead === false) { |
121 | 121 | $thead = $node; |
122 | - $ws_accum =& $after_thead_ws; |
|
122 | + $ws_accum = & $after_thead_ws; |
|
123 | 123 | } else { |
124 | 124 | // Oops, there's a second one! What |
125 | 125 | // should we do? Current behavior is to |
@@ -131,8 +131,8 @@ discard block |
||
131 | 131 | // doesn't float an extra tfoot to the |
132 | 132 | // bottom like it does for the first one. |
133 | 133 | $node->name = 'tbody'; |
134 | - $content[] = $node; |
|
135 | - $ws_accum =& $content; |
|
134 | + $content[ ] = $node; |
|
135 | + $ws_accum = & $content; |
|
136 | 136 | } |
137 | 137 | break; |
138 | 138 | case 'tfoot': |
@@ -140,17 +140,17 @@ discard block |
||
140 | 140 | $tbody_mode = true; |
141 | 141 | if ($tfoot === false) { |
142 | 142 | $tfoot = $node; |
143 | - $ws_accum =& $after_tfoot_ws; |
|
143 | + $ws_accum = & $after_tfoot_ws; |
|
144 | 144 | } else { |
145 | 145 | $node->name = 'tbody'; |
146 | - $content[] = $node; |
|
147 | - $ws_accum =& $content; |
|
146 | + $content[ ] = $node; |
|
147 | + $ws_accum = & $content; |
|
148 | 148 | } |
149 | 149 | break; |
150 | 150 | case 'colgroup': |
151 | 151 | case 'col': |
152 | - $cols[] = $node; |
|
153 | - $ws_accum =& $cols; |
|
152 | + $cols[ ] = $node; |
|
153 | + $ws_accum = & $cols; |
|
154 | 154 | break; |
155 | 155 | case '#PCDATA': |
156 | 156 | // How is whitespace handled? We treat is as sticky to |
@@ -158,7 +158,7 @@ discard block |
||
158 | 158 | // nonsense we have worked on is to keep things |
159 | 159 | // together. |
160 | 160 | if (!empty($node->is_whitespace)) { |
161 | - $ws_accum[] = $node; |
|
161 | + $ws_accum[ ] = $node; |
|
162 | 162 | } |
163 | 163 | break; |
164 | 164 | } |
@@ -170,18 +170,18 @@ discard block |
||
170 | 170 | |
171 | 171 | $ret = $initial_ws; |
172 | 172 | if ($caption !== false) { |
173 | - $ret[] = $caption; |
|
173 | + $ret[ ] = $caption; |
|
174 | 174 | $ret = array_merge($ret, $after_caption_ws); |
175 | 175 | } |
176 | 176 | if ($cols !== false) { |
177 | 177 | $ret = array_merge($ret, $cols); |
178 | 178 | } |
179 | 179 | if ($thead !== false) { |
180 | - $ret[] = $thead; |
|
180 | + $ret[ ] = $thead; |
|
181 | 181 | $ret = array_merge($ret, $after_thead_ws); |
182 | 182 | } |
183 | 183 | if ($tfoot !== false) { |
184 | - $ret[] = $tfoot; |
|
184 | + $ret[ ] = $tfoot; |
|
185 | 185 | $ret = array_merge($ret, $after_tfoot_ws); |
186 | 186 | } |
187 | 187 | |
@@ -189,25 +189,25 @@ discard block |
||
189 | 189 | // we have to shuffle tr into tbody |
190 | 190 | $current_tr_tbody = null; |
191 | 191 | |
192 | - foreach($content as $node) { |
|
192 | + foreach ($content as $node) { |
|
193 | 193 | switch ($node->name) { |
194 | 194 | case 'tbody': |
195 | 195 | $current_tr_tbody = null; |
196 | - $ret[] = $node; |
|
196 | + $ret[ ] = $node; |
|
197 | 197 | break; |
198 | 198 | case 'tr': |
199 | 199 | if ($current_tr_tbody === null) { |
200 | 200 | $current_tr_tbody = new HTMLPurifier_Node_Element('tbody'); |
201 | - $ret[] = $current_tr_tbody; |
|
201 | + $ret[ ] = $current_tr_tbody; |
|
202 | 202 | } |
203 | - $current_tr_tbody->children[] = $node; |
|
203 | + $current_tr_tbody->children[ ] = $node; |
|
204 | 204 | break; |
205 | 205 | case '#PCDATA': |
206 | 206 | assert($node->is_whitespace); |
207 | 207 | if ($current_tr_tbody === null) { |
208 | - $ret[] = $node; |
|
208 | + $ret[ ] = $node; |
|
209 | 209 | } else { |
210 | - $current_tr_tbody->children[] = $node; |
|
210 | + $current_tr_tbody->children[ ] = $node; |
|
211 | 211 | } |
212 | 212 | break; |
213 | 213 | } |
@@ -105,7 +105,9 @@ |
||
105 | 105 | break; |
106 | 106 | case 'caption': |
107 | 107 | // there can only be one caption! |
108 | - if ($caption !== false) break; |
|
108 | + if ($caption !== false) { |
|
109 | + break; |
|
110 | + } |
|
109 | 111 | $caption = $node; |
110 | 112 | $ws_accum =& $after_caption_ws; |
111 | 113 | break; |
@@ -48,7 +48,7 @@ discard block |
||
48 | 48 | |
49 | 49 | foreach ($children as $node) { |
50 | 50 | if (!empty($node->is_whitespace)) { |
51 | - $result[] = $node; |
|
51 | + $result[ ] = $node; |
|
52 | 52 | continue; |
53 | 53 | } |
54 | 54 | $all_whitespace = false; // phew, we're not talking about whitespace |
@@ -56,7 +56,7 @@ discard block |
||
56 | 56 | if ($node->name === 'li') { |
57 | 57 | // good |
58 | 58 | $current_li = $node; |
59 | - $result[] = $node; |
|
59 | + $result[ ] = $node; |
|
60 | 60 | } else { |
61 | 61 | // we want to tuck this into the previous li |
62 | 62 | // Invariant: we expect the node to be ol/ul |
@@ -67,9 +67,9 @@ discard block |
||
67 | 67 | // for non-list. This distinction is not currently made. |
68 | 68 | if ($current_li === false) { |
69 | 69 | $current_li = new HTMLPurifier_Node_Element('li'); |
70 | - $result[] = $current_li; |
|
70 | + $result[ ] = $current_li; |
|
71 | 71 | } |
72 | - $current_li->children[] = $node; |
|
72 | + $current_li->children[ ] = $node; |
|
73 | 73 | $current_li->empty = false; // XXX fascinating! Check for this error elsewhere ToDo |
74 | 74 | } |
75 | 75 | } |
@@ -72,20 +72,20 @@ discard block |
||
72 | 72 | foreach ($result as $node) { |
73 | 73 | if ($block_wrap === false) { |
74 | 74 | if (($node instanceof HTMLPurifier_Node_Text && !$node->is_whitespace) || |
75 | - ($node instanceof HTMLPurifier_Node_Element && !isset($this->elements[$node->name]))) { |
|
75 | + ($node instanceof HTMLPurifier_Node_Element && !isset($this->elements[ $node->name ]))) { |
|
76 | 76 | $block_wrap = new HTMLPurifier_Node_Element($def->info_block_wrapper); |
77 | - $ret[] = $block_wrap; |
|
77 | + $ret[ ] = $block_wrap; |
|
78 | 78 | } |
79 | 79 | } else { |
80 | - if ($node instanceof HTMLPurifier_Node_Element && isset($this->elements[$node->name])) { |
|
80 | + if ($node instanceof HTMLPurifier_Node_Element && isset($this->elements[ $node->name ])) { |
|
81 | 81 | $block_wrap = false; |
82 | 82 | |
83 | 83 | } |
84 | 84 | } |
85 | 85 | if ($block_wrap) { |
86 | - $block_wrap->children[] = $node; |
|
86 | + $block_wrap->children[ ] = $node; |
|
87 | 87 | } else { |
88 | - $ret[] = $node; |
|
88 | + $ret[ ] = $node; |
|
89 | 89 | } |
90 | 90 | } |
91 | 91 | return $ret; |
@@ -100,8 +100,8 @@ discard block |
||
100 | 100 | $def = $config->getHTMLDefinition(); |
101 | 101 | // allow all inline elements |
102 | 102 | $this->real_elements = $this->elements; |
103 | - $this->fake_elements = $def->info_content_sets['Flow']; |
|
104 | - $this->fake_elements['#PCDATA'] = true; |
|
103 | + $this->fake_elements = $def->info_content_sets[ 'Flow' ]; |
|
104 | + $this->fake_elements[ '#PCDATA' ] = true; |
|
105 | 105 | $this->init = true; |
106 | 106 | } |
107 | 107 | } |
@@ -30,9 +30,9 @@ discard block |
||
30 | 30 | if ($keys == array_keys($keys)) { |
31 | 31 | $elements = array_flip($elements); |
32 | 32 | foreach ($elements as $i => $x) { |
33 | - $elements[$i] = true; |
|
33 | + $elements[ $i ] = true; |
|
34 | 34 | if (empty($i)) { |
35 | - unset($elements[$i]); |
|
35 | + unset($elements[ $i ]); |
|
36 | 36 | } // remove blank |
37 | 37 | } |
38 | 38 | } |
@@ -71,7 +71,7 @@ discard block |
||
71 | 71 | // whether or not parsed character data is allowed |
72 | 72 | // this controls whether or not we silently drop a tag |
73 | 73 | // or generate escaped HTML from it |
74 | - $pcdata_allowed = isset($this->elements['#PCDATA']); |
|
74 | + $pcdata_allowed = isset($this->elements[ '#PCDATA' ]); |
|
75 | 75 | |
76 | 76 | // a little sanity check to make sure it's not ALL whitespace |
77 | 77 | $all_whitespace = true; |
@@ -80,29 +80,29 @@ discard block |
||
80 | 80 | while (!empty($stack)) { |
81 | 81 | $node = array_pop($stack); |
82 | 82 | if (!empty($node->is_whitespace)) { |
83 | - $result[] = $node; |
|
83 | + $result[ ] = $node; |
|
84 | 84 | continue; |
85 | 85 | } |
86 | 86 | $all_whitespace = false; // phew, we're not talking about whitespace |
87 | 87 | |
88 | - if (!isset($this->elements[$node->name])) { |
|
88 | + if (!isset($this->elements[ $node->name ])) { |
|
89 | 89 | // special case text |
90 | 90 | // XXX One of these ought to be redundant or something |
91 | 91 | if ($pcdata_allowed && $node instanceof HTMLPurifier_Node_Text) { |
92 | - $result[] = $node; |
|
92 | + $result[ ] = $node; |
|
93 | 93 | continue; |
94 | 94 | } |
95 | 95 | // spill the child contents in |
96 | 96 | // ToDo: Make configurable |
97 | 97 | if ($node instanceof HTMLPurifier_Node_Element) { |
98 | 98 | for ($i = count($node->children) - 1; $i >= 0; $i--) { |
99 | - $stack[] = $node->children[$i]; |
|
99 | + $stack[ ] = $node->children[ $i ]; |
|
100 | 100 | } |
101 | 101 | continue; |
102 | 102 | } |
103 | 103 | continue; |
104 | 104 | } |
105 | - $result[] = $node; |
|
105 | + $result[ ] = $node; |
|
106 | 106 | } |
107 | 107 | if (empty($result)) { |
108 | 108 | return false; |