/** * Starts the PhpBURN Application - Should be called at the index of the application * <code> * PhpBURN::StartApplication(); * </code> */ public static function startApplication() { // Setting up Model if (array_search('PhpBURN_Core', get_declared_classes()) == true) { // Adds Models Paths to include Path $packages = PhpBURN_Configuration::getConfig(); foreach ($packages as $package => $configItem) { $includePath = get_include_path(); $separator = strpos($includePath, ':') !== false ? ':' : ';'; set_include_path($includePath . $separator . $configItem->class_path . DS . $package); } } // Setting up Controller if (array_search('Controller', get_declared_classes()) == true) { PhpBURN::load('Tools.Util.Router'); include_once SYS_APPLICATION_PATH . DS . 'config' . DS . 'routes.php'; //Define the main route functions $router = new Router($routes); $currentRoute = $router->parseRoute(); if ($currentRoute != false) { $router->executeRoute($currentRoute); } else { Controller::callErrorPage('404'); } } }
/** * Starts the PhpBURN Application - Should be called at the index of the application * <code> * PhpBURN::StartApplication(); * </code> */ public static function startApplication() { self::enableAutoload(); // Setting up Controller if (array_search('Controller', get_declared_classes()) == true) { PhpBURN::load('Tools.Util.Router'); include_once SYS_APPLICATION_PATH . DS . 'config' . DS . 'routes.php'; //Define the main route functions $router = new Router($routes); $currentRoute = $router->parseRoute(); if ($currentRoute != false) { $router->executeRoute($currentRoute); } else { @Controller::callErrorPage('404'); } } }
public function executeRoute(array $route) { $route = explode('/', $route['action']); include_once SYS_CONTROLLER_PATH . $route[0] . '.' . SYS_CONTROLLER_EXT; $parms = array_slice($route, 2, count($route) - 2); $controller = new $route[0](); if (count($route) > 1) { $action = count($route) == 1 ? $route[0] : $route[1]; } else { $action = self::$routes['__defaultAction']; } if (method_exists($controller, $action)) { $controller->callAction($action, $parms); } else { Controller::callErrorPage('404'); } }