/** * Show the timeline of notices * * @return void */ function showTimeline() { // We'll pull common formatting out of this for other formats $atom = new AtomListNoticeFeed($this->list, $this->auth_user); $self = $this->getSelfUri(); switch ($this->format) { case 'xml': $this->initDocument('xml'); $this->elementStart('statuses_list', array('xmlns:statusnet' => 'http://status.net/schema/api/1/')); $this->elementStart('statuses', array('type' => 'array')); foreach ($this->notices as $n) { $twitter_status = $this->twitterStatusArray($n); $this->showTwitterXmlStatus($twitter_status); } $this->elementEnd('statuses'); $this->element('next_cursor', null, $this->next_cursor); $this->element('previous_cursor', null, $this->prev_cursor); $this->elementEnd('statuses_list'); $this->endDocument('xml'); break; case 'rss': $this->showRssTimeline($this->notices, $atom->title, $this->list->getUri(), $atom->subtitle, null, $atom->logo, $self); break; case 'atom': header('Content-Type: application/atom+xml; charset=utf-8'); try { $atom->setId($self); $atom->setSelfLink($self); $atom->addEntryFromNotices($this->notices); $this->raw($atom->getString()); } catch (Atom10FeedException $e) { // TRANS: Server error displayed whe trying to get a timeline fails. // TRANS: %s is the error message. $this->serverError(sprintf(_('Could not generate feed for list - %s'), $e->getMessage())); } break; case 'json': $this->initDocument('json'); $statuses = array(); foreach ($this->notices as $n) { $twitter_status = $this->twitterStatusArray($n); array_push($statuses, $twitter_status); } $statuses_list = array('statuses' => $statuses, 'next_cursor' => $this->next_cusror, 'next_cursor_str' => strval($this->next_cusror), 'previous_cursor' => $this->prev_cusror, 'previous_cursor_str' => strval($this->prev_cusror)); $this->showJsonObjects($statuses_list); $this->initDocument('json'); break; default: // TRANS: Client error displayed when coming across a non-supported API method. $this->clientError(_('API method not found.'), 404); } }
function peopletagFeedForNotice($ptag) { $atom = new AtomListNoticeFeed($ptag); $atom->addEntryFromNotice($this->notice); $feed = $atom->getString(); return $feed; }