X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=src%2FObject%2FApi%2FTwitter%2FUser.php;h=49e10e77e6a5327534025bf200eaf995f464acea;hb=6ea426178a973e39d04e328c64cef08fc64b7479;hp=c646b4924173fef0ca2b68da3ea738902a174290;hpb=dc42dbb68a50fb2c60f439393eb6d1fe80b327cf;p=friendica.git diff --git a/src/Object/Api/Twitter/User.php b/src/Object/Api/Twitter/User.php index c646b49241..49e10e77e6 100644 --- a/src/Object/Api/Twitter/User.php +++ b/src/Object/Api/Twitter/User.php @@ -1,6 +1,6 @@ id = $publicContact['id']; + $uid = $userContact['uid'] ?? 0; + + $this->id = (int)$publicContact['id']; $this->id_str = (string) $publicContact['id']; - $this->name = $publicContact['name']; + $this->name = $publicContact['name'] ?: $publicContact['nick']; $this->screen_name = $publicContact['nick'] ?: $publicContact['name']; $this->location = $publicContact['location'] ?: ContactSelector::networkToName($publicContact['network'], $publicContact['url'], $publicContact['protocol']); @@ -106,14 +119,14 @@ class User extends BaseEntity unset($this->entities); } $this->description = BBCode::toPlaintext($publicContact['about']); - $this->profile_image_url_https = $userContact['avatar'] ?? $publicContact['avatar']; + $this->profile_image_url_https = Contact::getAvatarUrlForUrl($publicContact['url'], $uid, Proxy::SIZE_MICRO); $this->protected = false; $this->followers_count = $apcontact['followers_count'] ?? 0; $this->friends_count = $apcontact['following_count'] ?? 0; $this->listed_count = 0; $this->created_at = api_date($publicContact['created']); $this->favourites_count = 0; - $this->verified = false; + $this->verified = $uid != 0; $this->statuses_count = $apcontact['statuses_count'] ?? 0; $this->profile_banner_url = ''; $this->default_profile = false; @@ -127,9 +140,9 @@ class User extends BaseEntity unset($this->withheld_scope); // Deprecated - $this->profile_image_url = $userContact['avatar'] ?? $publicContact['avatar']; - $this->profile_image_url_profile_size = $publicContact['thumb']; - $this->profile_image_url_large = $publicContact['photo']; + $this->profile_image_url = Contact::getAvatarUrlForUrl($publicContact['url'], $uid, Proxy::SIZE_MICRO); + $this->profile_image_url_profile_size = Contact::getAvatarUrlForUrl($publicContact['url'], $uid, Proxy::SIZE_THUMB); + $this->profile_image_url_large = Contact::getAvatarUrlForUrl($publicContact['url'], $uid, Proxy::SIZE_LARGE); $this->utc_offset = 0; $this->time_zone = 'UTC'; $this->geo_enabled = false; @@ -137,17 +150,17 @@ class User extends BaseEntity $this->contributors_enabled = false; $this->is_translator = false; $this->is_translation_enabled = false; - $this->following = false; + $this->following = in_array($userContact['rel'] ?? Contact::NOTHING, [Contact::FOLLOWER, Contact::FRIEND]); $this->follow_request_sent = false; $this->statusnet_blocking = false; $this->notifications = false; // Friendica-specific - $this->uid = $userContact['uid'] ?? 0; - $this->cid = $userContact['id'] ?? 0; - $this->pid = $publicContact['id']; - $this->self = $userContact['self'] ?? false; - $this->network = $publicContact['network']; + $this->uid = (int)$uid; + $this->cid = (int)($userContact['id'] ?? 0); + $this->pid = (int)$publicContact['id']; + $this->self = (boolean)($userContact['self'] ?? false); + $this->network = $publicContact['network'] ?: Protocol::DFRN; $this->statusnet_profile_url = $publicContact['url']; } }