fixed hilite whitespace checking
git-svn-id: http://svn.automattic.com/wordpress/trunk@770 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
4834619229
commit
8058390507
|
@ -1751,13 +1751,15 @@ function hilite($text) {
|
||||||
$search_engines = array('wordpress', 'google', 'lycos', 'yahoo');
|
$search_engines = array('wordpress', 'google', 'lycos', 'yahoo');
|
||||||
|
|
||||||
foreach ($search_engines as $engine) {
|
foreach ($search_engines as $engine) {
|
||||||
if ( is_referer_search_engine($engine) && !empty($term) && $term != ' ') {
|
if ( is_referer_search_engine($engine)) {
|
||||||
$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 (!preg_match('/<.+>/',$text)) {
|
if (!empty($term) && $term != ' ') {
|
||||||
$text = preg_replace('/(\b'.$term.'\b)/i','<span class="hilite">$1</span>',$text);
|
if (!preg_match('/<.+>/',$text)) {
|
||||||
} else {
|
$text = preg_replace('/(\b'.$term.'\b)/i','<span class="hilite">$1</span>',$text);
|
||||||
$text = preg_replace('/(?<=>)([^<]+)?(\b'.$term.'\b)/i','$1<span class="hilite">$2</span>',$text);
|
} else {
|
||||||
|
$text = preg_replace('/(?<=>)([^<]+)?(\b'.$term.'\b)/i','$1<span class="hilite">$2</span>',$text);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
Loading…
Reference in New Issue