Beispiel #1
0
 function __construct($indent = true)
 {
     parent::__construct($indent);
     // Feeds containing notice info use these namespaces
     $this->addNamespace('thr', 'http://purl.org/syndication/thread/1.0');
     $this->addNamespace('georss', 'http://www.georss.org/georss');
     $this->addNamespace('activity', 'http://activitystrea.ms/spec/1.0/');
     $this->addNamespace('media', 'http://purl.org/syndication/atommedia');
     $this->addNamespace('poco', 'http://portablecontacts.net/spec/1.0');
     // XXX: What should the uri be?
     $this->addNamespace('ostatus', 'http://ostatus.org/schema/1.0');
 }
 /**
  * Constructor - adds a bunch of XML namespaces we need in our
  * notice-specific Atom feeds, and allows setting the current
  * authenticated user (useful for API methods).
  *
  * @param User    $cur     the current authenticated user (optional)
  * @param boolean $indent  Whether to indent XML output
  *
  */
 function __construct($cur = null, $indent = true)
 {
     parent::__construct($indent);
     $this->cur = $cur ?: common_current_user();
     $this->scoped = !is_null($this->cur) ? $this->cur->getProfile() : null;
     // Feeds containing notice info use these namespaces
     $this->addNamespace('thr', 'http://purl.org/syndication/thread/1.0');
     $this->addNamespace('georss', 'http://www.georss.org/georss');
     $this->addNamespace('activity', 'http://activitystrea.ms/spec/1.0/');
     $this->addNamespace('media', 'http://purl.org/syndication/atommedia');
     $this->addNamespace('poco', 'http://portablecontacts.net/spec/1.0');
     // XXX: What should the uri be?
     $this->addNamespace('ostatus', 'http://ostatus.org/schema/1.0');
     $this->addNamespace('statusnet', 'http://status.net/schema/api/1/');
 }
 /**
  * Show the feed of subscriptions
  *
  * @return void
  */
 function showFeed()
 {
     header('Content-Type: application/atom+xml; charset=utf-8');
     $url = common_local_url('AtomPubSubscriptionFeed', array('subscriber' => $this->_profile->id));
     $feed = new Atom10Feed(true);
     $feed->addNamespace('activity', 'http://activitystrea.ms/spec/1.0/');
     $feed->addNamespace('poco', 'http://portablecontacts.net/spec/1.0');
     $feed->addNamespace('media', 'http://purl.org/syndication/atommedia');
     $feed->addNamespace('georss', 'http://www.georss.org/georss');
     $feed->id = $url;
     $feed->setUpdated('now');
     $feed->addAuthor($this->_profile->getBestName(), $this->_profile->getURI());
     // TRANS: Title for Atom subscription feed.
     // TRANS: %s is a user nickname.
     $feed->setTitle(sprintf(_("%s subscriptions"), $this->_profile->getBestName()));
     // TRANS: Subtitle for Atom subscription feed.
     // TRANS: %1$s is a user nickname, %s$s is the StatusNet sitename.
     $feed->setSubtitle(sprintf(_("People %1\$s has subscribed to on %2\$s"), $this->_profile->getBestName(), common_config('site', 'name')));
     $feed->addLink(common_local_url('subscriptions', array('nickname' => $this->_profile->nickname)));
     $feed->addLink($url, array('rel' => 'self', 'type' => 'application/atom+xml'));
     // If there's more...
     if ($this->page > 1) {
         $feed->addLink($url, array('rel' => 'first', 'type' => 'application/atom+xml'));
         $feed->addLink(common_local_url('AtomPubSubscriptionFeed', array('subscriber' => $this->_profile->id), array('page' => $this->page - 1)), array('rel' => 'prev', 'type' => 'application/atom+xml'));
     }
     if ($this->_subscriptions->N > $this->count) {
         $feed->addLink(common_local_url('AtomPubSubscriptionFeed', array('subscriber' => $this->_profile->id), array('page' => $this->page + 1)), array('rel' => 'next', 'type' => 'application/atom+xml'));
     }
     $i = 0;
     // XXX: This is kind of inefficient
     while ($this->_subscriptions->fetch()) {
         // We get one more than needed; skip that one
         $i++;
         if ($i > $this->count) {
             break;
         }
         $act = $this->_subscriptions->asActivity();
         $feed->addEntryRaw($act->asString(false, false, false));
     }
     $this->raw($feed->getString());
 }