Exemplo n.º 1
0
 public function createUrlByWord($word)
 {
     $re = array();
     if (is_numeric($this->typeId) && $this->typeId != 0) {
         $re[] = array('word' => $this->params[$this->type]['name'] . '类', 'url' => UrlNamespace::searchUrl($this->orgWord));
     } elseif ($this->typeId === 'author') {
         $re[] = array('word' => '作者', 'url' => UrlNamespace::searchUrl($this->orgWord));
     } elseif (strtolower($this->typeId) == 'uid') {
         $this->typeId = 'author';
         $w = '';
         foreach (DBScws::cutWord($this->params['username']) as $v) {
             $w .= $v;
         }
         $re[] = array('word' => $this->params['username'], 'url' => UrlNamespace::searchUrl());
         return $re;
     } elseif (strtolower($this->typeId) == 'bookid') {
         $this->typeId = 'bookname';
         $w = '';
         foreach (DBScws::cutWord($this->params['diarybook']) as $v) {
             $w .= $v;
         }
         $re[] = array('word' => $this->params['diarybook'], 'url' => UrlNamespace::searchUrl());
         return $re;
     } elseif ($this->typeId === 'bookname') {
         $re[] = array('word' => '日记本', 'url' => UrlNamespace::searchUrl($this->orgWord));
     }
     foreach ($word as $value) {
         $w = '';
         foreach ($this->cutWord as $v) {
             if ($value != $v) {
                 $w .= $v;
             }
         }
         $re[] = array('word' => $value, 'url' => UrlNamespace::searchUrl($w, $this->typeId));
     }
     return $re;
 }