@@ -34,7 +34,7 @@ |
||
34 | 34 | * @param string $string |
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($string, $config, $context) |
40 | 40 | { |
@@ -81,7 +81,7 @@ discard block |
||
81 | 81 | $context |
82 | 82 | ); |
83 | 83 | if ($r !== false) { |
84 | - $final .= $r . ' '; |
|
84 | + $final .= $r.' '; |
|
85 | 85 | $caught[$validator_name] = true; |
86 | 86 | break; |
87 | 87 | } |
@@ -145,7 +145,7 @@ discard block |
||
145 | 145 | $context |
146 | 146 | ); |
147 | 147 | if ($r !== false) { |
148 | - $final .= '/' . $r; |
|
148 | + $final .= '/'.$r; |
|
149 | 149 | } |
150 | 150 | } |
151 | 151 | $final .= ' '; |
@@ -162,7 +162,7 @@ discard block |
||
162 | 162 | $context |
163 | 163 | ); |
164 | 164 | if ($r !== false) { |
165 | - $final .= $r . ' '; |
|
165 | + $final .= $r.' '; |
|
166 | 166 | // processing completed successfully |
167 | 167 | return rtrim($final); |
168 | 168 | } |
@@ -30,7 +30,7 @@ |
||
30 | 30 | * @param string $string |
31 | 31 | * @param HTMLPurifier_Config $config |
32 | 32 | * @param HTMLPurifier_Context $context |
33 | - * @return bool|string |
|
33 | + * @return false|string |
|
34 | 34 | */ |
35 | 35 | public function validate($string, $config, $context) |
36 | 36 | { |
@@ -24,7 +24,7 @@ |
||
24 | 24 | * @param string $number |
25 | 25 | * @param HTMLPurifier_Config $config |
26 | 26 | * @param HTMLPurifier_Context $context |
27 | - * @return string|bool |
|
27 | + * @return false|string |
|
28 | 28 | * @warning Some contexts do not pass $config, $context. These |
29 | 29 | * variables should not be used without checking HTMLPurifier_Length |
30 | 30 | */ |
@@ -52,7 +52,7 @@ discard block |
||
52 | 52 | |
53 | 53 | if (ctype_digit($number)) { |
54 | 54 | $number = ltrim($number, '0'); |
55 | - return $number ? $sign . $number : '0'; |
|
55 | + return $number ? $sign.$number : '0'; |
|
56 | 56 | } |
57 | 57 | |
58 | 58 | // Period is the only non-numeric character allowed |
@@ -73,11 +73,11 @@ discard block |
||
73 | 73 | $right = rtrim($right, '0'); |
74 | 74 | |
75 | 75 | if ($right === '') { |
76 | - return $left ? $sign . $left : '0'; |
|
76 | + return $left ? $sign.$left : '0'; |
|
77 | 77 | } elseif (!ctype_digit($right)) { |
78 | 78 | return false; |
79 | 79 | } |
80 | - return $sign . $left . '.' . $right; |
|
80 | + return $sign.$left.'.'.$right; |
|
81 | 81 | } |
82 | 82 | } |
83 | 83 |
@@ -28,7 +28,7 @@ |
||
28 | 28 | * @param string $string |
29 | 29 | * @param HTMLPurifier_Config $config |
30 | 30 | * @param HTMLPurifier_Context $context |
31 | - * @return bool|string |
|
31 | + * @return boolean |
|
32 | 32 | */ |
33 | 33 | public function validate($string, $config, $context) |
34 | 34 | { |
@@ -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,18 +53,18 @@ |
||
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'); |
|
67 | + $id_accumulator = & $context->get('IDAccumulator'); |
|
68 | 68 | if (isset($id_accumulator->ids[$id])) { |
69 | 69 | return false; |
70 | 70 | } |
@@ -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,8 +45,8 @@ |
||
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 | 52 | return $matches[1]; |
@@ -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,12 +24,12 @@ 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)) { |
|
32 | + if (preg_match('#'.$pre.'$#s', $aIP, $find)) { |
|
33 | 33 | $aIP = substr($aIP, 0, 0 - strlen($find[0])); |
34 | 34 | unset($find); |
35 | 35 | } else { |
@@ -38,11 +38,11 @@ discard block |
||
38 | 38 | } |
39 | 39 | |
40 | 40 | // IPv4-compatiblity check |
41 | - if (preg_match('#(?<=:' . ')' . $this->ip4 . '$#s', $aIP, $find)) { |
|
41 | + if (preg_match('#(?<=:'.')'.$this->ip4.'$#s', $aIP, $find)) { |
|
42 | 42 | $aIP = substr($aIP, 0, 0 - strlen($find[0])); |
43 | 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 |
@@ -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 | { |
@@ -86,16 +86,16 @@ |
||
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 |