@@ -43,31 +43,31 @@ discard block |
||
43 | 43 | $this->_semiOptionalPrefixRegex = "/&()()()($semi_optional)/"; |
44 | 44 | |
45 | 45 | $this->_textEntitiesRegex = |
46 | - '/&(?:'. |
|
46 | + '/&(?:' . |
|
47 | 47 | // hex |
48 | - '[#]x([a-fA-F0-9]+);?|'. |
|
48 | + '[#]x([a-fA-F0-9]+);?|' . |
|
49 | 49 | // dec |
50 | - '[#]0*(\d+);?|'. |
|
50 | + '[#]0*(\d+);?|' . |
|
51 | 51 | // string (mandatory semicolon) |
52 | 52 | // NB: order matters: match semicolon preferentially |
53 | - '([A-Za-z_:][A-Za-z0-9.\-_:]*);|'. |
|
53 | + '([A-Za-z_:][A-Za-z0-9.\-_:]*);|' . |
|
54 | 54 | // string (optional semicolon) |
55 | - "($semi_optional)". |
|
55 | + "($semi_optional)" . |
|
56 | 56 | ')/'; |
57 | 57 | |
58 | 58 | $this->_attrEntitiesRegex = |
59 | - '/&(?:'. |
|
59 | + '/&(?:' . |
|
60 | 60 | // hex |
61 | - '[#]x([a-fA-F0-9]+);?|'. |
|
61 | + '[#]x([a-fA-F0-9]+);?|' . |
|
62 | 62 | // dec |
63 | - '[#]0*(\d+);?|'. |
|
63 | + '[#]0*(\d+);?|' . |
|
64 | 64 | // string (mandatory semicolon) |
65 | 65 | // NB: order matters: match semicolon preferentially |
66 | - '([A-Za-z_:][A-Za-z0-9.\-_:]*);|'. |
|
66 | + '([A-Za-z_:][A-Za-z0-9.\-_:]*);|' . |
|
67 | 67 | // string (optional semicolon) |
68 | 68 | // don't match if trailing is equals or alphanumeric (URL |
69 | 69 | // like) |
70 | - "($semi_optional)(?![=;A-Za-z0-9])". |
|
70 | + "($semi_optional)(?![=;A-Za-z0-9])" . |
|
71 | 71 | ')/'; |
72 | 72 | |
73 | 73 | } |
@@ -122,7 +122,7 @@ discard block |
||
122 | 122 | if ($hex_part !== NULL && $hex_part !== "") { |
123 | 123 | return HTMLPurifier_Encoder::unichr(hexdec($hex_part)); |
124 | 124 | } elseif ($dec_part !== NULL && $dec_part !== "") { |
125 | - return HTMLPurifier_Encoder::unichr((int) $dec_part); |
|
125 | + return HTMLPurifier_Encoder::unichr((int)$dec_part); |
|
126 | 126 | } else { |
127 | 127 | if (!$this->_entity_lookup) { |
128 | 128 | $this->_entity_lookup = HTMLPurifier_EntityLookup::instance(); |
@@ -215,7 +215,7 @@ discard block |
||
215 | 215 | $is_num = (@$matches[0][1] === '#'); |
216 | 216 | if ($is_num) { |
217 | 217 | $is_hex = (@$entity[2] === 'x'); |
218 | - $code = $is_hex ? hexdec($matches[1]) : (int) $matches[2]; |
|
218 | + $code = $is_hex ? hexdec($matches[1]) : (int)$matches[2]; |
|
219 | 219 | // abort for special characters |
220 | 220 | if (isset($this->_special_dec2str[$code])) { |
221 | 221 | return $entity; |
@@ -270,14 +270,12 @@ discard block |
||
270 | 270 | $is_num = (@$matches[0][1] === '#'); |
271 | 271 | if ($is_num) { |
272 | 272 | $is_hex = (@$entity[2] === 'x'); |
273 | - $int = $is_hex ? hexdec($matches[1]) : (int) $matches[2]; |
|
273 | + $int = $is_hex ? hexdec($matches[1]) : (int)$matches[2]; |
|
274 | 274 | return isset($this->_special_dec2str[$int]) ? |
275 | - $this->_special_dec2str[$int] : |
|
276 | - $entity; |
|
275 | + $this->_special_dec2str[$int] : $entity; |
|
277 | 276 | } else { |
278 | 277 | return isset($this->_special_ent2dec[$matches[3]]) ? |
279 | - $this->_special_dec2str[$this->_special_ent2dec[$matches[3]]] : |
|
280 | - $entity; |
|
278 | + $this->_special_dec2str[$this->_special_ent2dec[$matches[3]]] : $entity; |
|
281 | 279 | } |
282 | 280 | } |
283 | 281 | } |
@@ -85,7 +85,7 @@ discard block |
||
85 | 85 | |
86 | 86 | $e = false; |
87 | 87 | if ($config->get('Core.CollectErrors')) { |
88 | - $e =& $context->get('ErrorCollector'); |
|
88 | + $e = & $context->get('ErrorCollector'); |
|
89 | 89 | } |
90 | 90 | |
91 | 91 | // for testing synchronization |
@@ -110,7 +110,7 @@ discard block |
||
110 | 110 | // recalculate lines |
111 | 111 | if ($synchronize_interval && // synchronization is on |
112 | 112 | $cursor > 0 && // cursor is further than zero |
113 | - $loops % $synchronize_interval === 0) { // time to synchronize! |
|
113 | + $loops%$synchronize_interval === 0) { // time to synchronize! |
|
114 | 114 | $current_line = 1 + $this->substrCount($html, $nl, 0, $cursor); |
115 | 115 | } |
116 | 116 | } |
@@ -383,7 +383,7 @@ discard block |
||
383 | 383 | |
384 | 384 | $e = false; |
385 | 385 | if ($config->get('Core.CollectErrors')) { |
386 | - $e =& $context->get('ErrorCollector'); |
|
386 | + $e = & $context->get('ErrorCollector'); |
|
387 | 387 | } |
388 | 388 | |
389 | 389 | // let's see if we can abort as quickly as possible |
@@ -83,7 +83,7 @@ discard block |
||
83 | 83 | restore_error_handler(); |
84 | 84 | |
85 | 85 | $body = $doc->getElementsByTagName('html')->item(0)-> // <html> |
86 | - getElementsByTagName('body')->item(0); // <body> |
|
86 | + getElementsByTagName('body')->item(0); // <body> |
|
87 | 87 | |
88 | 88 | $div = $body->getElementsByTagName('div')->item(0); // <div> |
89 | 89 | $tokens = array(); |
@@ -188,7 +188,7 @@ discard block |
||
188 | 188 | if ($node->nodeType === XML_TEXT_NODE) { |
189 | 189 | $data = $this->getData($node); // Handle variable data property |
190 | 190 | if ($data !== null) { |
191 | - $tokens[] = $this->factory->createText($data); |
|
191 | + $tokens[] = $this->factory->createText($data); |
|
192 | 192 | } |
193 | 193 | return false; |
194 | 194 | } elseif ($node->nodeType === XML_CDATA_SECTION_NODE) { |
@@ -83,7 +83,7 @@ discard block |
||
83 | 83 | restore_error_handler(); |
84 | 84 | |
85 | 85 | $body = $doc->getElementsByTagName('html')->item(0)-> // <html> |
86 | - getElementsByTagName('body')->item(0); // <body> |
|
86 | + getElementsByTagName('body')->item(0); // <body> |
|
87 | 87 | |
88 | 88 | $div = $body->getElementsByTagName('div')->item(0); // <div> |
89 | 89 | $tokens = array(); |
@@ -222,7 +222,7 @@ discard block |
||
222 | 222 | $attr = $node->hasAttributes() ? $this->transformAttrToAssoc($node->attributes) : array(); |
223 | 223 | $tag_name = $this->getTagName($node); // Handle variable tagName property |
224 | 224 | if (empty($tag_name)) { |
225 | - return (bool) $node->childNodes->length; |
|
225 | + return (bool)$node->childNodes->length; |
|
226 | 226 | } |
227 | 227 | // We still have to make sure that the element actually IS empty |
228 | 228 | if (!$node->childNodes->length) { |
@@ -327,9 +327,13 @@ |
||
327 | 327 | $ret .= '<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />'; |
328 | 328 | // No protection if $html contains a stray </div>! |
329 | 329 | $ret .= '</head><body>'; |
330 | - if ($use_div) $ret .= '<div>'; |
|
330 | + if ($use_div) { |
|
331 | + $ret .= '<div>'; |
|
332 | + } |
|
331 | 333 | $ret .= $html; |
332 | - if ($use_div) $ret .= '</div>'; |
|
334 | + if ($use_div) { |
|
335 | + $ret .= '</div>'; |
|
336 | + } |
|
333 | 337 | $ret .= '</body></html>'; |
334 | 338 | return $ret; |
335 | 339 | } |
@@ -34,7 +34,7 @@ |
||
34 | 34 | $tokens = array(); |
35 | 35 | $this->tokenizeDOM( |
36 | 36 | $doc->getElementsByTagName('html')->item(0)-> // <html> |
37 | - getElementsByTagName('body')->item(0) // <body> |
|
37 | + getElementsByTagName('body')->item(0) // <body> |
|
38 | 38 | , |
39 | 39 | $tokens, $config |
40 | 40 | ); |
@@ -242,8 +242,7 @@ discard block |
||
242 | 242 | $this->info['width'] = |
243 | 243 | $this->info['height'] = |
244 | 244 | $max === null ? |
245 | - $trusted_wh : |
|
246 | - new HTMLPurifier_AttrDef_Switch( |
|
245 | + $trusted_wh : new HTMLPurifier_AttrDef_Switch( |
|
247 | 246 | 'img', |
248 | 247 | // For img tags: |
249 | 248 | new HTMLPurifier_AttrDef_CSS_Composite( |
@@ -258,8 +257,7 @@ discard block |
||
258 | 257 | $this->info['min-width'] = |
259 | 258 | $this->info['min-height'] = |
260 | 259 | $max === null ? |
261 | - $trusted_min_wh : |
|
262 | - new HTMLPurifier_AttrDef_Switch( |
|
260 | + $trusted_min_wh : new HTMLPurifier_AttrDef_Switch( |
|
263 | 261 | 'img', |
264 | 262 | // For img tags: |
265 | 263 | new HTMLPurifier_AttrDef_CSS_Composite( |
@@ -274,8 +272,7 @@ discard block |
||
274 | 272 | $this->info['max-width'] = |
275 | 273 | $this->info['max-height'] = |
276 | 274 | $max === null ? |
277 | - $trusted_max_wh : |
|
278 | - new HTMLPurifier_AttrDef_Switch( |
|
275 | + $trusted_max_wh : new HTMLPurifier_AttrDef_Switch( |
|
279 | 276 | 'img', |
280 | 277 | // For img tags: |
281 | 278 | new HTMLPurifier_AttrDef_CSS_Composite( |
@@ -42,8 +42,8 @@ |
||
42 | 42 | */ |
43 | 43 | public function __construct($n = '0', $u = false) |
44 | 44 | { |
45 | - $this->n = (string) $n; |
|
46 | - $this->unit = $u !== false ? (string) $u : false; |
|
45 | + $this->n = (string)$n; |
|
46 | + $this->unit = $u !== false ? (string)$u : false; |
|
47 | 47 | } |
48 | 48 | |
49 | 49 | /** |
@@ -33,7 +33,7 @@ |
||
33 | 33 | $this->context = $context; |
34 | 34 | $this->obj = $obj; |
35 | 35 | $this->member = $member; |
36 | - $this->contents =& $obj->$member; |
|
36 | + $this->contents = & $obj->$member; |
|
37 | 37 | } |
38 | 38 | |
39 | 39 | /** |
@@ -6,6 +6,6 @@ |
||
6 | 6 | * without any other side-effects. |
7 | 7 | */ |
8 | 8 | |
9 | -set_include_path(dirname(__FILE__) . PATH_SEPARATOR . get_include_path() ); |
|
9 | +set_include_path(dirname(__FILE__) . PATH_SEPARATOR . get_include_path()); |
|
10 | 10 | |
11 | 11 | // vim: et sw=4 sts=4 |
@@ -4,7 +4,7 @@ |
||
4 | 4 | * This is a stub include that automatically configures the include path. |
5 | 5 | */ |
6 | 6 | |
7 | -set_include_path(dirname(__FILE__) . PATH_SEPARATOR . get_include_path() ); |
|
7 | +set_include_path(dirname(__FILE__) . PATH_SEPARATOR . get_include_path()); |
|
8 | 8 | require_once 'HTMLPurifier/Bootstrap.php'; |
9 | 9 | require_once 'HTMLPurifier.autoload.php'; |
10 | 10 |