Example #1
0
 public function prePathParse(Controller $controller, StaticServer $server)
 {
     try {
         $this->path = $controller->getPath();
         // Transform routes base on host preferences
         $host_routes = Current::$config->get('plugins.routing.host_routes');
         if (count($host_routes)) {
             $host = $_SERVER['HTTP_HOST'];
             foreach ($host_routes as $search => $replace) {
                 if (preg_match($search, $host)) {
                     $this->applyTransform($replace);
                 }
             }
         }
         // Transform normal routes
         $routes = Current::$config->get('plugins.routing.routes');
         if (count($routes)) {
             $this->applyTransform($routes);
         }
         $controller->setPath($this->path);
         $server->setPath($this->path);
     } catch (RegistryException $e) {
     }
 }