4use \Bitrix\Main\Web\HttpClient;
8 const ID =
"GooglePlusOAuth";
13 if(!$this->entityOAuth)
18 return parent::getEntityOAuth(
$code);
34 foreach(
$res[
"items"] as
$key => $contact)
36 $contact[
"uid"] = $contact[
"id"];
38 if(array_key_exists(
"name", $contact))
40 $contact[
"first_name"] = $contact[
"name"][
"givenName"];
41 $contact[
"last_name"] = $contact[
"name"][
"familyName"];
45 list($contact[
"first_name"], $contact[
"last_name"]) = explode(
" ", $contact[
"displayName"], 2);
48 if(array_key_exists(
"image", $contact))
50 $contact[
"picture"] = preg_replace(
"/\?.*$/",
"", $contact[
"image"][
"url"]);
64 return "https://plus.google.com/".$uid;
72 const PROFILE_URL =
'https://www.googleapis.com/plus/v1/people/me';
73 const FRIENDS_URL =
'https://www.googleapis.com/plus/v1/people/me/people/visible';
75 const FRIENDS_FIELDS =
'items(displayName,emails,gender,id,image,name,nickname),nextPageToken,title,totalItems';
78 'https://www.googleapis.com/auth/plus.login',
79 'https://www.googleapis.com/auth/plus.me',
84 return $this->
query(static::PROFILE_URL);
89 $url = static::FRIENDS_URL.
'?';
91 $limit = intval($limit);
94 $url .=
'&maxResults='.$limit;
99 $url .=
'&pageToken='.$next;
104 $next =
$result[
'nextPageToken'];
107 $next =
'__finish__';
115 if($this->access_token ===
false)
119 $http->setHeader(
"authorization",
"Bearer ".$this->access_token);
getCurrentUserFriends($limit, &$next)
getEntityOAuth($code=false)
getFriendsList($limit, &$next)
</td ></tr ></table ></td ></tr >< tr >< td class="bx-popup-label bx-width30"><?=GetMessage("PAGE_NEW_TAGS")?> array( $site)
if(!is_null($config))($config as $configItem)(! $configItem->isVisible()) $code
IncludeModuleLangFile($filepath, $lang=false, $bReturnArray=false)
GetMessage($name, $aReplace=null)
if(empty($signedUserToken)) $key