Now + and - search terms are properly highlighted
under glossary searches. This was broken recently solving some non-iso problems.
This commit is contained in:
+12
-1
@@ -353,7 +353,18 @@
|
||||
|
||||
/// highlight the term if necessary
|
||||
if ($mode == 'search') {
|
||||
$entry->highlight = $hook;
|
||||
//We have to strip any word starting by + and take out words starting by -
|
||||
//to make highlight works properly
|
||||
$searchterms = explode(' ', $hook); // Search for words independently
|
||||
foreach ($searchterms as $key => $searchterm) {
|
||||
if (preg_match('/^\-/',$searchterm)) {
|
||||
unset($searchterms[$key]);
|
||||
} else {
|
||||
$searchterms[$key] = preg_replace('/^\+/','',$searchterm);
|
||||
}
|
||||
}
|
||||
$strippedsearch = implode(' ', $searchterms); // Rebuild the string
|
||||
$entry->highlight = $strippedsearch;
|
||||
}
|
||||
|
||||
/// and finally print the entry.
|
||||
|
||||
Reference in New Issue
Block a user