/** * Show the timeline of notices * * @return void */ function showTimeline() { // We'll pull common formatting out of this for other formats $atom = new AtomGroupNoticeFeed($this->group, $this->auth_user); $self = $this->getSelfUri(); $link = common_local_url('ApiTimelineGroup', array('nickname' => $this->group->nickname)); switch ($this->format) { case 'xml': $this->showXmlTimeline($this->notices); break; case 'rss': $this->showRssTimeline($this->notices, $atom->title, $this->group->homeUrl(), $atom->subtitle, null, $atom->logo, $self); break; case 'atom': header('Content-Type: application/atom+xml; charset=utf-8'); $atom->addEntryFromNotices($this->notices); $this->raw($atom->getString()); break; case 'json': $this->showJsonTimeline($this->notices); break; case 'as': header('Content-Type: ' . ActivityStreamJSONDocument::CONTENT_TYPE); $doc = new ActivityStreamJSONDocument($this->auth_user); $doc->setTitle($atom->title); $doc->addLink($link, 'alternate', 'text/html'); $doc->addItemsFromNotices($this->notices); $this->raw($doc->asString()); break; default: $this->clientError(_('API method not found.'), 404, $this->format); break; } }
/** * Show the timeline of notices * * @return void */ function showTimeline() { // We'll pull common formatting out of this for other formats $atom = new AtomGroupNoticeFeed($this->group); $self = $this->getSelfUri(); switch ($this->format) { case 'xml': $this->showXmlTimeline($this->notices); break; case 'rss': $this->showRssTimeline($this->notices, $atom->title, $this->group->homeUrl(), $atom->subtitle, null, $atom->logo, $self); break; case 'atom': header('Content-Type: application/atom+xml; charset=utf-8'); try { $atom->addAuthorRaw($this->group->asAtomAuthor()); $atom->setActivitySubject($this->group->asActivitySubject()); $atom->setId($self); $atom->setSelfLink($self); $atom->addEntryFromNotices($this->notices); $this->raw($atom->getString()); } catch (Atom10FeedException $e) { $this->serverError('Could not generate feed for group - ' . $e->getMessage()); return; } break; case 'json': $this->showJsonTimeline($this->notices); break; default: $this->clientError(_('API method not found.'), 404, $this->format); break; } }