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) { } }
public function prePathParse(Controller $controller, StaticServer $server) { $path = strtolower($server->getPath()); // Path begins with release path if (strncmp($path, $this->packaged_dir, strlen($this->packaged_dir)) !== 0) { return; } // Get package name from request path $package = preg_replace('#\\.css$#', '', substr($path, strlen($this->packaged_dir))); $filepath = $this->buildPackage($package); $server->setPath($filepath); $controller->setPath($filepath); // Prevent the path from being changed now $server->lockPath(); $this->is_package = true; }
public function prePathParse(Controller $controller, StaticServer $server) { $path = strtolower($server->getPath()); $url_path = COWL_BASE . $this->packaged_dir; // Path begins with release path, then we build it if need be if (strncmp($path, $url_path, strlen($url_path)) !== 0) { return; } // Get package name from request path $package = preg_replace('#\\.js$#', '', substr($path, strlen($url_path))); $filepath = $this->buildPackage($package); // No package here if (!$filepath) { return; } $server->setPath($filepath); $controller->setPath($filepath); $server->lockPath(); $this->is_package = true; }