@@ -140,12 +140,10 @@ |
||
140 | 140 | $is_hex = (@$entity[2] === 'x'); |
141 | 141 | $int = $is_hex ? hexdec($matches[1]) : (int) $matches[2]; |
142 | 142 | return isset($this->_special_dec2str[$int]) ? |
143 | - $this->_special_dec2str[$int] : |
|
144 | - $entity; |
|
143 | + $this->_special_dec2str[$int] : $entity; |
|
145 | 144 | } else { |
146 | 145 | return isset($this->_special_ent2dec[$matches[3]]) ? |
147 | - $this->_special_ent2dec[$matches[3]] : |
|
148 | - $entity; |
|
146 | + $this->_special_ent2dec[$matches[3]] : $entity; |
|
149 | 147 | } |
150 | 148 | } |
151 | 149 | } |
@@ -30,7 +30,7 @@ |
||
30 | 30 | protected function prependCSS(&$attr, $css) |
31 | 31 | { |
32 | 32 | $attr['style'] = isset($attr['style']) ? $attr['style'] : ''; |
33 | - $attr['style'] = $css . $attr['style']; |
|
33 | + $attr['style'] = $css.$attr['style']; |
|
34 | 34 | } |
35 | 35 | } |
36 | 36 |
@@ -103,9 +103,9 @@ |
||
103 | 103 | $parent_def = $definition->info_parent_def; |
104 | 104 | $stack = array( |
105 | 105 | array($top_node, |
106 | - $parent_def->descendants_are_inline, |
|
107 | - $parent_def->excludes, // exclusions |
|
108 | - 0) |
|
106 | + $parent_def->descendants_are_inline, |
|
107 | + $parent_def->excludes, // exclusions |
|
108 | + 0) |
|
109 | 109 | ); |
110 | 110 | |
111 | 111 | while (!empty($stack)) { |
@@ -61,7 +61,7 @@ |
||
61 | 61 | $context->register('IsInline', $is_inline); |
62 | 62 | |
63 | 63 | // setup error collector |
64 | - $e =& $context->get('ErrorCollector', true); |
|
64 | + $e = & $context->get('ErrorCollector', true); |
|
65 | 65 | |
66 | 66 | //####################################################################// |
67 | 67 | // Loop initialization |
@@ -128,19 +128,25 @@ discard block |
||
128 | 128 | break; |
129 | 129 | } |
130 | 130 | }; |
131 | - if ($go) continue; |
|
131 | + if ($go) { |
|
132 | + continue; |
|
133 | + } |
|
132 | 134 | list($token, $d) = $node->toTokenPair(); |
133 | 135 | // base case |
134 | 136 | if ($excludes_enabled && isset($excludes[$node->name])) { |
135 | 137 | $node->dead = true; |
136 | - if ($e) $e->send(E_ERROR, 'Strategy_FixNesting: Node excluded'); |
|
138 | + if ($e) { |
|
139 | + $e->send(E_ERROR, 'Strategy_FixNesting: Node excluded'); |
|
140 | + } |
|
137 | 141 | } else { |
138 | 142 | // XXX I suppose it would be slightly more efficient to |
139 | 143 | // avoid the allocation here and have children |
140 | 144 | // strategies handle it |
141 | 145 | $children = array(); |
142 | 146 | foreach ($node->children as $child) { |
143 | - if (!$child->dead) $children[] = $child; |
|
147 | + if (!$child->dead) { |
|
148 | + $children[] = $child; |
|
149 | + } |
|
144 | 150 | } |
145 | 151 | $result = $def->child->validateChildren($children, $config, $context); |
146 | 152 | if ($result === true) { |
@@ -148,7 +154,9 @@ discard block |
||
148 | 154 | $node->children = $children; |
149 | 155 | } elseif ($result === false) { |
150 | 156 | $node->dead = true; |
151 | - if ($e) $e->send(E_ERROR, 'Strategy_FixNesting: Node removed'); |
|
157 | + if ($e) { |
|
158 | + $e->send(E_ERROR, 'Strategy_FixNesting: Node removed'); |
|
159 | + } |
|
152 | 160 | } else { |
153 | 161 | $node->children = $result; |
154 | 162 | if ($e) { |
@@ -55,7 +55,7 @@ |
||
55 | 55 | |
56 | 56 | $e = false; |
57 | 57 | if ($config->get('Core.CollectErrors')) { |
58 | - $e =& $context->get('ErrorCollector'); |
|
58 | + $e = & $context->get('ErrorCollector'); |
|
59 | 59 | } |
60 | 60 | |
61 | 61 | foreach ($tokens as $token) { |
@@ -75,7 +75,7 @@ discard block |
||
75 | 75 | public function setup() |
76 | 76 | { |
77 | 77 | $this->validator = new HTMLPurifier_AttrDef_Lang(); |
78 | - $this->dir = HTMLPURIFIER_PREFIX . '/HTMLPurifier'; |
|
78 | + $this->dir = HTMLPURIFIER_PREFIX.'/HTMLPurifier'; |
|
79 | 79 | } |
80 | 80 | |
81 | 81 | /** |
@@ -107,8 +107,8 @@ discard block |
||
107 | 107 | if ($code == 'en') { |
108 | 108 | $lang = new HTMLPurifier_Language($config, $context); |
109 | 109 | } else { |
110 | - $class = 'HTMLPurifier_Language_' . $pcode; |
|
111 | - $file = $this->dir . '/Language/classes/' . $code . '.php'; |
|
110 | + $class = 'HTMLPurifier_Language_'.$pcode; |
|
111 | + $file = $this->dir.'/Language/classes/'.$code.'.php'; |
|
112 | 112 | if (file_exists($file) || class_exists($class, false)) { |
113 | 113 | $lang = new $class($config, $context); |
114 | 114 | } else { |
@@ -153,7 +153,7 @@ discard block |
||
153 | 153 | } |
154 | 154 | |
155 | 155 | // generate filename |
156 | - $filename = $this->dir . '/Language/messages/' . $code . '.php'; |
|
156 | + $filename = $this->dir.'/Language/messages/'.$code.'.php'; |
|
157 | 157 | |
158 | 158 | // default fallback : may be overwritten by the ensuing include |
159 | 159 | $fallback = ($code != 'en') ? 'en' : false; |
@@ -161,7 +161,7 @@ discard block |
||
161 | 161 | // load primary localisation |
162 | 162 | if (!file_exists($filename)) { |
163 | 163 | // skip the include: will rely solely on fallback |
164 | - $filename = $this->dir . '/Language/messages/en.php'; |
|
164 | + $filename = $this->dir.'/Language/messages/en.php'; |
|
165 | 165 | $cache = array(); |
166 | 166 | } else { |
167 | 167 | include $filename; |
@@ -174,7 +174,7 @@ discard block |
||
174 | 174 | // infinite recursion guard |
175 | 175 | if (isset($languages_seen[$code])) { |
176 | 176 | trigger_error( |
177 | - 'Circular fallback reference in language ' . |
|
177 | + 'Circular fallback reference in language '. |
|
178 | 178 | $code, |
179 | 179 | E_USER_ERROR |
180 | 180 | ); |
@@ -31,11 +31,11 @@ |
||
31 | 31 | // Note that ["<>] are an addition to the RFC's recommended |
32 | 32 | // characters, because they represent external delimeters. |
33 | 33 | $r_URI = '!'. |
34 | - '(([a-zA-Z0-9\.\+\-]+):)?'. // 2. Scheme |
|
35 | - '(//([^/?#"<>]*))?'. // 4. Authority |
|
36 | - '([^?#"<>]*)'. // 5. Path |
|
37 | - '(\?([^#"<>]*))?'. // 7. Query |
|
38 | - '(#([^"<>]*))?'. // 8. Fragment |
|
34 | + '(([a-zA-Z0-9\.\+\-]+):)?'.// 2. Scheme |
|
35 | + '(//([^/?#"<>]*))?'.// 4. Authority |
|
36 | + '([^?#"<>]*)'.// 5. Path |
|
37 | + '(\?([^#"<>]*))?'.// 7. Query |
|
38 | + '(#([^"<>]*))?'.// 8. Fragment |
|
39 | 39 | '!'; |
40 | 40 | |
41 | 41 | $matches = array(); |
@@ -41,7 +41,10 @@ |
||
41 | 41 | $matches = array(); |
42 | 42 | $result = preg_match($r_URI, $uri, $matches); |
43 | 43 | |
44 | - if (!$result) return false; // *really* invalid URI |
|
44 | + if (!$result) { |
|
45 | + return false; |
|
46 | + } |
|
47 | + // *really* invalid URI |
|
45 | 48 | |
46 | 49 | // seperate out parts |
47 | 50 | $scheme = !empty($matches[1]) ? $matches[2] : null; |
@@ -113,7 +113,7 @@ |
||
113 | 113 | $uri->port = null; |
114 | 114 | $uri->fragment = null; |
115 | 115 | $uri->query = null; |
116 | - $uri->path = "$content_type;base64," . base64_encode($raw_data); |
|
116 | + $uri->path = "$content_type;base64,".base64_encode($raw_data); |
|
117 | 117 | return true; |
118 | 118 | } |
119 | 119 |
@@ -41,12 +41,12 @@ |
||
41 | 41 | list($key, $typecode) = explode('=', $type, 2); |
42 | 42 | if ($key !== 'type') { |
43 | 43 | // invalid key, tack it back on encoded |
44 | - $uri->path .= '%3B' . $type; |
|
44 | + $uri->path .= '%3B'.$type; |
|
45 | 45 | } elseif ($typecode === 'a' || $typecode === 'i' || $typecode === 'd') { |
46 | 46 | $type_ret = ";type=$typecode"; |
47 | 47 | } |
48 | 48 | } else { |
49 | - $uri->path .= '%3B' . $type; |
|
49 | + $uri->path .= '%3B'.$type; |
|
50 | 50 | } |
51 | 51 | $uri->path = str_replace(';', '%3B', $uri->path); |
52 | 52 | $uri->path .= $type_ret; |
@@ -139,7 +139,7 @@ |
||
139 | 139 | } |
140 | 140 | |
141 | 141 | $mState = 0; // cached expected number of octets after the current octet |
142 | - // until the beginning of the next UTF8 character sequence |
|
142 | + // until the beginning of the next UTF8 character sequence |
|
143 | 143 | $mUcs4 = 0; // cached Unicode character |
144 | 144 | $mBytes = 1; // cached expected number of octets in the current sequence |
145 | 145 |
@@ -273,7 +273,7 @@ discard block |
||
273 | 273 | $mState = 0; |
274 | 274 | $mUcs4 = 0; |
275 | 275 | $mBytes = 1; |
276 | - $char =''; |
|
276 | + $char = ''; |
|
277 | 277 | } |
278 | 278 | } |
279 | 279 | } |
@@ -309,7 +309,7 @@ discard block |
||
309 | 309 | public static function unichr($code) |
310 | 310 | { |
311 | 311 | if ($code > 1114111 or $code < 0 or |
312 | - ($code >= 55296 and $code <= 57343) ) { |
|
312 | + ($code >= 55296 and $code <= 57343)) { |
|
313 | 313 | // bits are set outside the "valid" range as defined |
314 | 314 | // by UNICODE 4.1.0 |
315 | 315 | return ''; |
@@ -330,7 +330,7 @@ discard block |
||
330 | 330 | $z = (($code >> 12) & 15) | 224; |
331 | 331 | } else { |
332 | 332 | $z = (($code >> 12) & 63) | 128; |
333 | - $w = (($code >> 18) & 7) | 240; |
|
333 | + $w = (($code >> 18) & 7) | 240; |
|
334 | 334 | } |
335 | 335 | } |
336 | 336 | } |
@@ -384,7 +384,7 @@ discard block |
||
384 | 384 | $str = self::unsafeIconv($encoding, 'utf-8//IGNORE', $str); |
385 | 385 | if ($str === false) { |
386 | 386 | // $encoding is not a valid encoding |
387 | - trigger_error('Invalid encoding ' . $encoding, E_USER_ERROR); |
|
387 | + trigger_error('Invalid encoding '.$encoding, E_USER_ERROR); |
|
388 | 388 | return ''; |
389 | 389 | } |
390 | 390 | // If the string is bjorked by Shift_JIS or a similar encoding |
@@ -401,7 +401,7 @@ discard block |
||
401 | 401 | trigger_error('Encoding not supported, please install iconv', E_USER_ERROR); |
402 | 402 | } else { |
403 | 403 | trigger_error( |
404 | - 'You have a buggy version of iconv, see https://bugs.php.net/bug.php?id=48147 ' . |
|
404 | + 'You have a buggy version of iconv, see https://bugs.php.net/bug.php?id=48147 '. |
|
405 | 405 | 'and http://sourceware.org/bugzilla/show_bug.cgi?id=13541', |
406 | 406 | E_USER_ERROR |
407 | 407 | ); |
@@ -442,7 +442,7 @@ discard block |
||
442 | 442 | } |
443 | 443 | $str = strtr($str, array_flip($ascii_fix)); |
444 | 444 | // Normal stuff |
445 | - $str = self::iconv('utf-8', $encoding . '//IGNORE', $str); |
|
445 | + $str = self::iconv('utf-8', $encoding.'//IGNORE', $str); |
|
446 | 446 | return $str; |
447 | 447 | } elseif ($encoding === 'iso-8859-1') { |
448 | 448 | $str = utf8_decode($str); |
@@ -487,7 +487,7 @@ discard block |
||
487 | 487 | $working += ($bytevalue & 0x3F); |
488 | 488 | $bytesleft--; |
489 | 489 | if ($bytesleft <= 0) { |
490 | - $result .= "&#" . $working . ";"; |
|
490 | + $result .= "&#".$working.";"; |
|
491 | 491 | } |
492 | 492 | } elseif ($bytevalue <= 0xDF) { //110x xxxx |
493 | 493 | $working = $bytevalue & 0x1F; |
@@ -533,14 +533,14 @@ discard block |
||
533 | 533 | static $code = null; |
534 | 534 | if ($code === null) { |
535 | 535 | // better not use iconv, otherwise infinite loop! |
536 | - $r = self::unsafeIconv('utf-8', 'ascii//IGNORE', "\xCE\xB1" . str_repeat('a', 9000)); |
|
536 | + $r = self::unsafeIconv('utf-8', 'ascii//IGNORE', "\xCE\xB1".str_repeat('a', 9000)); |
|
537 | 537 | if ($r === false) { |
538 | 538 | $code = self::ICONV_UNUSABLE; |
539 | 539 | } elseif (($c = strlen($r)) < 9000) { |
540 | 540 | $code = self::ICONV_TRUNCATES; |
541 | 541 | } elseif ($c > 9000) { |
542 | 542 | trigger_error( |
543 | - 'Your copy of iconv is extremely buggy. Please notify HTML Purifier maintainers: ' . |
|
543 | + 'Your copy of iconv is extremely buggy. Please notify HTML Purifier maintainers: '. |
|
544 | 544 | 'include your iconv version as per phpversion()', |
545 | 545 | E_USER_ERROR |
546 | 546 | ); |
@@ -328,7 +328,7 @@ |
||
328 | 328 | * Determines if a particular token requires an earlier inline token |
329 | 329 | * to get a paragraph. This should be used with _forwardUntilEndToken |
330 | 330 | * @param HTMLPurifier_Token $current |
331 | - * @return bool |
|
331 | + * @return boolean|null |
|
332 | 332 | */ |
333 | 333 | private function _checkNeedsP($current) |
334 | 334 | { |