Пример #1
0
 public function parseUrl($request)
 {
     if ($this->getUrlFormat() === self::PATH_FORMAT) {
         $rawPathInfo = $request->getPathInfo();
         if (Settings::get('SEO', 'slugs_enabled') && ($p = Slug::getPath($rawPathInfo))) {
             $rawPathInfo = trim($p, '/');
             Yii::app()->punish = 0;
         }
         $pathInfo = $this->removeUrlSuffix($rawPathInfo, $this->urlSuffix);
         foreach ($this->_rules as $i => $rule) {
             if (is_array($rule)) {
                 $this->_rules[$i] = $rule = Yii::createComponent($rule);
             }
             if (($r = $rule->parseUrl($this, $request, $pathInfo, $rawPathInfo)) !== false) {
                 return isset($_GET[$this->routeVar]) ? $_GET[$this->routeVar] : $r;
             }
         }
         if ($this->useStrictParsing) {
             throw new AweException(404, Yii::t('yii', 'Unable to resolve the request "{route}".', array('{route}' => $pathInfo)));
         } else {
             return $pathInfo;
         }
     } else {
         if (isset($_GET[$this->routeVar])) {
             return $_GET[$this->routeVar];
         } else {
             if (isset($_POST[$this->routeVar])) {
                 return $_POST[$this->routeVar];
             } else {
                 return '';
             }
         }
     }
 }