// TODO: avatar url template (example.com/user/avatar?size={x}x{y})
$twitter_user['profile_image_url'] = Avatar::urlByProfile($profile, AVATAR_STREAM_SIZE);
+ $twitter_user['profile_image_url_https'] = $twitter_user['profile_image_url'];
+
// START introduced by qvitter API, not necessary for StatusNet API
$twitter_user['profile_image_url_profile_size'] = Avatar::urlByProfile($profile, AVATAR_PROFILE_SIZE);
try {
$twitter_user['created_at'] = $this->dateTwitter($profile->created);
- $twitter_user['favourites_count'] = $profile->faveCount(); // British spelling!
-
$timezone = 'UTC';
if (!empty($user) && $user->timezone) {
$twitter_user['statusnet_profile_url'] = $profile->profileurl;
+ // The event call to handle NoticeSimpleStatusArray lets plugins add data to the output array
+ Event::handle('TwitterUserArray', array($profile, &$twitter_user, $this->scoped, array()));
+
return $twitter_user;
}
if (!empty($notice->repeat_of)) {
$original = Notice::getKV('id', $notice->repeat_of);
- if (!empty($original)) {
- $original_array = $this->twitterSimpleStatusArray($original, $include_user);
- $base['retweeted_status'] = $original_array;
+ if ($original instanceof Notice) {
+ $orig_array = $this->twitterSimpleStatusArray($original, $include_user);
+ $base['retweeted_status'] = $orig_array;
}
}
}
if (!is_null($this->scoped)) {
- $twitter_status['favorited'] = $this->scoped->hasFave($notice);
$twitter_status['repeated'] = $this->scoped->hasRepeated($notice);
} else {
- $twitter_status['favorited'] = false;
$twitter_status['repeated'] = false;
}
$twitter_status['attachments'] = array();
foreach ($attachments as $attachment) {
- $enclosure_o=$attachment->getEnclosure();
- if ($enclosure_o) {
+ try {
+ $enclosure_o = $attachment->getEnclosure();
$enclosure = array();
$enclosure['url'] = $enclosure_o->url;
$enclosure['mimetype'] = $enclosure_o->mimetype;
$enclosure['size'] = $enclosure_o->size;
$twitter_status['attachments'][] = $enclosure;
+ } catch (ServerException $e) {
+ // There was not enough metadata available
}
}
}
$twitter_status['statusnet_html'] = $notice->rendered;
$twitter_status['statusnet_conversation_id'] = intval($notice->conversation);
+ // The event call to handle NoticeSimpleStatusArray lets plugins add data to the output array
+ Event::handle('NoticeSimpleStatusArray', array($notice, &$twitter_status, $this->scoped,
+ array('include_user'=>$include_user)));
+
return $twitter_status;
}
$enclosures = array();
foreach ($attachments as $attachment) {
- $enclosure_o=$attachment->getEnclosure();
- if ($enclosure_o) {
+ try {
+ $enclosure_o = $attachment->getEnclosure();
$enclosure = array();
$enclosure['url'] = $enclosure_o->url;
$enclosure['mimetype'] = $enclosure_o->mimetype;
$enclosure['size'] = $enclosure_o->size;
$enclosures[] = $enclosure;
+ } catch (ServerException $e) {
+ // There was not enough metadata available
}
}
default:
// TRANS: Client error on an API request with an unsupported data format.
$this->clientError(_('Not a supported data format.'));
- break;
}
return;
default:
// TRANS: Client error on an API request with an unsupported data format.
$this->clientError(_('Not a supported data format.'));
- break;
}
return;
}
default:
// TRANS: Client error on an API request with an unsupported data format.
$this->clientError(_('Not a supported data format.'));
- return;
}
return;
}