Exemplo n.º 1
0
 static function fromPeopletag($ptag)
 {
     $object = new ActivityObject();
     if (Event::handle('StartActivityObjectFromPeopletag', array($ptag, &$object))) {
         $object->type = ActivityObject::_LIST;
         $object->id = $ptag->getUri();
         $object->title = $ptag->tag;
         $object->summary = $ptag->description;
         $object->link = $ptag->homeUrl();
         $object->owner = Profile::getKV('id', $ptag->tagger);
         $object->poco = PoCo::fromProfile($object->owner);
         Event::handle('EndActivityObjectFromPeopletag', array($ptag, &$object));
     }
     return $object;
 }
Exemplo n.º 2
0
 static function fromGroup($group)
 {
     $object = new ActivityObject();
     $object->type = ActivityObject::GROUP;
     $object->id = $group->getUri();
     $object->title = $group->getBestName();
     $object->link = $group->getUri();
     $object->avatarLinks[] = AvatarLink::fromFilename($group->homepage_logo, AVATAR_PROFILE_SIZE);
     $object->avatarLinks[] = AvatarLink::fromFilename($group->stream_logo, AVATAR_STREAM_SIZE);
     $object->avatarLinks[] = AvatarLink::fromFilename($group->mini_logo, AVATAR_MINI_SIZE);
     $object->poco = PoCo::fromGroup($group);
     return $object;
 }
Exemplo n.º 3
0
 public function asActivityObject()
 {
     $object = new ActivityObject();
     if (Event::handle('StartActivityObjectFromProfile', array($this, &$object))) {
         $object->type = $this->getObjectType();
         $object->id = $this->getUri();
         $object->title = $this->getBestName();
         $object->link = $this->getUrl();
         $object->summary = $this->getDescription();
         try {
             $avatar = Avatar::getUploaded($this);
             $object->avatarLinks[] = AvatarLink::fromAvatar($avatar);
         } catch (NoAvatarException $e) {
             // Could not find an original avatar to link
         }
         $sizes = array(AVATAR_PROFILE_SIZE, AVATAR_STREAM_SIZE, AVATAR_MINI_SIZE);
         foreach ($sizes as $size) {
             $alink = null;
             try {
                 $avatar = Avatar::byProfile($this, $size);
                 $alink = AvatarLink::fromAvatar($avatar);
             } catch (NoAvatarException $e) {
                 $alink = new AvatarLink();
                 $alink->type = 'image/png';
                 $alink->height = $size;
                 $alink->width = $size;
                 $alink->url = Avatar::defaultImage($size);
             }
             $object->avatarLinks[] = $alink;
         }
         if (isset($this->lat) && isset($this->lon)) {
             $object->geopoint = (double) $this->lat . ' ' . (double) $this->lon;
         }
         $object->poco = PoCo::fromProfile($this);
         if ($this->isLocal()) {
             $object->extra[] = array('followers', array('url' => common_local_url('subscribers', array('nickname' => $this->getNickname()))));
         }
         Event::handle('EndActivityObjectFromProfile', array($this, &$object));
     }
     return $object;
 }
Exemplo n.º 4
-1
 static function fromGroup($group)
 {
     $object = new ActivityObject();
     if (Event::handle('StartActivityObjectFromGroup', array($group, &$object))) {
         $object->type = ActivityObject::GROUP;
         $object->id = $group->getUri();
         $object->title = $group->getBestName();
         $object->link = $group->getUri();
         $object->avatarLinks[] = AvatarLink::fromFilename($group->homepage_logo, AVATAR_PROFILE_SIZE);
         $object->avatarLinks[] = AvatarLink::fromFilename($group->stream_logo, AVATAR_STREAM_SIZE);
         $object->avatarLinks[] = AvatarLink::fromFilename($group->mini_logo, AVATAR_MINI_SIZE);
         $object->poco = PoCo::fromGroup($group);
         Event::handle('EndActivityObjectFromGroup', array($group, &$object));
     }
     return $object;
 }