• Модуль: socialservices
  • Путь к файлу: ~/bitrix/modules/socialservices/classes/general/googleplus.php
  • Класс: CSocServGooglePlusOAuth
  • Вызов: CSocServGooglePlusOAuth::getFriendsList
public function getFriendsList($limit, &$next)
{
	if($this->getEntityOAuth()->GetAccessToken() !== false)
	{
		$res = $this->getEntityOAuth()->getCurrentUserFriends($limit, $next);

		foreach($res["items"] as $key => $contact)
		{
			$contact["uid"] = $contact["id"];

			if(array_key_exists("name", $contact))
			{
				$contact["first_name"] = $contact["name"]["givenName"];
				$contact["last_name"] = $contact["name"]["familyName"];
			}
			else
			{
				list($contact["first_name"], $contact["last_name"]) = explode(" ", $contact["displayName"], 2);
			}

			if(array_key_exists("image", $contact))
			{
				$contact["picture"] = preg_replace("/?.*$/", "", $contact["image"]["url"]);
			}

			$res["items"][$key] = $contact;
		}

		return $res["items"];
	}

	return false;
}