Example #1
0
 public function getSpellSuggestions($query)
 {
     if ($this->totalLinks == 0 && count($this->spellcheck) > 0) {
         $suggLinkQuery = $this->replaceMismatch($query);
         $suggQuery = $this->replaceMismatch($query, true);
         $parameters = $_GET;
         $parameters['query'] = $suggLinkQuery;
         $href = getHTTPQuery($parameters);
         return "Did you mean „<a href='{$href}'>{$suggQuery}</a>”?";
     } else {
         return '';
     }
 }
Example #2
0
 public function getSimilar($symbol = "±")
 {
     if (!Settings::get('showSiblings')) {
         return '';
     }
     $data = array();
     $sibl = array();
     foreach ($this->results->sib as $sib) {
         if (count($sib->words) <= Settings::get('maxWordsInSiblings')) {
             $sibl[] = $sib;
         }
     }
     $siblings = array_slice($sibl, 0, $this->maxSib);
     if (count($siblings) > 0) {
         $minmax = $this->getMinMax($siblings);
         $min = $minmax['min'];
         $max = $minmax['max'];
         $classID = 15;
         foreach ($siblings as $sugg) {
             $words = $sugg->words;
             $rank = $sugg->rank;
             $text = $symbol . ' ' . implode(', ', $words);
             $parameters = array('query' => implode(' ', $words), 'database' => $this->database, 'lang' => $this->lang);
             $href = getHTTPQuery($parameters);
             $link = "\n<a href='{$href}' class='sibl-color-{$classID}' title='Degree of similarity: {$rank}'>{$text}</a>";
             $classID -= 3;
             $classID = max($classID, 3);
             array_push($data, $link);
         }
     }
     return implode(' | ', $data);
 }
Example #3
0
 private function getHref($page)
 {
     $parameters = $_GET;
     $parameters['page'] = $page;
     return getHTTPQuery($parameters);
 }