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/showfavorites.php | 33 ++++----------------------------- 1 file changed, 4 insertions(+), 29 deletions(-) (limited to 'actions/showfavorites.php') diff --git a/actions/showfavorites.php b/actions/showfavorites.php index 31479e1a7..d1c9283f0 100644 --- a/actions/showfavorites.php +++ b/actions/showfavorites.php @@ -113,7 +113,7 @@ class ShowfavoritesAction extends Action } common_set_returnto($this->selfUrl()); - + return true; } @@ -136,10 +136,10 @@ class ShowfavoritesAction extends Action /** * Feeds for the section * - * @return void + * @return array Feed objects to show */ - function showFeeds() + function getFeeds() { $feedurl = common_local_url('favoritesrss', array('nickname' => @@ -147,10 +147,7 @@ class ShowfavoritesAction extends Action $feedtitle = sprintf(_('Feed for favorites of %s'), $this->user->nickname); - $this->element('link', array('rel' => 'alternate', - 'href' => $feedurl, - 'type' => 'application/rss+xml', - 'title' => $feedtitle)); + return array(new Feed(Feed::RSS1, $feedurl, $feedtitle)); } /** @@ -165,28 +162,6 @@ class ShowfavoritesAction extends Action $nav->show(); } - /** - * Show the replies feed links - * - * @return void - */ - - function showExportData() - { - $feedurl = common_local_url('favoritesrss', - array('nickname' => - $this->user->nickname)); - - $fl = new FeedList($this); - - // XXX: I18N - - $fl->show(array(0=>array('href'=> $feedurl, - 'type' => 'rss', - 'version' => 'RSS 1.0', - 'item' => 'Favorites'))); - } - /** * Show the content * -- cgit v1.2.3