From a4eef390581c8478773e514fdedc0d8a211e7eec Mon Sep 17 00:00:00 2001 From: tmont Date: Mon, 13 Oct 2008 07:57:18 +0000 Subject: [PATCH] changed package to Panacea, initial bootstrapper and landing page --- src/.htaccess | 4 +++ src/bootstrap.php | 48 +++++++++++++++++++++++++++++++ src/inc/WikiControllerFactory.php | 4 +-- src/inc/WikiPageController.php | 4 +-- src/inc/WikiViewFactory.php | 4 +-- src/inc/views/WikiPageView.php | 6 ++-- src/index.php | 15 ++++++++++ 7 files changed, 76 insertions(+), 9 deletions(-) create mode 100644 src/.htaccess create mode 100644 src/bootstrap.php create mode 100644 src/index.php diff --git a/src/.htaccess b/src/.htaccess new file mode 100644 index 0000000..8bd6fbe --- /dev/null +++ b/src/.htaccess @@ -0,0 +1,4 @@ +RewriteEngine On + +RewriteCond %{REQUEST_URI} !.*index\.php +RewriteRule .+ /wiki/index.php [L] \ No newline at end of file diff --git a/src/bootstrap.php b/src/bootstrap.php new file mode 100644 index 0000000..7176d2c --- /dev/null +++ b/src/bootstrap.php @@ -0,0 +1,48 @@ +Panacea + * + * @package Panacea + * @author Tommy Montgomery + * @since 2008-10-12 + */ + + /** Bootstraps the NowhereConcave framework */ + require_once 'NowhereConcave/bootstrap.php'; + + /** + * Autoloader for Panacea + * + * @author Tommy Montgomery + * @since 2008-10-12 + * + * @param string $className Name of the class to load + */ + function panacea_autoload($className) { + $path = dirname(__FILE__); + $file = ''; + switch ($className) { + case 'WikiControllerFactory': + case 'WikiPageController': + case 'WikiViewFactory': + $file = "$path/inc/$className.php"; + break; + + case 'WikiPageView': + $file = "$path/inc/views/$className.php"; + break; + } + + if (!empty($file) && is_file($file)) { + require_once $file; + } + } + + //registers panacea_autoload() as an autoload function + if (spl_autoload_functions() === false || !in_array('panacea_autoload', spl_autoload_functions())) { + spl_autoload_register('panacea_autoload'); + } + + +?> \ No newline at end of file diff --git a/src/inc/WikiControllerFactory.php b/src/inc/WikiControllerFactory.php index 57edd7a..21c6838 100644 --- a/src/inc/WikiControllerFactory.php +++ b/src/inc/WikiControllerFactory.php @@ -3,7 +3,7 @@ /** * WikiControllerFactory * - * @package Wiki + * @package Panacea * @author Tommy Montgomery * @since 2008-10-05 */ @@ -14,7 +14,7 @@ /** * Creates a {@link Controller} * - * @package Wiki + * @package Panacea * @author Tommy Montgomery * @since 2008-10-05 */ diff --git a/src/inc/WikiPageController.php b/src/inc/WikiPageController.php index ca79a94..9cf1010 100644 --- a/src/inc/WikiPageController.php +++ b/src/inc/WikiPageController.php @@ -3,7 +3,7 @@ /** * WikiPageController * - * @package Wiki + * @package Panacea * @author Tommy Montgomery * @since 2008-10-05 */ @@ -14,7 +14,7 @@ /** * Wiki page controller * - * @package Wiki + * @package Panacea * @author Tommy Montgomery * @since 2008-10-05 */ diff --git a/src/inc/WikiViewFactory.php b/src/inc/WikiViewFactory.php index 76506b0..2ca34fe 100644 --- a/src/inc/WikiViewFactory.php +++ b/src/inc/WikiViewFactory.php @@ -3,7 +3,7 @@ /** * WikiViewFactory * - * @package Wiki + * @package Panacea * @author Tommy Montgomery * @since 2008-10-05 */ @@ -14,7 +14,7 @@ /** * Factory for generating {@link View}s * - * @package Wiki + * @package Panacea * @author Tommy Montgomery * @since 2008-10-05 */ diff --git a/src/inc/views/WikiPageView.php b/src/inc/views/WikiPageView.php index 159ffb6..5c3daa6 100644 --- a/src/inc/views/WikiPageView.php +++ b/src/inc/views/WikiPageView.php @@ -3,10 +3,10 @@ /** * WikiPageView * - * @package Wiki + * @package Panacea * @subpackage Views * @author Tommy Montgomery - * @since 2008-07-03 + * @since 2008-10-05 */ /** Bootstraps the NowhereConcave framework */ @@ -15,7 +15,7 @@ /** * View for standard wiki pages * - * @package Wiki + * @package Panacea * @subpackage Views * @author Tommy Montgomery * @since 2008-10-05 diff --git a/src/index.php b/src/index.php new file mode 100644 index 0000000..a781d21 --- /dev/null +++ b/src/index.php @@ -0,0 +1,15 @@ +uri = 'http://www.example.com'; + + Dispatcher::getInstance()->setUriRegex('^/wiki/(.*)') + ->setThrowExceptions(true) + ->setControllerFactory(WikiControllerFactory::getInstance()) + ->setRequest($request) + ->dispatch($_SERVER['REQUEST_URI']); + +?> \ No newline at end of file