/**
  * Constructor
  *
  * @param User    $user    the user for the feed
  * @param User    $cur     the current authenticated user, if any
  * @param boolean $indent  flag to turn indenting on or off
  *
  * @return void
  */
 function __construct($user, $cur = null, $indent = true)
 {
     parent::__construct($cur, $indent);
     $this->user = $user;
     if (!empty($user)) {
         $profile = $user->getProfile();
         $ao = ActivityObject::fromProfile($profile);
         array_push($ao->extra, $profile->profileInfo($cur));
         // XXX: For users, we generate an author _AND_ an <activity:subject>
         // This is for backward compatibility with clients (especially
         // StatusNet's clients) that assume the Atom will conform to an
         // older version of the Activity Streams API. Subject should be
         // removed in future versions of StatusNet.
         $this->addAuthorRaw($ao->asString('author'));
         $depMsg = 'Deprecation warning: activity:subject is present ' . 'only for backward compatibility. It will be ' . 'removed in the next version of StatusNet.';
         $this->addAuthorRaw("<!--{$depMsg}-->\n" . $ao->asString('activity:subject'));
     }
     // TRANS: Title in atom user notice feed. %s is a user name.
     $title = sprintf(_("%s timeline"), $user->nickname);
     $this->setTitle($title);
     $sitename = common_config('site', 'name');
     $subtitle = sprintf(_('Updates from %1$s on %2$s!'), $user->nickname, $sitename);
     $this->setSubtitle($subtitle);
     $avatar = $profile->getAvatar(AVATAR_PROFILE_SIZE);
     $logo = $avatar ? $avatar->displayUrl() : Avatar::defaultImage(AVATAR_PROFILE_SIZE);
     $this->setLogo($logo);
     $this->setUpdated('now');
     $this->addLink(common_local_url('showstream', array('nickname' => $user->nickname)));
     $self = common_local_url('ApiTimelineUser', array('id' => $user->id, 'format' => 'atom'));
     $this->setId($self);
     $this->setSelfLink($self);
     $this->addLink(common_local_url('sup', null, null, $user->id), array('rel' => 'http://api.friendfeed.com/2008/03#sup', 'type' => 'application/json'));
 }
 /**
  * Constructor
  *
  * @param User    $user    the user for the feed
  * @param User    $cur     the current authenticated user, if any
  * @param boolean $indent  flag to turn indenting on or off
  *
  * @return void
  */
 function __construct($user, $cur = null, $indent = true)
 {
     parent::__construct($cur, $indent);
     $this->user = $user;
     if (!empty($user)) {
         $profile = $user->getProfile();
         $this->addAuthor($profile->nickname, $user->uri);
         $this->setActivitySubject($profile->asActivityNoun('subject'));
     }
     // TRANS: Title in atom user notice feed. %s is a user name.
     $title = sprintf(_("%s timeline"), $user->nickname);
     $this->setTitle($title);
     $sitename = common_config('site', 'name');
     $subtitle = sprintf(_('Updates from %1$s on %2$s!'), $user->nickname, $sitename);
     $this->setSubtitle($subtitle);
     $avatar = $profile->getAvatar(AVATAR_PROFILE_SIZE);
     $logo = $avatar ? $avatar->displayUrl() : Avatar::defaultImage(AVATAR_PROFILE_SIZE);
     $this->setLogo($logo);
     $this->setUpdated('now');
     $this->addLink(common_local_url('showstream', array('nickname' => $user->nickname)));
     $self = common_local_url('ApiTimelineUser', array('id' => $user->id, 'format' => 'atom'));
     $this->setId($self);
     $this->setSelfLink($self);
     $this->addLink(common_local_url('sup', null, null, $user->id), array('rel' => 'http://api.friendfeed.com/2008/03#sup', 'type' => 'application/json'));
 }
 function initFeed()
 {
     parent::initFeed();
     $attrs = array();
     if (!empty($this->cur)) {
         $attrs['member'] = $this->cur->isMember($this->group) ? 'true' : 'false';
         $attrs['blocked'] = Group_block::isBlocked($this->group, $this->cur->getProfile()) ? 'true' : 'false';
     }
     $attrs['member_count'] = $this->group->getMemberCount();
     $this->element('statusnet:group_info', $attrs, null);
 }
Example #4
0
 /**
  * Constructor
  *
  * @param Group   $group   the group for the feed
  * @param boolean $indent  flag to turn indenting on or off
  *
  * @return void
  */
 function __construct($group, $indent = true)
 {
     parent::__construct($indent);
     $this->group = $group;
     $title = sprintf(_("%s timeline"), $group->nickname);
     $this->setTitle($title);
     $sitename = common_config('site', 'name');
     $subtitle = sprintf(_('Updates from %1$s on %2$s!'), $group->nickname, $sitename);
     $this->setSubtitle($subtitle);
     $avatar = $group->homepage_logo;
     $logo = $avatar ? $avatar : User_group::defaultLogo(AVATAR_PROFILE_SIZE);
     $this->setLogo($logo);
     $this->setUpdated('now');
     $self = common_local_url('ApiTimelineGroup', array('id' => $group->id, 'format' => 'atom'));
     $this->setId($self);
     $this->setSelfLink($self);
     $this->addAuthorRaw($group->asAtomAuthor());
     $this->setActivitySubject($group->asActivitySubject());
     $this->addLink($group->homeUrl());
 }
 /**
  * Constructor
  *
  * @param List    $list    the list for the feed
  * @param User    $cur     the current authenticated user, if any
  * @param boolean $indent  flag to turn indenting on or off
  *
  * @return void
  */
 function __construct($list, $cur = null, $indent = true)
 {
     parent::__construct($cur, $indent);
     $this->list = $list;
     $this->tagger = Profile::getKV('id', $list->tagger);
     // TRANS: Title in atom list notice feed. %1$s is a list name, %2$s is a tagger's nickname.
     $title = sprintf(_('Timeline for people in list %1$s by %2$s'), $list->tag, $this->tagger->nickname);
     $this->setTitle($title);
     $sitename = common_config('site', 'name');
     $subtitle = sprintf(_('Updates from %1$s\'s list %2$s on %3$s!'), $this->tagger->nickname, $list->tag, $sitename);
     $this->setSubtitle($subtitle);
     $avatar = $this->tagger->avatarUrl(AVATAR_PROFILE_SIZE);
     $this->setLogo($avatar);
     $this->setUpdated('now');
     $self = common_local_url('ApiTimelineList', array('user' => $this->tagger->nickname, 'id' => $list->tag, 'format' => 'atom'));
     $this->setId($self);
     $this->setSelfLink($self);
     $ao = ActivityObject::fromPeopletag($this->list);
     $this->addAuthorRaw($ao->asString('author'));
     $this->addLink($this->list->getUri());
 }
 /**
  * Constructor
  *
  * @param User    $user    the user for the feed
  * @param User    $cur     the current authenticated user, if any
  * @param boolean $indent  flag to turn indenting on or off
  *
  * @return void
  */
 function __construct($user, $cur = null, $indent = true)
 {
     parent::__construct($cur, $indent);
     $this->user = $user;
     if (!empty($user)) {
         $profile = $user->getProfile();
         $ao = $profile->asActivityObject();
         array_push($ao->extra, $profile->profileInfo($this->scoped));
         $this->addAuthorRaw($ao->asString('author'));
     }
     // TRANS: Title in atom user notice feed. %s is a user name.
     $title = sprintf(_("%s timeline"), $user->nickname);
     $this->setTitle($title);
     $sitename = common_config('site', 'name');
     $subtitle = sprintf(_('Updates from %1$s on %2$s!'), $user->nickname, $sitename);
     $this->setSubtitle($subtitle);
     $this->setLogo($profile->avatarUrl(AVATAR_PROFILE_SIZE));
     $this->setUpdated('now');
     $this->addLink(common_local_url('showstream', array('nickname' => $user->nickname)));
     $self = common_local_url('ApiTimelineUser', array('id' => $user->id, 'format' => 'atom'));
     $this->setId($self);
     $this->setSelfLink($self);
     $this->addLink(common_local_url('sup', null, null, $user->id), array('rel' => 'http://api.friendfeed.com/2008/03#sup', 'type' => 'application/json'));
 }
 /**
  * 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;
     }
 }
Example #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 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;
     }
 }
 /**
  * Handle the request
  *
  * show a timeline of the user's repeated notices
  *
  * @param array $args $_REQUEST data (unused)
  *
  * @return void
  */
 function handle($args)
 {
     parent::handle($args);
     $offset = ($this->page - 1) * $this->cnt;
     $limit = $this->cnt;
     // TRANS: Title of list of repeated notices of the logged in user.
     // TRANS: %s is the nickname of the logged in user.
     $title = sprintf(_("Repeats of %s"), $this->auth_user->nickname);
     $sitename = common_config('site', 'name');
     $profile = $this->auth_user->getProfile();
     $subtitle = sprintf(_('%1$s notices that %2$s / %3$s has repeated.'), $sitename, $this->auth_user->nickname, $profile->getBestName());
     $taguribase = TagURI::base();
     $id = "tag:{$taguribase}:RepeatsOfMe:" . $this->auth_user->id;
     $link = common_local_url('all', array('nickname' => $this->auth_user->nickname));
     $strm = $this->auth_user->repeatsOfMe($offset, $limit, $this->since_id, $this->max_id);
     switch ($this->format) {
         case 'xml':
             $this->showXmlTimeline($strm);
             break;
         case 'json':
             $this->showJsonTimeline($strm);
             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->setUpdated('now');
             $atom->addLink($link);
             $atom->setSelfLink($this->getSelfUri());
             $atom->addEntryFromNotices($strm);
             $this->raw($atom->getString());
             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($strm);
             $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);
             break;
     }
 }
 /**
  * Handle the request
  *
  * show a timeline of the user's repeated notices
  *
  * @param array $args $_REQUEST data (unused)
  *
  * @return void
  */
 function handle($args)
 {
     parent::handle($args);
     $offset = ($this->page - 1) * $this->cnt;
     $limit = $this->cnt;
     $strm = $this->auth_user->repeatsOfMe($offset, $limit, $this->since_id, $this->max_id);
     common_debug(var_export($strm, true));
     switch ($this->format) {
         case 'xml':
             $this->showXmlTimeline($strm);
             break;
         case 'json':
             $this->showJsonTimeline($strm);
             break;
         case 'atom':
             $profile = $this->auth_user->getProfile();
             $title = sprintf(_("Repeats of %s"), $this->auth_user->nickname);
             $taguribase = TagURI::base();
             $id = "tag:{$taguribase}:RepeatsOfMe:" . $this->auth_user->id;
             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->setUpdated('now');
             $atom->addLink(common_local_url('showstream', array('nickname' => $this->auth_user->nickname)));
             $id = $this->arg('id');
             $aargs = array('format' => 'atom');
             if (!empty($id)) {
                 $aargs['id'] = $id;
             }
             $atom->addLink($this->getSelfUri('ApiTimelineRetweetsOfMe', $aargs), array('rel' => 'self', 'type' => 'application/atom+xml'));
             $atom->addEntryFromNotices($strm);
             $this->raw($atom->getString());
             break;
         default:
             $this->clientError(_('API method not found.'), $code = 404);
             break;
     }
 }
Example #11
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;
     }
 }
Example #12
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;
     }
 }
 /**
  * Handler method
  *
  * @param array $argarray is ignored since it's now passed in in prepare()
  *
  * @return void
  */
 function handle($argarray = null)
 {
     $sitename = common_config('site', 'name');
     // TRANS: Title for conversion timeline.
     $title = _m('TITLE', 'Conversation');
     $id = common_local_url('apiconversation', array('id' => $this->conversation->id, 'format' => $this->format));
     $link = common_local_url('conversation', array('id' => $this->conversation->id));
     $self = $id;
     switch ($this->format) {
         case 'xml':
             $this->showXmlTimeline($this->notices);
             break;
         case 'rss':
             $this->showRssTimeline($this->notices, $title, $link, null, null, null, $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->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;
     }
 }
Example #14
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;
     }
 }
 /**
  * Handle the request
  *
  * show a timeline of the user's repeated notices
  *
  * @param array $args $_REQUEST data (unused)
  *
  * @return void
  */
 function handle($args)
 {
     parent::handle($args);
     $offset = ($this->page - 1) * $this->cnt;
     $limit = $this->cnt;
     // TRANS: Title for Atom feed "repeated to me". %s is the user nickname.
     $title = sprintf(_("Repeated to %s"), $this->auth_user->nickname);
     $subtitle = sprintf(_('%1$s notices that were to repeated to %2$s / %3$s.'), $sitename, $this->user->nickname, $profile->getBestName());
     $taguribase = TagURI::base();
     $id = "tag:{$taguribase}:RepeatedToMe:" . $this->auth_user->id;
     $link = common_local_url('all', array('nickname' => $this->auth_user->nickname));
     $strm = $this->auth_user->repeatedToMe($offset, $limit, $this->since_id, $this->max_id);
     switch ($this->format) {
         case 'xml':
             $this->showXmlTimeline($strm);
             break;
         case 'json':
             $this->showJsonTimeline($strm);
             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->setUpdated('now');
             $atom->addLink($link);
             $id = $this->arg('id');
             $atom->setSelfLink($self);
             $atom->addEntryFromNotices($strm);
             $this->raw($atom->getString());
             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($strm);
             $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;
     }
 }
 /**
  * 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);
     }
 }
Example #17
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;
     }
 }
Example #18
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;
     }
 }