• Модуль: socialservices
  • Путь к файлу: ~/bitrix/modules/socialservices/classes/general/twitter.php
  • Класс: CSocServTwitter
  • Вызов: CSocServTwitter::getFriendsList
public function getFriendsList($limit, &$next)
{
	global $USER;

	$currentUser = $this->userId;
	if(!$currentUser)
	{
		$currentUser = $USER->GetID();
	}

	$tw = new CTwitterInterface();
	$userId = self::TwitterUserId($currentUser);

	if($userId > 0)
	{
		$res = $tw->getUserFriends($userId, $limit, $next);

		if(is_array($res) && is_array($res['users']))
		{
			foreach($res['users'] as $key => $contact)
			{
				$res['users'][$key]['uid'] = $contact['id_str'];
				$res['users'][$key]['url'] = "https://twitter.com/".$contact["screen_name"];
				$res['users'][$key]['first_name'] = $contact['name'];

				if($contact['profile_image_url'])
				{
					$res['users'][$key]['picture'] = CMain::IsHTTPS()
						? $contact['profile_image_url_https']
						: $contact['profile_image_url'];
					$res['users'][$key]['picture'] = preg_replace("/_normal./i", ".",
						$res['users'][$key]['picture']);
				}
			}

			return $res['users'];
		}
	}

	return false;
}