@@ -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 |
@@ -342,11 +342,11 @@ discard block |
||
| 342 | 342 | $base_url = str_replace(DIRECTORY_SEPARATOR, '/', $base_url); |
| 343 | 343 | $base_url = trim($base_url, '/') . '/'; |
| 344 | 344 | |
| 345 | - if(strpos($path, 'resources') !== false && defined('PATH_RESOURCES')) { |
|
| 345 | + if (strpos($path, 'resources') !== false && defined('PATH_RESOURCES')) { |
|
| 346 | 346 | $path_url = 'resources' . '/' . str_replace(PATH_RESOURCES, '', $path); |
| 347 | - } elseif(strpos($path, 'public') !== false && defined('PATH_PUBLIC')) { |
|
| 347 | + } elseif (strpos($path, 'public') !== false && defined('PATH_PUBLIC')) { |
|
| 348 | 348 | $path_url = str_replace(PATH_PUBLIC, '', $path); |
| 349 | - } elseif(strpos($path, 'storage') !== false && defined('PATH_RESOURCES')) { |
|
| 349 | + } elseif (strpos($path, 'storage') !== false && defined('PATH_RESOURCES')) { |
|
| 350 | 350 | $path_url = 'storage' . '/' . str_replace(PATH_RESOURCES, '', $path); |
| 351 | 351 | } else { |
| 352 | 352 | $path_url = str_replace($base_dir, '', $path); |
@@ -421,7 +421,7 @@ discard block |
||
| 421 | 421 | $segments = explode('\\', $class); |
| 422 | 422 | |
| 423 | 423 | if (count($segments) > 1) { |
| 424 | - if ($segments[ 0 ] === $segments[ 1 ]) { |
|
| 424 | + if ($segments[0] === $segments[1]) { |
|
| 425 | 425 | array_shift($segments); |
| 426 | 426 | } |
| 427 | 427 | } |
@@ -494,27 +494,27 @@ discard block |
||
| 494 | 494 | foreach (explode("\n", $raw_headers) as $i => $h) { |
| 495 | 495 | $h = explode(':', $h, 2); |
| 496 | 496 | |
| 497 | - if (isset($h[ 1 ])) { |
|
| 498 | - if ( ! isset($headers[ $h[ 0 ] ])) { |
|
| 499 | - $headers[ $h[ 0 ] ] = trim($h[ 1 ]); |
|
| 500 | - } elseif (is_array($headers[ $h[ 0 ] ])) { |
|
| 501 | - $headers[ $h[ 0 ] ] = array_merge($headers[ $h[ 0 ] ], [trim($h[ 1 ])]); // [+] |
|
| 497 | + if (isset($h[1])) { |
|
| 498 | + if ( ! isset($headers[$h[0]])) { |
|
| 499 | + $headers[$h[0]] = trim($h[1]); |
|
| 500 | + } elseif (is_array($headers[$h[0]])) { |
|
| 501 | + $headers[$h[0]] = array_merge($headers[$h[0]], [trim($h[1])]); // [+] |
|
| 502 | 502 | } else { |
| 503 | - $headers[ $h[ 0 ] ] = array_merge([$headers[ $h[ 0 ] ]], [trim($h[ 1 ])]); // [+] |
|
| 503 | + $headers[$h[0]] = array_merge([$headers[$h[0]]], [trim($h[1])]); // [+] |
|
| 504 | 504 | } |
| 505 | 505 | |
| 506 | - $key = $h[ 0 ]; // [+] |
|
| 506 | + $key = $h[0]; // [+] |
|
| 507 | 507 | } else // [+] |
| 508 | 508 | { // [+] |
| 509 | - if (substr($h[ 0 ], 0, 1) == "\t") // [+] |
|
| 509 | + if (substr($h[0], 0, 1) == "\t") // [+] |
|
| 510 | 510 | { |
| 511 | - $headers[ $key ] .= "\r\n\t" . trim($h[ 0 ]); |
|
| 511 | + $headers[$key] .= "\r\n\t" . trim($h[0]); |
|
| 512 | 512 | } // [+] |
| 513 | 513 | elseif ( ! $key) // [+] |
| 514 | 514 | { |
| 515 | - $headers[ 0 ] = trim($h[ 0 ]); |
|
| 515 | + $headers[0] = trim($h[0]); |
|
| 516 | 516 | } |
| 517 | - trim($h[ 0 ]); // [+] |
|
| 517 | + trim($h[0]); // [+] |
|
| 518 | 518 | } // [+] |
| 519 | 519 | } |
| 520 | 520 | |
@@ -732,8 +732,8 @@ discard block |
||
| 732 | 732 | |
| 733 | 733 | $string = null; |
| 734 | 734 | |
| 735 | - if (isset($errors[ $code ])) { |
|
| 736 | - $string = $errors[ $code ]; |
|
| 735 | + if (isset($errors[$code])) { |
|
| 736 | + $string = $errors[$code]; |
|
| 737 | 737 | } |
| 738 | 738 | |
| 739 | 739 | return strtoupper($string); |