- static function fromNotice(Notice $notice)
- {
- $object = new ActivityObject();
-
- if (Event::handle('StartActivityObjectFromNotice', array($notice, &$object))) {
-
- $object->type = (empty($notice->object_type)) ? ActivityObject::NOTE : $notice->object_type;
-
- $object->id = $notice->uri;
- $object->content = $notice->rendered;
- $object->link = $notice->bestUrl();
-
- $object->extra[] = array('status_net', array('notice_id' => $notice->id));
-
- Event::handle('EndActivityObjectFromNotice', array($notice, &$object));
- }
-
- return $object;
- }
-
- static function fromProfile(Profile $profile)
- {
- $object = new ActivityObject();
-
- if (Event::handle('StartActivityObjectFromProfile', array($profile, &$object))) {
- $object->type = ActivityObject::PERSON;
- $object->id = $profile->getUri();
- $object->title = $profile->getBestName();
- $object->link = $profile->profileurl;
-
- $orig = $profile->getOriginalAvatar();
-
- if (!empty($orig)) {
- $object->avatarLinks[] = AvatarLink::fromAvatar($orig);
- }
-
- $sizes = array(
- AVATAR_PROFILE_SIZE,
- AVATAR_STREAM_SIZE,
- AVATAR_MINI_SIZE
- );
-
- foreach ($sizes as $size) {
- $alink = null;
- $avatar = $profile->getAvatar($size);
-
- if (!empty($avatar)) {
- $alink = AvatarLink::fromAvatar($avatar);
- } else {
- $alink = new AvatarLink();
- $alink->type = 'image/png';
- $alink->height = $size;
- $alink->width = $size;
- $alink->url = Avatar::defaultImage($size);
-
- if ($size == AVATAR_PROFILE_SIZE) {
- // Hack for Twitter import: we don't have a 96x96 image,
- // but we do have a 73x73 image. For now, fake it with that.
- $avatar = $profile->getAvatar(73);
- if ($avatar) {
- $alink = AvatarLink::fromAvatar($avatar);
- $alink->height= $size;
- $alink->width = $size;
- }
- }
- }
-
- $object->avatarLinks[] = $alink;
- }
-
- if (isset($profile->lat) && isset($profile->lon)) {
- $object->geopoint = (float)$profile->lat
- . ' ' . (float)$profile->lon;
- }
-
- $object->poco = PoCo::fromProfile($profile);
-
- if ($profile->getUser()) {
- $object->extra[] = array('followers', array('url' => common_local_url('subscribers', array('nickname' => $profile->nickname))));
- }
-
- Event::handle('EndActivityObjectFromProfile', array($profile, &$object));
- }
-
- return $object;
- }
-
- static function fromGroup($group)