summaryrefslogtreecommitdiff
path: root/actions/public.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/public.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/public.php')
-rw-r--r--actions/public.php53
1 files changed, 13 insertions, 40 deletions
diff --git a/actions/public.php b/actions/public.php
index 1137bd876..a20ae4032 100644
--- a/actions/public.php
+++ b/actions/public.php
@@ -119,24 +119,20 @@ class PublicAction extends Action
* @return void
*/
- function showFeeds()
+ function getFeeds()
{
- $this->element('link', array('rel' => 'alternate',
- 'href' => common_local_url('publicrss'),
- 'type' => 'application/rdf+xml',
- 'title' => _('Public Stream Feed (RSS 1.0)')));
- $this->element('link', array('rel' => 'alternate',
- 'href' => common_local_url('api',
- array('apiaction' => 'statuses',
- 'method' => 'public_timeline.rss')),
- 'type' => 'application/rss+xml',
- 'title' => _('Public Stream Feed (RSS 2.0)')));
- $this->element('link', array('rel' => 'alternate',
- 'href' => common_local_url('api',
- array('apiaction' => 'statuses',
- 'method' => 'public_timeline.atom')),
- 'type' => 'application/atom+xml',
- 'title' => _('Public Stream Feed (Atom)')));
+ return array(new Feed(Feed::RSS1, common_local_url('publicrss'),
+ _('Public Stream Feed (RSS 1.0)')),
+ new Feed(Feed::RSS2,
+ common_local_url('api',
+ array('apiaction' => 'statuses',
+ 'method' => 'public_timeline.rss')),
+ _('Public Stream Feed (RSS 2.0)')),
+ new Feed(Feed::ATOM,
+ common_local_url('api',
+ array('apiaction' => 'statuses',
+ 'method' => 'public_timeline.atom')),
+ _('Public Stream Feed (Atom)')));
}
/**
@@ -197,29 +193,6 @@ class PublicAction extends Action
$this->page, 'public');
}
- /**
- * Makes a list of exported feeds for this page
- *
- * @return void
- *
- * @todo I18N
- */
-
- function showExportData()
- {
- $fl = new FeedList($this);
- $fl->show(array(0 => array('href' => common_local_url('publicrss'),
- 'type' => 'rss',
- 'version' => 'RSS 1.0',
- 'item' => 'publicrss'),
- 1 => array('href' => common_local_url('api',
- array('apiaction' => 'statuses',
- 'method' => 'public_timeline.atom')),
- 'type' => 'atom',
- 'version' => 'Atom 1.0',
- 'item' => 'publicatom')));
- }
-
function showSections()
{
// $top = new TopPostersSection($this);