diff options
Diffstat (limited to 'lib/peoplesearchresults.php')
-rw-r--r-- | lib/peoplesearchresults.php | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/lib/peoplesearchresults.php b/lib/peoplesearchresults.php index d3f840852..9d9d17299 100644 --- a/lib/peoplesearchresults.php +++ b/lib/peoplesearchresults.php @@ -56,20 +56,25 @@ class PeopleSearchResults extends ProfileList function __construct($profile, $terms, $action) { - parent::__construct($profile, $terms, $action); + parent::__construct($profile, $action); + $this->terms = array_map('preg_quote', array_map('htmlspecialchars', $terms)); + $this->pattern = '/('.implode('|',$terms).')/i'; } - function highlight($text) + function newProfileItem($profile) { - return preg_replace($this->pattern, '<strong>\\1</strong>', htmlspecialchars($text)); + return new PeopleSearchResultItem($profile, $this->action); } +} - function isReadOnly($args) +class PeopleSearchResultItem extends ProfileListItem +{ + function highlight($text) { - return true; + return preg_replace($this->pattern, '<strong>\\1</strong>', htmlspecialchars($text)); } } |