From 22b10399aaa97061ed940f92f5b15f6aacfb1093 Mon Sep 17 00:00:00 2001 From: Evan Prodromou Date: Wed, 11 Feb 2009 11:37:50 -0500 Subject: Unify feeds definition in actions I got a little sick of trying to keep the export data and links synched in actions, so I made a common method, getFeeds(), which gets the feeds for both. It returns an array of Feed objects, which know about what their mime type is, title, location, all that jazz. I changed the FeedList class so it handles the new Feed objects instead of the old array of data. I changed all the actions that show feeds (I think...) so that they now use getFeeds() for all their feed needs. --- actions/tag.php | 22 ++++++---------------- 1 file changed, 6 insertions(+), 16 deletions(-) (limited to 'actions/tag.php') diff --git a/actions/tag.php b/actions/tag.php index 4401f892a..231f2c299 100644 --- a/actions/tag.php +++ b/actions/tag.php @@ -37,9 +37,9 @@ class TagAction extends Action } $this->page = ($this->arg('page')) ? ($this->arg('page')+0) : 1; - + common_set_returnto($this->selfUrl()); - + return true; } @@ -61,12 +61,11 @@ class TagAction extends Action $this->showPage(); } - function showFeeds() + function getFeeds() { - $this->element('link', array('rel' => 'alternate', - 'href' => common_local_url('tagrss', array('tag' => $this->tag)), - 'type' => 'application/rss+xml', - 'title' => sprintf(_('Feed for tag %s'), $this->tag))); + return array(new Feed(Feed::RSS1, + common_local_url('tagrss', array('tag' => $this->tag)), + sprintf(_('Feed for tag %s'), $this->tag))); } function showPageNotice() @@ -74,15 +73,6 @@ class TagAction extends Action return sprintf(_('Messages tagged "%s", most recent first'), $this->tag); } - function showExportData() - { - $fl = new FeedList($this); - $fl->show(array(0=>array('href'=>common_local_url('tagrss', array('tag' => $this->tag)), - 'type' => 'rss', - 'version' => 'RSS 1.0', - 'item' => 'tagrss'))); - } - function showContent() { $notice = Notice_tag::getStream($this->tag, (($this->page-1)*NOTICES_PER_PAGE), NOTICES_PER_PAGE + 1); -- cgit v1.2.3-54-g00ecf