@@ -153,7 +153,7 @@ |
||
| 153 | 153 | $lines = []; |
| 154 | 154 | |
| 155 | 155 | for ($i = 0; $i < $this->numbers; $i++) { |
| 156 | - $lines[ $i ] = $this->color->paint(str_repeat($this->string, $this->width)); |
|
| 156 | + $lines[$i] = $this->color->paint(str_repeat($this->string, $this->width)); |
|
| 157 | 157 | } |
| 158 | 158 | |
| 159 | 159 | return str_repeat(PHP_EOL, $this->newLinesBefore) . implode(PHP_EOL, $lines) . str_repeat(PHP_EOL, |
@@ -57,7 +57,7 @@ discard block |
||
| 57 | 57 | return; |
| 58 | 58 | } |
| 59 | 59 | |
| 60 | - $_POST[ $name ] = $standardInput; |
|
| 60 | + $_POST[$name] = $standardInput; |
|
| 61 | 61 | } |
| 62 | 62 | |
| 63 | 63 | // ------------------------------------------------------------------------ |
@@ -97,7 +97,7 @@ discard block |
||
| 97 | 97 | return; |
| 98 | 98 | } |
| 99 | 99 | |
| 100 | - $_POST[ $name ] = (bool)($standardInput === 'Y'); |
|
| 100 | + $_POST[$name] = (bool)($standardInput === 'Y'); |
|
| 101 | 101 | } |
| 102 | 102 | |
| 103 | 103 | // ------------------------------------------------------------------------ |
@@ -119,7 +119,7 @@ discard block |
||
| 119 | 119 | $choices = []; |
| 120 | 120 | $i = 1; |
| 121 | 121 | foreach ($options as $value => $label) { |
| 122 | - $choices[ $i ] = $value; |
|
| 122 | + $choices[$i] = $value; |
|
| 123 | 123 | output()->write( |
| 124 | 124 | (new Format()) |
| 125 | 125 | ->setString('(' . $i . ') ' . language()->getLine($label)) |
@@ -166,6 +166,6 @@ discard block |
||
| 166 | 166 | return; |
| 167 | 167 | } |
| 168 | 168 | |
| 169 | - $_POST[ $name ] = $choices[ $standardInput ]; |
|
| 169 | + $_POST[$name] = $choices[$standardInput]; |
|
| 170 | 170 | } |
| 171 | 171 | } |
| 172 | 172 | \ No newline at end of file |
@@ -161,12 +161,12 @@ |
||
| 161 | 161 | |
| 162 | 162 | // set foreground color |
| 163 | 163 | if (array_key_exists($this->foreground, $this->foregroundColors)) { |
| 164 | - $coloredString .= "\033[" . $this->foregroundColors[ $this->foreground ] . "m"; |
|
| 164 | + $coloredString .= "\033[" . $this->foregroundColors[$this->foreground] . "m"; |
|
| 165 | 165 | } |
| 166 | 166 | |
| 167 | 167 | // set background color |
| 168 | 168 | if (array_key_exists($this->background, $this->backgroundColors)) { |
| 169 | - $coloredString .= "\033[" . $this->backgroundColors[ $this->background ] . "m"; |
|
| 169 | + $coloredString .= "\033[" . $this->backgroundColors[$this->background] . "m"; |
|
| 170 | 170 | } |
| 171 | 171 | |
| 172 | 172 | // combine with string and end the painting |
@@ -93,7 +93,7 @@ |
||
| 93 | 93 | $commander->setApp($this); |
| 94 | 94 | } |
| 95 | 95 | |
| 96 | - $this->commandersPool[ $commander->getCommandName() ] = $commander; |
|
| 96 | + $this->commandersPool[$commander->getCommandName()] = $commander; |
|
| 97 | 97 | } |
| 98 | 98 | |
| 99 | 99 | // ------------------------------------------------------------------------ |
@@ -25,7 +25,7 @@ |
||
| 25 | 25 | * @param $className |
| 26 | 26 | */ |
| 27 | 27 | spl_autoload_register( |
| 28 | - function ($className) { |
|
| 28 | + function($className) { |
|
| 29 | 29 | if ($className === 'O2System\Kernel') { |
| 30 | 30 | require __DIR__ . DIRECTORY_SEPARATOR . 'Kernel.php'; |
| 31 | 31 | } elseif (strpos($className, 'O2System\Kernel\\') === false) { |
@@ -114,24 +114,24 @@ |
||
| 114 | 114 | } |
| 115 | 115 | |
| 116 | 116 | $rules = [ |
| 117 | - '/^(ox)$/' => '\1\2en', // ox |
|
| 118 | - '/([m|l])ouse$/' => '\1ice', // mouse, louse |
|
| 119 | - '/(matr|vert|ind)ix|ex$/' => '\1ices', // matrix, vertex, index |
|
| 120 | - '/(x|ch|ss|sh)$/' => '\1es', // search, switch, fix, box, process, address |
|
| 121 | - '/([^aeiouy]|qu)y$/' => '\1ies', // query, ability, agency |
|
| 122 | - '/(hive)$/' => '\1s', // archive, hive |
|
| 123 | - '/(?:([^f])fe|([lr])f)$/' => '\1\2ves', // half, safe, wife |
|
| 124 | - '/sis$/' => 'ses', // basis, diagnosis |
|
| 125 | - '/([ti])um$/' => '\1a', // datum, medium |
|
| 126 | - '/(p)erson$/' => '\1eople', // person, salesperson |
|
| 127 | - '/(m)an$/' => '\1en', // man, woman, spokesman |
|
| 128 | - '/(c)hild$/' => '\1hildren', // child |
|
| 129 | - '/(buffal|tomat)o$/' => '\1\2oes', // buffalo, tomato |
|
| 130 | - '/(bu|campu)s$/' => '\1\2ses', // bus, campus |
|
| 131 | - '/(alias|status|virus)$/' => '\1es', // alias |
|
| 132 | - '/(octop)us$/' => '\1i', // octopus |
|
| 133 | - '/(ax|cris|test)is$/' => '\1es', // axis, crisis |
|
| 134 | - '/s$/' => 's', // no change (compatibility) |
|
| 117 | + '/^(ox)$/' => '\1\2en', // ox |
|
| 118 | + '/([m|l])ouse$/' => '\1ice', // mouse, louse |
|
| 119 | + '/(matr|vert|ind)ix|ex$/' => '\1ices', // matrix, vertex, index |
|
| 120 | + '/(x|ch|ss|sh)$/' => '\1es', // search, switch, fix, box, process, address |
|
| 121 | + '/([^aeiouy]|qu)y$/' => '\1ies', // query, ability, agency |
|
| 122 | + '/(hive)$/' => '\1s', // archive, hive |
|
| 123 | + '/(?:([^f])fe|([lr])f)$/' => '\1\2ves', // half, safe, wife |
|
| 124 | + '/sis$/' => 'ses', // basis, diagnosis |
|
| 125 | + '/([ti])um$/' => '\1a', // datum, medium |
|
| 126 | + '/(p)erson$/' => '\1eople', // person, salesperson |
|
| 127 | + '/(m)an$/' => '\1en', // man, woman, spokesman |
|
| 128 | + '/(c)hild$/' => '\1hildren', // child |
|
| 129 | + '/(buffal|tomat)o$/' => '\1\2oes', // buffalo, tomato |
|
| 130 | + '/(bu|campu)s$/' => '\1\2ses', // bus, campus |
|
| 131 | + '/(alias|status|virus)$/' => '\1es', // alias |
|
| 132 | + '/(octop)us$/' => '\1i', // octopus |
|
| 133 | + '/(ax|cris|test)is$/' => '\1es', // axis, crisis |
|
| 134 | + '/s$/' => 's', // no change (compatibility) |
|
| 135 | 135 | '/$/' => 's', |
| 136 | 136 | ]; |
| 137 | 137 | |
@@ -43,30 +43,30 @@ discard block |
||
| 43 | 43 | if (is_array($name)) { |
| 44 | 44 | // always leave 'name' in last place, as the loop will break otherwise, due to $$item |
| 45 | 45 | foreach (['value', 'expire', 'domain', 'path', 'prefix', 'secure', 'httponly', 'name'] as $item) { |
| 46 | - if (isset($name[ $item ])) { |
|
| 47 | - $$item = $name[ $item ]; |
|
| 46 | + if (isset($name[$item])) { |
|
| 47 | + $$item = $name[$item]; |
|
| 48 | 48 | } |
| 49 | 49 | } |
| 50 | 50 | } |
| 51 | 51 | |
| 52 | 52 | if ($prefix === '' && function_exists('config')) { |
| 53 | - $prefix = config()->offsetGet('cookie')[ 'prefix' ]; |
|
| 53 | + $prefix = config()->offsetGet('cookie')['prefix']; |
|
| 54 | 54 | } |
| 55 | 55 | |
| 56 | 56 | if ($domain === '' && function_exists('config')) { |
| 57 | - $domain = config()->offsetGet('cookie')[ 'domain' ]; |
|
| 57 | + $domain = config()->offsetGet('cookie')['domain']; |
|
| 58 | 58 | } |
| 59 | 59 | |
| 60 | 60 | if ($path === '' && function_exists('config')) { |
| 61 | - $path = config()->offsetGet('cookie')[ 'path' ]; |
|
| 61 | + $path = config()->offsetGet('cookie')['path']; |
|
| 62 | 62 | } |
| 63 | 63 | |
| 64 | 64 | if ($secure === null && function_exists('config')) { |
| 65 | - $secure = config()->offsetGet('cookie')[ 'secure' ]; |
|
| 65 | + $secure = config()->offsetGet('cookie')['secure']; |
|
| 66 | 66 | } |
| 67 | 67 | |
| 68 | 68 | if ($httponly === null && function_exists('config')) { |
| 69 | - $httponly = config()->offsetGet('cookie')[ 'httpOnly' ]; |
|
| 69 | + $httponly = config()->offsetGet('cookie')['httpOnly']; |
|
| 70 | 70 | } |
| 71 | 71 | |
| 72 | 72 | if ( ! is_numeric($expire) OR $expire < 0) { |
@@ -99,12 +99,12 @@ discard block |
||
| 99 | 99 | */ |
| 100 | 100 | function get_cookie($name) |
| 101 | 101 | { |
| 102 | - if (isset($_COOKIE[ $name ])) { |
|
| 103 | - return $_COOKIE[ $name ]; |
|
| 102 | + if (isset($_COOKIE[$name])) { |
|
| 103 | + return $_COOKIE[$name]; |
|
| 104 | 104 | } elseif (function_exists('config')) { |
| 105 | - $prefix = config()->offsetGet('cookie')[ 'prefix' ]; |
|
| 106 | - if (isset($_COOKIE[ $prefix . $name ])) { |
|
| 107 | - return $_COOKIE[ $prefix . $name ]; |
|
| 105 | + $prefix = config()->offsetGet('cookie')['prefix']; |
|
| 106 | + if (isset($_COOKIE[$prefix . $name])) { |
|
| 107 | + return $_COOKIE[$prefix . $name]; |
|
| 108 | 108 | } |
| 109 | 109 | } |
| 110 | 110 | |
@@ -128,11 +128,11 @@ discard block |
||
| 128 | 128 | function delete_cookie($name, $domain = '', $path = '/', $prefix = '') |
| 129 | 129 | { |
| 130 | 130 | if ($prefix === '' && function_exists('config')) { |
| 131 | - $prefix = config()->offsetGet('cookie')[ 'prefix' ]; |
|
| 131 | + $prefix = config()->offsetGet('cookie')['prefix']; |
|
| 132 | 132 | } |
| 133 | 133 | |
| 134 | - if (isset($_COOKIE[ $prefix . $name ])) { |
|
| 135 | - unset($_COOKIE[ $prefix . $name ]); |
|
| 134 | + if (isset($_COOKIE[$prefix . $name])) { |
|
| 135 | + unset($_COOKIE[$prefix . $name]); |
|
| 136 | 136 | } |
| 137 | 137 | |
| 138 | 138 | return set_cookie($name, '', -1, $domain, $path, $prefix); |
@@ -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); |
@@ -63,7 +63,7 @@ |
||
| 63 | 63 | $this->path = PATH_CACHE . 'logs' . DIRECTORY_SEPARATOR; |
| 64 | 64 | } else { |
| 65 | 65 | $this->path = dirname( |
| 66 | - $_SERVER[ 'SCRIPT_FILENAME' ] |
|
| 66 | + $_SERVER['SCRIPT_FILENAME'] |
|
| 67 | 67 | ) . DIRECTORY_SEPARATOR . 'cache' . DIRECTORY_SEPARATOR . 'logs' . DIRECTORY_SEPARATOR; |
| 68 | 68 | } |
| 69 | 69 | |