@@ -106,7 +106,7 @@ discard block |
||
106 | 106 | $loopThrough = []; |
107 | 107 | |
108 | 108 | foreach ($offset as $key) { |
109 | - $loopThrough[ $key ] = $this->filter($type, $key, $filter); |
|
109 | + $loopThrough[$key] = $this->filter($type, $key, $filter); |
|
110 | 110 | } |
111 | 111 | |
112 | 112 | if (empty($loopThrough)) { |
@@ -120,38 +120,38 @@ discard block |
||
120 | 120 | // of the simpler filter_input(); |
121 | 121 | switch ($type) { |
122 | 122 | case INPUT_GET: |
123 | - $value = isset($_GET[ $offset ]) |
|
124 | - ? $_GET[ $offset ] |
|
123 | + $value = isset($_GET[$offset]) |
|
124 | + ? $_GET[$offset] |
|
125 | 125 | : null; |
126 | 126 | break; |
127 | 127 | case INPUT_POST: |
128 | - $value = isset($_POST[ $offset ]) |
|
129 | - ? $_POST[ $offset ] |
|
128 | + $value = isset($_POST[$offset]) |
|
129 | + ? $_POST[$offset] |
|
130 | 130 | : null; |
131 | 131 | break; |
132 | 132 | case INPUT_SERVER: |
133 | - $value = isset($_SERVER[ $offset ]) |
|
134 | - ? $_SERVER[ $offset ] |
|
133 | + $value = isset($_SERVER[$offset]) |
|
134 | + ? $_SERVER[$offset] |
|
135 | 135 | : null; |
136 | 136 | break; |
137 | 137 | case INPUT_ENV: |
138 | - $value = isset($_ENV[ $offset ]) |
|
139 | - ? $_ENV[ $offset ] |
|
138 | + $value = isset($_ENV[$offset]) |
|
139 | + ? $_ENV[$offset] |
|
140 | 140 | : null; |
141 | 141 | break; |
142 | 142 | case INPUT_COOKIE: |
143 | - $value = isset($_COOKIE[ $offset ]) |
|
144 | - ? $_COOKIE[ $offset ] |
|
143 | + $value = isset($_COOKIE[$offset]) |
|
144 | + ? $_COOKIE[$offset] |
|
145 | 145 | : null; |
146 | 146 | break; |
147 | 147 | case INPUT_REQUEST: |
148 | - $value = isset($_REQUEST[ $offset ]) |
|
149 | - ? $_REQUEST[ $offset ] |
|
148 | + $value = isset($_REQUEST[$offset]) |
|
149 | + ? $_REQUEST[$offset] |
|
150 | 150 | : null; |
151 | 151 | break; |
152 | 152 | case INPUT_SESSION: |
153 | - $value = isset($_SESSION[ $offset ]) |
|
154 | - ? $_SESSION[ $offset ] |
|
153 | + $value = isset($_SESSION[$offset]) |
|
154 | + ? $_SESSION[$offset] |
|
155 | 155 | : null; |
156 | 156 | break; |
157 | 157 | default: |
@@ -210,13 +210,13 @@ discard block |
||
210 | 210 | { |
211 | 211 | foreach ($data as $key => $value) { |
212 | 212 | if (is_array($value) AND is_array($filter)) { |
213 | - $data[ $key ] = filter_var_array($value, $filter); |
|
213 | + $data[$key] = filter_var_array($value, $filter); |
|
214 | 214 | } elseif (is_array($value)) { |
215 | - $data[ $key ] = $this->filterRecursive($value, $filter); |
|
215 | + $data[$key] = $this->filterRecursive($value, $filter); |
|
216 | 216 | } elseif (isset($filter)) { |
217 | - $data[ $key ] = filter_var($value, $filter); |
|
217 | + $data[$key] = filter_var($value, $filter); |
|
218 | 218 | } else { |
219 | - $data[ $key ] = $value; |
|
219 | + $data[$key] = $value; |
|
220 | 220 | } |
221 | 221 | } |
222 | 222 | |
@@ -260,12 +260,12 @@ discard block |
||
260 | 260 | */ |
261 | 261 | final public function argv($offset = null, $filter = null) |
262 | 262 | { |
263 | - $arguments = $_SERVER[ 'argv' ]; |
|
264 | - $numArguments = $_SERVER[ 'argc' ]; |
|
263 | + $arguments = $_SERVER['argv']; |
|
264 | + $numArguments = $_SERVER['argc']; |
|
265 | 265 | |
266 | 266 | $argv = []; |
267 | 267 | for ($i = 1; $i < $numArguments; $i++) { |
268 | - $optionCommand = trim($arguments[ $i ]); |
|
268 | + $optionCommand = trim($arguments[$i]); |
|
269 | 269 | $optionValue = true; |
270 | 270 | |
271 | 271 | if (empty($optionCommand)) { |
@@ -276,10 +276,10 @@ discard block |
||
276 | 276 | $xOptionCommand = explode('=', $optionCommand); |
277 | 277 | $xOptionCommand = array_map('trim', $xOptionCommand); |
278 | 278 | |
279 | - $optionCommand = str_replace(['-', '--'], '', $xOptionCommand[ 0 ]); |
|
280 | - $optionValue = $xOptionCommand[ 1 ]; |
|
279 | + $optionCommand = str_replace(['-', '--'], '', $xOptionCommand[0]); |
|
280 | + $optionValue = $xOptionCommand[1]; |
|
281 | 281 | |
282 | - $argv[ $optionCommand ] = $optionValue; |
|
282 | + $argv[$optionCommand] = $optionValue; |
|
283 | 283 | continue; |
284 | 284 | } |
285 | 285 | |
@@ -288,14 +288,14 @@ discard block |
||
288 | 288 | ) { |
289 | 289 | $optionCommand = str_replace(['-', '--'], '', $optionCommand); |
290 | 290 | |
291 | - if (isset($arguments[ $i + 1 ])) { |
|
292 | - $nextOptionCommand = $arguments[ $i + 1 ]; |
|
291 | + if (isset($arguments[$i + 1])) { |
|
292 | + $nextOptionCommand = $arguments[$i + 1]; |
|
293 | 293 | |
294 | 294 | if (strpos($nextOptionCommand, '--') === false |
295 | 295 | || strpos($nextOptionCommand, '-') === false |
296 | 296 | ) { |
297 | 297 | $optionValue = $nextOptionCommand; |
298 | - $arguments[ $i + 1 ] = null; |
|
298 | + $arguments[$i + 1] = null; |
|
299 | 299 | } |
300 | 300 | } |
301 | 301 | } |
@@ -306,13 +306,13 @@ discard block |
||
306 | 306 | $optionValue = filter_var($optionValue, FILTER_DEFAULT); |
307 | 307 | } |
308 | 308 | |
309 | - $argv[ $optionCommand ] = $optionValue; |
|
309 | + $argv[$optionCommand] = $optionValue; |
|
310 | 310 | } |
311 | 311 | |
312 | 312 | if (empty($offset)) { |
313 | 313 | return $argv; |
314 | - } elseif (isset($argv[ $offset ])) { |
|
315 | - return $argv[ $offset ]; |
|
314 | + } elseif (isset($argv[$offset])) { |
|
315 | + return $argv[$offset]; |
|
316 | 316 | } |
317 | 317 | } |
318 | 318 | |
@@ -327,8 +327,8 @@ discard block |
||
327 | 327 | |
328 | 328 | public function getApp() |
329 | 329 | { |
330 | - return isset($_SERVER[ 'argv' ][ 0 ]) |
|
331 | - ? $_SERVER[ 'argv' ][ 0 ] |
|
330 | + return isset($_SERVER['argv'][0]) |
|
331 | + ? $_SERVER['argv'][0] |
|
332 | 332 | : false; |
333 | 333 | } |
334 | 334 | |
@@ -336,8 +336,8 @@ discard block |
||
336 | 336 | |
337 | 337 | public function getCommand() |
338 | 338 | { |
339 | - return isset($_SERVER[ 'argv' ][ 1 ]) |
|
340 | - ? $_SERVER[ 'argv' ][ 1 ] |
|
339 | + return isset($_SERVER['argv'][1]) |
|
340 | + ? $_SERVER['argv'][1] |
|
341 | 341 | : false; |
342 | 342 | } |
343 | 343 | |
@@ -345,13 +345,13 @@ discard block |
||
345 | 345 | |
346 | 346 | public function getOptions($offset = null, $filter = null) |
347 | 347 | { |
348 | - $arguments = $_SERVER[ 'argv' ]; |
|
349 | - $numArguments = $_SERVER[ 'argc' ]; |
|
348 | + $arguments = $_SERVER['argv']; |
|
349 | + $numArguments = $_SERVER['argc']; |
|
350 | 350 | |
351 | 351 | $argv = []; |
352 | 352 | |
353 | 353 | for ($i = 2; $i < $numArguments; $i++) { |
354 | - $optionCommand = trim($arguments[ $i ]); |
|
354 | + $optionCommand = trim($arguments[$i]); |
|
355 | 355 | $optionValue = true; |
356 | 356 | |
357 | 357 | if (empty($optionCommand)) { |
@@ -362,10 +362,10 @@ discard block |
||
362 | 362 | $xOptionCommand = explode('=', $optionCommand); |
363 | 363 | $xOptionCommand = array_map('trim', $xOptionCommand); |
364 | 364 | |
365 | - $optionCommand = str_replace(['-', '--'], '', $xOptionCommand[ 0 ]); |
|
366 | - $optionValue = $xOptionCommand[ 1 ]; |
|
365 | + $optionCommand = str_replace(['-', '--'], '', $xOptionCommand[0]); |
|
366 | + $optionValue = $xOptionCommand[1]; |
|
367 | 367 | |
368 | - $argv[ $optionCommand ] = $optionValue; |
|
368 | + $argv[$optionCommand] = $optionValue; |
|
369 | 369 | continue; |
370 | 370 | } |
371 | 371 | |
@@ -374,14 +374,14 @@ discard block |
||
374 | 374 | ) { |
375 | 375 | $optionCommand = str_replace(['-', '--'], '', $optionCommand); |
376 | 376 | |
377 | - if (isset($arguments[ $i + 1 ])) { |
|
378 | - $nextOptionCommand = $arguments[ $i + 1 ]; |
|
377 | + if (isset($arguments[$i + 1])) { |
|
378 | + $nextOptionCommand = $arguments[$i + 1]; |
|
379 | 379 | |
380 | 380 | if (strpos($nextOptionCommand, '--') === false |
381 | 381 | || strpos($nextOptionCommand, '-') === false |
382 | 382 | ) { |
383 | 383 | $optionValue = $nextOptionCommand; |
384 | - $arguments[ $i + 1 ] = null; |
|
384 | + $arguments[$i + 1] = null; |
|
385 | 385 | } |
386 | 386 | } |
387 | 387 | } |
@@ -392,13 +392,13 @@ discard block |
||
392 | 392 | $optionValue = filter_var($optionValue, FILTER_DEFAULT); |
393 | 393 | } |
394 | 394 | |
395 | - $argv[ $optionCommand ] = $optionValue; |
|
395 | + $argv[$optionCommand] = $optionValue; |
|
396 | 396 | } |
397 | 397 | |
398 | 398 | if (empty($offset)) { |
399 | 399 | return $argv; |
400 | - } elseif (isset($argv[ $offset ])) { |
|
401 | - return $argv[ $offset ]; |
|
400 | + } elseif (isset($argv[$offset])) { |
|
401 | + return $argv[$offset]; |
|
402 | 402 | } |
403 | 403 | } |
404 | 404 |
@@ -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); |
@@ -502,14 +502,18 @@ |
||
502 | 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 | { |
507 | 508 | $headers[ $key ] .= "\r\n\t" . trim($h[ 0 ]); |
509 | + } |
|
508 | 510 | } // [+] |
509 | - elseif ( ! $key) // [+] |
|
511 | + elseif ( ! $key) { |
|
512 | + // [+] |
|
510 | 513 | { |
511 | 514 | $headers[ 0 ] = trim($h[ 0 ]); |
512 | 515 | } |
516 | + } |
|
513 | 517 | trim($h[ 0 ]); // [+] |
514 | 518 | } // [+] |
515 | 519 | } |
@@ -10,7 +10,7 @@ discard block |
||
10 | 10 | */ |
11 | 11 | // ------------------------------------------------------------------------ |
12 | 12 | |
13 | -if (!function_exists('kernel')) { |
|
13 | +if ( ! function_exists('kernel')) { |
|
14 | 14 | /** |
15 | 15 | * kernel |
16 | 16 | * |
@@ -31,7 +31,7 @@ discard block |
||
31 | 31 | // ------------------------------------------------------------------------ |
32 | 32 | |
33 | 33 | |
34 | -if (!function_exists('services')) { |
|
34 | +if ( ! function_exists('services')) { |
|
35 | 35 | /** |
36 | 36 | * services |
37 | 37 | * |
@@ -45,7 +45,7 @@ discard block |
||
45 | 45 | |
46 | 46 | if (count($args)) { |
47 | 47 | if (kernel()->services->has($args[0])) { |
48 | - if(isset($args[1]) and is_array($args[1])) { |
|
48 | + if (isset($args[1]) and is_array($args[1])) { |
|
49 | 49 | return kernel()->services->get($args[0], $args[1]); |
50 | 50 | } |
51 | 51 | return kernel()->services->get($args[0]); |
@@ -60,7 +60,7 @@ discard block |
||
60 | 60 | |
61 | 61 | // ------------------------------------------------------------------------ |
62 | 62 | |
63 | -if (!function_exists('profiler')) { |
|
63 | +if ( ! function_exists('profiler')) { |
|
64 | 64 | /** |
65 | 65 | * profiler |
66 | 66 | * |
@@ -76,7 +76,7 @@ discard block |
||
76 | 76 | |
77 | 77 | // ------------------------------------------------------------------------ |
78 | 78 | |
79 | -if (!function_exists('language')) { |
|
79 | +if ( ! function_exists('language')) { |
|
80 | 80 | /** |
81 | 81 | * language |
82 | 82 | * |
@@ -90,7 +90,7 @@ discard block |
||
90 | 90 | |
91 | 91 | if (count($args)) { |
92 | 92 | if (services()->has('language')) { |
93 | - $language =& kernel()->services->get('language'); |
|
93 | + $language = & kernel()->services->get('language'); |
|
94 | 94 | |
95 | 95 | return call_user_func_array([&$language, 'getLine'], $args); |
96 | 96 | } |
@@ -104,7 +104,7 @@ discard block |
||
104 | 104 | |
105 | 105 | // ------------------------------------------------------------------------ |
106 | 106 | |
107 | -if (!function_exists('logger')) { |
|
107 | +if ( ! function_exists('logger')) { |
|
108 | 108 | /** |
109 | 109 | * logger |
110 | 110 | * |
@@ -118,7 +118,7 @@ discard block |
||
118 | 118 | |
119 | 119 | if (count($args)) { |
120 | 120 | if (services()->has('logger')) { |
121 | - $logger =& services('logger'); |
|
121 | + $logger = & services('logger'); |
|
122 | 122 | |
123 | 123 | return call_user_func_array([&$logger, 'log'], $args); |
124 | 124 | } |
@@ -132,7 +132,7 @@ discard block |
||
132 | 132 | |
133 | 133 | // ------------------------------------------------------------------------ |
134 | 134 | |
135 | -if (!function_exists('shutdown')) { |
|
135 | +if ( ! function_exists('shutdown')) { |
|
136 | 136 | /** |
137 | 137 | * shutdown |
138 | 138 | * |
@@ -148,7 +148,7 @@ discard block |
||
148 | 148 | |
149 | 149 | // ------------------------------------------------------------------------ |
150 | 150 | |
151 | -if (!function_exists('input')) { |
|
151 | +if ( ! function_exists('input')) { |
|
152 | 152 | /** |
153 | 153 | * input |
154 | 154 | * |
@@ -164,7 +164,7 @@ discard block |
||
164 | 164 | |
165 | 165 | // ------------------------------------------------------------------------ |
166 | 166 | |
167 | -if (!function_exists('output')) { |
|
167 | +if ( ! function_exists('output')) { |
|
168 | 168 | /** |
169 | 169 | * output |
170 | 170 | * |
@@ -180,7 +180,7 @@ discard block |
||
180 | 180 | |
181 | 181 | // ------------------------------------------------------------------------ |
182 | 182 | |
183 | -if (!function_exists('server_request')) { |
|
183 | +if ( ! function_exists('server_request')) { |
|
184 | 184 | /** |
185 | 185 | * server_request |
186 | 186 | * |
@@ -191,13 +191,13 @@ discard block |
||
191 | 191 | function server_request() |
192 | 192 | { |
193 | 193 | if (function_exists('o2system')) { |
194 | - if (!services()->has('serverRequest')) { |
|
194 | + if ( ! services()->has('serverRequest')) { |
|
195 | 195 | services()->load(new \O2System\Kernel\Http\Message\ServerRequest(), 'serverRequest'); |
196 | 196 | } |
197 | 197 | |
198 | 198 | return services('serverRequest'); |
199 | 199 | } else { |
200 | - if (!services()->has('serverRequest')) { |
|
200 | + if ( ! services()->has('serverRequest')) { |
|
201 | 201 | services()->load(new \O2System\Kernel\Http\Message\ServerRequest(), 'serverRequest'); |
202 | 202 | } |
203 | 203 | |
@@ -208,7 +208,7 @@ discard block |
||
208 | 208 | |
209 | 209 | // ------------------------------------------------------------------------ |
210 | 210 | |
211 | -if (!function_exists('globals')) { |
|
211 | +if ( ! function_exists('globals')) { |
|
212 | 212 | /** |
213 | 213 | * globals |
214 | 214 | * |
@@ -242,7 +242,7 @@ discard block |
||
242 | 242 | |
243 | 243 | // ------------------------------------------------------------------------ |
244 | 244 | |
245 | -if (!function_exists('env')) { |
|
245 | +if ( ! function_exists('env')) { |
|
246 | 246 | /** |
247 | 247 | * env |
248 | 248 | * |
@@ -34,14 +34,14 @@ discard block |
||
34 | 34 | public function load($service, $offset = null) |
35 | 35 | { |
36 | 36 | if (is_string($service)) { |
37 | - if(class_exists('O2System\Framework', false)) { |
|
37 | + if (class_exists('O2System\Framework', false)) { |
|
38 | 38 | $className = str_replace( |
39 | - ['App\\','App\Kernel\\','O2System\Framework\\','O2System\Kernel\\'], |
|
39 | + ['App\\', 'App\Kernel\\', 'O2System\Framework\\', 'O2System\Kernel\\'], |
|
40 | 40 | '', |
41 | 41 | $service |
42 | 42 | ); |
43 | 43 | |
44 | - foreach(['App\\','App\Kernel\\','O2System\Framework\\','O2System\Kernel\\'] as $namespace) { |
|
44 | + foreach (['App\\', 'App\Kernel\\', 'O2System\Framework\\', 'O2System\Kernel\\'] as $namespace) { |
|
45 | 45 | if (class_exists($namespace . $className)) { |
46 | 46 | $service = $namespace . $className; |
47 | 47 | break; |
@@ -54,7 +54,7 @@ discard block |
||
54 | 54 | } |
55 | 55 | } |
56 | 56 | |
57 | - if($service instanceof SplServiceRegistry) { |
|
57 | + if ($service instanceof SplServiceRegistry) { |
|
58 | 58 | if (profiler() !== false) { |
59 | 59 | profiler()->watch('Load New Service: ' . $service->getClassName()); |
60 | 60 | } |
@@ -99,7 +99,7 @@ discard block |
||
99 | 99 | */ |
100 | 100 | public function offsetExists($offset) |
101 | 101 | { |
102 | - return isset($GLOBALS[ $offset ]); |
|
102 | + return isset($GLOBALS[$offset]); |
|
103 | 103 | } |
104 | 104 | |
105 | 105 | // ------------------------------------------------------------------------ |
@@ -116,7 +116,7 @@ discard block |
||
116 | 116 | */ |
117 | 117 | public function &__get($offset) |
118 | 118 | { |
119 | - return $GLOBALS[ $offset ]; |
|
119 | + return $GLOBALS[$offset]; |
|
120 | 120 | } |
121 | 121 | |
122 | 122 | // ------------------------------------------------------------------------ |
@@ -172,7 +172,7 @@ discard block |
||
172 | 172 | */ |
173 | 173 | public function offsetSet($offset, $value) |
174 | 174 | { |
175 | - $GLOBALS[ $offset ] = $value; |
|
175 | + $GLOBALS[$offset] = $value; |
|
176 | 176 | } |
177 | 177 | |
178 | 178 | // ------------------------------------------------------------------------ |
@@ -225,8 +225,8 @@ discard block |
||
225 | 225 | */ |
226 | 226 | public function offsetUnset($offset) |
227 | 227 | { |
228 | - if (isset($GLOBALS[ $offset ])) { |
|
229 | - unset($GLOBALS[ $offset ]); |
|
228 | + if (isset($GLOBALS[$offset])) { |
|
229 | + unset($GLOBALS[$offset]); |
|
230 | 230 | } |
231 | 231 | } |
232 | 232 | |
@@ -421,6 +421,6 @@ discard block |
||
421 | 421 | */ |
422 | 422 | public function offsetGet($offset) |
423 | 423 | { |
424 | - return (isset($GLOBALS[ $offset ])) ? $GLOBALS[ $offset ] : false; |
|
424 | + return (isset($GLOBALS[$offset])) ? $GLOBALS[$offset] : false; |
|
425 | 425 | } |
426 | 426 | } |
427 | 427 | \ No newline at end of file |
@@ -99,7 +99,7 @@ discard block |
||
99 | 99 | */ |
100 | 100 | public function offsetExists($offset) |
101 | 101 | { |
102 | - return isset($_ENV[ $offset ]); |
|
102 | + return isset($_ENV[$offset]); |
|
103 | 103 | } |
104 | 104 | |
105 | 105 | // ------------------------------------------------------------------------ |
@@ -116,7 +116,7 @@ discard block |
||
116 | 116 | */ |
117 | 117 | public function &__get($offset) |
118 | 118 | { |
119 | - return $_ENV[ $offset ]; |
|
119 | + return $_ENV[$offset]; |
|
120 | 120 | } |
121 | 121 | |
122 | 122 | // ------------------------------------------------------------------------ |
@@ -172,7 +172,7 @@ discard block |
||
172 | 172 | */ |
173 | 173 | public function offsetSet($offset, $value) |
174 | 174 | { |
175 | - $_ENV[ $offset ] = $value; |
|
175 | + $_ENV[$offset] = $value; |
|
176 | 176 | } |
177 | 177 | |
178 | 178 | // ------------------------------------------------------------------------ |
@@ -225,8 +225,8 @@ discard block |
||
225 | 225 | */ |
226 | 226 | public function offsetUnset($offset) |
227 | 227 | { |
228 | - if (isset($_ENV[ $offset ])) { |
|
229 | - unset($_ENV[ $offset ]); |
|
228 | + if (isset($_ENV[$offset])) { |
|
229 | + unset($_ENV[$offset]); |
|
230 | 230 | } |
231 | 231 | } |
232 | 232 | |
@@ -421,6 +421,6 @@ discard block |
||
421 | 421 | */ |
422 | 422 | public function offsetGet($offset) |
423 | 423 | { |
424 | - return (isset($_ENV[ $offset ])) ? $_ENV[ $offset ] : false; |
|
424 | + return (isset($_ENV[$offset])) ? $_ENV[$offset] : false; |
|
425 | 425 | } |
426 | 426 | } |
427 | 427 | \ No newline at end of file |