summaryrefslogtreecommitdiff
path: root/actions/all.php
diff options
context:
space:
mode:
authorEvan Prodromou <evan@controlyourself.ca>2009-02-11 11:37:50 -0500
committerEvan Prodromou <evan@controlyourself.ca>2009-02-11 11:37:50 -0500
commit22b10399aaa97061ed940f92f5b15f6aacfb1093 (patch)
tree81ddddc5ed3df873f81e7a18c3e2a2e47dc79ff9 /actions/all.php
parentad65c447d5e32b8ef5681789eca12a3717231311 (diff)
Unify feeds definition in actions
I got a little sick of trying to keep the export data and <head> 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.
Diffstat (limited to 'actions/all.php')
-rw-r--r--actions/all.php36
1 files changed, 18 insertions, 18 deletions
diff --git a/actions/all.php b/actions/all.php
index d75d1b946..08dcccbdd 100644
--- a/actions/all.php
+++ b/actions/all.php
@@ -42,9 +42,9 @@ class AllAction extends Action
if (!$this->page) {
$this->page = 1;
}
-
+
common_set_returnto($this->selfUrl());
-
+
return true;
}
@@ -69,13 +69,22 @@ class AllAction extends Action
}
}
- function showFeeds()
+ function getFeeds()
{
- $this->element('link', array('rel' => 'alternate',
- 'href' => common_local_url('allrss', array('nickname' =>
- $this->user->nickname)),
- 'type' => 'application/rss+xml',
- 'title' => sprintf(_('Feed for friends of %s'), $this->user->nickname)));
+ return array(new Feed(Feed::RSS1,
+ common_local_url('allrss', array('nickname' =>
+ $this->user->nickname)),
+ sprintf(_('Feed for friends of %s (RSS 1.0)'), $this->user->nickname)),
+ new Feed(Feed::RSS2,
+ common_local_url('api', array('apiaction' => 'statuses',
+ 'method' => 'friends',
+ 'argument' => $this->user->nickname.'.rss')),
+ sprintf(_('Feed for friends of %s (RSS 2.0)'), $this->user->nickname)),
+ new Feed(Feed::ATOM,
+ common_local_url('api', array('apiaction' => 'statuses',
+ 'method' => 'friends',
+ 'argument' => $this->user->nickname.'.atom')),
+ sprintf(_('Feed for friends of %s (Atom)'), $this->user->nickname)));
}
function showLocalNav()
@@ -84,15 +93,6 @@ class AllAction extends Action
$nav->show();
}
- function showExportData()
- {
- $fl = new FeedList($this);
- $fl->show(array(0=>array('href'=>common_local_url('allrss', array('nickname' => $this->user->nickname)),
- 'type' => 'rss',
- 'version' => 'RSS 1.0',
- 'item' => 'allrss')));
- }
-
function showContent()
{
$notice = $this->user->noticesWithFriends(($this->page-1)*NOTICES_PER_PAGE, NOTICES_PER_PAGE + 1);
@@ -110,7 +110,7 @@ class AllAction extends Action
$user =& common_current_user();
if ($user && ($user->id == $this->user->id)) {
$this->element('h1', NULL, _("You and friends"));
- } else {
+ } else {
$this->element('h1', NULL, sprintf(_('%s and friends'), $this->user->nickname));
}
}