/**
  * Show the timeline of notices
  *
  * @return void
  */
 function showTimeline()
 {
     $sitename = common_config('site', 'name');
     // TRANS: Title of API timeline for a user and friends.
     // TRANS: %s is a username.
     $title = sprintf(_("%s and friends"), $this->target->nickname);
     $taguribase = TagURI::base();
     $id = "tag:{$taguribase}:FriendsTimelineHiddenReplies:" . $this->target->id;
     $subtitle = sprintf(_('Updates from %1$s and friends on %2$s! (with replies to non-friends hidden)'), $this->target->nickname, $sitename);
     $logo = $this->target->avatarUrl(AVATAR_PROFILE_SIZE);
     $link = common_local_url('all', array('nickname' => $this->target->nickname));
     $self = $this->getSelfUri();
     switch ($this->format) {
         case 'xml':
             $this->showXmlTimeline($this->notices);
             break;
         case 'rss':
             $this->showRssTimeline($this->notices, $title, $link, $subtitle, null, $logo, $self);
             break;
         case 'atom':
             header('Content-Type: application/atom+xml; charset=utf-8');
             $atom = new AtomNoticeFeed($this->auth_user);
             $atom->setId($id);
             $atom->setTitle($title);
             $atom->setSubtitle($subtitle);
             $atom->setLogo($logo);
             $atom->setUpdated('now');
             $atom->addLink($link);
             $atom->setSelfLink($self);
             $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, $title);
             $doc->addLink($link, 'alternate', 'text/html');
             $doc->addItemsFromNotices($this->notices);
             $this->raw($doc->asString());
             break;
         default:
             // TRANS: Client error displayed when coming across a non-supported API method.
             $this->clientError(_('API method not found.'), 404);
     }
 }
Пример #2
0
 /**
  * Show the timeline of notices
  *
  * @return void
  */
 function showTimeline()
 {
     $sitename = common_config('site', 'name');
     $sitelogo = common_config('site', 'logo') ? common_config('site', 'logo') : Theme::path('logo.png');
     // TRANS: Title for site timeline. %s is the StatusNet sitename.
     $title = sprintf(_("%s public timeline"), $sitename);
     $taguribase = TagURI::base();
     $id = "tag:{$taguribase}:PublicTimeline";
     $link = common_local_url('public');
     $self = $this->getSelfUri();
     // TRANS: Subtitle for site timeline. %s is the StatusNet sitename.
     $subtitle = sprintf(_("%s updates from everyone!"), $sitename);
     switch ($this->format) {
         case 'xml':
             $this->showXmlTimeline($this->notices);
             break;
         case 'rss':
             $this->showRssTimeline($this->notices, $title, $link, $subtitle, null, $sitelogo, $self);
             break;
         case 'atom':
             header('Content-Type: application/atom+xml; charset=utf-8');
             $atom = new AtomNoticeFeed($this->auth_user);
             $atom->setId($id);
             $atom->setTitle($title);
             $atom->setSubtitle($subtitle);
             $atom->setLogo($sitelogo);
             $atom->setUpdated('now');
             $atom->addLink(common_local_url('public'));
             $atom->setSelfLink($self);
             $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($title);
             $doc->addLink($link, 'alternate', 'text/html');
             $doc->addItemsFromNotices($this->notices);
             $this->raw($doc->asString());
             break;
         default:
             // TRANS: Client error displayed when coming across a non-supported API method.
             $this->clientError(_('API method not found.'), $code = 404);
             break;
     }
 }
 /**
  * Show the timeline of notices
  *
  * @return void
  */
 function showTimeline()
 {
     $profile = $this->user->getProfile();
     $avatar = $profile->getAvatar(AVATAR_PROFILE_SIZE);
     $sitename = common_config('site', 'name');
     $title = sprintf(_('%1$s / Updates mentioning %2$s'), $sitename, $this->user->nickname);
     $taguribase = TagURI::base();
     $id = "tag:{$taguribase}:Mentions:" . $this->user->id;
     $link = common_local_url('replies', array('nickname' => $this->user->nickname));
     $self = $this->getSelfUri();
     $subtitle = sprintf(_('%1$s updates that reply to updates from %2$s / %3$s.'), $sitename, $this->user->nickname, $profile->getBestName());
     $logo = $avatar ? $avatar->displayUrl() : Avatar::defaultImage(AVATAR_PROFILE_SIZE);
     switch ($this->format) {
         case 'xml':
             $this->showXmlTimeline($this->notices);
             break;
         case 'rss':
             $this->showRssTimeline($this->notices, $title, $link, $subtitle, null, $logo, $self);
             break;
         case 'atom':
             header('Content-Type: application/atom+xml; charset=utf-8');
             $atom = new AtomNoticeFeed();
             $atom->setId($id);
             $atom->setTitle($title);
             $atom->setSubtitle($subtitle);
             $atom->setLogo($logo);
             $atom->setUpdated('now');
             $atom->addLink($link);
             $atom->setSelfLink($self);
             $atom->addEntryFromNotices($this->notices);
             $this->raw($atom->getString());
             break;
         case 'json':
             $this->showJsonTimeline($this->notices);
             break;
         default:
             $this->clientError(_('API method not found.'), $code = 404);
             break;
     }
 }
Пример #4
0
 /**
  * Show the timeline of notices
  *
  * @return void
  */
 function showTimeline()
 {
     $profile = $this->user->getProfile();
     $avatar = $profile->getAvatar(AVATAR_PROFILE_SIZE);
     $sitename = common_config('site', 'name');
     $title = sprintf(_('%1$s / Bookmarks from %2$s'), $sitename, $this->user->nickname);
     $taguribase = TagURI::base();
     $id = "tag:{$taguribase}:Bookmarks:" . $this->user->id;
     $subtitle = sprintf(_('%1$s updates bookmarked by %2$s / %3$s.'), $sitename, $profile->getBestName(), $this->user->nickname);
     $logo = !empty($avatar) ? $avatar->displayUrl() : Avatar::defaultImage(AVATAR_PROFILE_SIZE);
     $link = common_local_url('bookmarks', array('nickname' => $this->user->nickname));
     $self = $this->getSelfUri();
     switch ($this->format) {
         case 'xml':
             $this->showXmlTimeline($this->notices);
             break;
         case 'rss':
             $this->showRssTimeline($this->notices, $title, $link, $subtitle, null, $logo, $self);
             break;
         case 'atom':
             header('Content-Type: application/atom+xml; charset=utf-8');
             $atom = new AtomNoticeFeed($this->auth_user);
             $atom->setId($id);
             $atom->setTitle($title);
             $atom->setSubtitle($subtitle);
             $atom->setLogo($logo);
             $atom->setUpdated('now');
             $atom->addLink($link);
             $atom->setSelfLink($self);
             $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($title);
             $doc->addLink($link, 'alternate', 'text/html');
             $doc->addItemsFromNotices($this->notices);
             $this->raw($doc->asString());
             break;
         default:
             // TRANS: Client error displayed when coming across a non-supported API method.
             $this->clientError(_('API method not found.'), $code = 404);
             break;
     }
 }
Пример #5
0
 /**
  * Show the timeline of notices
  *
  * @return void
  */
 function showTimeline()
 {
     $profile = $this->user->getProfile();
     $avatar = $profile->getAvatar(AVATAR_PROFILE_SIZE);
     $sitename = common_config('site', 'name');
     // TRANS: Timeline title for user and friends. %s is a user nickname.
     $title = sprintf(_("%s and friends"), $this->user->nickname);
     $taguribase = TagURI::base();
     $id = "tag:{$taguribase}:HomeTimeline:" . $this->user->id;
     $subtitle = sprintf(_('Updates from %1$s and friends on %2$s!'), $this->user->nickname, $sitename);
     $link = common_local_url('all', array('nickname' => $this->user->nickname));
     $self = $this->getSelfUri();
     $logo = !empty($avatar) ? $avatar->displayUrl() : Avatar::defaultImage(AVATAR_PROFILE_SIZE);
     switch ($this->format) {
         case 'xml':
             $this->showXmlTimeline($this->notices);
             break;
         case 'rss':
             $this->showRssTimeline($this->notices, $title, $link, $subtitle, null, $logo, $self);
             break;
         case 'atom':
             header('Content-Type: application/atom+xml; charset=utf-8');
             $atom = new AtomNoticeFeed($this->auth_user);
             $atom->setId($id);
             $atom->setTitle($title);
             $atom->setSubtitle($subtitle);
             $atom->setLogo($logo);
             $atom->setUpdated('now');
             $atom->addLink($link);
             $atom->setSelfLink($self);
             $atom->addEntryFromNotices($this->notices);
             $this->raw($atom->getString());
             break;
         case 'json':
             $this->showJsonTimeline($this->notices);
             break;
         default:
             // TRANS: Client error displayed when trying to handle an unknown API method.
             $this->clientError(_('API method not found.'), $code = 404);
             break;
     }
 }
Пример #6
0
 /**
  * Show the timeline of notices
  *
  * @return void
  */
 function showTimeline()
 {
     $sitename = common_config('site', 'name');
     $sitelogo = common_config('site', 'logo') ? common_config('site', 'logo') : Theme::path('logo.png');
     $title = sprintf(_("%s public timeline"), $sitename);
     $taguribase = TagURI::base();
     $id = "tag:{$taguribase}:PublicTimeline";
     $link = common_local_url('public');
     $self = $this->getSelfUri();
     $subtitle = sprintf(_("%s updates from everyone!"), $sitename);
     switch ($this->format) {
         case 'xml':
             $this->showXmlTimeline($this->notices);
             break;
         case 'rss':
             $this->showRssTimeline($this->notices, $title, $link, $subtitle, null, $sitelogo, $self);
             break;
         case 'atom':
             header('Content-Type: application/atom+xml; charset=utf-8');
             $atom = new AtomNoticeFeed($this->auth_user);
             $atom->setId($id);
             $atom->setTitle($title);
             $atom->setSubtitle($subtitle);
             $atom->setLogo($sitelogo);
             $atom->setUpdated('now');
             $atom->addLink(common_local_url('public'));
             $atom->setSelfLink($self);
             $atom->addEntryFromNotices($this->notices);
             $this->raw($atom->getString());
             break;
         case 'json':
             $this->showJsonTimeline($this->notices);
             break;
         default:
             $this->clientError(_('API method not found.'), $code = 404);
             break;
     }
 }
Пример #7
0
 /**
  * Show the timeline of notices
  *
  * @return void
  */
 function showTimeline()
 {
     $sitename = common_config('site', 'name');
     $sitelogo = common_config('site', 'logo') ? common_config('site', 'logo') : Theme::path('logo.png');
     $title = sprintf(_("Notices tagged with %s"), $this->tag);
     $subtitle = sprintf(_('Updates tagged with %1$s on %2$s!'), $this->tag, $sitename);
     $taguribase = TagURI::base();
     $id = "tag:{$taguribase}:TagTimeline:" . $tag;
     $link = common_local_url('tag', array('tag' => $this->tag));
     $self = $this->getSelfUri();
     common_debug("self link is: {$self}");
     switch ($this->format) {
         case 'xml':
             $this->showXmlTimeline($this->notices);
             break;
         case 'rss':
             $this->showRssTimeline($this->notices, $title, $link, $subtitle, null, $sitelogo, $self);
             break;
         case 'atom':
             header('Content-Type: application/atom+xml; charset=utf-8');
             $atom = new AtomNoticeFeed($this->auth_user);
             $atom->setId($id);
             $atom->setTitle($title);
             $atom->setSubtitle($subtitle);
             $atom->setLogo($logo);
             $atom->setUpdated('now');
             $atom->addLink($link);
             $atom->setSelfLink($self);
             $atom->addEntryFromNotices($this->notices);
             $this->raw($atom->getString());
             break;
         case 'json':
             $this->showJsonTimeline($this->notices);
             break;
         default:
             $this->clientError(_('API method not found.'), $code = 404);
             break;
     }
 }
Пример #8
0
 /**
  * Show the timeline of notices
  *
  * @return void
  */
 function showTimeline()
 {
     $sitename = common_config('site', 'name');
     $sitelogo = common_config('site', 'logo') ? common_config('site', 'logo') : Theme::path('logo.png');
     // TRANS: Title for timeline with lastest notices with a given tag.
     // TRANS: %s is the tag.
     $title = sprintf(_("Notices tagged with %s"), $this->tag);
     $subtitle = sprintf(_('Updates tagged with %1$s on %2$s!'), $this->tag, $sitename);
     $taguribase = TagURI::base();
     $id = "tag:{$taguribase}:TagTimeline:" . $this->tag;
     $link = common_local_url('tag', array('tag' => $this->tag));
     $self = $this->getSelfUri();
     switch ($this->format) {
         case 'xml':
             $this->showXmlTimeline($this->notices);
             break;
         case 'rss':
             $this->showRssTimeline($this->notices, $title, $link, $subtitle, null, $sitelogo, $self);
             break;
         case 'atom':
             header('Content-Type: application/atom+xml; charset=utf-8');
             $atom = new AtomNoticeFeed($this->auth_user);
             $atom->setId($id);
             $atom->setTitle($title);
             $atom->setSubtitle($subtitle);
             $atom->setLogo($logo);
             $atom->setUpdated('now');
             $atom->addLink($link);
             $atom->setSelfLink($self);
             $atom->addEntryFromNotices($this->notices);
             $this->raw($atom->getString());
             break;
         case 'json':
             $this->showJsonTimeline($this->notices);
             break;
         case 'as':
             header('Content-Type: application/json; charset=utf-8');
             $doc = new ActivityStreamJSONDocument($this->auth_user);
             $doc->setTitle($title);
             $doc->addLink($link, 'alternate', 'text/html');
             $doc->addItemsFromNotices($this->notices);
             $this->raw($doc->asString());
             break;
         default:
             // TRANS: Client error displayed when trying to handle an unknown API method.
             $this->clientError(_('API method not found.'), $code = 404);
             break;
     }
 }