0){ foreach(WikiPage::loadAll(array(),array('label'),array('100'), array('*'), 1) as $page){ $page->content(); $content = $page->label.' - '.$page->content; if(preg_match_all('/'.implode('|',$rterms).'/iUs',$content, $matches, PREG_OFFSET_CAPTURE)){ foreach ($matches as $match) { foreach ($match as $word) { $offset = $word[1]; $word = $word[0]; $length = strlen($page->content); $start = $offset-50; $start = $start < 0 ? 0 : $start; $end = $start+100 > $length -1 ? $length -1: 100; $excerpt = substr($page->content,$start,$end).'...'; $excerpt = htmlentities($excerpt); $excerpt = preg_replace('|(.*)('.$word.')(.*)|iUs', '$1$2$3', $excerpt); //Dans quel but ? (ligne dessous) // if(isset($results[$page->id])) $excerpt = $results[$page->id]['excerpt'].' '.$excerpt; $results[$page->id] = array( 'type' => 'page', 'item' => $page, 'excerpt' => $excerpt ); } } } } foreach(WikiCategory::staticQuery('SELECT * FROM {{table}} WHERE label REGEXP ? ',array(implode('|',$rterms)),true) as $category){ $results[$category->id] = array( 'type' => 'category', 'item' => $category, 'excerpt' => 'Catégorie' ); } } ?>
Aucun mot-clé renseigné...
Oops ! Rien trouvé..