Don't "hightlight" search terms (by surrounding them in <strong>$term</strong>) when the term appears in an HTML attribute

Fixes http://status.net/trac/ticket/1852
This commit is contained in:
Craig Andrews 2009-09-07 22:36:01 -04:00
parent c77c0d88ce
commit 6020d85191

View File

@ -198,7 +198,7 @@ class SearchNoticeListItem extends NoticeListItem {
$result = preg_replace($pattern, '<strong>\\1</strong>', $text);
/* Remove highlighting from inside links, loop incase multiple highlights in links */
$pattern = '/(href="[^"]*)<strong>('.$options.')<\/strong>([^"]*")/iU';
$pattern = '/(\w+="[^"]*)<strong>('.$options.')<\/strong>([^"]*")/iU';
do {
$result = preg_replace($pattern, '\\1\\2\\3', $result, -1, $count);
} while ($count);