@@ -103,7 +103,7 @@ |
||
| 103 | 103 | break; |
| 104 | 104 | } |
| 105 | 105 | // This is safe because we removed the token that triggered this. |
| 106 | - $this->rewindOffset($b+$deleted); |
|
| 106 | + $this->rewindOffset($b + $deleted); |
|
| 107 | 107 | return; |
| 108 | 108 | } |
| 109 | 109 | } |
@@ -87,9 +87,13 @@ |
||
| 87 | 87 | if (isset($this->exclude[$token->name])) { |
| 88 | 88 | $r = true; |
| 89 | 89 | foreach ($this->exclude[$token->name] as $elem) { |
| 90 | - if (!isset($token->attr[$elem])) $r = false; |
|
| 90 | + if (!isset($token->attr[$elem])) { |
|
| 91 | + $r = false; |
|
| 92 | + } |
|
| 93 | + } |
|
| 94 | + if ($r) { |
|
| 95 | + return; |
|
| 91 | 96 | } |
| 92 | - if ($r) return; |
|
| 93 | 97 | } |
| 94 | 98 | if (isset($token->attr['id']) || isset($token->attr['name'])) { |
| 95 | 99 | return; |
@@ -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 | /** |
@@ -319,7 +319,7 @@ discard block |
||
| 319 | 319 | if (isset($def->isAlias)) { |
| 320 | 320 | if ($this->aliasMode) { |
| 321 | 321 | $this->triggerError( |
| 322 | - 'Double-aliases not allowed, please fix '. |
|
| 322 | + 'Double-aliases not allowed, please fix ' . |
|
| 323 | 323 | 'ConfigSchema bug with' . $key, |
| 324 | 324 | E_USER_ERROR |
| 325 | 325 | ); |
@@ -535,8 +535,7 @@ discard block |
||
| 535 | 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 | 540 | "Cannot retrieve raw definition after it has already been setup" . |
| 542 | 541 | $extra |
@@ -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 | } |
@@ -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 | |
@@ -225,7 +225,7 @@ discard block |
||
| 225 | 225 | // two loop iterations |
| 226 | 226 | for ($i = 0, $c = count($basic_selectors); $i < $c; $i++) { |
| 227 | 227 | $x = $basic_selectors[$i]; |
| 228 | - if ($i % 2) { |
|
| 228 | + if ($i%2) { |
|
| 229 | 229 | // delimiter |
| 230 | 230 | if ($x === ' ') { |
| 231 | 231 | $delim = ' '; |
@@ -249,7 +249,7 @@ discard block |
||
| 249 | 249 | // in which case we ignore the |
| 250 | 250 | // outer $delim |
| 251 | 251 | } |
| 252 | - } elseif ($j % 2) { |
|
| 252 | + } elseif ($j%2) { |
|
| 253 | 253 | // set delimiter |
| 254 | 254 | $sdelim = $y; |
| 255 | 255 | } else { |
@@ -53,7 +53,7 @@ |
||
| 53 | 53 | |
| 54 | 54 | // number is really a positive integer (one or more digits) |
| 55 | 55 | // FIXME: ^^ not always, see start and value of list items |
| 56 | - $this->info['Number'] = new HTMLPurifier_AttrDef_Integer(false, false, true); |
|
| 56 | + $this->info['Number'] = new HTMLPurifier_AttrDef_Integer(false, false, true); |
|
| 57 | 57 | } |
| 58 | 58 | |
| 59 | 59 | private static function makeEnum($in) |
@@ -30,12 +30,12 @@ discard block |
||
| 30 | 30 | // Regexp is as per Appendix B. |
| 31 | 31 | // Note that ["<>] are an addition to the RFC's recommended |
| 32 | 32 | // characters, because they represent external delimeters. |
| 33 | - $r_URI = '!'. |
|
| 34 | - '(([a-zA-Z0-9\.\+\-]+):)?'. // 2. Scheme |
|
| 35 | - '(//([^/?#"<>]*))?'. // 4. Authority |
|
| 36 | - '([^?#"<>]*)'. // 5. Path |
|
| 37 | - '(\?([^#"<>]*))?'. // 7. Query |
|
| 38 | - '(#([^"<>]*))?'. // 8. Fragment |
|
| 33 | + $r_URI = '!' . |
|
| 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(); |
@@ -57,7 +57,7 @@ discard block |
||
| 57 | 57 | preg_match($r_authority, $authority, $matches); |
| 58 | 58 | $userinfo = !empty($matches[1]) ? $matches[2] : null; |
| 59 | 59 | $host = !empty($matches[3]) ? $matches[3] : ''; |
| 60 | - $port = !empty($matches[4]) ? (int) $matches[5] : null; |
|
| 60 | + $port = !empty($matches[4]) ? (int)$matches[5] : null; |
|
| 61 | 61 | } else { |
| 62 | 62 | $port = $host = $userinfo = null; |
| 63 | 63 | } |
@@ -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; |
@@ -164,9 +164,9 @@ |
||
| 164 | 164 | public function postProcess() |
| 165 | 165 | { |
| 166 | 166 | foreach ($this->info as $key => $v) { |
| 167 | - if (count((array) $v) == 1) { |
|
| 167 | + if (count((array)$v) == 1) { |
|
| 168 | 168 | $this->info[$key] = $v->type; |
| 169 | - } elseif (count((array) $v) == 2 && isset($v->allow_null)) { |
|
| 169 | + } elseif (count((array)$v) == 2 && isset($v->allow_null)) { |
|
| 170 | 170 | $this->info[$key] = -$v->type; |
| 171 | 171 | } |
| 172 | 172 | } |
@@ -385,7 +385,7 @@ |
||
| 385 | 385 | case 1: |
| 386 | 386 | $attribute = htmlspecialchars($bits[0]); |
| 387 | 387 | trigger_error( |
| 388 | - "Global attribute '$attribute' is not ". |
|
| 388 | + "Global attribute '$attribute' is not " . |
|
| 389 | 389 | "supported in any elements $support", |
| 390 | 390 | E_USER_WARNING |
| 391 | 391 | ); |
@@ -56,10 +56,10 @@ discard block |
||
| 56 | 56 | */ |
| 57 | 57 | public function __construct($context) |
| 58 | 58 | { |
| 59 | - $this->locale =& $context->get('Locale'); |
|
| 59 | + $this->locale = & $context->get('Locale'); |
|
| 60 | 60 | $this->context = $context; |
| 61 | - $this->_current =& $this->_stacks[0]; |
|
| 62 | - $this->errors =& $this->_stacks[0]; |
|
| 61 | + $this->_current = & $this->_stacks[0]; |
|
| 62 | + $this->errors = & $this->_stacks[0]; |
|
| 63 | 63 | } |
| 64 | 64 | |
| 65 | 65 | /** |
@@ -78,7 +78,7 @@ discard block |
||
| 78 | 78 | |
| 79 | 79 | $token = $this->context->get('CurrentToken', true); |
| 80 | 80 | $line = $token ? $token->line : $this->context->get('CurrentLine', true); |
| 81 | - $col = $token ? $token->col : $this->context->get('CurrentCol', true); |
|
| 81 | + $col = $token ? $token->col : $this->context->get('CurrentCol', true); |
|
| 82 | 82 | $attr = $this->context->get('CurrentAttr', true); |
| 83 | 83 | |
| 84 | 84 | // perform special substitutions, also add custom parameters |
@@ -42,7 +42,10 @@ discard block |
||
| 42 | 42 | public function addFilter($filter, $config) |
| 43 | 43 | { |
| 44 | 44 | $r = $filter->prepare($config); |
| 45 | - if ($r === false) return; // null is ok, for backwards compat |
|
| 45 | + if ($r === false) { |
|
| 46 | + return; |
|
| 47 | + } |
|
| 48 | + // null is ok, for backwards compat |
|
| 46 | 49 | if ($filter->post) { |
| 47 | 50 | $this->postFilters[$filter->name] = $filter; |
| 48 | 51 | } else { |
@@ -79,9 +82,13 @@ discard block |
||
| 79 | 82 | $parser = new HTMLPurifier_URIParser(); |
| 80 | 83 | $this->base = $parser->parse($base_uri); |
| 81 | 84 | $this->defaultScheme = $this->base->scheme; |
| 82 | - if (is_null($this->host)) $this->host = $this->base->host; |
|
| 85 | + if (is_null($this->host)) { |
|
| 86 | + $this->host = $this->base->host; |
|
| 87 | + } |
|
| 88 | + } |
|
| 89 | + if (is_null($this->defaultScheme)) { |
|
| 90 | + $this->defaultScheme = $config->get('URI.DefaultScheme'); |
|
| 83 | 91 | } |
| 84 | - if (is_null($this->defaultScheme)) $this->defaultScheme = $config->get('URI.DefaultScheme'); |
|
| 85 | 92 | } |
| 86 | 93 | |
| 87 | 94 | public function getDefaultScheme($config, $context) |
@@ -93,7 +100,9 @@ discard block |
||
| 93 | 100 | { |
| 94 | 101 | foreach ($this->filters as $name => $f) { |
| 95 | 102 | $result = $f->filter($uri, $config, $context); |
| 96 | - if (!$result) return false; |
|
| 103 | + if (!$result) { |
|
| 104 | + return false; |
|
| 105 | + } |
|
| 97 | 106 | } |
| 98 | 107 | return true; |
| 99 | 108 | } |
@@ -102,7 +111,9 @@ discard block |
||
| 102 | 111 | { |
| 103 | 112 | foreach ($this->postFilters as $name => $f) { |
| 104 | 113 | $result = $f->filter($uri, $config, $context); |
| 105 | - if (!$result) return false; |
|
| 114 | + if (!$result) { |
|
| 115 | + return false; |
|
| 116 | + } |
|
| 106 | 117 | } |
| 107 | 118 | return true; |
| 108 | 119 | } |