@@ -85,8 +85,8 @@ discard block |
||
85 | 85 | */ |
86 | 86 | public function isAjax() |
87 | 87 | { |
88 | - return ( ! empty($_SERVER[ 'HTTP_X_REQUESTED_WITH' ]) && |
|
89 | - strtolower($_SERVER[ 'HTTP_X_REQUESTED_WITH' ]) === 'xmlhttprequest'); |
|
88 | + return ( ! empty($_SERVER['HTTP_X_REQUESTED_WITH']) && |
|
89 | + strtolower($_SERVER['HTTP_X_REQUESTED_WITH']) === 'xmlhttprequest'); |
|
90 | 90 | } |
91 | 91 | |
92 | 92 | //-------------------------------------------------------------------- |
@@ -99,12 +99,12 @@ discard block |
||
99 | 99 | */ |
100 | 100 | public function isSecure() |
101 | 101 | { |
102 | - if ( ! empty($_SERVER[ 'HTTPS' ]) && strtolower($_SERVER[ 'HTTPS' ]) !== 'off') { |
|
102 | + if ( ! empty($_SERVER['HTTPS']) && strtolower($_SERVER['HTTPS']) !== 'off') { |
|
103 | 103 | return true; |
104 | - } elseif (isset($_SERVER[ 'HTTP_X_FORWARDED_PROTO' ]) && $_SERVER[ 'HTTP_X_FORWARDED_PROTO' ] === 'https') { |
|
104 | + } elseif (isset($_SERVER['HTTP_X_FORWARDED_PROTO']) && $_SERVER['HTTP_X_FORWARDED_PROTO'] === 'https') { |
|
105 | 105 | return true; |
106 | - } elseif ( ! empty($_SERVER[ 'HTTP_FRONT_END_HTTPS' ]) && strtolower( |
|
107 | - $_SERVER[ 'HTTP_FRONT_END_HTTPS' ] |
|
106 | + } elseif ( ! empty($_SERVER['HTTP_FRONT_END_HTTPS']) && strtolower( |
|
107 | + $_SERVER['HTTP_FRONT_END_HTTPS'] |
|
108 | 108 | ) !== 'off' |
109 | 109 | ) { |
110 | 110 | return true; |
@@ -125,8 +125,8 @@ discard block |
||
125 | 125 | public function getTime($format = null) |
126 | 126 | { |
127 | 127 | return isset($format) |
128 | - ? date($format, $_SERVER[ 'REQUEST_TIME' ]) |
|
129 | - : $_SERVER[ 'REQUEST_TIME' ]; |
|
128 | + ? date($format, $_SERVER['REQUEST_TIME']) |
|
129 | + : $_SERVER['REQUEST_TIME']; |
|
130 | 130 | } |
131 | 131 | |
132 | 132 | //-------------------------------------------------------------------- |
@@ -208,12 +208,12 @@ discard block |
||
208 | 208 | |
209 | 209 | $uri = $this->uri; |
210 | 210 | |
211 | - if (isset($parseTarget[ 'path' ])) { |
|
212 | - $uri = $this->uri->withPath($parseTarget[ 'path' ]); |
|
211 | + if (isset($parseTarget['path'])) { |
|
212 | + $uri = $this->uri->withPath($parseTarget['path']); |
|
213 | 213 | } |
214 | 214 | |
215 | - if (isset($parseTarget[ 'query' ])) { |
|
216 | - $uri = $this->uri->withPath($parseTarget[ 'query' ]); |
|
215 | + if (isset($parseTarget['query'])) { |
|
216 | + $uri = $this->uri->withPath($parseTarget['query']); |
|
217 | 217 | } |
218 | 218 | |
219 | 219 | $this->uri = $uri; |
@@ -25,11 +25,11 @@ discard block |
||
25 | 25 | static $_is_php; |
26 | 26 | $version = (string)$version; |
27 | 27 | |
28 | - if ( ! isset($_is_php[ $version ])) { |
|
29 | - $_is_php[ $version ] = version_compare(PHP_VERSION, $version, '>='); |
|
28 | + if ( ! isset($_is_php[$version])) { |
|
29 | + $_is_php[$version] = version_compare(PHP_VERSION, $version, '>='); |
|
30 | 30 | } |
31 | 31 | |
32 | - return $_is_php[ $version ]; |
|
32 | + return $_is_php[$version]; |
|
33 | 33 | } |
34 | 34 | } |
35 | 35 | |
@@ -131,12 +131,12 @@ discard block |
||
131 | 131 | */ |
132 | 132 | function is_https() |
133 | 133 | { |
134 | - if ( ! empty($_SERVER[ 'HTTPS' ]) && strtolower($_SERVER[ 'HTTPS' ]) !== 'off') { |
|
134 | + if ( ! empty($_SERVER['HTTPS']) && strtolower($_SERVER['HTTPS']) !== 'off') { |
|
135 | 135 | return true; |
136 | - } elseif (isset($_SERVER[ 'HTTP_X_FORWARDED_PROTO' ]) && $_SERVER[ 'HTTP_X_FORWARDED_PROTO' ] === 'https') { |
|
136 | + } elseif (isset($_SERVER['HTTP_X_FORWARDED_PROTO']) && $_SERVER['HTTP_X_FORWARDED_PROTO'] === 'https') { |
|
137 | 137 | return true; |
138 | - } elseif ( ! empty($_SERVER[ 'HTTP_FRONT_END_HTTPS' ]) && strtolower( |
|
139 | - $_SERVER[ 'HTTP_FRONT_END_HTTPS' ] |
|
138 | + } elseif ( ! empty($_SERVER['HTTP_FRONT_END_HTTPS']) && strtolower( |
|
139 | + $_SERVER['HTTP_FRONT_END_HTTPS'] |
|
140 | 140 | ) !== 'off' |
141 | 141 | ) { |
142 | 142 | return true; |
@@ -174,8 +174,8 @@ discard block |
||
174 | 174 | */ |
175 | 175 | function is_ajax() |
176 | 176 | { |
177 | - return ( ! empty($_SERVER[ 'HTTP_X_REQUESTED_WITH' ]) && strtolower( |
|
178 | - $_SERVER[ 'HTTP_X_REQUESTED_WITH' ] |
|
177 | + return ( ! empty($_SERVER['HTTP_X_REQUESTED_WITH']) && strtolower( |
|
178 | + $_SERVER['HTTP_X_REQUESTED_WITH'] |
|
179 | 179 | ) === 'xmlhttprequest'); |
180 | 180 | } |
181 | 181 | } |
@@ -201,11 +201,11 @@ discard block |
||
201 | 201 | // every control character except newline (dec 10), |
202 | 202 | // carriage return (dec 13) and horizontal tab (dec 09) |
203 | 203 | if ($url_encoded) { |
204 | - $non_displayables[] = '/%0[0-8bcef]/'; // url encoded 00-08, 11, 12, 14, 15 |
|
205 | - $non_displayables[] = '/%1[0-9a-f]/'; // url encoded 16-31 |
|
204 | + $non_displayables[] = '/%0[0-8bcef]/'; // url encoded 00-08, 11, 12, 14, 15 |
|
205 | + $non_displayables[] = '/%1[0-9a-f]/'; // url encoded 16-31 |
|
206 | 206 | } |
207 | 207 | |
208 | - $non_displayables[] = '/[\x00-\x08\x0B\x0C\x0E-\x1F\x7F]+/S'; // 00-08, 11, 12, 14-31, 127 |
|
208 | + $non_displayables[] = '/[\x00-\x08\x0B\x0C\x0E-\x1F\x7F]+/S'; // 00-08, 11, 12, 14-31, 127 |
|
209 | 209 | |
210 | 210 | do { |
211 | 211 | $str = preg_replace($non_displayables, '', $str, -1, $count); |
@@ -286,11 +286,11 @@ discard block |
||
286 | 286 | $matches_regex = explode('_', $header_key); |
287 | 287 | if (count($matches_regex) > 0 and strlen($header_key) > 2) { |
288 | 288 | foreach ($matches_regex as $match_key => $match_value) { |
289 | - $matches_regex[ $match_key ] = ucfirst($match_value); |
|
289 | + $matches_regex[$match_key] = ucfirst($match_value); |
|
290 | 290 | } |
291 | 291 | $header_key = implode('-', $matches_regex); |
292 | 292 | } |
293 | - $headers[ $header_key ] = $server_value; |
|
293 | + $headers[$header_key] = $server_value; |
|
294 | 294 | } |
295 | 295 | } |
296 | 296 | |
@@ -310,8 +310,8 @@ discard block |
||
310 | 310 | function path_to_url($path) |
311 | 311 | { |
312 | 312 | $path = str_replace(['/', '\\'], DIRECTORY_SEPARATOR, $path); |
313 | - $root_dir = str_replace(['/', '\\'], DIRECTORY_SEPARATOR, $_SERVER[ 'DOCUMENT_ROOT' ]); |
|
314 | - $base_dir = str_replace(['/', '\\'], DIRECTORY_SEPARATOR, dirname($_SERVER[ 'SCRIPT_FILENAME' ])); |
|
313 | + $root_dir = str_replace(['/', '\\'], DIRECTORY_SEPARATOR, $_SERVER['DOCUMENT_ROOT']); |
|
314 | + $base_dir = str_replace(['/', '\\'], DIRECTORY_SEPARATOR, dirname($_SERVER['SCRIPT_FILENAME'])); |
|
315 | 315 | |
316 | 316 | $root_dir = rtrim($root_dir, DIRECTORY_SEPARATOR) . DIRECTORY_SEPARATOR; |
317 | 317 | $base_dir = rtrim($base_dir, DIRECTORY_SEPARATOR) . DIRECTORY_SEPARATOR; |
@@ -326,15 +326,15 @@ discard block |
||
326 | 326 | |
327 | 327 | $base_url = is_https() ? 'https' : 'http'; |
328 | 328 | |
329 | - if (isset($_SERVER[ 'HTTP_HOST' ])) { |
|
330 | - $base_url .= '://' . $_SERVER[ 'HTTP_HOST' ]; |
|
331 | - } elseif (isset($_SERVER[ 'SERVER_NAME' ])) { |
|
329 | + if (isset($_SERVER['HTTP_HOST'])) { |
|
330 | + $base_url .= '://' . $_SERVER['HTTP_HOST']; |
|
331 | + } elseif (isset($_SERVER['SERVER_NAME'])) { |
|
332 | 332 | |
333 | 333 | // Add server name |
334 | - $base_url .= '://' . $_SERVER[ 'SERVER_NAME' ]; |
|
334 | + $base_url .= '://' . $_SERVER['SERVER_NAME']; |
|
335 | 335 | |
336 | 336 | // Add server port if needed |
337 | - $base_url .= $_SERVER[ 'SERVER_PORT' ] !== '80' ? ':' . $_SERVER[ 'SERVER_PORT' ] : ''; |
|
337 | + $base_url .= $_SERVER['SERVER_PORT'] !== '80' ? ':' . $_SERVER['SERVER_PORT'] : ''; |
|
338 | 338 | } |
339 | 339 | |
340 | 340 | // Add base path |
@@ -417,7 +417,7 @@ discard block |
||
417 | 417 | $segments = explode('\\', $class); |
418 | 418 | |
419 | 419 | if (count($segments) > 1) { |
420 | - if ($segments[ 0 ] === $segments[ 1 ]) { |
|
420 | + if ($segments[0] === $segments[1]) { |
|
421 | 421 | array_shift($segments); |
422 | 422 | } |
423 | 423 | } |
@@ -490,27 +490,27 @@ discard block |
||
490 | 490 | foreach (explode("\n", $raw_headers) as $i => $h) { |
491 | 491 | $h = explode(':', $h, 2); |
492 | 492 | |
493 | - if (isset($h[ 1 ])) { |
|
494 | - if ( ! isset($headers[ $h[ 0 ] ])) { |
|
495 | - $headers[ $h[ 0 ] ] = trim($h[ 1 ]); |
|
496 | - } elseif (is_array($headers[ $h[ 0 ] ])) { |
|
497 | - $headers[ $h[ 0 ] ] = array_merge($headers[ $h[ 0 ] ], [trim($h[ 1 ])]); // [+] |
|
493 | + if (isset($h[1])) { |
|
494 | + if ( ! isset($headers[$h[0]])) { |
|
495 | + $headers[$h[0]] = trim($h[1]); |
|
496 | + } elseif (is_array($headers[$h[0]])) { |
|
497 | + $headers[$h[0]] = array_merge($headers[$h[0]], [trim($h[1])]); // [+] |
|
498 | 498 | } else { |
499 | - $headers[ $h[ 0 ] ] = array_merge([$headers[ $h[ 0 ] ]], [trim($h[ 1 ])]); // [+] |
|
499 | + $headers[$h[0]] = array_merge([$headers[$h[0]]], [trim($h[1])]); // [+] |
|
500 | 500 | } |
501 | 501 | |
502 | - $key = $h[ 0 ]; // [+] |
|
502 | + $key = $h[0]; // [+] |
|
503 | 503 | } else // [+] |
504 | 504 | { // [+] |
505 | - if (substr($h[ 0 ], 0, 1) == "\t") // [+] |
|
505 | + if (substr($h[0], 0, 1) == "\t") // [+] |
|
506 | 506 | { |
507 | - $headers[ $key ] .= "\r\n\t" . trim($h[ 0 ]); |
|
507 | + $headers[$key] .= "\r\n\t" . trim($h[0]); |
|
508 | 508 | } // [+] |
509 | 509 | elseif ( ! $key) // [+] |
510 | 510 | { |
511 | - $headers[ 0 ] = trim($h[ 0 ]); |
|
511 | + $headers[0] = trim($h[0]); |
|
512 | 512 | } |
513 | - trim($h[ 0 ]); // [+] |
|
513 | + trim($h[0]); // [+] |
|
514 | 514 | } // [+] |
515 | 515 | } |
516 | 516 | |
@@ -728,8 +728,8 @@ discard block |
||
728 | 728 | |
729 | 729 | $string = null; |
730 | 730 | |
731 | - if (isset($errors[ $code ])) { |
|
732 | - $string = $errors[ $code ]; |
|
731 | + if (isset($errors[$code])) { |
|
732 | + $string = $errors[$code]; |
|
733 | 733 | } |
734 | 734 | |
735 | 735 | return strtoupper($string); |
@@ -46,12 +46,12 @@ discard block |
||
46 | 46 | $args = func_get_args(); |
47 | 47 | |
48 | 48 | if (count($args)) { |
49 | - if (kernel()->services->has($args[ 0 ])) { |
|
50 | - if (isset($args[ 1 ]) and is_array($args[ 1 ])) { |
|
51 | - return kernel()->services->get($args[ 0 ], $args[ 1 ]); |
|
49 | + if (kernel()->services->has($args[0])) { |
|
50 | + if (isset($args[1]) and is_array($args[1])) { |
|
51 | + return kernel()->services->get($args[0], $args[1]); |
|
52 | 52 | } |
53 | 53 | |
54 | - return kernel()->services->get($args[ 0 ]); |
|
54 | + return kernel()->services->get($args[0]); |
|
55 | 55 | } |
56 | 56 | |
57 | 57 | return false; |
@@ -97,7 +97,7 @@ discard block |
||
97 | 97 | |
98 | 98 | if (count($args)) { |
99 | 99 | if (services()->has('language')) { |
100 | - $language =& services()->get('language'); |
|
100 | + $language = & services()->get('language'); |
|
101 | 101 | |
102 | 102 | return call_user_func_array([&$language, 'getLine'], $args); |
103 | 103 | } |
@@ -125,7 +125,7 @@ discard block |
||
125 | 125 | |
126 | 126 | if (count($args)) { |
127 | 127 | if (services()->has('logger')) { |
128 | - $logger =& services('logger'); |
|
128 | + $logger = & services('logger'); |
|
129 | 129 | |
130 | 130 | return call_user_func_array([&$logger, 'log'], $args); |
131 | 131 | } |
@@ -106,7 +106,7 @@ discard block |
||
106 | 106 | |
107 | 107 | if (count($this->isLoaded)) { |
108 | 108 | foreach ($this->isLoaded as $fileIndex => $filePath) { |
109 | - unset($this->isLoaded[ $fileIndex ]); |
|
109 | + unset($this->isLoaded[$fileIndex]); |
|
110 | 110 | $this->loadFile($fileIndex); |
111 | 111 | } |
112 | 112 | } |
@@ -216,7 +216,7 @@ discard block |
||
216 | 216 | |
217 | 217 | if (is_array($lines)) { |
218 | 218 | if (count($lines)) { |
219 | - $this->isLoaded[ $this->getFileIndex($filePath) ] = $filePath; |
|
219 | + $this->isLoaded[$this->getFileIndex($filePath)] = $filePath; |
|
220 | 220 | |
221 | 221 | $this->lines = array_merge($this->lines, $lines); |
222 | 222 | |
@@ -346,9 +346,9 @@ discard block |
||
346 | 346 | $lineOffset = strtoupper($line); |
347 | 347 | |
348 | 348 | if (empty($context)) { |
349 | - $lineContent = isset($this->lines[ $lineOffset ]) ? $this->lines[ $lineOffset ] : $line; |
|
349 | + $lineContent = isset($this->lines[$lineOffset]) ? $this->lines[$lineOffset] : $line; |
|
350 | 350 | } else { |
351 | - $line = isset($this->lines[ $lineOffset ]) ? $this->lines[ $lineOffset ] : $line; |
|
351 | + $line = isset($this->lines[$lineOffset]) ? $this->lines[$lineOffset] : $line; |
|
352 | 352 | array_unshift($context, $line); |
353 | 353 | |
354 | 354 | $lineContent = @call_user_func_array('sprintf', $context); |
@@ -52,11 +52,11 @@ discard block |
||
52 | 52 | */ |
53 | 53 | public function getOption($name, $default = null) |
54 | 54 | { |
55 | - if ( ! isset($this->options[ $name ])) { |
|
55 | + if ( ! isset($this->options[$name])) { |
|
56 | 56 | return $default; |
57 | 57 | } |
58 | 58 | |
59 | - return $this->options[ $name ]; |
|
59 | + return $this->options[$name]; |
|
60 | 60 | } |
61 | 61 | |
62 | 62 | // ------------------------------------------------------------------------ |
@@ -73,7 +73,7 @@ discard block |
||
73 | 73 | */ |
74 | 74 | public function setOption($name, $value) |
75 | 75 | { |
76 | - $this->options[ $name ] = $value; |
|
76 | + $this->options[$name] = $value; |
|
77 | 77 | |
78 | 78 | return $this; |
79 | 79 | } |
@@ -432,13 +432,13 @@ |
||
432 | 432 | } |
433 | 433 | |
434 | 434 | foreach ([ |
435 | - 'HTTP_CLIENT_IP', |
|
436 | - 'HTTP_FORWARDED', |
|
437 | - 'HTTP_X_FORWARDED_FOR', |
|
438 | - 'HTTP_X_CLIENT_IP', |
|
439 | - 'HTTP_X_CLUSTER_CLIENT_IP', |
|
440 | - 'REMOTE_ADDR', |
|
441 | - ] as $header |
|
435 | + 'HTTP_CLIENT_IP', |
|
436 | + 'HTTP_FORWARDED', |
|
437 | + 'HTTP_X_FORWARDED_FOR', |
|
438 | + 'HTTP_X_CLIENT_IP', |
|
439 | + 'HTTP_X_CLUSTER_CLIENT_IP', |
|
440 | + 'REMOTE_ADDR', |
|
441 | + ] as $header |
|
442 | 442 | ) { |
443 | 443 | if (null !== ($ipAddress = $this->server($header))) { |
444 | 444 | if (filter_var($ipAddress, FILTER_VALIDATE_IP)) { |
@@ -53,7 +53,7 @@ discard block |
||
53 | 53 | // Use $_GET directly here, since filter_has_var only |
54 | 54 | // checks the initial GET data, not anything that might |
55 | 55 | // have been added since. |
56 | - return isset($_GET[ $offset ]) |
|
56 | + return isset($_GET[$offset]) |
|
57 | 57 | ? $this->get($offset, $filter) |
58 | 58 | : $this->post($offset, $filter); |
59 | 59 | } |
@@ -139,7 +139,7 @@ discard block |
||
139 | 139 | $loopThrough = []; |
140 | 140 | |
141 | 141 | foreach ($offset as $key) { |
142 | - $loopThrough[ $key ] = $this->filter($type, $key, $filter); |
|
142 | + $loopThrough[$key] = $this->filter($type, $key, $filter); |
|
143 | 143 | } |
144 | 144 | |
145 | 145 | if (empty($loopThrough)) { |
@@ -153,38 +153,38 @@ discard block |
||
153 | 153 | // of the simpler filter_input(); |
154 | 154 | switch ($type) { |
155 | 155 | case INPUT_GET: |
156 | - $value = isset($_GET[ $offset ]) |
|
157 | - ? $_GET[ $offset ] |
|
156 | + $value = isset($_GET[$offset]) |
|
157 | + ? $_GET[$offset] |
|
158 | 158 | : null; |
159 | 159 | break; |
160 | 160 | case INPUT_POST: |
161 | - $value = isset($_POST[ $offset ]) |
|
162 | - ? $_POST[ $offset ] |
|
161 | + $value = isset($_POST[$offset]) |
|
162 | + ? $_POST[$offset] |
|
163 | 163 | : null; |
164 | 164 | break; |
165 | 165 | case INPUT_SERVER: |
166 | - $value = isset($_SERVER[ $offset ]) |
|
167 | - ? $_SERVER[ $offset ] |
|
166 | + $value = isset($_SERVER[$offset]) |
|
167 | + ? $_SERVER[$offset] |
|
168 | 168 | : null; |
169 | 169 | break; |
170 | 170 | case INPUT_ENV: |
171 | - $value = isset($_ENV[ $offset ]) |
|
172 | - ? $_ENV[ $offset ] |
|
171 | + $value = isset($_ENV[$offset]) |
|
172 | + ? $_ENV[$offset] |
|
173 | 173 | : null; |
174 | 174 | break; |
175 | 175 | case INPUT_COOKIE: |
176 | - $value = isset($_COOKIE[ $offset ]) |
|
177 | - ? $_COOKIE[ $offset ] |
|
176 | + $value = isset($_COOKIE[$offset]) |
|
177 | + ? $_COOKIE[$offset] |
|
178 | 178 | : null; |
179 | 179 | break; |
180 | 180 | case INPUT_REQUEST: |
181 | - $value = isset($_REQUEST[ $offset ]) |
|
182 | - ? $_REQUEST[ $offset ] |
|
181 | + $value = isset($_REQUEST[$offset]) |
|
182 | + ? $_REQUEST[$offset] |
|
183 | 183 | : null; |
184 | 184 | break; |
185 | 185 | case INPUT_SESSION: |
186 | - $value = isset($_SESSION[ $offset ]) |
|
187 | - ? $_SESSION[ $offset ] |
|
186 | + $value = isset($_SESSION[$offset]) |
|
187 | + ? $_SESSION[$offset] |
|
188 | 188 | : null; |
189 | 189 | break; |
190 | 190 | default: |
@@ -243,13 +243,13 @@ discard block |
||
243 | 243 | { |
244 | 244 | foreach ($data as $key => $value) { |
245 | 245 | if (is_array($value) AND is_array($filter)) { |
246 | - $data[ $key ] = filter_var_array($value, $filter); |
|
246 | + $data[$key] = filter_var_array($value, $filter); |
|
247 | 247 | } elseif (is_array($value)) { |
248 | - $data[ $key ] = $this->filterRecursive($value, $filter); |
|
248 | + $data[$key] = $this->filterRecursive($value, $filter); |
|
249 | 249 | } elseif (isset($filter)) { |
250 | - $data[ $key ] = filter_var($value, $filter); |
|
250 | + $data[$key] = filter_var($value, $filter); |
|
251 | 251 | } else { |
252 | - $data[ $key ] = $value; |
|
252 | + $data[$key] = $value; |
|
253 | 253 | } |
254 | 254 | } |
255 | 255 | |
@@ -298,7 +298,7 @@ discard block |
||
298 | 298 | // Use $_POST directly here, since filter_has_var only |
299 | 299 | // checks the initial POST data, not anything that might |
300 | 300 | // have been added since. |
301 | - return isset($_POST[ $offset ]) |
|
301 | + return isset($_POST[$offset]) |
|
302 | 302 | ? $this->post($offset, $filter) |
303 | 303 | : $this->get($offset, $filter); |
304 | 304 | } |
@@ -321,8 +321,8 @@ discard block |
||
321 | 321 | $uploadFiles = server_request()->getUploadedFiles(); |
322 | 322 | |
323 | 323 | if (isset($offset)) { |
324 | - if (isset($uploadFiles[ $offset ])) { |
|
325 | - return $uploadFiles[ $offset ]; |
|
324 | + if (isset($uploadFiles[$offset])) { |
|
325 | + return $uploadFiles[$offset]; |
|
326 | 326 | } |
327 | 327 | } |
328 | 328 | |
@@ -548,6 +548,6 @@ discard block |
||
548 | 548 | */ |
549 | 549 | final public function submit() |
550 | 550 | { |
551 | - return (bool)isset($_POST[ 'submit' ]); |
|
551 | + return (bool)isset($_POST['submit']); |
|
552 | 552 | } |
553 | 553 | } |
554 | 554 | \ No newline at end of file |
@@ -113,7 +113,7 @@ discard block |
||
113 | 113 | } |
114 | 114 | } else { |
115 | 115 | $uriPath = urldecode( |
116 | - parse_url($_SERVER[ 'REQUEST_URI' ], PHP_URL_PATH) |
|
116 | + parse_url($_SERVER['REQUEST_URI'], PHP_URL_PATH) |
|
117 | 117 | ); |
118 | 118 | |
119 | 119 | $uriPathParts = explode('public/', $uriPath); |
@@ -227,8 +227,8 @@ discard block |
||
227 | 227 | ); |
228 | 228 | } elseif (preg_match("/([a-zA-Z0-9\\\]+)(@)([a-zA-Z0-9\\\]+)/", $closure, $matches)) { |
229 | 229 | $this->setController( |
230 | - (new Router\DataStructures\Controller($matches[ 1 ])) |
|
231 | - ->setRequestMethod($matches[ 3 ]), |
|
230 | + (new Router\DataStructures\Controller($matches[1])) |
|
231 | + ->setRequestMethod($matches[3]), |
|
232 | 232 | $uriSegments |
233 | 233 | ); |
234 | 234 | } elseif (is_string($closure) && $closure !== '') { |
@@ -317,10 +317,10 @@ discard block |
||
317 | 317 | $parameters = $controllerMethodParams; |
318 | 318 | } else { |
319 | 319 | foreach ($method->getParameters() as $index => $parameter) { |
320 | - if (isset($uriSegments[ $parameter->name ])) { |
|
321 | - $parameters[ $index ] = $controllerMethodParams[ $parameter->name ]; |
|
320 | + if (isset($uriSegments[$parameter->name])) { |
|
321 | + $parameters[$index] = $controllerMethodParams[$parameter->name]; |
|
322 | 322 | } else { |
323 | - $parameters[ $index ] = null; |
|
323 | + $parameters[$index] = null; |
|
324 | 324 | } |
325 | 325 | } |
326 | 326 | } |
@@ -64,8 +64,8 @@ discard block |
||
64 | 64 | break; |
65 | 65 | case 'PATH_INFO': |
66 | 66 | default: |
67 | - $this->string = isset($_SERVER[ $protocol ]) |
|
68 | - ? $_SERVER[ $protocol ] |
|
67 | + $this->string = isset($_SERVER[$protocol]) |
|
68 | + ? $_SERVER[$protocol] |
|
69 | 69 | : $this->parseRequestUri(); |
70 | 70 | break; |
71 | 71 | } |
@@ -90,23 +90,23 @@ discard block |
||
90 | 90 | */ |
91 | 91 | protected function parseRequestUri() |
92 | 92 | { |
93 | - if ( ! isset($_SERVER[ 'REQUEST_URI' ], $_SERVER[ 'SCRIPT_NAME' ])) { |
|
93 | + if ( ! isset($_SERVER['REQUEST_URI'], $_SERVER['SCRIPT_NAME'])) { |
|
94 | 94 | return ''; |
95 | 95 | } |
96 | 96 | |
97 | - $uri = parse_url($_SERVER[ 'REQUEST_URI' ]); |
|
98 | - $query = isset($uri[ 'query' ]) |
|
99 | - ? $uri[ 'query' ] |
|
97 | + $uri = parse_url($_SERVER['REQUEST_URI']); |
|
98 | + $query = isset($uri['query']) |
|
99 | + ? $uri['query'] |
|
100 | 100 | : ''; |
101 | - $uri = isset($uri[ 'path' ]) |
|
102 | - ? $uri[ 'path' ] |
|
101 | + $uri = isset($uri['path']) |
|
102 | + ? $uri['path'] |
|
103 | 103 | : ''; |
104 | 104 | |
105 | - if (isset($_SERVER[ 'SCRIPT_NAME' ][ 0 ])) { |
|
106 | - if (strpos($uri, $_SERVER[ 'SCRIPT_NAME' ]) === 0) { |
|
107 | - $uri = (string)substr($uri, strlen($_SERVER[ 'SCRIPT_NAME' ])); |
|
108 | - } elseif (strpos($uri, dirname($_SERVER[ 'SCRIPT_NAME' ])) === 0) { |
|
109 | - $uri = (string)substr($uri, strlen(dirname($_SERVER[ 'SCRIPT_NAME' ]))); |
|
105 | + if (isset($_SERVER['SCRIPT_NAME'][0])) { |
|
106 | + if (strpos($uri, $_SERVER['SCRIPT_NAME']) === 0) { |
|
107 | + $uri = (string)substr($uri, strlen($_SERVER['SCRIPT_NAME'])); |
|
108 | + } elseif (strpos($uri, dirname($_SERVER['SCRIPT_NAME'])) === 0) { |
|
109 | + $uri = (string)substr($uri, strlen(dirname($_SERVER['SCRIPT_NAME']))); |
|
110 | 110 | } |
111 | 111 | } |
112 | 112 | |
@@ -114,16 +114,16 @@ discard block |
||
114 | 114 | // URI is found, and also fixes the QUERY_STRING server var and $_GET array. |
115 | 115 | if (trim($uri, '/') === '' AND strncmp($query, '/', 1) === 0) { |
116 | 116 | $query = explode('?', $query, 2); |
117 | - $uri = $query[ 0 ]; |
|
117 | + $uri = $query[0]; |
|
118 | 118 | |
119 | - $_SERVER[ 'QUERY_STRING' ] = isset($query[ 1 ]) |
|
120 | - ? $query[ 1 ] |
|
119 | + $_SERVER['QUERY_STRING'] = isset($query[1]) |
|
120 | + ? $query[1] |
|
121 | 121 | : ''; |
122 | 122 | } else { |
123 | - $_SERVER[ 'QUERY_STRING' ] = $query; |
|
123 | + $_SERVER['QUERY_STRING'] = $query; |
|
124 | 124 | } |
125 | 125 | |
126 | - parse_str($_SERVER[ 'QUERY_STRING' ], $_GET); |
|
126 | + parse_str($_SERVER['QUERY_STRING'], $_GET); |
|
127 | 127 | |
128 | 128 | if ($uri === '/' || $uri === '') { |
129 | 129 | return '/'; |
@@ -184,21 +184,21 @@ discard block |
||
184 | 184 | */ |
185 | 185 | protected function parseQueryString() |
186 | 186 | { |
187 | - $uri = isset($_SERVER[ 'QUERY_STRING' ]) |
|
188 | - ? $_SERVER[ 'QUERY_STRING' ] |
|
187 | + $uri = isset($_SERVER['QUERY_STRING']) |
|
188 | + ? $_SERVER['QUERY_STRING'] |
|
189 | 189 | : @getenv('QUERY_STRING'); |
190 | 190 | |
191 | 191 | if (trim($uri, '/') === '') { |
192 | 192 | return ''; |
193 | 193 | } elseif (strncmp($uri, '/', 1) === 0) { |
194 | 194 | $uri = explode('?', $uri, 2); |
195 | - $_SERVER[ 'QUERY_STRING' ] = isset($uri[ 1 ]) |
|
196 | - ? $uri[ 1 ] |
|
195 | + $_SERVER['QUERY_STRING'] = isset($uri[1]) |
|
196 | + ? $uri[1] |
|
197 | 197 | : ''; |
198 | - $uri = rawurldecode($uri[ 0 ]); |
|
198 | + $uri = rawurldecode($uri[0]); |
|
199 | 199 | } |
200 | 200 | |
201 | - parse_str($_SERVER[ 'QUERY_STRING' ], $_GET); |
|
201 | + parse_str($_SERVER['QUERY_STRING'], $_GET); |
|
202 | 202 | |
203 | 203 | return $this->removeRelativeDirectory($uri); |
204 | 204 | } |
@@ -234,7 +234,7 @@ discard block |
||
234 | 234 | $validSegments = array_filter($validSegments); |
235 | 235 | array_unshift($validSegments, null); |
236 | 236 | |
237 | - unset($validSegments[ 0 ]); |
|
237 | + unset($validSegments[0]); |
|
238 | 238 | |
239 | 239 | $this->segments = $validSegments; |
240 | 240 | $this->string = implode('/', $this->segments); |
@@ -273,8 +273,8 @@ discard block |
||
273 | 273 | |
274 | 274 | // Convert programatic characters to entities and return |
275 | 275 | return str_replace( |
276 | - ['$', '(', ')', '%28', '%29', $config->offsetGet('suffix')], // Bad |
|
277 | - ['$', '(', ')', '(', ')', ''], // Good |
|
276 | + ['$', '(', ')', '%28', '%29', $config->offsetGet('suffix')], // Bad |
|
277 | + ['$', '(', ')', '(', ')', ''], // Good |
|
278 | 278 | $segment |
279 | 279 | ); |
280 | 280 | } |
@@ -94,15 +94,15 @@ discard block |
||
94 | 94 | */ |
95 | 95 | public function __construct($string = null) |
96 | 96 | { |
97 | - $this->origin = isset($_SERVER[ 'HTTP_HOST' ]) |
|
98 | - ? $_SERVER[ 'HTTP_HOST' ] |
|
99 | - : $_SERVER[ 'SERVER_NAME' ]; |
|
97 | + $this->origin = isset($_SERVER['HTTP_HOST']) |
|
98 | + ? $_SERVER['HTTP_HOST'] |
|
99 | + : $_SERVER['SERVER_NAME']; |
|
100 | 100 | $this->scheme = is_https() |
101 | 101 | ? 'https' |
102 | 102 | : 'http'; |
103 | 103 | |
104 | - $paths = explode('.php', $_SERVER[ 'PHP_SELF' ]); |
|
105 | - $paths = explode('/', trim($paths[ 0 ], '/')); |
|
104 | + $paths = explode('.php', $_SERVER['PHP_SELF']); |
|
105 | + $paths = explode('/', trim($paths[0], '/')); |
|
106 | 106 | array_pop($paths); |
107 | 107 | |
108 | 108 | $this->path = empty($paths) |
@@ -112,26 +112,26 @@ discard block |
||
112 | 112 | if (isset($string)) { |
113 | 113 | $this->string = trim($string, '/'); |
114 | 114 | $metadata = parse_url($string); |
115 | - $metadata[ 'path' ] = empty($metadata[ 'path' ]) |
|
115 | + $metadata['path'] = empty($metadata['path']) |
|
116 | 116 | ? null |
117 | - : $metadata[ 'path' ]; |
|
117 | + : $metadata['path']; |
|
118 | 118 | |
119 | - $this->scheme = empty($metadata[ 'scheme' ]) |
|
119 | + $this->scheme = empty($metadata['scheme']) |
|
120 | 120 | ? $this->scheme |
121 | - : $metadata[ 'scheme' ]; |
|
121 | + : $metadata['scheme']; |
|
122 | 122 | |
123 | - if ($metadata[ 'path' ] === $this->string) { |
|
123 | + if ($metadata['path'] === $this->string) { |
|
124 | 124 | $paths = explode('/', $this->string); |
125 | - $this->origin = $paths[ 0 ]; |
|
125 | + $this->origin = $paths[0]; |
|
126 | 126 | |
127 | 127 | $this->path = implode('/', array_slice($paths, 1)); |
128 | - } elseif (isset($metadata[ 'host' ])) { |
|
129 | - $this->path = trim($metadata[ 'path' ]); |
|
130 | - $this->origin = $metadata[ 'host' ]; |
|
128 | + } elseif (isset($metadata['host'])) { |
|
129 | + $this->path = trim($metadata['path']); |
|
130 | + $this->origin = $metadata['host']; |
|
131 | 131 | } |
132 | 132 | } |
133 | 133 | |
134 | - $directories = explode('/', str_replace('\\', '/', dirname($_SERVER[ 'SCRIPT_FILENAME' ]))); |
|
134 | + $directories = explode('/', str_replace('\\', '/', dirname($_SERVER['SCRIPT_FILENAME']))); |
|
135 | 135 | $paths = explode('/', $this->path); |
136 | 136 | $paths = array_intersect($paths, $directories); |
137 | 137 | |
@@ -143,7 +143,7 @@ discard block |
||
143 | 143 | } |
144 | 144 | |
145 | 145 | if (preg_match('/(:)([0-9]+)/', $this->string, $matches)) { |
146 | - $this->port = $matches[ 2 ]; |
|
146 | + $this->port = $matches[2]; |
|
147 | 147 | } |
148 | 148 | |
149 | 149 | if (filter_var($this->origin, FILTER_VALIDATE_IP) !== false) { |
@@ -194,12 +194,12 @@ discard block |
||
194 | 194 | if ((($ordinalNumber % 100) >= 11) && (($ordinalNumber % 100) <= 13)) { |
195 | 195 | $ordinalKey = $ordinalNumber . 'th'; |
196 | 196 | } else { |
197 | - $ordinalKey = $ordinalNumber . $ordinalEnds[ $ordinalNumber % 10 ]; |
|
197 | + $ordinalKey = $ordinalNumber . $ordinalEnds[$ordinalNumber % 10]; |
|
198 | 198 | } |
199 | 199 | |
200 | - $this->subDomains[ $ordinalKey ] = $subdomain; |
|
200 | + $this->subDomains[$ordinalKey] = $subdomain; |
|
201 | 201 | |
202 | - unset($this->subDomains[ $key ]); |
|
202 | + unset($this->subDomains[$key]); |
|
203 | 203 | } |
204 | 204 | |
205 | 205 | foreach ($this->tlds as $key => $tld) { |
@@ -208,12 +208,12 @@ discard block |
||
208 | 208 | if ((($ordinalNumber % 100) >= 11) && (($ordinalNumber % 100) <= 13)) { |
209 | 209 | $ordinalKey = $ordinalNumber . 'th'; |
210 | 210 | } else { |
211 | - $ordinalKey = $ordinalNumber . $ordinalEnds[ $ordinalNumber % 10 ]; |
|
211 | + $ordinalKey = $ordinalNumber . $ordinalEnds[$ordinalNumber % 10]; |
|
212 | 212 | } |
213 | 213 | |
214 | - $this->tlds[ $ordinalKey ] = $tld; |
|
214 | + $this->tlds[$ordinalKey] = $tld; |
|
215 | 215 | |
216 | - unset($this->tlds[ $key ]); |
|
216 | + unset($this->tlds[$key]); |
|
217 | 217 | } |
218 | 218 | } |
219 | 219 | |
@@ -312,8 +312,8 @@ discard block |
||
312 | 312 | */ |
313 | 313 | public function getSubDomain($level = '3rd') |
314 | 314 | { |
315 | - if (isset($this->subDomains[ $level ])) { |
|
316 | - return $this->subDomains[ $level ]; |
|
315 | + if (isset($this->subDomains[$level])) { |
|
316 | + return $this->subDomains[$level]; |
|
317 | 317 | } |
318 | 318 | |
319 | 319 | return false; |
@@ -356,8 +356,8 @@ discard block |
||
356 | 356 | { |
357 | 357 | if (is_null($level)) { |
358 | 358 | return implode('.', $this->tlds); |
359 | - } elseif (isset($this->tlds[ $level ])) { |
|
360 | - return $this->tlds[ $level ]; |
|
359 | + } elseif (isset($this->tlds[$level])) { |
|
360 | + return $this->tlds[$level]; |
|
361 | 361 | } |
362 | 362 | |
363 | 363 | return false; |