public function actionSearch($text, $fulltext) { $search = $text; $this->search = $search; //"MATCH(title) AGAINST('".$search."')"; $this->template->search = $search; $this->template->fulltext = $fulltext ? TRUE : FALSE; if ($fulltext) { $this->searchFulltext = $search; } else { $words = explode(" ", $this->search); $long = array(); $short = array(); foreach ($words as $key => $word) { $eng = ""; if (strlen($eng = Model::getEnglishAlpha($word)) < 4) { $short[] = $eng; if ($eng != $word) { $short[] = $word; } } else { $long[] = $cut = substr($word, 0, 3 + strlen($word) - strlen($eng)); if ($cut != ($engCut = substr($eng, 0, 3))) { $long[] = $engCut; } } } $this->search = $long; $this->searchFull = $short; } }
protected function fixValues($array) { if ($array['award'] == "0") { $array['award'] = $array['newAward']; } if ($array['type'] == "0") { $array['type'] = $array['newType']; } unset($array['newAward']); unset($array['newType']); //$array['text'] = $this->sanitizeFromWord($array['text']); //$array['characters'] = strlen($array['text']); $array['characters'] = strlen(Model::getEnglishAlpha($array['text'])); $array['pages'] = ceil($array['characters'] / 1800); //$array['words'] = str_word_count($array['text']); $array['words'] = count(preg_split('/[\\s,]+/', $array['text'])); return $array; }