// 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['profile_image_url_original'] = $origurl;
- $twitter_user['groups_count'] = $profile->getGroups(0, null)->N;
+ $twitter_user['groups_count'] = $profile->getGroupCount();
foreach (array('linkcolor', 'backgroundcolor') as $key) {
$twitter_user[$key] = Profile_prefs::getConfigData($profile, 'theme', $key);
}
$twitter_status['truncated'] = false; # Not possible on StatusNet
$twitter_status['created_at'] = $this->dateTwitter($notice->created);
try {
- $in_reply_to = $notice->getParent()->id;
+ // We could just do $notice->reply_to but maybe the future holds a
+ // different story for parenting.
+ $parent = $notice->getParent();
+ $in_reply_to = $parent->id;
} catch (Exception $e) {
$in_reply_to = null;
}
$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
}
}
}
$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;
}
} else if ($this->arg('screen_name')) {
$nickname = common_canonical_nickname($this->arg('screen_name'));
$user = User::getKV('nickname', $nickname);
- return $user ? $user->getProfile() : null;
+ return $user instanceof User ? $user->getProfile() : null;
} else {
// Fall back to trying the currently authenticated user
return $this->scoped;