quote match terms
darcs-hash:20080718183534-84dde-a8cdb4cbcb3eb67152eb74179e3b00061e2287cf.gz
This commit is contained in:
parent
f50bc70445
commit
7853df51ce
@ -115,7 +115,8 @@ class PeoplesearchAction extends SearchAction {
|
||||
}
|
||||
|
||||
function highlight($text, $terms) {
|
||||
$pattern = '/('.implode('|',array_map('htmlspecialchars', $terms)).')/i';
|
||||
$terms = array_map('preg_quote', array_map('htmlspecialchars', $terms));
|
||||
$pattern = '/('.implode('|',$terms).')/i';
|
||||
$result = preg_replace($pattern, '<strong>\\1</strong>', htmlspecialchars($text));
|
||||
return $result;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user