preg_quote search terms. http://mosquito.wordpress.org/bug_view_page.php?bug_id=0000123
git-svn-id: https://develop.svn.wordpress.org/trunk@1462 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
parent
dc70d3501d
commit
918aabfbd5
|
@ -104,6 +104,7 @@ function hilite($text) {
|
||||||
$query_terms = get_search_query_terms($engine);
|
$query_terms = get_search_query_terms($engine);
|
||||||
foreach ($query_terms as $term) {
|
foreach ($query_terms as $term) {
|
||||||
if (!empty($term) && $term != ' ') {
|
if (!empty($term) && $term != ' ') {
|
||||||
|
$term = preg_quote($term, '/');
|
||||||
if (!preg_match('/<.+>/',$text)) {
|
if (!preg_match('/<.+>/',$text)) {
|
||||||
$text = preg_replace('/(\b'.$term.'\b)/i','<span class="hilite">$1</span>',$text);
|
$text = preg_replace('/(\b'.$term.'\b)/i','<span class="hilite">$1</span>',$text);
|
||||||
} else {
|
} else {
|
||||||
|
|
Loading…
Reference in New Issue