Exemplo n.º 1
0
 private function createPageUrlSeo($pageNumber = 0)
 {
     $link = "#";
     if (!empty($this->suffix) && !empty($this->object_link)) {
         $object = $this->object_link;
         if ($pageNumber > 0) {
             $object['other']['p'] = $pageNumber + 1;
         }
         switch ($this->suffix) {
             case 'gr':
                 //genre
                 $link = URLHelper::makeUrlGenre($object);
                 break;
             case 'at':
                 //genre
             //genre
             case 'ai':
                 //artist_list
                 $link = URLHelper::makeUrlMultiLevel($object);
                 break;
         }
     } else {
         $link = Yii::app()->request->requestUri;
         preg_match("/p=(\\w+)/", $link, $match);
         if ($match) {
             if (!empty($match[0])) {
                 if ($pageNumber > 0) {
                     $p = $pageNumber + 1;
                     $link = str_replace($match[0], 'p=' . $p, $link);
                 } else {
                     $link = str_replace(array('?' . $match[0], '&' . $match[0]), '', $link);
                 }
             }
         } else {
             if ($pageNumber > 0) {
                 $p = $pageNumber + 1;
                 if (strpos($link, '?') !== false) {
                     $link .= "&p=" . $p;
                 } else {
                     $link .= "?p=" . $p;
                 }
             }
         }
     }
     return $link;
 }