$user = null;
}
- $twitter_user['id'] = intval($profile->id);
+ $twitter_user['id'] = $profile->getID();
$twitter_user['name'] = $profile->getBestName();
- $twitter_user['screen_name'] = $profile->nickname;
- $twitter_user['location'] = ($profile->location) ? $profile->location : null;
- $twitter_user['description'] = ($profile->bio) ? $profile->bio : null;
+ $twitter_user['screen_name'] = $profile->getNickname();
+ $twitter_user['location'] = $profile->location;
+ $twitter_user['description'] = $profile->getDescription();
// TODO: avatar url template (example.com/user/avatar?size={x}x{y})
$twitter_user['profile_image_url'] = Avatar::urlByProfile($profile, AVATAR_STREAM_SIZE);
$twitter_status['in_reply_to_status_id'] = $in_reply_to;
$source = null;
+ $source_link = null;
$ns = $notice->getSource();
if ($ns instanceof Notice_source) {
- if (!empty($ns->name) && !empty($ns->url)) {
- $source = '<a href="'
- . htmlspecialchars($ns->url)
- . '" rel="nofollow">'
- . htmlspecialchars($ns->name)
- . '</a>';
- } else {
- $source = $ns->code;
+ $source = $ns->code;
+ if (!empty($ns->url)) {
+ $source_link = $ns->url;
+ if (!empty($ns->name)) {
+ $source = $ns->name;
+ }
}
}
$twitter_status['uri'] = $notice->getUri();
$twitter_status['source'] = $source;
+ $twitter_status['source_link'] = $source_link;
$twitter_status['id'] = intval($notice->id);
$replier_profile = null;
function showSingleAtomStatus($notice)
{
- header('Content-Type: application/atom+xml; charset=utf-8');
+ header('Content-Type: application/atom+xml;type=entry;charset="utf-8"');
+ print '<?xml version="1.0" encoding="UTF-8"?>' . "\n";
print $notice->asAtomEntry(true, true, true, $this->scoped);
}
if (self::is_decimal($this->arg('user_id'))) {
return Profile::getKV('id', $this->arg('user_id'));
}
- } else if ($this->arg('screen_name')) {
+ } elseif (mb_strlen($this->arg('screen_name')) > 0) {
$nickname = common_canonical_nickname($this->arg('screen_name'));
- $user = User::getKV('nickname', $nickname);
- return $user instanceof User ? $user->getProfile() : null;
+ $user = User::getByNickname($nickname);
+ return $user->getProfile();
} else {
// Fall back to trying the currently authenticated user
return $this->scoped;
}
- } else if (self::is_decimal($id)) {
- return Profile::getKV($id);
+ } else if (self::is_decimal($id) && intval($id) > 0) {
+ return Profile::getByID($id);
} else {
+ // FIXME: check if isAcct to identify remote profiles and not just local nicknames
$nickname = common_canonical_nickname($id);
- $user = User::getKV('nickname', $nickname);
- return $user ? $user->getProfile() : null;
+ $user = User::getByNickname($nickname);
+ return $user->getProfile();
}
}
return $uri;
}
-}
\ No newline at end of file
+}