@@ -24,7 +24,7 @@ |
||
| 24 | 24 | * @param string $string |
| 25 | 25 | * @param HTMLPurifier_Config $config |
| 26 | 26 | * @param HTMLPurifier_Context $context |
| 27 | - * @return bool|string |
|
| 27 | + * @return string|false |
|
| 28 | 28 | */ |
| 29 | 29 | public function validate($string, $config, $context) |
| 30 | 30 | { |
@@ -34,7 +34,7 @@ |
||
| 34 | 34 | * @param string $id |
| 35 | 35 | * @param HTMLPurifier_Config $config |
| 36 | 36 | * @param HTMLPurifier_Context $context |
| 37 | - * @return bool|string |
|
| 37 | + * @return false|string |
|
| 38 | 38 | */ |
| 39 | 39 | public function validate($id, $config, $context) |
| 40 | 40 | { |
@@ -53,19 +53,19 @@ discard block |
||
| 53 | 53 | $prefix .= $config->get('Attr.IDPrefixLocal'); |
| 54 | 54 | // prevent re-appending the prefix |
| 55 | 55 | if (strpos($id, $prefix) !== 0) { |
| 56 | - $id = $prefix . $id; |
|
| 56 | + $id = $prefix.$id; |
|
| 57 | 57 | } |
| 58 | 58 | } elseif ($config->get('Attr.IDPrefixLocal') !== '') { |
| 59 | 59 | trigger_error( |
| 60 | - '%Attr.IDPrefixLocal cannot be used unless ' . |
|
| 60 | + '%Attr.IDPrefixLocal cannot be used unless '. |
|
| 61 | 61 | '%Attr.IDPrefix is set', |
| 62 | 62 | E_USER_WARNING |
| 63 | 63 | ); |
| 64 | 64 | } |
| 65 | 65 | |
| 66 | 66 | if (!$this->selector) { |
| 67 | - $id_accumulator =& $context->get('IDAccumulator'); |
|
| 68 | - if (isset($id_accumulator->ids[$id])) { |
|
| 67 | + $id_accumulator = & $context->get('IDAccumulator'); |
|
| 68 | + if (isset($id_accumulator->ids[ $id ])) { |
|
| 69 | 69 | return false; |
| 70 | 70 | } |
| 71 | 71 | } |
@@ -75,7 +75,7 @@ discard block |
||
| 75 | 75 | if (ctype_alpha($id)) { |
| 76 | 76 | $result = true; |
| 77 | 77 | } else { |
| 78 | - if (!ctype_alpha(@$id[0])) { |
|
| 78 | + if (!ctype_alpha(@$id[ 0 ])) { |
|
| 79 | 79 | return false; |
| 80 | 80 | } |
| 81 | 81 | // primitive style of regexps, I suppose |
@@ -10,7 +10,7 @@ discard block |
||
| 10 | 10 | * @param string $string |
| 11 | 11 | * @param HTMLPurifier_Config $config |
| 12 | 12 | * @param HTMLPurifier_Context $context |
| 13 | - * @return bool|string |
|
| 13 | + * @return false|string |
|
| 14 | 14 | */ |
| 15 | 15 | public function validate($string, $config, $context) |
| 16 | 16 | { |
@@ -34,7 +34,7 @@ discard block |
||
| 34 | 34 | * @param string $string |
| 35 | 35 | * @param HTMLPurifier_Config $config |
| 36 | 36 | * @param HTMLPurifier_Context $context |
| 37 | - * @return array |
|
| 37 | + * @return string[] |
|
| 38 | 38 | */ |
| 39 | 39 | protected function split($string, $config, $context) |
| 40 | 40 | { |
@@ -56,7 +56,7 @@ discard block |
||
| 56 | 56 | * Template method for removing certain tokens based on arbitrary criteria. |
| 57 | 57 | * @note If we wanted to be really functional, we'd do an array_filter |
| 58 | 58 | * with a callback. But... we're not. |
| 59 | - * @param array $tokens |
|
| 59 | + * @param string[] $tokens |
|
| 60 | 60 | * @param HTMLPurifier_Config $config |
| 61 | 61 | * @param HTMLPurifier_Context $context |
| 62 | 62 | * @return array |
@@ -45,11 +45,11 @@ |
||
| 45 | 45 | // escaping because I don't know how to do that with regexps |
| 46 | 46 | // and plus it would complicate optimization efforts (you never |
| 47 | 47 | // see that anyway). |
| 48 | - $pattern = '/(?:(?<=\s)|\A)' . // look behind for space or string start |
|
| 49 | - '((?:--|-?[A-Za-z_])[A-Za-z_\-0-9]*)' . |
|
| 48 | + $pattern = '/(?:(?<=\s)|\A)'.// look behind for space or string start |
|
| 49 | + '((?:--|-?[A-Za-z_])[A-Za-z_\-0-9]*)'. |
|
| 50 | 50 | '(?:(?=\s)|\z)/'; // look ahead for space or string end |
| 51 | 51 | preg_match_all($pattern, $string, $matches); |
| 52 | - return $matches[1]; |
|
| 52 | + return $matches[ 1 ]; |
|
| 53 | 53 | } |
| 54 | 54 | |
| 55 | 55 | /** |
@@ -13,7 +13,7 @@ |
||
| 13 | 13 | * @param string $aIP |
| 14 | 14 | * @param HTMLPurifier_Config $config |
| 15 | 15 | * @param HTMLPurifier_Context $context |
| 16 | - * @return bool|string |
|
| 16 | + * @return false|string |
|
| 17 | 17 | */ |
| 18 | 18 | public function validate($aIP, $config, $context) |
| 19 | 19 | { |
@@ -24,13 +24,13 @@ discard block |
||
| 24 | 24 | $original = $aIP; |
| 25 | 25 | |
| 26 | 26 | $hex = '[0-9a-fA-F]'; |
| 27 | - $blk = '(?:' . $hex . '{1,4})'; |
|
| 27 | + $blk = '(?:'.$hex.'{1,4})'; |
|
| 28 | 28 | $pre = '(?:/(?:12[0-8]|1[0-1][0-9]|[1-9][0-9]|[0-9]))'; // /0 - /128 |
| 29 | 29 | |
| 30 | 30 | // prefix check |
| 31 | 31 | if (strpos($aIP, '/') !== false) { |
| 32 | - if (preg_match('#' . $pre . '$#s', $aIP, $find)) { |
|
| 33 | - $aIP = substr($aIP, 0, 0 - strlen($find[0])); |
|
| 32 | + if (preg_match('#'.$pre.'$#s', $aIP, $find)) { |
|
| 33 | + $aIP = substr($aIP, 0, 0 - strlen($find[ 0 ])); |
|
| 34 | 34 | unset($find); |
| 35 | 35 | } else { |
| 36 | 36 | return false; |
@@ -38,11 +38,11 @@ discard block |
||
| 38 | 38 | } |
| 39 | 39 | |
| 40 | 40 | // IPv4-compatiblity check |
| 41 | - if (preg_match('#(?<=:' . ')' . $this->ip4 . '$#s', $aIP, $find)) { |
|
| 42 | - $aIP = substr($aIP, 0, 0 - strlen($find[0])); |
|
| 43 | - $ip = explode('.', $find[0]); |
|
| 41 | + if (preg_match('#(?<=:'.')'.$this->ip4.'$#s', $aIP, $find)) { |
|
| 42 | + $aIP = substr($aIP, 0, 0 - strlen($find[ 0 ])); |
|
| 43 | + $ip = explode('.', $find[ 0 ]); |
|
| 44 | 44 | $ip = array_map('dechex', $ip); |
| 45 | - $aIP .= $ip[0] . $ip[1] . ':' . $ip[2] . $ip[3]; |
|
| 45 | + $aIP .= $ip[ 0 ].$ip[ 1 ].':'.$ip[ 2 ].$ip[ 3 ]; |
|
| 46 | 46 | unset($find, $ip); |
| 47 | 47 | } |
| 48 | 48 | |
@@ -68,7 +68,7 @@ discard block |
||
| 68 | 68 | $aIP = $first; |
| 69 | 69 | unset($first, $second); |
| 70 | 70 | } else { |
| 71 | - $aIP = explode(':', $aIP[0]); |
|
| 71 | + $aIP = explode(':', $aIP[ 0 ]); |
|
| 72 | 72 | } |
| 73 | 73 | $c = count($aIP); |
| 74 | 74 | |
@@ -31,7 +31,7 @@ |
||
| 31 | 31 | private $_pcre_regex; |
| 32 | 32 | |
| 33 | 33 | /** |
| 34 | - * @param $dtd_regex Allowed child pattern from the DTD |
|
| 34 | + * @param string $dtd_regex Allowed child pattern from the DTD |
|
| 35 | 35 | */ |
| 36 | 36 | public function __construct($dtd_regex) |
| 37 | 37 | { |
@@ -56,8 +56,8 @@ discard block |
||
| 56 | 56 | |
| 57 | 57 | // collect all elements into the $elements array |
| 58 | 58 | preg_match_all("/$el/", $reg, $matches); |
| 59 | - foreach ($matches[0] as $match) { |
|
| 60 | - $this->elements[$match] = true; |
|
| 59 | + foreach ($matches[ 0 ] as $match) { |
|
| 60 | + $this->elements[ $match ] = true; |
|
| 61 | 61 | } |
| 62 | 62 | |
| 63 | 63 | // setup all elements as parentheticals with leading commas |
@@ -86,16 +86,16 @@ discard block |
||
| 86 | 86 | if (!empty($node->is_whitespace)) { |
| 87 | 87 | continue; |
| 88 | 88 | } |
| 89 | - $list_of_children .= $node->name . ','; |
|
| 89 | + $list_of_children .= $node->name.','; |
|
| 90 | 90 | } |
| 91 | 91 | // add leading comma to deal with stray comma declarations |
| 92 | - $list_of_children = ',' . rtrim($list_of_children, ','); |
|
| 92 | + $list_of_children = ','.rtrim($list_of_children, ','); |
|
| 93 | 93 | $okay = |
| 94 | 94 | preg_match( |
| 95 | - '/^,?' . $this->_pcre_regex . '$/', |
|
| 95 | + '/^,?'.$this->_pcre_regex.'$/', |
|
| 96 | 96 | $list_of_children |
| 97 | 97 | ); |
| 98 | - return (bool)$okay; |
|
| 98 | + return (bool) $okay; |
|
| 99 | 99 | } |
| 100 | 100 | } |
| 101 | 101 | |
@@ -20,7 +20,7 @@ |
||
| 20 | 20 | public $type = 'optional'; |
| 21 | 21 | |
| 22 | 22 | /** |
| 23 | - * @param array $children |
|
| 23 | + * @param HTMLPurifier_Node[] $children |
|
| 24 | 24 | * @param HTMLPurifier_Config $config |
| 25 | 25 | * @param HTMLPurifier_Context $context |
| 26 | 26 | * @return array |
@@ -763,7 +763,7 @@ |
||
| 763 | 763 | * @param bool $mq_fix Boolean whether or not to enable magic quotes fix |
| 764 | 764 | * @param HTMLPurifier_ConfigSchema $schema Schema to use, if not global copy |
| 765 | 765 | * |
| 766 | - * @return mixed |
|
| 766 | + * @return HTMLPurifier_Config |
|
| 767 | 767 | */ |
| 768 | 768 | public static function loadArrayFromForm($array, $index = false, $allowed = true, $mq_fix = true, $schema = null) |
| 769 | 769 | { |
@@ -782,8 +782,8 @@ |
||
| 782 | 782 | */ |
| 783 | 783 | public function mergeArrayFromForm($array, $index = false, $allowed = true, $mq_fix = true) |
| 784 | 784 | { |
| 785 | - $ret = HTMLPurifier_Config::prepareArrayFromForm($array, $index, $allowed, $mq_fix, $this->def); |
|
| 786 | - $this->loadArray($ret); |
|
| 785 | + $ret = HTMLPurifier_Config::prepareArrayFromForm($array, $index, $allowed, $mq_fix, $this->def); |
|
| 786 | + $this->loadArray($ret); |
|
| 787 | 787 | } |
| 788 | 788 | |
| 789 | 789 | /** |
@@ -178,18 +178,18 @@ discard block |
||
| 178 | 178 | if (!$this->finalized) { |
| 179 | 179 | $this->autoFinalize(); |
| 180 | 180 | } |
| 181 | - if (!isset($this->def->info[$key])) { |
|
| 181 | + if (!isset($this->def->info[ $key ])) { |
|
| 182 | 182 | // can't add % due to SimpleTest bug |
| 183 | 183 | $this->triggerError( |
| 184 | - 'Cannot retrieve value of undefined directive ' . htmlspecialchars($key), |
|
| 184 | + 'Cannot retrieve value of undefined directive '.htmlspecialchars($key), |
|
| 185 | 185 | E_USER_WARNING |
| 186 | 186 | ); |
| 187 | 187 | return; |
| 188 | 188 | } |
| 189 | - if (isset($this->def->info[$key]->isAlias)) { |
|
| 190 | - $d = $this->def->info[$key]; |
|
| 189 | + if (isset($this->def->info[ $key ]->isAlias)) { |
|
| 190 | + $d = $this->def->info[ $key ]; |
|
| 191 | 191 | $this->triggerError( |
| 192 | - 'Cannot get value from aliased directive, use real name ' . $d->key, |
|
| 192 | + 'Cannot get value from aliased directive, use real name '.$d->key, |
|
| 193 | 193 | E_USER_ERROR |
| 194 | 194 | ); |
| 195 | 195 | return; |
@@ -198,9 +198,9 @@ discard block |
||
| 198 | 198 | list($ns) = explode('.', $key); |
| 199 | 199 | if ($ns !== $this->lock) { |
| 200 | 200 | $this->triggerError( |
| 201 | - 'Cannot get value of namespace ' . $ns . ' when lock for ' . |
|
| 202 | - $this->lock . |
|
| 203 | - ' is active, this probably indicates a Definition setup method ' . |
|
| 201 | + 'Cannot get value of namespace '.$ns.' when lock for '. |
|
| 202 | + $this->lock. |
|
| 203 | + ' is active, this probably indicates a Definition setup method '. |
|
| 204 | 204 | 'is accessing directives that are not within its namespace', |
| 205 | 205 | E_USER_ERROR |
| 206 | 206 | ); |
@@ -223,15 +223,15 @@ discard block |
||
| 223 | 223 | $this->autoFinalize(); |
| 224 | 224 | } |
| 225 | 225 | $full = $this->getAll(); |
| 226 | - if (!isset($full[$namespace])) { |
|
| 226 | + if (!isset($full[ $namespace ])) { |
|
| 227 | 227 | $this->triggerError( |
| 228 | - 'Cannot retrieve undefined namespace ' . |
|
| 228 | + 'Cannot retrieve undefined namespace '. |
|
| 229 | 229 | htmlspecialchars($namespace), |
| 230 | 230 | E_USER_WARNING |
| 231 | 231 | ); |
| 232 | 232 | return; |
| 233 | 233 | } |
| 234 | - return $full[$namespace]; |
|
| 234 | + return $full[ $namespace ]; |
|
| 235 | 235 | } |
| 236 | 236 | |
| 237 | 237 | /** |
@@ -246,12 +246,12 @@ discard block |
||
| 246 | 246 | */ |
| 247 | 247 | public function getBatchSerial($namespace) |
| 248 | 248 | { |
| 249 | - if (empty($this->serials[$namespace])) { |
|
| 249 | + if (empty($this->serials[ $namespace ])) { |
|
| 250 | 250 | $batch = $this->getBatch($namespace); |
| 251 | - unset($batch['DefinitionRev']); |
|
| 252 | - $this->serials[$namespace] = sha1(serialize($batch)); |
|
| 251 | + unset($batch[ 'DefinitionRev' ]); |
|
| 252 | + $this->serials[ $namespace ] = sha1(serialize($batch)); |
|
| 253 | 253 | } |
| 254 | - return $this->serials[$namespace]; |
|
| 254 | + return $this->serials[ $namespace ]; |
|
| 255 | 255 | } |
| 256 | 256 | |
| 257 | 257 | /** |
@@ -281,7 +281,7 @@ discard block |
||
| 281 | 281 | $ret = array(); |
| 282 | 282 | foreach ($this->plist->squash() as $name => $value) { |
| 283 | 283 | list($ns, $key) = explode('.', $name, 2); |
| 284 | - $ret[$ns][$key] = $value; |
|
| 284 | + $ret[ $ns ][ $key ] = $value; |
|
| 285 | 285 | } |
| 286 | 286 | return $ret; |
| 287 | 287 | } |
@@ -307,20 +307,20 @@ discard block |
||
| 307 | 307 | if ($this->isFinalized('Cannot set directive after finalization')) { |
| 308 | 308 | return; |
| 309 | 309 | } |
| 310 | - if (!isset($this->def->info[$key])) { |
|
| 310 | + if (!isset($this->def->info[ $key ])) { |
|
| 311 | 311 | $this->triggerError( |
| 312 | - 'Cannot set undefined directive ' . htmlspecialchars($key) . ' to value', |
|
| 312 | + 'Cannot set undefined directive '.htmlspecialchars($key).' to value', |
|
| 313 | 313 | E_USER_WARNING |
| 314 | 314 | ); |
| 315 | 315 | return; |
| 316 | 316 | } |
| 317 | - $def = $this->def->info[$key]; |
|
| 317 | + $def = $this->def->info[ $key ]; |
|
| 318 | 318 | |
| 319 | 319 | if (isset($def->isAlias)) { |
| 320 | 320 | if ($this->aliasMode) { |
| 321 | 321 | $this->triggerError( |
| 322 | 322 | 'Double-aliases not allowed, please fix '. |
| 323 | - 'ConfigSchema bug with' . $key, |
|
| 323 | + 'ConfigSchema bug with'.$key, |
|
| 324 | 324 | E_USER_ERROR |
| 325 | 325 | ); |
| 326 | 326 | return; |
@@ -347,7 +347,7 @@ discard block |
||
| 347 | 347 | $value = $this->parser->parse($value, $type, $allow_null); |
| 348 | 348 | } catch (HTMLPurifier_VarParserException $e) { |
| 349 | 349 | $this->triggerError( |
| 350 | - 'Value for ' . $key . ' is of invalid type, should be ' . |
|
| 350 | + 'Value for '.$key.' is of invalid type, should be '. |
|
| 351 | 351 | HTMLPurifier_VarParser::getTypeName($type), |
| 352 | 352 | E_USER_WARNING |
| 353 | 353 | ); |
@@ -355,13 +355,13 @@ discard block |
||
| 355 | 355 | } |
| 356 | 356 | if (is_string($value) && is_object($def)) { |
| 357 | 357 | // resolve value alias if defined |
| 358 | - if (isset($def->aliases[$value])) { |
|
| 359 | - $value = $def->aliases[$value]; |
|
| 358 | + if (isset($def->aliases[ $value ])) { |
|
| 359 | + $value = $def->aliases[ $value ]; |
|
| 360 | 360 | } |
| 361 | 361 | // check to see if the value is allowed |
| 362 | - if (isset($def->allowed) && !isset($def->allowed[$value])) { |
|
| 362 | + if (isset($def->allowed) && !isset($def->allowed[ $value ])) { |
|
| 363 | 363 | $this->triggerError( |
| 364 | - 'Value not supported, valid values are: ' . |
|
| 364 | + 'Value not supported, valid values are: '. |
|
| 365 | 365 | $this->_listify($def->allowed), |
| 366 | 366 | E_USER_WARNING |
| 367 | 367 | ); |
@@ -374,10 +374,10 @@ discard block |
||
| 374 | 374 | // this is a very costly process, so it's discouraged |
| 375 | 375 | // with finalization |
| 376 | 376 | if ($namespace == 'HTML' || $namespace == 'CSS' || $namespace == 'URI') { |
| 377 | - $this->definitions[$namespace] = null; |
|
| 377 | + $this->definitions[ $namespace ] = null; |
|
| 378 | 378 | } |
| 379 | 379 | |
| 380 | - $this->serials[$namespace] = false; |
|
| 380 | + $this->serials[ $namespace ] = false; |
|
| 381 | 381 | } |
| 382 | 382 | |
| 383 | 383 | /** |
@@ -391,7 +391,7 @@ discard block |
||
| 391 | 391 | { |
| 392 | 392 | $list = array(); |
| 393 | 393 | foreach ($lookup as $name => $b) { |
| 394 | - $list[] = $name; |
|
| 394 | + $list[ ] = $name; |
|
| 395 | 395 | } |
| 396 | 396 | return implode(', ', $list); |
| 397 | 397 | } |
@@ -488,8 +488,8 @@ discard block |
||
| 488 | 488 | // full definition |
| 489 | 489 | // --------------- |
| 490 | 490 | // check if definition is in memory |
| 491 | - if (!empty($this->definitions[$type])) { |
|
| 492 | - $def = $this->definitions[$type]; |
|
| 491 | + if (!empty($this->definitions[ $type ])) { |
|
| 492 | + $def = $this->definitions[ $type ]; |
|
| 493 | 493 | // check if the definition is setup |
| 494 | 494 | if ($def->setup) { |
| 495 | 495 | return $def; |
@@ -505,7 +505,7 @@ discard block |
||
| 505 | 505 | $def = $cache->get($this); |
| 506 | 506 | if ($def) { |
| 507 | 507 | // definition in cache, save to memory and return it |
| 508 | - $this->definitions[$type] = $def; |
|
| 508 | + $this->definitions[ $type ] = $def; |
|
| 509 | 509 | return $def; |
| 510 | 510 | } |
| 511 | 511 | // initialize it |
@@ -524,28 +524,27 @@ discard block |
||
| 524 | 524 | // check preconditions |
| 525 | 525 | $def = null; |
| 526 | 526 | if ($optimized) { |
| 527 | - if (is_null($this->get($type . '.DefinitionID'))) { |
|
| 527 | + if (is_null($this->get($type.'.DefinitionID'))) { |
|
| 528 | 528 | // fatally error out if definition ID not set |
| 529 | 529 | throw new HTMLPurifier_Exception( |
| 530 | 530 | "Cannot retrieve raw version without specifying %$type.DefinitionID" |
| 531 | 531 | ); |
| 532 | 532 | } |
| 533 | 533 | } |
| 534 | - if (!empty($this->definitions[$type])) { |
|
| 535 | - $def = $this->definitions[$type]; |
|
| 534 | + if (!empty($this->definitions[ $type ])) { |
|
| 535 | + $def = $this->definitions[ $type ]; |
|
| 536 | 536 | if ($def->setup && !$optimized) { |
| 537 | 537 | $extra = $this->chatty ? |
| 538 | - " (try moving this code block earlier in your initialization)" : |
|
| 539 | - ""; |
|
| 538 | + " (try moving this code block earlier in your initialization)" : ""; |
|
| 540 | 539 | throw new HTMLPurifier_Exception( |
| 541 | - "Cannot retrieve raw definition after it has already been setup" . |
|
| 540 | + "Cannot retrieve raw definition after it has already been setup". |
|
| 542 | 541 | $extra |
| 543 | 542 | ); |
| 544 | 543 | } |
| 545 | 544 | if ($def->optimized === null) { |
| 546 | 545 | $extra = $this->chatty ? " (try flushing your cache)" : ""; |
| 547 | 546 | throw new HTMLPurifier_Exception( |
| 548 | - "Optimization status of definition is unknown" . $extra |
|
| 547 | + "Optimization status of definition is unknown".$extra |
|
| 549 | 548 | ); |
| 550 | 549 | } |
| 551 | 550 | if ($def->optimized !== $optimized) { |
@@ -554,7 +553,7 @@ discard block |
||
| 554 | 553 | " (this backtrace is for the first inconsistent call, which was for a $msg raw definition)" |
| 555 | 554 | : ""; |
| 556 | 555 | throw new HTMLPurifier_Exception( |
| 557 | - "Inconsistent use of optimized and unoptimized raw definition retrievals" . $extra |
|
| 556 | + "Inconsistent use of optimized and unoptimized raw definition retrievals".$extra |
|
| 558 | 557 | ); |
| 559 | 558 | } |
| 560 | 559 | } |
@@ -580,22 +579,22 @@ discard block |
||
| 580 | 579 | if ($def) { |
| 581 | 580 | // save the full definition for later, but don't |
| 582 | 581 | // return it yet |
| 583 | - $this->definitions[$type] = $def; |
|
| 582 | + $this->definitions[ $type ] = $def; |
|
| 584 | 583 | return null; |
| 585 | 584 | } |
| 586 | 585 | } |
| 587 | 586 | // check invariants for creation |
| 588 | 587 | if (!$optimized) { |
| 589 | - if (!is_null($this->get($type . '.DefinitionID'))) { |
|
| 588 | + if (!is_null($this->get($type.'.DefinitionID'))) { |
|
| 590 | 589 | if ($this->chatty) { |
| 591 | 590 | $this->triggerError( |
| 592 | - 'Due to a documentation error in previous version of HTML Purifier, your ' . |
|
| 593 | - 'definitions are not being cached. If this is OK, you can remove the ' . |
|
| 594 | - '%$type.DefinitionRev and %$type.DefinitionID declaration. Otherwise, ' . |
|
| 595 | - 'modify your code to use maybeGetRawDefinition, and test if the returned ' . |
|
| 596 | - 'value is null before making any edits (if it is null, that means that a ' . |
|
| 597 | - 'cached version is available, and no raw operations are necessary). See ' . |
|
| 598 | - '<a href="http://htmlpurifier.org/docs/enduser-customize.html#optimized">' . |
|
| 591 | + 'Due to a documentation error in previous version of HTML Purifier, your '. |
|
| 592 | + 'definitions are not being cached. If this is OK, you can remove the '. |
|
| 593 | + '%$type.DefinitionRev and %$type.DefinitionID declaration. Otherwise, '. |
|
| 594 | + 'modify your code to use maybeGetRawDefinition, and test if the returned '. |
|
| 595 | + 'value is null before making any edits (if it is null, that means that a '. |
|
| 596 | + 'cached version is available, and no raw operations are necessary). See '. |
|
| 597 | + '<a href="http://htmlpurifier.org/docs/enduser-customize.html#optimized">'. |
|
| 599 | 598 | 'Customize</a> for more details', |
| 600 | 599 | E_USER_WARNING |
| 601 | 600 | ); |
@@ -637,7 +636,7 @@ discard block |
||
| 637 | 636 | "Definition of $type type not supported" |
| 638 | 637 | ); |
| 639 | 638 | } |
| 640 | - $this->definitions[$type] = $def; |
|
| 639 | + $this->definitions[ $type ] = $def; |
|
| 641 | 640 | return $def; |
| 642 | 641 | } |
| 643 | 642 | |
@@ -689,7 +688,7 @@ discard block |
||
| 689 | 688 | $namespace = $key; |
| 690 | 689 | $namespace_values = $value; |
| 691 | 690 | foreach ($namespace_values as $directive => $value2) { |
| 692 | - $this->set($namespace .'.'. $directive, $value2); |
|
| 691 | + $this->set($namespace.'.'.$directive, $value2); |
|
| 693 | 692 | } |
| 694 | 693 | } |
| 695 | 694 | } |
@@ -720,14 +719,14 @@ discard block |
||
| 720 | 719 | foreach ($allowed as $ns_or_directive) { |
| 721 | 720 | if (strpos($ns_or_directive, '.') !== false) { |
| 722 | 721 | // directive |
| 723 | - if ($ns_or_directive[0] == '-') { |
|
| 724 | - $blacklisted_directives[substr($ns_or_directive, 1)] = true; |
|
| 722 | + if ($ns_or_directive[ 0 ] == '-') { |
|
| 723 | + $blacklisted_directives[ substr($ns_or_directive, 1) ] = true; |
|
| 725 | 724 | } else { |
| 726 | - $allowed_directives[$ns_or_directive] = true; |
|
| 725 | + $allowed_directives[ $ns_or_directive ] = true; |
|
| 727 | 726 | } |
| 728 | 727 | } else { |
| 729 | 728 | // namespace |
| 730 | - $allowed_ns[$ns_or_directive] = true; |
|
| 729 | + $allowed_ns[ $ns_or_directive ] = true; |
|
| 731 | 730 | } |
| 732 | 731 | } |
| 733 | 732 | } |
@@ -735,10 +734,10 @@ discard block |
||
| 735 | 734 | foreach ($schema->info as $key => $def) { |
| 736 | 735 | list($ns, $directive) = explode('.', $key, 2); |
| 737 | 736 | if ($allowed !== true) { |
| 738 | - if (isset($blacklisted_directives["$ns.$directive"])) { |
|
| 737 | + if (isset($blacklisted_directives[ "$ns.$directive" ])) { |
|
| 739 | 738 | continue; |
| 740 | 739 | } |
| 741 | - if (!isset($allowed_directives["$ns.$directive"]) && !isset($allowed_ns[$ns])) { |
|
| 740 | + if (!isset($allowed_directives[ "$ns.$directive" ]) && !isset($allowed_ns[ $ns ])) { |
|
| 742 | 741 | continue; |
| 743 | 742 | } |
| 744 | 743 | } |
@@ -748,7 +747,7 @@ discard block |
||
| 748 | 747 | if ($directive == 'DefinitionID' || $directive == 'DefinitionRev') { |
| 749 | 748 | continue; |
| 750 | 749 | } |
| 751 | - $ret[] = array($ns, $directive); |
|
| 750 | + $ret[ ] = array($ns, $directive); |
|
| 752 | 751 | } |
| 753 | 752 | return $ret; |
| 754 | 753 | } |
@@ -801,7 +800,7 @@ discard block |
||
| 801 | 800 | public static function prepareArrayFromForm($array, $index = false, $allowed = true, $mq_fix = true, $schema = null) |
| 802 | 801 | { |
| 803 | 802 | if ($index !== false) { |
| 804 | - $array = (isset($array[$index]) && is_array($array[$index])) ? $array[$index] : array(); |
|
| 803 | + $array = (isset($array[ $index ]) && is_array($array[ $index ])) ? $array[ $index ] : array(); |
|
| 805 | 804 | } |
| 806 | 805 | $mq = $mq_fix && function_exists('get_magic_quotes_gpc') && get_magic_quotes_gpc(); |
| 807 | 806 | |
@@ -810,15 +809,15 @@ discard block |
||
| 810 | 809 | foreach ($allowed as $key) { |
| 811 | 810 | list($ns, $directive) = $key; |
| 812 | 811 | $skey = "$ns.$directive"; |
| 813 | - if (!empty($array["Null_$skey"])) { |
|
| 814 | - $ret[$ns][$directive] = null; |
|
| 812 | + if (!empty($array[ "Null_$skey" ])) { |
|
| 813 | + $ret[ $ns ][ $directive ] = null; |
|
| 815 | 814 | continue; |
| 816 | 815 | } |
| 817 | - if (!isset($array[$skey])) { |
|
| 816 | + if (!isset($array[ $skey ])) { |
|
| 818 | 817 | continue; |
| 819 | 818 | } |
| 820 | - $value = $mq ? stripslashes($array[$skey]) : $array[$skey]; |
|
| 821 | - $ret[$ns][$directive] = $value; |
|
| 819 | + $value = $mq ? stripslashes($array[ $skey ]) : $array[ $skey ]; |
|
| 820 | + $ret[ $ns ][ $directive ] = $value; |
|
| 822 | 821 | } |
| 823 | 822 | return $ret; |
| 824 | 823 | } |
@@ -890,15 +889,15 @@ discard block |
||
| 890 | 889 | // zip(tail(trace), trace) -- but PHP is not Haskell har har |
| 891 | 890 | for ($i = 0, $c = count($trace); $i < $c - 1; $i++) { |
| 892 | 891 | // XXX this is not correct on some versions of HTML Purifier |
| 893 | - if ($trace[$i + 1]['class'] === 'HTMLPurifier_Config') { |
|
| 892 | + if ($trace[ $i + 1 ][ 'class' ] === 'HTMLPurifier_Config') { |
|
| 894 | 893 | continue; |
| 895 | 894 | } |
| 896 | - $frame = $trace[$i]; |
|
| 897 | - $extra = " invoked on line {$frame['line']} in file {$frame['file']}"; |
|
| 895 | + $frame = $trace[ $i ]; |
|
| 896 | + $extra = " invoked on line {$frame[ 'line' ]} in file {$frame[ 'file' ]}"; |
|
| 898 | 897 | break; |
| 899 | 898 | } |
| 900 | 899 | } |
| 901 | - trigger_error($msg . $extra, $no); |
|
| 900 | + trigger_error($msg.$extra, $no); |
|
| 902 | 901 | } |
| 903 | 902 | |
| 904 | 903 | /** |
@@ -133,7 +133,9 @@ |
||
| 133 | 133 | } |
| 134 | 134 | if (is_string($config)) { |
| 135 | 135 | $ret->loadIni($config); |
| 136 | - } elseif (is_array($config)) $ret->loadArray($config); |
|
| 136 | + } elseif (is_array($config)) { |
|
| 137 | + $ret->loadArray($config); |
|
| 138 | + } |
|
| 137 | 139 | return $ret; |
| 138 | 140 | } |
| 139 | 141 | |
@@ -351,7 +351,7 @@ |
||
| 351 | 351 | } |
| 352 | 352 | |
| 353 | 353 | /** |
| 354 | - * @return bool |
|
| 354 | + * @return boolean|null |
|
| 355 | 355 | */ |
| 356 | 356 | public static function iconvAvailable() |
| 357 | 357 | { |
@@ -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 | |
@@ -71,13 +71,13 @@ discard block |
||
| 71 | 71 | break; |
| 72 | 72 | } |
| 73 | 73 | // wibble the boundary |
| 74 | - if (0x80 != (0xC0 & ord($text[$i + $max_chunk_size]))) { |
|
| 74 | + if (0x80 != (0xC0 & ord($text[ $i + $max_chunk_size ]))) { |
|
| 75 | 75 | $chunk_size = $max_chunk_size; |
| 76 | - } elseif (0x80 != (0xC0 & ord($text[$i + $max_chunk_size - 1]))) { |
|
| 76 | + } elseif (0x80 != (0xC0 & ord($text[ $i + $max_chunk_size - 1 ]))) { |
|
| 77 | 77 | $chunk_size = $max_chunk_size - 1; |
| 78 | - } elseif (0x80 != (0xC0 & ord($text[$i + $max_chunk_size - 2]))) { |
|
| 78 | + } elseif (0x80 != (0xC0 & ord($text[ $i + $max_chunk_size - 2 ]))) { |
|
| 79 | 79 | $chunk_size = $max_chunk_size - 2; |
| 80 | - } elseif (0x80 != (0xC0 & ord($text[$i + $max_chunk_size - 3]))) { |
|
| 80 | + } elseif (0x80 != (0xC0 & ord($text[ $i + $max_chunk_size - 3 ]))) { |
|
| 81 | 81 | $chunk_size = $max_chunk_size - 3; |
| 82 | 82 | } else { |
| 83 | 83 | return false; // rather confusing UTF-8... |
@@ -155,7 +155,7 @@ discard block |
||
| 155 | 155 | $len = strlen($str); |
| 156 | 156 | for ($i = 0; $i < $len; $i++) { |
| 157 | 157 | $in = ord($str{$i}); |
| 158 | - $char .= $str[$i]; // append byte to char |
|
| 158 | + $char .= $str[ $i ]; // append byte to char |
|
| 159 | 159 | if (0 == $mState) { |
| 160 | 160 | // When mState is zero we expect either a US-ASCII character |
| 161 | 161 | // or a multi-octet sequence. |
@@ -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 | ); |
@@ -436,13 +436,13 @@ discard block |
||
| 436 | 436 | if (!$escape && !empty($ascii_fix)) { |
| 437 | 437 | $clear_fix = array(); |
| 438 | 438 | foreach ($ascii_fix as $utf8 => $native) { |
| 439 | - $clear_fix[$utf8] = ''; |
|
| 439 | + $clear_fix[ $utf8 ] = ''; |
|
| 440 | 440 | } |
| 441 | 441 | $str = strtr($str, $clear_fix); |
| 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); |
@@ -478,7 +478,7 @@ discard block |
||
| 478 | 478 | $working = 0; |
| 479 | 479 | $len = strlen($str); |
| 480 | 480 | for ($i = 0; $i < $len; $i++) { |
| 481 | - $bytevalue = ord($str[$i]); |
|
| 481 | + $bytevalue = ord($str[ $i ]); |
|
| 482 | 482 | if ($bytevalue <= 0x7F) { //0xxx xxxx |
| 483 | 483 | $result .= chr($bytevalue); |
| 484 | 484 | $bytesleft = 0; |
@@ -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 | ); |
@@ -571,8 +571,8 @@ discard block |
||
| 571 | 571 | // If ICONV_UNUSABLE, this call is irrelevant |
| 572 | 572 | static $encodings = array(); |
| 573 | 573 | if (!$bypass) { |
| 574 | - if (isset($encodings[$encoding])) { |
|
| 575 | - return $encodings[$encoding]; |
|
| 574 | + if (isset($encodings[ $encoding ])) { |
|
| 575 | + return $encodings[ $encoding ]; |
|
| 576 | 576 | } |
| 577 | 577 | $lenc = strtolower($encoding); |
| 578 | 578 | switch ($lenc) { |
@@ -600,10 +600,10 @@ discard block |
||
| 600 | 600 | // Reverse engineer: what's the UTF-8 equiv of this byte |
| 601 | 601 | // sequence? This assumes that there's no variable width |
| 602 | 602 | // encoding that doesn't support ASCII. |
| 603 | - $ret[self::unsafeIconv($encoding, 'UTF-8//IGNORE', $c)] = $c; |
|
| 603 | + $ret[ self::unsafeIconv($encoding, 'UTF-8//IGNORE', $c) ] = $c; |
|
| 604 | 604 | } |
| 605 | 605 | } |
| 606 | - $encodings[$encoding] = $ret; |
|
| 606 | + $encodings[ $encoding ] = $ret; |
|
| 607 | 607 | return $ret; |
| 608 | 608 | } |
| 609 | 609 | } |
@@ -451,7 +451,7 @@ |
||
| 451 | 451 | * separate lists for processing. Format is element[attr1|attr2],element2... |
| 452 | 452 | * @warning Although it's largely drawn from TinyMCE's implementation, |
| 453 | 453 | * it is different, and you'll probably have to modify your lists |
| 454 | - * @param array $list String list to parse |
|
| 454 | + * @param string $list String list to parse |
|
| 455 | 455 | * @return array |
| 456 | 456 | * @todo Give this its own class, probably static interface |
| 457 | 457 | */ |
@@ -113,12 +113,12 @@ discard block |
||
| 113 | 113 | public function addAttribute($element_name, $attr_name, $def) |
| 114 | 114 | { |
| 115 | 115 | $module = $this->getAnonymousModule(); |
| 116 | - if (!isset($module->info[$element_name])) { |
|
| 116 | + if (!isset($module->info[ $element_name ])) { |
|
| 117 | 117 | $element = $module->addBlankElement($element_name); |
| 118 | 118 | } else { |
| 119 | - $element = $module->info[$element_name]; |
|
| 119 | + $element = $module->info[ $element_name ]; |
|
| 120 | 120 | } |
| 121 | - $element->attr[$attr_name] = $def; |
|
| 121 | + $element->attr[ $attr_name ] = $def; |
|
| 122 | 122 | } |
| 123 | 123 | |
| 124 | 124 | /** |
@@ -198,8 +198,8 @@ discard block |
||
| 198 | 198 | |
| 199 | 199 | // cleanup some of the element definitions |
| 200 | 200 | foreach ($this->info as $k => $v) { |
| 201 | - unset($this->info[$k]->content_model); |
|
| 202 | - unset($this->info[$k]->content_model_type); |
|
| 201 | + unset($this->info[ $k ]->content_model); |
|
| 202 | + unset($this->info[ $k ]->content_model_type); |
|
| 203 | 203 | } |
| 204 | 204 | } |
| 205 | 205 | |
@@ -223,30 +223,30 @@ discard block |
||
| 223 | 223 | foreach ($this->manager->modules as $module) { |
| 224 | 224 | foreach ($module->info_tag_transform as $k => $v) { |
| 225 | 225 | if ($v === false) { |
| 226 | - unset($this->info_tag_transform[$k]); |
|
| 226 | + unset($this->info_tag_transform[ $k ]); |
|
| 227 | 227 | } else { |
| 228 | - $this->info_tag_transform[$k] = $v; |
|
| 228 | + $this->info_tag_transform[ $k ] = $v; |
|
| 229 | 229 | } |
| 230 | 230 | } |
| 231 | 231 | foreach ($module->info_attr_transform_pre as $k => $v) { |
| 232 | 232 | if ($v === false) { |
| 233 | - unset($this->info_attr_transform_pre[$k]); |
|
| 233 | + unset($this->info_attr_transform_pre[ $k ]); |
|
| 234 | 234 | } else { |
| 235 | - $this->info_attr_transform_pre[$k] = $v; |
|
| 235 | + $this->info_attr_transform_pre[ $k ] = $v; |
|
| 236 | 236 | } |
| 237 | 237 | } |
| 238 | 238 | foreach ($module->info_attr_transform_post as $k => $v) { |
| 239 | 239 | if ($v === false) { |
| 240 | - unset($this->info_attr_transform_post[$k]); |
|
| 240 | + unset($this->info_attr_transform_post[ $k ]); |
|
| 241 | 241 | } else { |
| 242 | - $this->info_attr_transform_post[$k] = $v; |
|
| 242 | + $this->info_attr_transform_post[ $k ] = $v; |
|
| 243 | 243 | } |
| 244 | 244 | } |
| 245 | 245 | foreach ($module->info_injector as $k => $v) { |
| 246 | 246 | if ($v === false) { |
| 247 | - unset($this->info_injector[$k]); |
|
| 247 | + unset($this->info_injector[ $k ]); |
|
| 248 | 248 | } else { |
| 249 | - $this->info_injector[$k] = $v; |
|
| 249 | + $this->info_injector[ $k ] = $v; |
|
| 250 | 250 | } |
| 251 | 251 | } |
| 252 | 252 | } |
@@ -261,7 +261,7 @@ discard block |
||
| 261 | 261 | protected function setupConfigStuff($config) |
| 262 | 262 | { |
| 263 | 263 | $block_wrapper = $config->get('HTML.BlockWrapper'); |
| 264 | - if (isset($this->info_content_sets['Block'][$block_wrapper])) { |
|
| 264 | + if (isset($this->info_content_sets[ 'Block' ][ $block_wrapper ])) { |
|
| 265 | 265 | $this->info_block_wrapper = $block_wrapper; |
| 266 | 266 | } else { |
| 267 | 267 | trigger_error( |
@@ -300,10 +300,10 @@ discard block |
||
| 300 | 300 | |
| 301 | 301 | if (is_array($allowed_elements)) { |
| 302 | 302 | foreach ($this->info as $name => $d) { |
| 303 | - if (!isset($allowed_elements[$name])) { |
|
| 304 | - unset($this->info[$name]); |
|
| 303 | + if (!isset($allowed_elements[ $name ])) { |
|
| 304 | + unset($this->info[ $name ]); |
|
| 305 | 305 | } |
| 306 | - unset($allowed_elements[$name]); |
|
| 306 | + unset($allowed_elements[ $name ]); |
|
| 307 | 307 | } |
| 308 | 308 | // emit errors |
| 309 | 309 | foreach ($allowed_elements as $element => $d) { |
@@ -323,15 +323,15 @@ discard block |
||
| 323 | 323 | $keys = array($attr, "*@$attr", "*.$attr"); |
| 324 | 324 | $delete = true; |
| 325 | 325 | foreach ($keys as $key) { |
| 326 | - if ($delete && isset($allowed_attributes[$key])) { |
|
| 326 | + if ($delete && isset($allowed_attributes[ $key ])) { |
|
| 327 | 327 | $delete = false; |
| 328 | 328 | } |
| 329 | - if (isset($allowed_attributes_mutable[$key])) { |
|
| 330 | - unset($allowed_attributes_mutable[$key]); |
|
| 329 | + if (isset($allowed_attributes_mutable[ $key ])) { |
|
| 330 | + unset($allowed_attributes_mutable[ $key ]); |
|
| 331 | 331 | } |
| 332 | 332 | } |
| 333 | 333 | if ($delete) { |
| 334 | - unset($this->info_global_attr[$attr]); |
|
| 334 | + unset($this->info_global_attr[ $attr ]); |
|
| 335 | 335 | } |
| 336 | 336 | } |
| 337 | 337 | |
@@ -340,22 +340,22 @@ discard block |
||
| 340 | 340 | $keys = array("$tag@$attr", $attr, "*@$attr", "$tag.$attr", "*.$attr"); |
| 341 | 341 | $delete = true; |
| 342 | 342 | foreach ($keys as $key) { |
| 343 | - if ($delete && isset($allowed_attributes[$key])) { |
|
| 343 | + if ($delete && isset($allowed_attributes[ $key ])) { |
|
| 344 | 344 | $delete = false; |
| 345 | 345 | } |
| 346 | - if (isset($allowed_attributes_mutable[$key])) { |
|
| 347 | - unset($allowed_attributes_mutable[$key]); |
|
| 346 | + if (isset($allowed_attributes_mutable[ $key ])) { |
|
| 347 | + unset($allowed_attributes_mutable[ $key ]); |
|
| 348 | 348 | } |
| 349 | 349 | } |
| 350 | 350 | if ($delete) { |
| 351 | - if ($this->info[$tag]->attr[$attr]->required) { |
|
| 351 | + if ($this->info[ $tag ]->attr[ $attr ]->required) { |
|
| 352 | 352 | trigger_error( |
| 353 | - "Required attribute '$attr' in element '$tag' " . |
|
| 353 | + "Required attribute '$attr' in element '$tag' ". |
|
| 354 | 354 | "was not allowed, which means '$tag' will not be allowed either", |
| 355 | 355 | E_USER_WARNING |
| 356 | 356 | ); |
| 357 | 357 | } |
| 358 | - unset($this->info[$tag]->attr[$attr]); |
|
| 358 | + unset($this->info[ $tag ]->attr[ $attr ]); |
|
| 359 | 359 | } |
| 360 | 360 | } |
| 361 | 361 | } |
@@ -365,12 +365,12 @@ discard block |
||
| 365 | 365 | $c = count($bits); |
| 366 | 366 | switch ($c) { |
| 367 | 367 | case 2: |
| 368 | - if ($bits[0] !== '*') { |
|
| 369 | - $element = htmlspecialchars($bits[0]); |
|
| 370 | - $attribute = htmlspecialchars($bits[1]); |
|
| 371 | - if (!isset($this->info[$element])) { |
|
| 368 | + if ($bits[ 0 ] !== '*') { |
|
| 369 | + $element = htmlspecialchars($bits[ 0 ]); |
|
| 370 | + $attribute = htmlspecialchars($bits[ 1 ]); |
|
| 371 | + if (!isset($this->info[ $element ])) { |
|
| 372 | 372 | trigger_error( |
| 373 | - "Cannot allow attribute '$attribute' if element " . |
|
| 373 | + "Cannot allow attribute '$attribute' if element ". |
|
| 374 | 374 | "'$element' is not allowed/supported $support" |
| 375 | 375 | ); |
| 376 | 376 | } else { |
@@ -383,7 +383,7 @@ discard block |
||
| 383 | 383 | } |
| 384 | 384 | // otherwise fall through |
| 385 | 385 | case 1: |
| 386 | - $attribute = htmlspecialchars($bits[0]); |
|
| 386 | + $attribute = htmlspecialchars($bits[ 0 ]); |
|
| 387 | 387 | trigger_error( |
| 388 | 388 | "Global attribute '$attribute' is not ". |
| 389 | 389 | "supported in any elements $support", |
@@ -400,21 +400,21 @@ discard block |
||
| 400 | 400 | $forbidden_attributes = $config->get('HTML.ForbiddenAttributes'); |
| 401 | 401 | |
| 402 | 402 | foreach ($this->info as $tag => $info) { |
| 403 | - if (isset($forbidden_elements[$tag])) { |
|
| 404 | - unset($this->info[$tag]); |
|
| 403 | + if (isset($forbidden_elements[ $tag ])) { |
|
| 404 | + unset($this->info[ $tag ]); |
|
| 405 | 405 | continue; |
| 406 | 406 | } |
| 407 | 407 | foreach ($info->attr as $attr => $x) { |
| 408 | - if (isset($forbidden_attributes["$tag@$attr"]) || |
|
| 409 | - isset($forbidden_attributes["*@$attr"]) || |
|
| 410 | - isset($forbidden_attributes[$attr]) |
|
| 408 | + if (isset($forbidden_attributes[ "$tag@$attr" ]) || |
|
| 409 | + isset($forbidden_attributes[ "*@$attr" ]) || |
|
| 410 | + isset($forbidden_attributes[ $attr ]) |
|
| 411 | 411 | ) { |
| 412 | - unset($this->info[$tag]->attr[$attr]); |
|
| 412 | + unset($this->info[ $tag ]->attr[ $attr ]); |
|
| 413 | 413 | continue; |
| 414 | - } elseif (isset($forbidden_attributes["$tag.$attr"])) { // this segment might get removed eventually |
|
| 414 | + } elseif (isset($forbidden_attributes[ "$tag.$attr" ])) { // this segment might get removed eventually |
|
| 415 | 415 | // $tag.$attr are not user supplied, so no worries! |
| 416 | 416 | trigger_error( |
| 417 | - "Error with $tag.$attr: tag.attr syntax not supported for " . |
|
| 417 | + "Error with $tag.$attr: tag.attr syntax not supported for ". |
|
| 418 | 418 | "HTML.ForbiddenAttributes; use tag@attr instead", |
| 419 | 419 | E_USER_WARNING |
| 420 | 420 | ); |
@@ -425,10 +425,10 @@ discard block |
||
| 425 | 425 | if (strlen($key) < 2) { |
| 426 | 426 | continue; |
| 427 | 427 | } |
| 428 | - if ($key[0] != '*') { |
|
| 428 | + if ($key[ 0 ] != '*') { |
|
| 429 | 429 | continue; |
| 430 | 430 | } |
| 431 | - if ($key[1] == '.') { |
|
| 431 | + if ($key[ 1 ] == '.') { |
|
| 432 | 432 | trigger_error( |
| 433 | 433 | "Error with $key: *.attr syntax not supported for HTML.ForbiddenAttributes; use attr instead", |
| 434 | 434 | E_USER_WARNING |
@@ -441,7 +441,7 @@ discard block |
||
| 441 | 441 | if ($injector->checkNeeded($config) !== false) { |
| 442 | 442 | // remove injector that does not have it's required |
| 443 | 443 | // elements/attributes present, and is thus not needed. |
| 444 | - unset($this->info_injector[$i]); |
|
| 444 | + unset($this->info_injector[ $i ]); |
|
| 445 | 445 | } |
| 446 | 446 | } |
| 447 | 447 | } |
@@ -475,7 +475,7 @@ discard block |
||
| 475 | 475 | list($element, $attr) = explode('[', $chunk); |
| 476 | 476 | } |
| 477 | 477 | if ($element !== '*') { |
| 478 | - $elements[$element] = true; |
|
| 478 | + $elements[ $element ] = true; |
|
| 479 | 479 | } |
| 480 | 480 | if (!$attr) { |
| 481 | 481 | continue; |
@@ -483,7 +483,7 @@ discard block |
||
| 483 | 483 | $attr = substr($attr, 0, strlen($attr) - 1); // remove trailing ] |
| 484 | 484 | $attr = explode('|', $attr); |
| 485 | 485 | foreach ($attr as $key) { |
| 486 | - $attributes["$element.$key"] = true; |
|
| 486 | + $attributes[ "$element.$key" ] = true; |
|
| 487 | 487 | } |
| 488 | 488 | } |
| 489 | 489 | return array($elements, $attributes); |