@@ -30,7 +30,7 @@ discard block |
||
30 | 30 | ); |
31 | 31 | return; |
32 | 32 | } |
33 | - $this->_storage[$name] =& $ref; |
|
33 | + $this->_storage[ $name ] = & $ref; |
|
34 | 34 | } |
35 | 35 | |
36 | 36 | /** |
@@ -51,7 +51,7 @@ discard block |
||
51 | 51 | $var = null; // so we can return by reference |
52 | 52 | return $var; |
53 | 53 | } |
54 | - return $this->_storage[$name]; |
|
54 | + return $this->_storage[ $name ]; |
|
55 | 55 | } |
56 | 56 | |
57 | 57 | /** |
@@ -67,7 +67,7 @@ discard block |
||
67 | 67 | ); |
68 | 68 | return; |
69 | 69 | } |
70 | - unset($this->_storage[$name]); |
|
70 | + unset($this->_storage[ $name ]); |
|
71 | 71 | } |
72 | 72 | |
73 | 73 | /** |
@@ -87,7 +87,7 @@ discard block |
||
87 | 87 | public function loadArray($context_array) |
88 | 88 | { |
89 | 89 | foreach ($context_array as $key => $discard) { |
90 | - $this->register($key, $context_array[$key]); |
|
90 | + $this->register($key, $context_array[ $key ]); |
|
91 | 91 | } |
92 | 92 | } |
93 | 93 | } |
@@ -36,7 +36,7 @@ discard block |
||
36 | 36 | |
37 | 37 | public function registerFilter($filter) |
38 | 38 | { |
39 | - $this->registeredFilters[$filter->name] = $filter; |
|
39 | + $this->registeredFilters[ $filter->name ] = $filter; |
|
40 | 40 | } |
41 | 41 | |
42 | 42 | public function addFilter($filter, $config) |
@@ -44,9 +44,9 @@ discard block |
||
44 | 44 | $r = $filter->prepare($config); |
45 | 45 | if ($r === false) return; // null is ok, for backwards compat |
46 | 46 | if ($filter->post) { |
47 | - $this->postFilters[$filter->name] = $filter; |
|
47 | + $this->postFilters[ $filter->name ] = $filter; |
|
48 | 48 | } else { |
49 | - $this->filters[$filter->name] = $filter; |
|
49 | + $this->filters[ $filter->name ] = $filter; |
|
50 | 50 | } |
51 | 51 | } |
52 | 52 | |
@@ -62,7 +62,7 @@ discard block |
||
62 | 62 | if ($filter->always_load) { |
63 | 63 | $this->addFilter($filter, $config); |
64 | 64 | } else { |
65 | - $conf = $config->get('URI.' . $name); |
|
65 | + $conf = $config->get('URI.'.$name); |
|
66 | 66 | if ($conf !== false && $conf !== null) { |
67 | 67 | $this->addFilter($filter, $config); |
68 | 68 | } |
@@ -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 | } |
@@ -2,7 +2,7 @@ discard block |
||
2 | 2 | |
3 | 3 | // constants are slow, so we use as few as possible |
4 | 4 | if (!defined('HTMLPURIFIER_PREFIX')) { |
5 | - define('HTMLPURIFIER_PREFIX', realpath(dirname(__FILE__) . '/..')); |
|
5 | + define('HTMLPURIFIER_PREFIX', realpath(dirname(__FILE__).'/..')); |
|
6 | 6 | } |
7 | 7 | |
8 | 8 | // accomodations for versions earlier than 5.0.2 |
@@ -46,7 +46,7 @@ discard block |
||
46 | 46 | // Zend extensions such as Zend debugger and APC, this invariant |
47 | 47 | // may be broken. Since we have efficient alternatives, pay |
48 | 48 | // the cost here and avoid the bug. |
49 | - require_once HTMLPURIFIER_PREFIX . '/' . $file; |
|
49 | + require_once HTMLPURIFIER_PREFIX.'/'.$file; |
|
50 | 50 | return true; |
51 | 51 | } |
52 | 52 | |
@@ -63,11 +63,11 @@ discard block |
||
63 | 63 | // Custom implementations |
64 | 64 | if (strncmp('HTMLPurifier_Language_', $class, 22) === 0) { |
65 | 65 | $code = str_replace('_', '-', substr($class, 22)); |
66 | - $file = 'HTMLPurifier/Language/classes/' . $code . '.php'; |
|
66 | + $file = 'HTMLPurifier/Language/classes/'.$code.'.php'; |
|
67 | 67 | } else { |
68 | - $file = str_replace('_', '/', $class) . '.php'; |
|
68 | + $file = str_replace('_', '/', $class).'.php'; |
|
69 | 69 | } |
70 | - if (!file_exists(HTMLPURIFIER_PREFIX . '/' . $file)) { |
|
70 | + if (!file_exists(HTMLPURIFIER_PREFIX.'/'.$file)) { |
|
71 | 71 | return false; |
72 | 72 | } |
73 | 73 | return $file; |
@@ -93,7 +93,7 @@ discard block |
||
93 | 93 | if ($buggy && is_array($func)) { |
94 | 94 | // :TRICKY: There are some compatibility issues and some |
95 | 95 | // places where we need to error out |
96 | - $reflector = new ReflectionMethod($func[0], $func[1]); |
|
96 | + $reflector = new ReflectionMethod($func[ 0 ], $func[ 1 ]); |
|
97 | 97 | if (!$reflector->isStatic()) { |
98 | 98 | throw new Exception( |
99 | 99 | 'HTML Purifier autoloader registrar is not compatible |
@@ -52,7 +52,7 @@ discard block |
||
52 | 52 | */ |
53 | 53 | public function register($short, $long) |
54 | 54 | { |
55 | - $this->implementations[$short] = $long; |
|
55 | + $this->implementations[ $short ] = $long; |
|
56 | 56 | } |
57 | 57 | |
58 | 58 | /** |
@@ -67,11 +67,11 @@ discard block |
||
67 | 67 | if ($method === null) { |
68 | 68 | return new HTMLPurifier_DefinitionCache_Null($type); |
69 | 69 | } |
70 | - if (!empty($this->caches[$method][$type])) { |
|
71 | - return $this->caches[$method][$type]; |
|
70 | + if (!empty($this->caches[ $method ][ $type ])) { |
|
71 | + return $this->caches[ $method ][ $type ]; |
|
72 | 72 | } |
73 | - if (isset($this->implementations[$method]) && |
|
74 | - class_exists($class = $this->implementations[$method], false)) { |
|
73 | + if (isset($this->implementations[ $method ]) && |
|
74 | + class_exists($class = $this->implementations[ $method ], false)) { |
|
75 | 75 | $cache = new $class($type); |
76 | 76 | } else { |
77 | 77 | if ($method != 'Serializer') { |
@@ -85,8 +85,8 @@ discard block |
||
85 | 85 | unset($cache); |
86 | 86 | $cache = $new_cache; |
87 | 87 | } |
88 | - $this->caches[$method][$type] = $cache; |
|
89 | - return $this->caches[$method][$type]; |
|
88 | + $this->caches[ $method ][ $type ] = $cache; |
|
89 | + return $this->caches[ $method ][ $type ]; |
|
90 | 90 | } |
91 | 91 | |
92 | 92 | /** |
@@ -99,7 +99,7 @@ discard block |
||
99 | 99 | $class = "HTMLPurifier_DefinitionCache_Decorator_$decorator"; |
100 | 100 | $decorator = new $class; |
101 | 101 | } |
102 | - $this->decorators[$decorator->name] = $decorator; |
|
102 | + $this->decorators[ $decorator->name ] = $decorator; |
|
103 | 103 | } |
104 | 104 | } |
105 | 105 |
@@ -94,10 +94,10 @@ discard block |
||
94 | 94 | |
95 | 95 | $state = $dest_state = false; |
96 | 96 | foreach (self::$units as $k => $x) { |
97 | - if (isset($x[$unit])) { |
|
97 | + if (isset($x[ $unit ])) { |
|
98 | 98 | $state = $k; |
99 | 99 | } |
100 | - if (isset($x[$to_unit])) { |
|
100 | + if (isset($x[ $to_unit ])) { |
|
101 | 101 | $dest_state = $k; |
102 | 102 | } |
103 | 103 | } |
@@ -116,7 +116,7 @@ discard block |
||
116 | 116 | // our default if the initial number has no decimals, or increase |
117 | 117 | // it by how ever many decimals, thus, the number of guard digits |
118 | 118 | // will always be greater than or equal to internalPrecision. |
119 | - $log = (int)floor(log(abs($n), 10)); |
|
119 | + $log = (int) floor(log(abs($n), 10)); |
|
120 | 120 | $cp = ($log < 0) ? $this->internalPrecision - $log : $this->internalPrecision; // internal precision |
121 | 121 | |
122 | 122 | for ($i = 0; $i < 2; $i++) { |
@@ -127,12 +127,12 @@ discard block |
||
127 | 127 | $dest_unit = $to_unit; |
128 | 128 | } else { |
129 | 129 | // Convert to the smallest unit, pending a system shift |
130 | - $dest_unit = self::$units[$state][$dest_state][0]; |
|
130 | + $dest_unit = self::$units[ $state ][ $dest_state ][ 0 ]; |
|
131 | 131 | } |
132 | 132 | |
133 | 133 | // Do the conversion if necessary |
134 | 134 | if ($dest_unit !== $unit) { |
135 | - $factor = $this->div(self::$units[$state][$unit], self::$units[$state][$dest_unit], $cp); |
|
135 | + $factor = $this->div(self::$units[ $state ][ $unit ], self::$units[ $state ][ $dest_unit ], $cp); |
|
136 | 136 | $n = $this->mul($n, $factor, $cp); |
137 | 137 | $unit = $dest_unit; |
138 | 138 | } |
@@ -158,8 +158,8 @@ discard block |
||
158 | 158 | // Pre-condition: $i == 0 |
159 | 159 | |
160 | 160 | // Perform conversion to next system of units |
161 | - $n = $this->mul($n, self::$units[$state][$dest_state][1], $cp); |
|
162 | - $unit = self::$units[$state][$dest_state][2]; |
|
161 | + $n = $this->mul($n, self::$units[ $state ][ $dest_state ][ 1 ], $cp); |
|
162 | + $unit = self::$units[ $state ][ $dest_state ][ 2 ]; |
|
163 | 163 | $state = $dest_state; |
164 | 164 | |
165 | 165 | // One more loop around to convert the unit in the new system. |
@@ -216,7 +216,7 @@ discard block |
||
216 | 216 | if ($this->bcmath) { |
217 | 217 | return bcadd($s1, $s2, $scale); |
218 | 218 | } else { |
219 | - return $this->scale((float)$s1 + (float)$s2, $scale); |
|
219 | + return $this->scale((float) $s1 + (float) $s2, $scale); |
|
220 | 220 | } |
221 | 221 | } |
222 | 222 | |
@@ -232,7 +232,7 @@ discard block |
||
232 | 232 | if ($this->bcmath) { |
233 | 233 | return bcmul($s1, $s2, $scale); |
234 | 234 | } else { |
235 | - return $this->scale((float)$s1 * (float)$s2, $scale); |
|
235 | + return $this->scale((float) $s1 * (float) $s2, $scale); |
|
236 | 236 | } |
237 | 237 | } |
238 | 238 | |
@@ -248,7 +248,7 @@ discard block |
||
248 | 248 | if ($this->bcmath) { |
249 | 249 | return bcdiv($s1, $s2, $scale); |
250 | 250 | } else { |
251 | - return $this->scale((float)$s1 / (float)$s2, $scale); |
|
251 | + return $this->scale((float) $s1 / (float) $s2, $scale); |
|
252 | 252 | } |
253 | 253 | } |
254 | 254 | |
@@ -261,18 +261,18 @@ discard block |
||
261 | 261 | */ |
262 | 262 | private function round($n, $sigfigs) |
263 | 263 | { |
264 | - $new_log = (int)floor(log(abs($n), 10)); // Number of digits left of decimal - 1 |
|
264 | + $new_log = (int) floor(log(abs($n), 10)); // Number of digits left of decimal - 1 |
|
265 | 265 | $rp = $sigfigs - $new_log - 1; // Number of decimal places needed |
266 | 266 | $neg = $n < 0 ? '-' : ''; // Negative sign |
267 | 267 | if ($this->bcmath) { |
268 | 268 | if ($rp >= 0) { |
269 | - $n = bcadd($n, $neg . '0.' . str_repeat('0', $rp) . '5', $rp + 1); |
|
269 | + $n = bcadd($n, $neg.'0.'.str_repeat('0', $rp).'5', $rp + 1); |
|
270 | 270 | $n = bcdiv($n, '1', $rp); |
271 | 271 | } else { |
272 | 272 | // This algorithm partially depends on the standardized |
273 | 273 | // form of numbers that comes out of bcmath. |
274 | - $n = bcadd($n, $neg . '5' . str_repeat('0', $new_log - $sigfigs), 0); |
|
275 | - $n = substr($n, 0, $sigfigs + strlen($neg)) . str_repeat('0', $new_log - $sigfigs + 1); |
|
274 | + $n = bcadd($n, $neg.'5'.str_repeat('0', $new_log - $sigfigs), 0); |
|
275 | + $n = substr($n, 0, $sigfigs + strlen($neg)).str_repeat('0', $new_log - $sigfigs + 1); |
|
276 | 276 | } |
277 | 277 | return $n; |
278 | 278 | } else { |
@@ -291,16 +291,16 @@ discard block |
||
291 | 291 | if ($scale < 0) { |
292 | 292 | // The f sprintf type doesn't support negative numbers, so we |
293 | 293 | // need to cludge things manually. First get the string. |
294 | - $r = sprintf('%.0f', (float)$r); |
|
294 | + $r = sprintf('%.0f', (float) $r); |
|
295 | 295 | // Due to floating point precision loss, $r will more than likely |
296 | 296 | // look something like 4652999999999.9234. We grab one more digit |
297 | 297 | // than we need to precise from $r and then use that to round |
298 | 298 | // appropriately. |
299 | - $precise = (string)round(substr($r, 0, strlen($r) + $scale), -1); |
|
299 | + $precise = (string) round(substr($r, 0, strlen($r) + $scale), -1); |
|
300 | 300 | // Now we return it, truncating the zero that was rounded off. |
301 | - return substr($precise, 0, -1) . str_repeat('0', -$scale + 1); |
|
301 | + return substr($precise, 0, -1).str_repeat('0', -$scale + 1); |
|
302 | 302 | } |
303 | - return sprintf('%.' . $scale . 'f', (float)$r); |
|
303 | + return sprintf('%.'.$scale.'f', (float) $r); |
|
304 | 304 | } |
305 | 305 | } |
306 | 306 |
@@ -60,7 +60,7 @@ discard block |
||
60 | 60 | $this->scheme = is_null($scheme) || ctype_lower($scheme) ? $scheme : strtolower($scheme); |
61 | 61 | $this->userinfo = $userinfo; |
62 | 62 | $this->host = $host; |
63 | - $this->port = is_null($port) ? $port : (int)$port; |
|
63 | + $this->port = is_null($port) ? $port : (int) $port; |
|
64 | 64 | $this->path = $path; |
65 | 65 | $this->query = $query; |
66 | 66 | $this->fragment = $fragment; |
@@ -87,7 +87,7 @@ discard block |
||
87 | 87 | if (!$scheme_obj) { |
88 | 88 | // something funky happened to the default scheme object |
89 | 89 | trigger_error( |
90 | - 'Default scheme object "' . $def->defaultScheme . '" was not readable', |
|
90 | + 'Default scheme object "'.$def->defaultScheme.'" was not readable', |
|
91 | 91 | E_USER_WARNING |
92 | 92 | ); |
93 | 93 | return false; |
@@ -108,7 +108,7 @@ discard block |
||
108 | 108 | // ABNF definitions from RFC 3986 |
109 | 109 | $chars_sub_delims = '!$&\'()*+,;='; |
110 | 110 | $chars_gen_delims = ':/?#[]@'; |
111 | - $chars_pchar = $chars_sub_delims . ':@'; |
|
111 | + $chars_pchar = $chars_sub_delims.':@'; |
|
112 | 112 | |
113 | 113 | // validate host |
114 | 114 | if (!is_null($this->host)) { |
@@ -136,7 +136,7 @@ discard block |
||
136 | 136 | |
137 | 137 | // validate username |
138 | 138 | if (!is_null($this->userinfo)) { |
139 | - $encoder = new HTMLPurifier_PercentEncoder($chars_sub_delims . ':'); |
|
139 | + $encoder = new HTMLPurifier_PercentEncoder($chars_sub_delims.':'); |
|
140 | 140 | $this->userinfo = $encoder->encode($this->userinfo); |
141 | 141 | } |
142 | 142 | |
@@ -148,7 +148,7 @@ discard block |
||
148 | 148 | } |
149 | 149 | |
150 | 150 | // validate path |
151 | - $segments_encoder = new HTMLPurifier_PercentEncoder($chars_pchar . '/'); |
|
151 | + $segments_encoder = new HTMLPurifier_PercentEncoder($chars_pchar.'/'); |
|
152 | 152 | if (!is_null($this->host)) { // this catches $this->host === '' |
153 | 153 | // path-abempty (hier and relative) |
154 | 154 | // http://www.example.com/my/path |
@@ -160,11 +160,11 @@ discard block |
||
160 | 160 | // ///my/path |
161 | 161 | $this->path = $segments_encoder->encode($this->path); |
162 | 162 | } elseif ($this->path !== '') { |
163 | - if ($this->path[0] === '/') { |
|
163 | + if ($this->path[ 0 ] === '/') { |
|
164 | 164 | // path-absolute (hier and relative) |
165 | 165 | // http:/my/path |
166 | 166 | // /my/path |
167 | - if (strlen($this->path) >= 2 && $this->path[1] === '/') { |
|
167 | + if (strlen($this->path) >= 2 && $this->path[ 1 ] === '/') { |
|
168 | 168 | // This could happen if both the host gets stripped |
169 | 169 | // out |
170 | 170 | // http://my/path |
@@ -182,11 +182,11 @@ discard block |
||
182 | 182 | // path-noscheme (relative) |
183 | 183 | // my/path |
184 | 184 | // (once again, not checking nz) |
185 | - $segment_nc_encoder = new HTMLPurifier_PercentEncoder($chars_sub_delims . '@'); |
|
185 | + $segment_nc_encoder = new HTMLPurifier_PercentEncoder($chars_sub_delims.'@'); |
|
186 | 186 | $c = strpos($this->path, '/'); |
187 | 187 | if ($c !== false) { |
188 | 188 | $this->path = |
189 | - $segment_nc_encoder->encode(substr($this->path, 0, $c)) . |
|
189 | + $segment_nc_encoder->encode(substr($this->path, 0, $c)). |
|
190 | 190 | $segments_encoder->encode(substr($this->path, $c)); |
191 | 191 | } else { |
192 | 192 | $this->path = $segment_nc_encoder->encode($this->path); |
@@ -198,7 +198,7 @@ discard block |
||
198 | 198 | } |
199 | 199 | |
200 | 200 | // qf = query and fragment |
201 | - $qf_encoder = new HTMLPurifier_PercentEncoder($chars_pchar . '/?'); |
|
201 | + $qf_encoder = new HTMLPurifier_PercentEncoder($chars_pchar.'/?'); |
|
202 | 202 | |
203 | 203 | if (!is_null($this->query)) { |
204 | 204 | $this->query = $qf_encoder->encode($this->query); |
@@ -224,11 +224,11 @@ discard block |
||
224 | 224 | if (!is_null($this->host)) { |
225 | 225 | $authority = ''; |
226 | 226 | if (!is_null($this->userinfo)) { |
227 | - $authority .= $this->userinfo . '@'; |
|
227 | + $authority .= $this->userinfo.'@'; |
|
228 | 228 | } |
229 | 229 | $authority .= $this->host; |
230 | 230 | if (!is_null($this->port)) { |
231 | - $authority .= ':' . $this->port; |
|
231 | + $authority .= ':'.$this->port; |
|
232 | 232 | } |
233 | 233 | } |
234 | 234 | |
@@ -240,17 +240,17 @@ discard block |
||
240 | 240 | // defer to the schemes to do the right thing. |
241 | 241 | $result = ''; |
242 | 242 | if (!is_null($this->scheme)) { |
243 | - $result .= $this->scheme . ':'; |
|
243 | + $result .= $this->scheme.':'; |
|
244 | 244 | } |
245 | 245 | if (!is_null($authority)) { |
246 | - $result .= '//' . $authority; |
|
246 | + $result .= '//'.$authority; |
|
247 | 247 | } |
248 | 248 | $result .= $this->path; |
249 | 249 | if (!is_null($this->query)) { |
250 | - $result .= '?' . $this->query; |
|
250 | + $result .= '?'.$this->query; |
|
251 | 251 | } |
252 | 252 | if (!is_null($this->fragment)) { |
253 | - $result .= '#' . $this->fragment; |
|
253 | + $result .= '#'.$this->fragment; |
|
254 | 254 | } |
255 | 255 | |
256 | 256 | return $result; |
@@ -31,17 +31,17 @@ discard block |
||
31 | 31 | return $var; |
32 | 32 | case self::INT: |
33 | 33 | if (is_string($var) && ctype_digit($var)) { |
34 | - $var = (int)$var; |
|
34 | + $var = (int) $var; |
|
35 | 35 | } |
36 | 36 | return $var; |
37 | 37 | case self::FLOAT: |
38 | 38 | if ((is_string($var) && is_numeric($var)) || is_int($var)) { |
39 | - $var = (float)$var; |
|
39 | + $var = (float) $var; |
|
40 | 40 | } |
41 | 41 | return $var; |
42 | 42 | case self::BOOL: |
43 | 43 | if (is_int($var) && ($var === 0 || $var === 1)) { |
44 | - $var = (bool)$var; |
|
44 | + $var = (bool) $var; |
|
45 | 45 | } elseif (is_string($var)) { |
46 | 46 | if ($var == 'on' || $var == 'true' || $var == '1') { |
47 | 47 | $var = true; |
@@ -71,17 +71,17 @@ discard block |
||
71 | 71 | } |
72 | 72 | // remove spaces |
73 | 73 | foreach ($var as $i => $j) { |
74 | - $var[$i] = trim($j); |
|
74 | + $var[ $i ] = trim($j); |
|
75 | 75 | } |
76 | 76 | if ($type === self::HASH) { |
77 | 77 | // key:value,key2:value2 |
78 | 78 | $nvar = array(); |
79 | 79 | foreach ($var as $keypair) { |
80 | 80 | $c = explode(':', $keypair, 2); |
81 | - if (!isset($c[1])) { |
|
81 | + if (!isset($c[ 1 ])) { |
|
82 | 82 | continue; |
83 | 83 | } |
84 | - $nvar[trim($c[0])] = trim($c[1]); |
|
84 | + $nvar[ trim($c[ 0 ]) ] = trim($c[ 1 ]); |
|
85 | 85 | } |
86 | 86 | $var = $nvar; |
87 | 87 | } |
@@ -96,7 +96,7 @@ discard block |
||
96 | 96 | } elseif ($type == self::LOOKUP) { |
97 | 97 | $new = array(); |
98 | 98 | foreach ($var as $key) { |
99 | - $new[$key] = true; |
|
99 | + $new[ $key ] = true; |
|
100 | 100 | } |
101 | 101 | return $new; |
102 | 102 | } else { |
@@ -111,12 +111,12 @@ discard block |
||
111 | 111 | foreach ($var as $key => $value) { |
112 | 112 | if ($value !== true) { |
113 | 113 | trigger_error( |
114 | - "Lookup array has non-true value at key '$key'; " . |
|
114 | + "Lookup array has non-true value at key '$key'; ". |
|
115 | 115 | "maybe your input array was not indexed numerically", |
116 | 116 | E_USER_WARNING |
117 | 117 | ); |
118 | 118 | } |
119 | - $var[$key] = true; |
|
119 | + $var[ $key ] = true; |
|
120 | 120 | } |
121 | 121 | } |
122 | 122 | return $var; |
@@ -46,11 +46,11 @@ |
||
46 | 46 | // normalization only necessary when key is not lowercase |
47 | 47 | if (!ctype_lower($key)) { |
48 | 48 | $new_key = strtolower($key); |
49 | - if (!isset($attr[$new_key])) { |
|
50 | - $attr[$new_key] = $attr[$key]; |
|
49 | + if (!isset($attr[ $new_key ])) { |
|
50 | + $attr[ $new_key ] = $attr[ $key ]; |
|
51 | 51 | } |
52 | 52 | if ($new_key !== $key) { |
53 | - unset($attr[$key]); |
|
53 | + unset($attr[ $key ]); |
|
54 | 54 | } |
55 | 55 | } |
56 | 56 | } |
@@ -98,19 +98,19 @@ discard block |
||
98 | 98 | // flexibly parse it |
99 | 99 | $ret = ''; |
100 | 100 | for ($i = 0, $c = strlen($string); $i < $c; $i++) { |
101 | - if ($string[$i] === '\\') { |
|
101 | + if ($string[ $i ] === '\\') { |
|
102 | 102 | $i++; |
103 | 103 | if ($i >= $c) { |
104 | 104 | $ret .= '\\'; |
105 | 105 | break; |
106 | 106 | } |
107 | - if (ctype_xdigit($string[$i])) { |
|
108 | - $code = $string[$i]; |
|
107 | + if (ctype_xdigit($string[ $i ])) { |
|
108 | + $code = $string[ $i ]; |
|
109 | 109 | for ($a = 1, $i++; $i < $c && $a < 6; $i++, $a++) { |
110 | - if (!ctype_xdigit($string[$i])) { |
|
110 | + if (!ctype_xdigit($string[ $i ])) { |
|
111 | 111 | break; |
112 | 112 | } |
113 | - $code .= $string[$i]; |
|
113 | + $code .= $string[ $i ]; |
|
114 | 114 | } |
115 | 115 | // We have to be extremely careful when adding |
116 | 116 | // new characters, to make sure we're not breaking |
@@ -120,16 +120,16 @@ discard block |
||
120 | 120 | continue; |
121 | 121 | } |
122 | 122 | $ret .= $char; |
123 | - if ($i < $c && trim($string[$i]) !== '') { |
|
123 | + if ($i < $c && trim($string[ $i ]) !== '') { |
|
124 | 124 | $i--; |
125 | 125 | } |
126 | 126 | continue; |
127 | 127 | } |
128 | - if ($string[$i] === "\n") { |
|
128 | + if ($string[ $i ] === "\n") { |
|
129 | 129 | continue; |
130 | 130 | } |
131 | 131 | } |
132 | - $ret .= $string[$i]; |
|
132 | + $ret .= $string[ $i ]; |
|
133 | 133 | } |
134 | 134 | return $ret; |
135 | 135 | } |