53 private $searchString;
69 $this->searchString = $searchString;
77 private function getWords()
79 if (!isset($this->words)) {
80 $words = explode(
' ', $this->searchString);
81 $this->words = array();
82 foreach ($words as $word) {
85 if (class_exists(
'\Normalizer',
false)
86 && method_exists(
'\Normalizer',
'normalize')
88 $word = \Normalizer::normalize($word);
90 $this->words[] = $word;
111 $words = $this->getWords();
115 foreach ($c as
$i => $content) {
116 if (!
hide(
$i) || $cf[
'show_hidden'][
'pages_search'] ==
'true') {
118 $content = $this->prepareContent($content,
$i);
119 foreach ($words as $word) {
141 private function prepareContent($content, $pageIndex)
145 $vars = array(
's',
'o',
'hjs',
'bjs',
'e',
'onload');
146 foreach ($vars as $var) {
147 $old[$var] = $GLOBALS[$var];
151 foreach ($vars as $var) {
152 $GLOBALS[$var] = $old[$var];
154 if (method_exists(
'\Normalizer',
'normalize')) {
155 $content = \Normalizer::normalize($content);
157 return html_entity_decode($content, ENT_QUOTES,
'UTF-8');
169 private function foundMessage($count)
175 } elseif ($count == 1) {
177 } elseif (2 <= $count && $count <= 4) {
182 $message = sprintf($tx[
'search'][$key], $this->searchString, $count);
183 $message =
XH_hsc($message);
184 $message =
'<p>' . $message .
'</p>';
204 $cf[
'meta'][
'robots'] =
'noindex, nofollow';
205 $o =
'<h1>' . $tx[
'search'][
'result'] .
'</h1>';
206 $words = $this->getWords();
207 $pages = $this->search();
208 $count = count($pages);
209 $o .= $this->foundMessage($count) . PHP_EOL;
211 $o .=
'<ul>' . PHP_EOL;
212 $words = implode(
' ', $words);
213 foreach ($pages as
$i) {
214 $pageData = $pd_router->find_page($i);
215 $site = isset($pageData[
'title']) ? $pageData[
'title'] :
'';
217 $url = $sn .
'?' . $u[
$i] .
'&search=' . urlencode($words);
218 $o .=
' <li><a href="' . $url .
'">' .
$title .
'</a>';
219 $description = isset($pageData[
'description'])
220 ? $pageData[
'description'] :
'';
221 if ($description !=
'') {
222 $o .=
'<div>' .
XH_hsc($description) .
'</div>';
224 $o .=
'</li>' . PHP_EOL;
226 $o .=
'</ul>' . PHP_EOL;
__construct($searchString)
utf8_stripos($haystack, $needle, $offset=0)
evaluate_plugincall($text)
XH_title($site, $subtitle)