summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobin Millette <millette@controlyourself.ca>2009-05-18 18:18:08 -0400
committerRobin Millette <millette@controlyourself.ca>2009-05-18 18:18:08 -0400
commitf5606b6aa3868d777c6c697cf1bbc5348cb2ccc3 (patch)
tree39dc174a6e535412f21d166ac8e19b0c8dfb9bf5
parent57860b4d8a0ae201b32c9eb611ecdcb8e850a13a (diff)
Added RSS for personal tags
-rw-r--r--actions/showstream.php9
-rw-r--r--actions/userrss.php24
-rw-r--r--lib/router.php5
-rw-r--r--lib/rssaction.php6
4 files changed, 41 insertions, 3 deletions
diff --git a/actions/showstream.php b/actions/showstream.php
index 1654f589c..678a3174c 100644
--- a/actions/showstream.php
+++ b/actions/showstream.php
@@ -113,6 +113,15 @@ class ShowstreamAction extends ProfileAction
function getFeeds()
{
+ if (!empty($this->tag)) {
+ return array(new Feed(Feed::RSS1,
+ common_local_url('userrss',
+ array('nickname' => $this->user->nickname,
+ 'tag' => $this->tag)),
+ sprintf(_('Notice feed for %s tagged %s (RSS 1.0)'),
+ $this->user->nickname, $this->tag)));
+ }
+
return array(new Feed(Feed::RSS1,
common_local_url('userrss',
array('nickname' => $this->user->nickname)),
diff --git a/actions/userrss.php b/actions/userrss.php
index 5861d9ee3..2280509b2 100644
--- a/actions/userrss.php
+++ b/actions/userrss.php
@@ -25,14 +25,15 @@ require_once(INSTALLDIR.'/lib/rssaction.php');
class UserrssAction extends Rss10Action
{
-
var $user = null;
+ var $tag = null;
function prepare($args)
{
parent::prepare($args);
- $nickname = $this->trimmed('nickname');
+ $nickname = $this->trimmed('nickname');
$this->user = User::staticGet('nickname', $nickname);
+ $this->tag = $this->trimmed('tag');
if (!$this->user) {
$this->clientError(_('No such user.'));
@@ -42,6 +43,25 @@ class UserrssAction extends Rss10Action
}
}
+ function getTaggedNotices($tag = null, $limit=0)
+ {
+ $user = $this->user;
+
+ if (is_null($user)) {
+ return null;
+ }
+
+ $notice = $user->getTaggedNotices(0, ($limit == 0) ? NOTICES_PER_PAGE : $limit, 0, 0, null, $tag);
+
+ $notices = array();
+ while ($notice->fetch()) {
+ $notices[] = clone($notice);
+ }
+
+ return $notices;
+ }
+
+
function getNotices($limit=0)
{
diff --git a/lib/router.php b/lib/router.php
index f07e59373..70ee0f3fb 100644
--- a/lib/router.php
+++ b/lib/router.php
@@ -426,6 +426,11 @@ class Router
array('size' => '(original|96|48|24)',
'nickname' => '[a-zA-Z0-9]{1,64}'));
+ $m->connect(':nickname/tag/:tag/rss',
+ array('action' => 'userrss'),
+ array('nickname' => '[a-zA-Z0-9]{1,64}'),
+ array('tag' => '[a-zA-Z0-9]+'));
+
$m->connect(':nickname/tag/:tag',
array('action' => 'showstream'),
array('nickname' => '[a-zA-Z0-9]{1,64}'),
diff --git a/lib/rssaction.php b/lib/rssaction.php
index ddba862dc..2f25ed7e4 100644
--- a/lib/rssaction.php
+++ b/lib/rssaction.php
@@ -97,7 +97,11 @@ class Rss10Action extends Action
// Parent handling, including cache check
parent::handle($args);
// Get the list of notices
- $this->notices = $this->getNotices($this->limit);
+ if (empty($this->tag)) {
+ $this->notices = $this->getNotices($this->limit);
+ } else {
+ $this->notices = $this->getTaggedNotices($this->tag, $this->limit);
+ }
$this->showRss();
}