/** * Checks if the controllers are avaible else send to error controller * @return null */ public function routeCurrentDir() { if (PWEL_ROUTING::$routed == true) { return true; } $url = new PWEL_URL(); $this->url_variables = $url->locateUrlVariables(); if (empty($this->url_variables)) { $check = $this->checkIncludeControllerClass(self::$start_controller); if ($check) { } else { $check = $this->checkIncludeControllerClass(self::$error_controller); if (!$check) { return; } } $this->displayController(new $check(), "startController"); self::$controllerNotFound = false; } else { self::$controllerNotFound = false; $check = $this->checkIncludeControllerClass($this->url_variables[0]); if ($check) { } else { $check = $this->checkIncludeControllerClass(self::$error_controller); self::$controllerNotFound = true; if (!$check) { return; } } $this->displayController(new $check()); } /** * Routing executed */ PWEL_ROUTING::$routed = true; }
public function _execute() { $this->checkValues(); $routing = new PWEL_ROUTING(); if (!isset($this->setRoutes['class'])) { $check = $routing->checkIncludeControllerClass(PWEL_ROUTING::$start_controller); $this->displayController(new $check()); PWEL_ROUTING::$controllerNotFound = false; PWEL_ROUTING::$routed = true; return true; } if (empty(self::$variables) || empty(self::$variables['class'])) { $check = $routing->checkIncludeControllerClass(PWEL_ROUTING::$start_controller); if ($check) { } else { $check = $routing->checkIncludeControllerClass(PWEL_ROUTING::$error_controller); if (!$check) { return; } } $this->displayController(new $check(), 'startController'); PWEL_ROUTING::$controllerNotFound = false; } else { PWEL_ROUTING::$controllerNotFound = false; $check = $routing->checkIncludeControllerClass(self::$variables['class']); if ($check) { } else { $check = $routing->checkIncludeControllerClass(PWEL_ROUTING::$error_controller); PWEL_ROUTING::$controllerNotFound = true; if (!$check) { return; } } $this->displayController(new $check()); } // Routing executed PWEL_ROUTING::$routed = true; }