@@ -2,15 +2,15 @@ discard block |
||
| 2 | 2 | define('ROOT', "../"); |
| 3 | 3 | define('EXTRACT_DIRECTORY', "../composer"); |
| 4 | 4 | |
| 5 | -if(file_exists(ROOT.'vendor')) { |
|
| 5 | +if (file_exists(ROOT . 'vendor')) { |
|
| 6 | 6 | return header("Refresh:0; url=/"); |
| 7 | 7 | } |
| 8 | 8 | |
| 9 | -if (file_exists(EXTRACT_DIRECTORY.'/vendor/autoload.php') == true) { |
|
| 9 | +if (file_exists(EXTRACT_DIRECTORY . '/vendor/autoload.php') == true) { |
|
| 10 | 10 | echo "Extracted autoload already exists. Skipping phar extraction as presumably it's already extracted."; |
| 11 | 11 | } |
| 12 | -else{ |
|
| 13 | - $composerPhar = ROOT.'composer.phar'; |
|
| 12 | +else { |
|
| 13 | + $composerPhar = ROOT . 'composer.phar'; |
|
| 14 | 14 | if (!file_exists($composerPhar)) { |
| 15 | 15 | $composer = file_get_contents('https://getcomposer.org/download/latest-stable/composer.phar'); |
| 16 | 16 | file_put_contents($composerPhar, $composer); |
@@ -19,7 +19,7 @@ discard block |
||
| 19 | 19 | $composerExtract->extractTo(EXTRACT_DIRECTORY); |
| 20 | 20 | } |
| 21 | 21 | |
| 22 | -require_once (EXTRACT_DIRECTORY.'/vendor/autoload.php'); |
|
| 22 | +require_once (EXTRACT_DIRECTORY . '/vendor/autoload.php'); |
|
| 23 | 23 | |
| 24 | 24 | //Use the Composer classes |
| 25 | 25 | use Composer\Console\Application; |
@@ -1,6 +1,6 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | // Check if vendor folder exist |
| 3 | -if(file_exists(__DIR__ . '/../vendor')) { |
|
| 3 | +if (file_exists(__DIR__ . '/../vendor')) { |
|
| 4 | 4 | (require __DIR__ . '/../src/start.php')->run(); |
| 5 | 5 | } else { |
| 6 | 6 | ?> |
@@ -37,7 +37,7 @@ discard block |
||
| 37 | 37 | $container->set('themesdir', __DIR__ . '/../public/themes/'); |
| 38 | 38 | |
| 39 | 39 | // Set settings array in container for use in all routes |
| 40 | -$container->set('settings', function () { |
|
| 40 | +$container->set('settings', function() { |
|
| 41 | 41 | $config = file_get_contents(__DIR__ . '/../config/config.json'); |
| 42 | 42 | $settings = json_decode($config, true); |
| 43 | 43 | return $settings; |
@@ -72,7 +72,7 @@ discard block |
||
| 72 | 72 | mkdir($container->get('cachedir'), 0755, true); |
| 73 | 73 | } else { |
| 74 | 74 | // Flush Cache folder if disabled |
| 75 | - if ((file_exists($container->get('cachedir'))) && ($settings["devMode"] == true )) { |
|
| 75 | + if ((file_exists($container->get('cachedir'))) && ($settings["devMode"] == true)) { |
|
| 76 | 76 | $path = $container->get('cachedir'); |
| 77 | 77 | $files = glob($path . '/*'); |
| 78 | 78 | foreach ($files as $file) { |
@@ -86,7 +86,7 @@ discard block |
||
| 86 | 86 | AppFactory::setContainer($container); |
| 87 | 87 | |
| 88 | 88 | // Set Twig engine for templating |
| 89 | -$container->set('view', function () { |
|
| 89 | +$container->set('view', function() { |
|
| 90 | 90 | $settings = json_decode(file_get_contents(__DIR__ . '/../config/config.json'), true); |
| 91 | 91 | $tpls = [ |
| 92 | 92 | __DIR__ . "/../resources/views/", |
@@ -114,7 +114,7 @@ discard block |
||
| 114 | 114 | }); |
| 115 | 115 | |
| 116 | 116 | //Set Session engine |
| 117 | -$container->set('session', function () { |
|
| 117 | +$container->set('session', function() { |
|
| 118 | 118 | return new \SlimSession\Helper(); |
| 119 | 119 | }); |
| 120 | 120 | |
@@ -185,7 +185,7 @@ discard block |
||
| 185 | 185 | |
| 186 | 186 | foreach ($pages as $page) { |
| 187 | 187 | $route = substr($page, 0, strrpos($page, ".")); |
| 188 | - $app->get('/' . $route, function ($request, $response) { |
|
| 188 | + $app->get('/' . $route, function($request, $response) { |
|
| 189 | 189 | $settings = $this->get('settings'); |
| 190 | 190 | $uri = $request->getUri(); |
| 191 | 191 | $route = substr(strrchr($uri, "/"), 1); |