/** * Creates an instance of the Controller specified in the Context, * and verifies that the requested action exists, returning * the created instance if true, or false if not * @param Context $context * @return Controller */ protected final function loadController(Context $context) { $page_name = Loader::includeApplicationClass($context); #Search the requested action, only return the page object #if the action exists if ($page_name) { $page = new $page_name($context); $action_method = array(&$page, $context->getAction()); return is_callable($action_method) ? $page : false; } return false; }
private function loadPlugins() { foreach (AppConfig::$plugins as $plugin => $config) { $parts = explode('/', $plugin); $context = new Context('plugin', $parts[0], $parts[1], array(), false); $plugin_name = Loader::includeApplicationClass($context); if ($plugin_name) { $plugin = new $plugin_name($context, $config); $this->plugins[$plugin->getName()] = $plugin; } } $this->list = new PluginList($this->plugins); foreach ($this->plugins as $plugin) { $plugin->initialize(); } }
array_walk_recursive($gpc, 'undo_magic_quotes'); } $plugin_manager = PluginManager::getInstance(); $url_mapper = new UrlMapper(); $context = $url_mapper->map($_SERVER['REQUEST_URI']); if (!$context) { header("HTTP/1.1 400 Bad Request"); @(include PHAXSI_ERROR_400); exit; } if (AppConfig::$language_redirect && !Lang::wasSet()) { $lang = Lang::autoDetect(); RedirectHelper::to(UrlHelper::current($lang)); } if (AppConfig::CUSTOM_ROUTER) { $router_name = Loader::includeApplicationClass(new Context('router', AppConfig::CUSTOM_ROUTER)); if ($router_name) { $router = new $router_name(); } else { trigger_error('Custom router "' . AppConfig::CUSTOM_ROUTER . '" was not found', E_USER_ERROR); } } else { $router = new Router(); } $controller = $router->getController($context); if (!$controller) { header("HTTP/1.1 404 Not Found"); @(include PHAXSI_ERROR_404); exit; } $context = $controller->_getContext();