/** * 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()); }
/** * Returns an XML string fragment with profile information as an * Activity Streams noun object with the given element type. * * Assumes that 'activity' namespace has been previously defined. * * @todo FIXME: Replace with wrappers on asActivityObject when it's got everything. * * @param string $element one of 'actor', 'subject', 'object', 'target' * @return string */ function asActivityNoun($element) { if ($this->isGroup()) { $noun = ActivityObject::fromGroup($this->localGroup()); return $noun->asString('activity:' . $element); } else { if ($this->isPeopletag()) { $noun = ActivityObject::fromPeopletag($this->localPeopletag()); return $noun->asString('activity:' . $element); } else { $noun = $this->localProfile()->asActivityObject(); return $noun->asString('activity:' . $element); } } }
/** * return an xml string to represent this people tag * as a noun in an activitystreams feed. * * @param string $element the xml tag * * @return string activitystreams noun */ function asActivityNoun($element) { $noun = ActivityObject::fromPeopletag($this); return $noun->asString('activity:' . $element); }
/** * Notify remote user that a people tag has been removed * - untag verb is queued * - the subscription is undone immediately if not required * i.e garbageCollect()'d * * @param Profile_tag $ptag the people tag that was deleted * @return hook return value */ function onEndUntagProfile($ptag) { $oprofile = Ostatus_profile::staticGet('profile_id', $ptag->tagged); if (empty($oprofile)) { return true; } $plist = $ptag->getMeta(); if ($plist->private) { return true; } $act = new Activity(); $tagger = $plist->getTagger(); $tagged = Profile::staticGet('id', $ptag->tagged); $act->verb = ActivityVerb::UNTAG; $act->id = TagURI::mint('untag_profile:%d:%d:%s', $plist->tagger, $plist->id, common_date_iso8601(time())); $act->time = time(); // TRANS: Title for unlisting a remote profile. $act->title = _m('TITLE', 'Unlist'); // TRANS: Success message for remote list removal through OStatus. // TRANS: %1$s is the list creator's name, %2$s is the removed list member, %3$s is the list name. $act->content = sprintf(_m('%1$s removed %2$s from the list %3$s.'), $tagger->getBestName(), $tagged->getBestName(), $plist->getBestName()); $act->actor = ActivityObject::fromProfile($tagger); $act->objects = array(ActivityObject::fromProfile($tagged)); $act->target = ActivityObject::fromPeopletag($plist); $oprofile->notifyDeferred($act, $tagger); // unsubscribe to PuSH feed if no more required $oprofile->garbageCollect(); return true; }