@@ -36,8 +36,8 @@ |
||
36 | 36 | // Delete all non-numeric characters, non-x characters |
37 | 37 | // from phone number, EXCEPT for a leading plus sign. |
38 | 38 | $uri->path = preg_replace('/(?!^\+)[^\dx]/', '', |
39 | - // Normalize e(x)tension to lower-case |
|
40 | - str_replace('X', 'x', $uri->path)); |
|
39 | + // Normalize e(x)tension to lower-case |
|
40 | + str_replace('X', 'x', $uri->path)); |
|
41 | 41 | |
42 | 42 | return true; |
43 | 43 | } |
@@ -79,7 +79,7 @@ |
||
79 | 79 | } else { |
80 | 80 | $raw_data = $data; |
81 | 81 | } |
82 | - if ( strlen($raw_data) < 12 ) { |
|
82 | + if (strlen($raw_data) < 12) { |
|
83 | 83 | // error; exif_imagetype throws exception with small files, |
84 | 84 | // and this likely indicates a corrupt URI/failed parse anyway |
85 | 85 | return false; |
@@ -104,9 +104,9 @@ |
||
104 | 104 | if ($result !== false) { |
105 | 105 | return $result; |
106 | 106 | } |
107 | - $this->currentNesting =& $context->get('CurrentNesting'); |
|
108 | - $this->currentToken =& $context->get('CurrentToken'); |
|
109 | - $this->inputZipper =& $context->get('InputZipper'); |
|
107 | + $this->currentNesting = & $context->get('CurrentNesting'); |
|
108 | + $this->currentToken = & $context->get('CurrentToken'); |
|
109 | + $this->inputZipper = & $context->get('InputZipper'); |
|
110 | 110 | return false; |
111 | 111 | } |
112 | 112 |
@@ -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,7 +88,7 @@ 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) { |
@@ -101,13 +101,13 @@ discard block |
||
101 | 101 | // fall through |
102 | 102 | case 'tr': |
103 | 103 | $content[] = $node; |
104 | - $ws_accum =& $content; |
|
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 |
@@ -132,7 +132,7 @@ discard block |
||
132 | 132 | // bottom like it does for the first one. |
133 | 133 | $node->name = 'tbody'; |
134 | 134 | $content[] = $node; |
135 | - $ws_accum =& $content; |
|
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 | 146 | $content[] = $node; |
147 | - $ws_accum =& $content; |
|
147 | + $ws_accum = & $content; |
|
148 | 148 | } |
149 | 149 | break; |
150 | 150 | case 'colgroup': |
151 | 151 | case 'col': |
152 | 152 | $cols[] = $node; |
153 | - $ws_accum =& $cols; |
|
153 | + $ws_accum = & $cols; |
|
154 | 154 | break; |
155 | 155 | case '#PCDATA': |
156 | 156 | // How is whitespace handled? We treat is as sticky to |
@@ -189,7 +189,7 @@ 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; |
@@ -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; |
@@ -144,7 +144,7 @@ |
||
144 | 144 | } |
145 | 145 | |
146 | 146 | $mState = 0; // cached expected number of octets after the current octet |
147 | - // until the beginning of the next UTF8 character sequence |
|
147 | + // until the beginning of the next UTF8 character sequence |
|
148 | 148 | $mUcs4 = 0; // cached Unicode character |
149 | 149 | $mBytes = 1; // cached expected number of octets in the current sequence |
150 | 150 |
@@ -228,7 +228,7 @@ discard block |
||
228 | 228 | // multi-octet sequence |
229 | 229 | if (0x80 == (0xC0 & ($in))) { |
230 | 230 | // Legal continuation. |
231 | - $shift = ($mState - 1) * 6; |
|
231 | + $shift = ($mState - 1)*6; |
|
232 | 232 | $tmp = $in; |
233 | 233 | $tmp = ($tmp & 0x0000003F) << $shift; |
234 | 234 | $mUcs4 |= $tmp; |
@@ -279,7 +279,7 @@ discard block |
||
279 | 279 | $mState = 0; |
280 | 280 | $mUcs4 = 0; |
281 | 281 | $mBytes = 1; |
282 | - $char =''; |
|
282 | + $char = ''; |
|
283 | 283 | } |
284 | 284 | } |
285 | 285 | } |
@@ -315,7 +315,7 @@ discard block |
||
315 | 315 | public static function unichr($code) |
316 | 316 | { |
317 | 317 | if ($code > 1114111 or $code < 0 or |
318 | - ($code >= 55296 and $code <= 57343) ) { |
|
318 | + ($code >= 55296 and $code <= 57343)) { |
|
319 | 319 | // bits are set outside the "valid" range as defined |
320 | 320 | // by UNICODE 4.1.0 |
321 | 321 | return ''; |
@@ -336,7 +336,7 @@ discard block |
||
336 | 336 | $z = (($code >> 12) & 15) | 224; |
337 | 337 | } else { |
338 | 338 | $z = (($code >> 12) & 63) | 128; |
339 | - $w = (($code >> 18) & 7) | 240; |
|
339 | + $w = (($code >> 18) & 7) | 240; |
|
340 | 340 | } |
341 | 341 | } |
342 | 342 | } |
@@ -18,17 +18,17 @@ |
||
18 | 18 | public function validateToken($token, $config, $context) |
19 | 19 | { |
20 | 20 | $definition = $config->getHTMLDefinition(); |
21 | - $e =& $context->get('ErrorCollector', true); |
|
21 | + $e = & $context->get('ErrorCollector', true); |
|
22 | 22 | |
23 | 23 | // initialize IDAccumulator if necessary |
24 | - $ok =& $context->get('IDAccumulator', true); |
|
24 | + $ok = & $context->get('IDAccumulator', true); |
|
25 | 25 | if (!$ok) { |
26 | 26 | $id_accumulator = HTMLPurifier_IDAccumulator::build($config, $context); |
27 | 27 | $context->register('IDAccumulator', $id_accumulator); |
28 | 28 | } |
29 | 29 | |
30 | 30 | // initialize CurrentToken if necessary |
31 | - $current_token =& $context->get('CurrentToken', true); |
|
31 | + $current_token = & $context->get('CurrentToken', true); |
|
32 | 32 | if (!$current_token) { |
33 | 33 | $context->register('CurrentToken', $token); |
34 | 34 | } |
@@ -28,7 +28,7 @@ |
||
28 | 28 | { |
29 | 29 | $decorator = $this->copy(); |
30 | 30 | // reference is necessary for mocks in PHP 4 |
31 | - $decorator->cache =& $cache; |
|
31 | + $decorator->cache = & $cache; |
|
32 | 32 | $decorator->type = $cache->type; |
33 | 33 | return $decorator; |
34 | 34 | } |
@@ -89,10 +89,10 @@ |
||
89 | 89 | $p = '\s*(\d+(\.\d+)?([%]?))\s*'; |
90 | 90 | |
91 | 91 | if (preg_match('/(rgba|hsla)\(/', $string)) { |
92 | - return preg_replace('/(rgba|hsla)\('.$p.','.$p.','.$p.','.$p.'\)/', '\1(\2,\5,\8,\11)', $string); |
|
92 | + return preg_replace('/(rgba|hsla)\(' . $p . ',' . $p . ',' . $p . ',' . $p . '\)/', '\1(\2,\5,\8,\11)', $string); |
|
93 | 93 | } |
94 | 94 | |
95 | - return preg_replace('/(rgb|hsl)\('.$p.','.$p.','.$p.'\)/', '\1(\2,\5,\8)', $string); |
|
95 | + return preg_replace('/(rgb|hsl)\(' . $p . ',' . $p . ',' . $p . '\)/', '\1(\2,\5,\8)', $string); |
|
96 | 96 | } |
97 | 97 | |
98 | 98 | /** |
@@ -36,7 +36,7 @@ |
||
36 | 36 | $this->preserve[45] = true; // Dash - |
37 | 37 | $this->preserve[46] = true; // Period . |
38 | 38 | $this->preserve[95] = true; // Underscore _ |
39 | - $this->preserve[126]= true; // Tilde ~ |
|
39 | + $this->preserve[126] = true; // Tilde ~ |
|
40 | 40 | |
41 | 41 | // extra letters not to escape |
42 | 42 | if ($preserve !== false) { |