From 0d4b62ffb9edb1b0b839189e2e45543946120473 Mon Sep 17 00:00:00 2001 From: Nick Yeoman Date: Fri, 27 Sep 2024 12:58:19 -0700 Subject: [PATCH] updated defaults from examples --- defaults/App/config.php | 11 +++++++++++ {examples => defaults}/App/controllers/404.php | 1 + .../App/controllers/index.php | 0 {examples => defaults}/App/routes.php | 0 .../App/templates/override.html.twig | 0 .../App/views/index.html.twig | 0 {examples => defaults}/public/.htaccess | 0 {examples => defaults}/public/index.php | 0 src/Router.php | 15 ++++++++++++--- src/novaconium.php | 18 +++++++++++++----- 10 files changed, 37 insertions(+), 8 deletions(-) create mode 100644 defaults/App/config.php rename {examples => defaults}/App/controllers/404.php (80%) rename {examples => defaults}/App/controllers/index.php (100%) rename {examples => defaults}/App/routes.php (100%) rename {examples => defaults}/App/templates/override.html.twig (100%) rename {examples => defaults}/App/views/index.html.twig (100%) rename {examples => defaults}/public/.htaccess (100%) rename {examples => defaults}/public/index.php (100%) diff --git a/defaults/App/config.php b/defaults/App/config.php new file mode 100644 index 0000000..cbc7c23 --- /dev/null +++ b/defaults/App/config.php @@ -0,0 +1,11 @@ + [ + 'host' => '', + 'name' => '', + 'user' => '', + 'pass' => '', + 'port' => 3306 + ], + 'base_url' => 'http://localhost:8000' +]; diff --git a/examples/App/controllers/404.php b/defaults/App/controllers/404.php similarity index 80% rename from examples/App/controllers/404.php rename to defaults/App/controllers/404.php index 54012dd..6d08c22 100644 --- a/examples/App/controllers/404.php +++ b/defaults/App/controllers/404.php @@ -11,4 +11,5 @@ header("Content-Type: text/html");

Error 404 Resource Not found

+

Novaconium Default 404 page.

diff --git a/examples/App/controllers/index.php b/defaults/App/controllers/index.php similarity index 100% rename from examples/App/controllers/index.php rename to defaults/App/controllers/index.php diff --git a/examples/App/routes.php b/defaults/App/routes.php similarity index 100% rename from examples/App/routes.php rename to defaults/App/routes.php diff --git a/examples/App/templates/override.html.twig b/defaults/App/templates/override.html.twig similarity index 100% rename from examples/App/templates/override.html.twig rename to defaults/App/templates/override.html.twig diff --git a/examples/App/views/index.html.twig b/defaults/App/views/index.html.twig similarity index 100% rename from examples/App/views/index.html.twig rename to defaults/App/views/index.html.twig diff --git a/examples/public/.htaccess b/defaults/public/.htaccess similarity index 100% rename from examples/public/.htaccess rename to defaults/public/.htaccess diff --git a/examples/public/index.php b/defaults/public/index.php similarity index 100% rename from examples/public/index.php rename to defaults/public/index.php diff --git a/src/Router.php b/src/Router.php index 4b7df21..3f40182 100644 --- a/src/Router.php +++ b/src/Router.php @@ -19,7 +19,12 @@ class Router { } private function loadRoutes() { - require_once( BASEPATH . '/App/routes.php'); + // Check if Path exists + if (file_exists(BASEPATH . '/App/routes.php')) { + require_once( BASEPATH . '/App/routes.php'); + } else { + require_once(FRAMEWORKPATH . '/defaults/App/routes.php'); + } return $routes; } @@ -104,9 +109,13 @@ class Router { if (file_exists($cp)) { return $cp; } else { - return BASEPATH . '/App/controllers/404.php'; + //Check if 404 exits + if (file_exists(BASEPATH . '/App/controllers/404.php')) { + return BASEPATH . '/App/controllers/404.php'; + } else { + return FRAMEWORKPATH . '/defaults/App/controllers/404.php'; + } } - } public function debug() { diff --git a/src/novaconium.php b/src/novaconium.php index f47cdf5..0833e0d 100644 --- a/src/novaconium.php +++ b/src/novaconium.php @@ -1,20 +1,28 @@ debug(); require_once($router->controllerPath);