From ce3c3be1bf971329f82bedbf3aae636e3c8ecbf9 Mon Sep 17 00:00:00 2001 From: Zach Copley Date: Wed, 10 Feb 2010 14:24:16 -0800 Subject: Utility classes for atom feeds --- actions/apitimelineuser.php | 39 ++++++++++++++++++++++++++++++++++++--- 1 file changed, 36 insertions(+), 3 deletions(-) (limited to 'actions/apitimelineuser.php') diff --git a/actions/apitimelineuser.php b/actions/apitimelineuser.php index ed9104905..bcc48f59c 100644 --- a/actions/apitimelineuser.php +++ b/actions/apitimelineuser.php @@ -145,7 +145,26 @@ class ApiTimelineUserAction extends ApiBareAuthAction ); break; case 'atom': + + header('Content-Type: application/atom+xml; charset=utf-8'); + + $atom = new AtomNoticeFeed(); + + $atom->addLink( + common_local_url( + 'showstream', + array('nickname' => $this->user->nickname) + ) + ); + + $atom->setId($id); + $atom->setTitle($title); + $atom->setSubtitle($subtitle); + $atom->setLogo($logo); + $atom->setUpdated('now'); + $id = $this->arg('id'); + if ($id) { $selfuri = common_root_url() . 'api/statuses/user_timeline/' . @@ -154,10 +173,24 @@ class ApiTimelineUserAction extends ApiBareAuthAction $selfuri = common_root_url() . 'api/statuses/user_timeline.atom'; } - $this->showAtomTimeline( - $this->notices, $title, $id, $link, - $subtitle, $suplink, $selfuri, $logo + + $atom->addLink( + $selfuri, + array('rel' => 'self', 'type' => 'application/atom+xml') + ); + + $atom->addLink( + $suplink, + array( + 'rel' => 'http://api.friendfeed.com/2008/03#sup', + 'type' => 'application/json' + ) ); + + $atom->addEntryFromNotices($this->notices); + + print $atom->getString(); + break; case 'json': $this->showJsonTimeline($this->notices); -- cgit v1.2.3-54-g00ecf