Use str_replace for matching searchwords, thanks to Dietrich Raisin
This commit is contained in:
parent
e8a2d18a11
commit
e9545daaf9
@ -3,6 +3,10 @@
|
|||||||
Version 1.3 ()
|
Version 1.3 ()
|
||||||
------------------------------------------------------------------------
|
------------------------------------------------------------------------
|
||||||
|
|
||||||
|
* Highlighting searched words in entries now uses str_replace instead
|
||||||
|
of slower and possibly insecure preg_replace(). Thanks to
|
||||||
|
Dietrich Raisin!
|
||||||
|
|
||||||
* New plugin API method "parseTemplate($filename)" to allow a
|
* New plugin API method "parseTemplate($filename)" to allow a
|
||||||
sidebar- or event-plugin to fetch+display a smarty template.
|
sidebar- or event-plugin to fetch+display a smarty template.
|
||||||
(garvinhicking)
|
(garvinhicking)
|
||||||
|
@ -970,7 +970,7 @@ function serendipity_printEntries($entries, $extended = 0, $preview = false, $sm
|
|||||||
$searchterms = explode($searchterms, ' ');
|
$searchterms = explode($searchterms, ' ');
|
||||||
foreach($searchterms as $searchdx => $searchterm) {
|
foreach($searchterms as $searchdx => $searchterm) {
|
||||||
$searchclass = "foundterm foundterm".$searchdx;
|
$searchclass = "foundterm foundterm".$searchdx;
|
||||||
$entry['body'] = preg_replace('/('.$searchterm.')/mi', '<span class="'.$searchclass.'">\1</span>', $entry['body']);
|
$entry['body'] = str_replace($searchterm, '<span class="'.$searchclass.'">' . $searchterm . '</span>', $entry['body']);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user