예제 #1
0
파일: Route.php 프로젝트: jewelhuq/fraym
 /**
  * @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;
 }
예제 #2
0
파일: Route.php 프로젝트: fraym/core
 /**
  * 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();
     }
 }