diff options
author | Evan Prodromou <evan@controlyourself.ca> | 2009-07-03 23:34:44 -0400 |
---|---|---|
committer | Evan Prodromou <evan@controlyourself.ca> | 2009-07-03 23:34:44 -0400 |
commit | 741eb1a28bbe505364baa440539bbc5ed6fbe5e0 (patch) | |
tree | 0ab3ccfd1f1b340056c0548252f57e47cc0ef843 /actions | |
parent | 3e4be98ff6de7a1044f0d7b0deef4f6054e64464 (diff) | |
parent | eedfaa7d1a8e0f97175dfb832091250ca2e1f851 (diff) |
Merge branch '0.8.x' into queuemanager
Diffstat (limited to 'actions')
-rw-r--r-- | actions/conversation.php | 5 | ||||
-rw-r--r-- | actions/peoplesearch.php | 44 |
2 files changed, 48 insertions, 1 deletions
diff --git a/actions/conversation.php b/actions/conversation.php index 468409189..0eb0d86d6 100644 --- a/actions/conversation.php +++ b/actions/conversation.php @@ -31,6 +31,9 @@ if (!defined('LACONICA')) { exit(1); } +// XXX: not sure how to do paging yet, +// so set a 60-notice limit + require_once INSTALLDIR.'/lib/noticelist.php'; /** @@ -107,7 +110,7 @@ class ConversationAction extends Action function showContent() { - $notices = Notice::conversationStream($this->id, null); + $notices = Notice::conversationStream($this->id, null, null); $ct = new ConversationTree($notices, $this); diff --git a/actions/peoplesearch.php b/actions/peoplesearch.php index c61e0e273..60ddb6a82 100644 --- a/actions/peoplesearch.php +++ b/actions/peoplesearch.php @@ -87,3 +87,47 @@ class PeoplesearchAction extends SearchAction } } +/** + * People search results class + * + * Derivative of ProfileList with specialization for highlighting search terms. + * + * @category Widget + * @package Laconica + * @author Evan Prodromou <evan@controlyourself.ca> + * @author Robin Millette <millette@controlyourself.ca> + * @license http://www.fsf.org/licensing/licenses/agpl.html AGPLv3 + * @link http://laconi.ca/ + * + * @see PeoplesearchAction + */ + +class PeopleSearchResults extends ProfileList +{ + var $terms = null; + var $pattern = null; + + function __construct($profile, $terms, $action) + { + parent::__construct($profile, $action); + + $this->terms = array_map('preg_quote', + array_map('htmlspecialchars', $terms)); + + $this->pattern = '/('.implode('|',$terms).')/i'; + } + + function newProfileItem($profile) + { + return new PeopleSearchResultItem($profile, $this->action); + } +} + +class PeopleSearchResultItem extends ProfileListItem +{ + function highlight($text) + { + return preg_replace($this->pattern, '<strong>\\1</strong>', htmlspecialchars($text)); + } +} + |