preg_quote search terms. http://mosquito.wordpress.org/bug_view_page.php?bug_id=0000123
git-svn-id: http://svn.automattic.com/wordpress/trunk@1462 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
a166bd1267
commit
91b74efae1
|
@ -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