@@ -97,7 +97,7 @@ discard block |
||
| 97 | 97 | { |
| 98 | 98 | return preg_replace_callback( |
| 99 | 99 | '#\b(?<![href|src]=[\'"])https?://[^\s()<>]+(?:\([\w\d]+\)|([^[:punct:]\s]|/))#', |
| 100 | - function ($matches) { |
|
| 100 | + function($matches) { |
|
| 101 | 101 | return "<a href=\'{$matches[0]}\'>{$matches[0]}</a>"; |
| 102 | 102 | }, |
| 103 | 103 | $text |
@@ -154,7 +154,7 @@ discard block |
||
| 154 | 154 | |
| 155 | 155 | return preg_replace_callback( |
| 156 | 156 | $patterns, |
| 157 | - function ($matches) { |
|
| 157 | + function($matches) { |
|
| 158 | 158 | switch ($matches[1]) { |
| 159 | 159 | |
| 160 | 160 | case 'FIGURE': |
@@ -201,7 +201,7 @@ discard block |
||
| 201 | 201 | $res[$match] = true; |
| 202 | 202 | } else { |
| 203 | 203 | $key = substr($match, 0, $pos); |
| 204 | - $val = trim(substr($match, $pos+1), '"'); |
|
| 204 | + $val = trim(substr($match, $pos + 1), '"'); |
|
| 205 | 205 | $res[$key] = $val; |
| 206 | 206 | } |
| 207 | 207 | } |
@@ -16,9 +16,9 @@ |
||
| 16 | 16 | * Properties |
| 17 | 17 | * |
| 18 | 18 | */ |
| 19 | - private $routes; // All the routes |
|
| 20 | - private $internalRoutes; // All internal routes |
|
| 21 | - private $defaultRoute = null; // A default rout to catch all |
|
| 19 | + private $routes; // All the routes |
|
| 20 | + private $internalRoutes; // All internal routes |
|
| 21 | + private $defaultRoute = null; // A default rout to catch all |
|
| 22 | 22 | |
| 23 | 23 | |
| 24 | 24 | |
@@ -13,8 +13,8 @@ |
||
| 13 | 13 | * Properties |
| 14 | 14 | * |
| 15 | 15 | */ |
| 16 | - private $name; // A name for this route |
|
| 17 | - private $rule; // The rule for this route |
|
| 16 | + private $name; // A name for this route |
|
| 17 | + private $rule; // The rule for this route |
|
| 18 | 18 | private $action; // The controller action to handle this route |
| 19 | 19 | |
| 20 | 20 | |
@@ -28,7 +28,7 @@ discard block |
||
| 28 | 28 | 'id' => null, |
| 29 | 29 | 'class' => null, |
| 30 | 30 | 'wrapper' => 'nav', |
| 31 | - 'create_url' => function ($url) { |
|
| 31 | + 'create_url' => function($url) { |
|
| 32 | 32 | return $url; |
| 33 | 33 | }, |
| 34 | 34 | ); |
@@ -36,7 +36,7 @@ discard block |
||
| 36 | 36 | |
| 37 | 37 | // Create the ul li menu from the array, use an anonomous recursive function that returns an |
| 38 | 38 | // array of values. |
| 39 | - $createMenu = function ($items, $callback) use (&$createMenu, $menu) { |
|
| 39 | + $createMenu = function($items, $callback) use (&$createMenu, $menu) { |
|
| 40 | 40 | |
| 41 | 41 | $html = null; |
| 42 | 42 | $hasItemIsSelected = false; |
@@ -68,7 +68,7 @@ discard block |
||
| 68 | 68 | } |
| 69 | 69 | |
| 70 | 70 | // Is there a class set for this item, then use it |
| 71 | - $class = isset($item['class']) && ! is_null($item['class']) |
|
| 71 | + $class = isset($item['class']) && !is_null($item['class']) |
|
| 72 | 72 | ? $item['class'] |
| 73 | 73 | : null; |
| 74 | 74 | |
@@ -96,7 +96,7 @@ discard block |
||
| 96 | 96 | |
| 97 | 97 | |
| 98 | 98 | // Set the id & class element, only if it exists in the menu-array |
| 99 | - $id = isset($menu['id']) ? " id='{$menu['id']}'" : null; |
|
| 99 | + $id = isset($menu['id']) ? " id='{$menu['id']}'" : null; |
|
| 100 | 100 | $class = isset($menu['class']) ? " class='{$menu['class']}'" : null; |
| 101 | 101 | $wrapper = $menu['wrapper']; |
| 102 | 102 | |
@@ -16,10 +16,10 @@ |
||
| 16 | 16 | * Properties |
| 17 | 17 | * |
| 18 | 18 | */ |
| 19 | - private $controllerName; // Name of controller |
|
| 20 | - private $controller; // Actual controller |
|
| 21 | - private $action; // Name of action |
|
| 22 | - private $params; // Params |
|
| 19 | + private $controllerName; // Name of controller |
|
| 20 | + private $controller; // Actual controller |
|
| 21 | + private $action; // Name of action |
|
| 22 | + private $params; // Params |
|
| 23 | 23 | |
| 24 | 24 | |
| 25 | 25 | |
@@ -88,7 +88,7 @@ |
||
| 88 | 88 | } |
| 89 | 89 | |
| 90 | 90 | $param = is_int($key) ? null : $val; |
| 91 | - $test = $tests[$rule]; |
|
| 91 | + $test = $tests[$rule]; |
|
| 92 | 92 | |
| 93 | 93 | if (is_callable($test['test'])) { |
| 94 | 94 | |
@@ -13,7 +13,7 @@ |
||
| 13 | 13 | * Properties |
| 14 | 14 | * |
| 15 | 15 | */ |
| 16 | - const URL_CLEAN = 'clean'; // controller/action/param1/param2 |
|
| 16 | + const URL_CLEAN = 'clean'; // controller/action/param1/param2 |
|
| 17 | 17 | const URL_APPEND = 'append'; // index.php/controller/action/param1/param2 |
| 18 | 18 | |
| 19 | 19 | private $urlType = self::URL_APPEND; // What type of urls to generate |
@@ -16,19 +16,19 @@ discard block |
||
| 16 | 16 | */ |
| 17 | 17 | private $requestUri; // Request URI from $_SERVER |
| 18 | 18 | private $scriptName; // Scriptname from $_SERVER, actual scriptname part |
| 19 | - private $path; // Scriptname from $_SERVER, path-part |
|
| 19 | + private $path; // Scriptname from $_SERVER, path-part |
|
| 20 | 20 | |
| 21 | - private $route; // The route |
|
| 21 | + private $route; // The route |
|
| 22 | 22 | private $routeParts; // The route as an array |
| 23 | 23 | |
| 24 | 24 | |
| 25 | 25 | private $currentUrl; // Current url |
| 26 | - private $siteUrl; // Url to this site, http://dbwebb.se |
|
| 27 | - private $baseUrl; // Url to root dir, siteUrl . /some/installation/directory/ |
|
| 26 | + private $siteUrl; // Url to this site, http://dbwebb.se |
|
| 27 | + private $baseUrl; // Url to root dir, siteUrl . /some/installation/directory/ |
|
| 28 | 28 | |
| 29 | 29 | private $server; // Mapped to $_SERVER |
| 30 | - private $get; // Mapped to $_GET |
|
| 31 | - private $post; // Mapped to $_POST |
|
| 30 | + private $get; // Mapped to $_GET |
|
| 31 | + private $post; // Mapped to $_POST |
|
| 32 | 32 | |
| 33 | 33 | |
| 34 | 34 | |
@@ -54,8 +54,8 @@ discard block |
||
| 54 | 54 | public function setGlobals($globals = []) |
| 55 | 55 | { |
| 56 | 56 | $this->server = isset($globals['server']) ? array_merge($_SERVER, $globals['server']) : $_SERVER; |
| 57 | - $this->get = isset($globals['get']) ? array_merge($_GET, $globals['get']) : $_GET; |
|
| 58 | - $this->post = isset($globals['post']) ? array_merge($_POST, $globals['post']) : $_POST; |
|
| 57 | + $this->get = isset($globals['get']) ? array_merge($_GET, $globals['get']) : $_GET; |
|
| 58 | + $this->post = isset($globals['post']) ? array_merge($_POST, $globals['post']) : $_POST; |
|
| 59 | 59 | } |
| 60 | 60 | |
| 61 | 61 | |
@@ -5,7 +5,7 @@ discard block |
||
| 5 | 5 | */ |
| 6 | 6 | |
| 7 | 7 | // Get environment & autoloader. |
| 8 | -require __DIR__.'/config.php'; |
|
| 8 | +require __DIR__ . '/config.php'; |
|
| 9 | 9 | |
| 10 | 10 | |
| 11 | 11 | |
@@ -31,7 +31,7 @@ discard block |
||
| 31 | 31 | |
| 32 | 32 | |
| 33 | 33 | // Create a default route to catch all |
| 34 | -$app->router->add('*', function () use ($app, $pages) { |
|
| 34 | +$app->router->add('*', function() use ($app, $pages) { |
|
| 35 | 35 | |
| 36 | 36 | // Get current route |
| 37 | 37 | $route = $app->request->getRoute(); |