/** * Parases a URL based on this rule. * @param eRouter $manager the router/URL manager * @param eRequest $request the request object * @param string $pathInfo path info part of the URL * @param string $rawPathInfo path info that contains the potential URL suffix * @return mixed the route that consists of the controller ID and action ID or false on error */ public function parseUrl($manager, $request, $pathInfo, $rawPathInfo) { $case = 'i'; # 'i' = insensitive if ($this->urlSuffix !== null) { $pathInfo = $manager->removeUrlSuffix($rawPathInfo, $this->urlSuffix); } $pathInfo = rtrim($pathInfo, '/') . '/'; // pathInfo is decoded, pattern could be encoded - required for proper url assemble (e.g. cyrillic chars) if (preg_match(rawurldecode($this->pattern) . $case, $pathInfo, $matches)) { foreach ($this->defaultParams as $name => $value) { //if (!isset($_GET[$name])) $_REQUEST[$name] = $_GET[$name] = $value; if (!$request->isRequestParam($name)) { $request->setRequestParam($name, $value); } } $tr = array(); foreach ($matches as $key => $value) { if (isset($this->references[$key])) { $tr[$this->references[$key]] = $value; } elseif (isset($this->params[$key])) { //$_REQUEST[$key] = $_GET[$key] = $value; $request->setRequestParam($key, $value); } } if ($pathInfo !== $matches[0]) { $manager->parsePathInfo($request, ltrim(substr($pathInfo, strlen($matches[0])), '/')); } return null !== $this->routePattern ? strtr($this->route, $tr) : $this->route; } else { return false; } }