diff options
author | Evan Prodromou <evan@controlyourself.ca> | 2009-01-21 21:53:02 -0500 |
---|---|---|
committer | Evan Prodromou <evan@controlyourself.ca> | 2009-01-21 21:53:02 -0500 |
commit | fca1ccc351138abfaf060d01808e9e102d5a9b6d (patch) | |
tree | 5afb8043aeec0987dd841f071dbe95deb29ab83f /lib/util.php | |
parent | fc90dd44b73d3bae7cf5f986fb70dd90752cd1b0 (diff) |
First pass at delivery of group messages
A first pass at the delivery of group messages.
Diffstat (limited to 'lib/util.php')
-rw-r--r-- | lib/util.php | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/lib/util.php b/lib/util.php index 4d4a3b20f..03a99e54c 100644 --- a/lib/util.php +++ b/lib/util.php @@ -424,6 +424,7 @@ function common_render_content($text, $notice) $r = preg_replace('/(^|\s+)@([A-Za-z0-9]{1,64})/e', "'\\1@'.common_at_link($id, '\\2')", $r); $r = preg_replace('/^T ([A-Z0-9]{1,64}) /e', "'T '.common_at_link($id, '\\1').' '", $r); $r = preg_replace('/(^|\s+)@#([A-Za-z0-9]{1,64})/e', "'\\1@#'.common_at_hash_link($id, '\\2')", $r); + $r = preg_replace('/(^|\s)!([A-Za-z0-9]{1,64})/e', "\\1'!'.common_group_link($id, '\\2')", $r); return $r; } @@ -595,6 +596,17 @@ function common_at_link($sender_id, $nickname) } } +function common_group_link($sender_id, $nickname) +{ + $sender = Profile::staticGet($sender_id); + $group = User_group::staticGet(common_canonical_nickname($nickname)); + if ($group && $sender->isMember($group)) { + return '<span class="vcard"><a href="'.htmlspecialchars($group->permalink()).'" class="url"><span class="fn nickname">'.$nickname.'</span></a></span>'; + } else { + return $nickname; + } +} + function common_at_hash_link($sender_id, $tag) { $user = User::staticGet($sender_id); @@ -1052,7 +1064,7 @@ function common_redirect($url, $code=307) $xo->startXML('a', '-//W3C//DTD XHTML 1.0 Strict//EN', 'http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd'); - $xo->output('a', array('href' => $url), $url); + $xo->element('a', array('href' => $url), $url); $xo->endXML(); exit; } |