summaryrefslogtreecommitdiff
path: root/lib/peoplesearchresults.php
diff options
context:
space:
mode:
authorEvan Prodromou <evan@controlyourself.ca>2009-06-14 14:52:26 -0700
committerEvan Prodromou <evan@controlyourself.ca>2009-06-14 14:52:26 -0700
commitc2dae24701a22cd2362ebe1a96828cd7945c6b5a (patch)
treef42f7a9961b131c3311800544ef113cb3c6e220a /lib/peoplesearchresults.php
parent9addfeacfdacf1eb8c6a90a636f468e4aeb0e9fe (diff)
Break profilelist into a recipe
Expanded the ProfileList class so it worked more like a recipe. This helps to get rid of a lot of special cases and simplifies the code. It also makes it possible to do things like group block.
Diffstat (limited to 'lib/peoplesearchresults.php')
-rw-r--r--lib/peoplesearchresults.php15
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));
}
}