Skip to content
Snippets Groups Projects
Commit 6c196437 authored by Christopher Smith's avatar Christopher Smith
Browse files

Merge pull request #546 from splitbrain/phrase_match

Add FULLTEXT_PHRASE_MATCH event for allowing plugins to match phrases FS#2936
parents ebe968f9 a7e8b43e
No related branches found
No related tags found
No related merge requests found
......@@ -72,8 +72,20 @@ function _ft_pageSearch(&$data) {
$pages = end($stack);
$pages_matched = array();
foreach(array_keys($pages) as $id){
$text = utf8_strtolower(rawWiki($id));
if (strpos($text, $phrase) !== false) {
$evdata = array(
'id' => $id,
'phrase' => $phrase,
'text' => rawWiki($id)
);
$evt = new Doku_Event('FULLTEXT_PHRASE_MATCH',$evdata);
if ($evt->advise_before() && $evt->result !== true) {
$text = utf8_strtolower($evdata['text']);
if (strpos($text, $phrase) !== false) {
$evt->result = true;
}
}
$evt->advise_after();
if ($evt->result === true) {
$pages_matched[$id] = 0; // phrase: always 0 hit
}
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment