X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=actions%2Fnoticesearch.php;h=29527c56725c721486b2d234bf2b4c108fac2826;hb=912e9b3f4ff3e43838e44e9ab804765e9573206f;hp=eb3382779975659b50c65c2585f1bd65cdabae59;hpb=a1515e5411eaed5e21bf56536438bc906d197d35;p=quix0rs-gnu-social.git diff --git a/actions/noticesearch.php b/actions/noticesearch.php index eb33827799..29527c5672 100644 --- a/actions/noticesearch.php +++ b/actions/noticesearch.php @@ -139,8 +139,15 @@ class NoticesearchAction extends SearchAction { } function highlight($text, $terms) { + /* Highligh serach terms */ $pattern = '/('.implode('|',array_map('htmlspecialchars', $terms)).')/i'; $result = preg_replace($pattern, '\\1', $text); + + /* Remove highlighting from inside links, loop incase multiple highlights in links */ + $pattern = '/(href="[^"]*)('.implode('|',array_map('htmlspecialchars', $terms)).')<\/strong>([^"]*")/iU'; + do { + $result = preg_replace($pattern, '\\1\\2\\3', $result, -1, $count); + } while ($count); return $result; } }