/** * @return bool */ public function checkVirtualRoute() { foreach ($this->virutalRoutes as $data) { $isRelativeRoute = substr($data->route, 0, 1) === '/' ? false : true; $route = rtrim($this->getSiteBaseURI(false), '/') . $data->route; if ($this->core->isCLI() && $route == $this->getRequestRoute(false, false) || ($isRelativeRoute === true && ltrim($this->getAddionalURI(), '/') == $data->route || $isRelativeRoute === false && $route == $this->getRequestRoute(false, false))) { $controller = $data->controller; $action = $data->action; $instance = $this->serviceLocator->get($controller); return $instance->{$action}(); } } return false; }
/** * Init annotation and extension routes */ public function loadRoutes() { if ($this->core->isCLI() === false && $this->cache->isCachingActive() && $this->user->isAdmin() === false) { if (($routes = $this->cache->getDataCache('routes')) === false) { $this->initAnnotationRoutes(); $this->cache->setDataCache('routes', $this->virutalRoutes); } else { $this->virutalRoutes = $routes; } } else { $this->initExtensionRoutes(); $this->initAnnotationRoutes(); } }