public function process($params) { $parameters = $this->parseURL($params); //Loads router config ItemConfigLoader::selectFile("routing-exceptions"); $this->exceptions = ItemConfigLoader::getItemList(); //if there are no parameters in the URL redirects to /home if (!$parameters[0]) { $this->redir("home"); } $controllerClass = $this->getClassName(array_shift($parameters)); //if Controller class does not exists redirects to /error if (!$controllerClass || !Files::existsController($controllerClass)) { $this->redir("error"); } //checks routing rules foreach ($this->exceptions as $exception) { if ($exception[1] . "Controller" == $controllerClass) { if ($exception[0] == "block") { $this->redir("error"); } else { if ($exception[0] == "redir") { $this->redir($exception[2]); } } } } //Creates an inner controller according to the first parameter and then creates it's view $this->innerController = new $controllerClass(); /** @noinspection PhpUndefinedMethodInspection */ $this->innerController->process($parameters); $this->data["title"] = $this->innerController->header["title"]; $this->data["keywords"] = $this->innerController->header["keywords"]; $this->data["description"] = $this->innerController->header["description"]; $this->data['messages'] = $this->getMessages(); $this->view = "base-view"; }
/** * Selects a file for the ConfigLoader. When calling the getValue() function the Loader will read that file. * @param $file String; of the file WITHOUT extension. The file MUST be placed in config loader and MUST have .config extension * @throws ConfigurationException Thrown in case the file does not exists or it is empty. */ public static function selectFile($file) { parent::selectFile($file); self::$lineCount = count(self::$currentFileLines); self::$currentLine = 0; }