@@ -8,7 +8,7 @@ |
||
| 8 | 8 | "ipHandler" => [ |
| 9 | 9 | "shared" => true, |
| 10 | 10 | "active" => false, |
| 11 | - "callback" => function () { |
|
| 11 | + "callback" => function() { |
|
| 12 | 12 | $ipHandler = new \Ylvan\Models\IpHandler(); |
| 13 | 13 | |
| 14 | 14 | return $ipHandler; |
@@ -8,5 +8,5 @@ |
||
| 8 | 8 | "basePath" => ANAX_INSTALL_PATH . "/cache/anax", |
| 9 | 9 | |
| 10 | 10 | // Default time to live until item expires |
| 11 | - "timeToLive" => 7 * 24 * 60 * 60, |
|
| 11 | + "timeToLive" => 7*24*60*60, |
|
| 12 | 12 | ]; |
@@ -16,21 +16,21 @@ discard block |
||
| 16 | 16 | [ |
| 17 | 17 | "info" => "Just say hi with a string.", |
| 18 | 18 | "path" => "hi", |
| 19 | - "handler" => function () { |
|
| 19 | + "handler" => function() { |
|
| 20 | 20 | return "Hi."; |
| 21 | 21 | }, |
| 22 | 22 | ], |
| 23 | 23 | [ |
| 24 | 24 | "info" => "Say No! with status code 500.", |
| 25 | 25 | "path" => "no", |
| 26 | - "handler" => function () { |
|
| 26 | + "handler" => function() { |
|
| 27 | 27 | return ["No!", 500]; |
| 28 | 28 | }, |
| 29 | 29 | ], |
| 30 | 30 | [ |
| 31 | 31 | "info" => "Say Hi through JSON.", |
| 32 | 32 | "path" => "json", |
| 33 | - "handler" => function () { |
|
| 33 | + "handler" => function() { |
|
| 34 | 34 | return [["message" => "Hi JSON"]]; |
| 35 | 35 | }, |
| 36 | 36 | ], |
@@ -47,28 +47,28 @@ discard block |
||
| 47 | 47 | [ |
| 48 | 48 | "info" => "Throw standard exception.", |
| 49 | 49 | "path" => "exception", |
| 50 | - "handler" => function () { |
|
| 50 | + "handler" => function() { |
|
| 51 | 51 | throw new \Exception("Standard \Exception"); |
| 52 | 52 | }, |
| 53 | 53 | ], |
| 54 | 54 | [ |
| 55 | 55 | "info" => "Try internal 403.", |
| 56 | 56 | "path" => "403", |
| 57 | - "handler" => function () { |
|
| 57 | + "handler" => function() { |
|
| 58 | 58 | throw new ForbiddenException("Detailed error message."); |
| 59 | 59 | }, |
| 60 | 60 | ], |
| 61 | 61 | [ |
| 62 | 62 | "info" => "Try internal 404.", |
| 63 | 63 | "path" => "404", |
| 64 | - "handler" => function () { |
|
| 64 | + "handler" => function() { |
|
| 65 | 65 | throw new NotFoundException("Detailed error message."); |
| 66 | 66 | }, |
| 67 | 67 | ], |
| 68 | 68 | [ |
| 69 | 69 | "info" => "Try internal 500.", |
| 70 | 70 | "path" => "500", |
| 71 | - "handler" => function () { |
|
| 71 | + "handler" => function() { |
|
| 72 | 72 | throw new InternalErrorException("Detailed error message."); |
| 73 | 73 | }, |
| 74 | 74 | ], |
@@ -13,7 +13,7 @@ |
||
| 13 | 13 | "info" => "Just say hi with a string.", |
| 14 | 14 | "method" => null, |
| 15 | 15 | "path" => "hi", |
| 16 | - "handler" => function () { |
|
| 16 | + "handler" => function() { |
|
| 17 | 17 | //echo "Ho"; |
| 18 | 18 | return "Hi."; |
| 19 | 19 | }, |
@@ -25,10 +25,10 @@ discard block |
||
| 25 | 25 | error_reporting(-1); // Report all type of errors |
| 26 | 26 | //error_reporting(E_ALL ^ E_DEPRECATED); // Report no deprecated errors |
| 27 | 27 | if (constant("ANAX_DEVELOPMENT")) { |
| 28 | - ini_set("display_errors", 1); // Display all errors |
|
| 28 | + ini_set("display_errors", 1); // Display all errors |
|
| 29 | 29 | } elseif (constant("ANAX_PRODUCTION")) { |
| 30 | - ini_set("display_errors", 0); // Display no errors |
|
| 31 | - ini_set("log_errors", 1); // Log errors to file error_log |
|
| 30 | + ini_set("display_errors", 0); // Display no errors |
|
| 31 | + ini_set("log_errors", 1); // Log errors to file error_log |
|
| 32 | 32 | ini_set("error_log", ANAX_INSTALL_PATH . "/log/error_log"); |
| 33 | 33 | } |
| 34 | 34 | |
@@ -37,7 +37,7 @@ discard block |
||
| 37 | 37 | /** |
| 38 | 38 | * Default exception handler. |
| 39 | 39 | */ |
| 40 | -set_exception_handler(function ($e) { |
|
| 40 | +set_exception_handler(function($e) { |
|
| 41 | 41 | echo "<p>Anax: Uncaught exception:</p><p>Line " |
| 42 | 42 | . $e->getLine() |
| 43 | 43 | . " in file " |
@@ -11,7 +11,7 @@ discard block |
||
| 11 | 11 | /** |
| 12 | 12 | * Custom exception handler. |
| 13 | 13 | */ |
| 14 | -set_exception_handler(function ($exception) { |
|
| 14 | +set_exception_handler(function($exception) { |
|
| 15 | 15 | errorPage( |
| 16 | 16 | "<p><b>img.php: Uncaught exception:</b> <p>" |
| 17 | 17 | . $exception->getMessage() |
@@ -28,7 +28,7 @@ discard block |
||
| 28 | 28 | * Get configuration options from file, if the file exists, else use $config |
| 29 | 29 | * if its defined or create an empty $config. |
| 30 | 30 | */ |
| 31 | -$configFile = __DIR__.'/'.basename(__FILE__, '.php').'_config.php'; |
|
| 31 | +$configFile = __DIR__ . '/' . basename(__FILE__, '.php') . '_config.php'; |
|
| 32 | 32 | |
| 33 | 33 | if (is_file($configFile)) { |
| 34 | 34 | $config = require $configFile; |
@@ -404,7 +404,7 @@ discard block |
||
| 404 | 404 | * Manage size constants from config file, use constants to replace values |
| 405 | 405 | * for width and height. |
| 406 | 406 | */ |
| 407 | -$sizeConstant = getConfig('size_constant', function () { |
|
| 407 | +$sizeConstant = getConfig('size_constant', function() { |
|
| 408 | 408 | |
| 409 | 409 | // Set sizes to map constant to value, easier to use with width or height |
| 410 | 410 | $sizes = array( |
@@ -418,7 +418,7 @@ discard block |
||
| 418 | 418 | $gridColumns = 24; |
| 419 | 419 | |
| 420 | 420 | for ($i = 1; $i <= $gridColumns; $i++) { |
| 421 | - $sizes['c' . $i] = ($gridColumnWidth + $gridGutterWidth) * $i - $gridGutterWidth; |
|
| 421 | + $sizes['c' . $i] = ($gridColumnWidth + $gridGutterWidth)*$i - $gridGutterWidth; |
|
| 422 | 422 | } |
| 423 | 423 | |
| 424 | 424 | return $sizes; |
@@ -440,7 +440,7 @@ discard block |
||
| 440 | 440 | } |
| 441 | 441 | |
| 442 | 442 | // Support width as % of original width |
| 443 | -if ($newWidth && $newWidth[strlen($newWidth)-1] == '%') { |
|
| 443 | +if ($newWidth && $newWidth[strlen($newWidth) - 1] == '%') { |
|
| 444 | 444 | is_numeric(substr($newWidth, 0, -1)) |
| 445 | 445 | or errorPage('Width % not numeric.', 404); |
| 446 | 446 | } else { |
@@ -465,7 +465,7 @@ discard block |
||
| 465 | 465 | } |
| 466 | 466 | |
| 467 | 467 | // height |
| 468 | -if ($newHeight && $newHeight[strlen($newHeight)-1] == '%') { |
|
| 468 | +if ($newHeight && $newHeight[strlen($newHeight) - 1] == '%') { |
|
| 469 | 469 | is_numeric(substr($newHeight, 0, -1)) |
| 470 | 470 | or errorPage('Height % out of range.', 404); |
| 471 | 471 | } else { |
@@ -482,7 +482,7 @@ discard block |
||
| 482 | 482 | * aspect-ratio, ar - affecting the resulting image width, height and resize options |
| 483 | 483 | */ |
| 484 | 484 | $aspectRatio = get(array('aspect-ratio', 'ar')); |
| 485 | -$aspectRatioConstant = getConfig('aspect_ratio_constant', function () { |
|
| 485 | +$aspectRatioConstant = getConfig('aspect_ratio_constant', function() { |
|
| 486 | 486 | return array( |
| 487 | 487 | '3:1' => 3/1, |
| 488 | 488 | '3:2' => 3/2, |
@@ -504,7 +504,7 @@ discard block |
||
| 504 | 504 | } |
| 505 | 505 | |
| 506 | 506 | if ($negateAspectRatio) { |
| 507 | - $aspectRatio = 1 / $aspectRatio; |
|
| 507 | + $aspectRatio = 1/$aspectRatio; |
|
| 508 | 508 | } |
| 509 | 509 | |
| 510 | 510 | is_null($aspectRatio) |
@@ -568,7 +568,7 @@ discard block |
||
| 568 | 568 | if ($fillToFit !== null) { |
| 569 | 569 | |
| 570 | 570 | if (!empty($fillToFit)) { |
| 571 | - $bgColor = $fillToFit; |
|
| 571 | + $bgColor = $fillToFit; |
|
| 572 | 572 | verbose("fillToFit changed bgColor to = $bgColor"); |
| 573 | 573 | } |
| 574 | 574 | |
@@ -72,7 +72,7 @@ discard block |
||
| 72 | 72 | Luftfuktighet: <?= json_encode($data["humidity"]) ?>% |
| 73 | 73 | Vindstyrka: <?= json_encode($data["wind_speed"]) ?> m/s |
| 74 | 74 | </p> |
| 75 | - <?php endforeach;?> |
|
| 75 | + <?php endforeach; ?> |
|
| 76 | 76 | <?php endif; ?> |
| 77 | 77 | |
| 78 | 78 | |
@@ -91,7 +91,7 @@ discard block |
||
| 91 | 91 | <br> |
| 92 | 92 | Vindstyrka: <?= json_encode($data["current"]["wind_speed"]) ?> m/s |
| 93 | 93 | </p> |
| 94 | - <?php endforeach;?> |
|
| 94 | + <?php endforeach; ?> |
|
| 95 | 95 | <?php endif; ?> |
| 96 | 96 | |
| 97 | 97 | |
@@ -9,7 +9,7 @@ discard block |
||
| 9 | 9 | */ |
| 10 | 10 | class WeatherHandler |
| 11 | 11 | { |
| 12 | - private $accessKey='31e4a45c184fb9ee516a7e276edafb79'; |
|
| 12 | + private $accessKey = '31e4a45c184fb9ee516a7e276edafb79'; |
|
| 13 | 13 | |
| 14 | 14 | |
| 15 | 15 | /** |
@@ -173,7 +173,7 @@ discard block |
||
| 173 | 173 | $key = $this->accessKey; |
| 174 | 174 | |
| 175 | 175 | // {layer}/{z}/{x}/{y}.png?appid={API key} |
| 176 | - $params = 'clouds_new/3/'.$lat.'/'.$long.'.png?'; |
|
| 176 | + $params = 'clouds_new/3/' . $lat . '/' . $long . '.png?'; |
|
| 177 | 177 | |
| 178 | 178 | try { |
| 179 | 179 | // Initialize CURL: |
@@ -28,7 +28,7 @@ discard block |
||
| 28 | 28 | $latitude = $userPosition['latitude']; |
| 29 | 29 | $longitude = $userPosition['longitude']; |
| 30 | 30 | $city = $userPosition['city']; |
| 31 | - $coordinates = 'Latitude: '.$latitude . ' ' . 'Longitude: ' . $longitude; |
|
| 31 | + $coordinates = 'Latitude: ' . $latitude . ' ' . 'Longitude: ' . $longitude; |
|
| 32 | 32 | |
| 33 | 33 | $ipv4 = $ip->ipv4($userIp); |
| 34 | 34 | $ipv6 = $ip->ipv6($userIp); |
@@ -41,7 +41,7 @@ discard block |
||
| 41 | 41 | $latitude = $ipPosition['latitude']; |
| 42 | 42 | $longitude = $ipPosition['longitude']; |
| 43 | 43 | $city = $ipPosition['city']; |
| 44 | - $coordinates = 'Latitude: '.$latitude . ' ' . 'Longitude: ' . $longitude; |
|
| 44 | + $coordinates = 'Latitude: ' . $latitude . ' ' . 'Longitude: ' . $longitude; |
|
| 45 | 45 | } |
| 46 | 46 | |
| 47 | 47 | $page->add("ip/location", [ |