Added RSS for personal tags
This commit is contained in:
parent
57860b4d8a
commit
f5606b6aa3
@ -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)),
|
||||
|
@ -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)
|
||||
{
|
||||
|
||||
|
@ -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}'),
|
||||
|
@ -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();
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user