Gentics Portal.Node PHP API
 All Classes Namespaces Functions Variables Pages
Protected Member Functions | List of all members
CustomVKontakteService Class Reference
Inheritance diagram for CustomVKontakteService:
VKontakteOAuthService EOAuth2Service EAuthServiceBase IAuthService IAuthService

Protected Member Functions

 fetchAttributes ()
- Protected Member Functions inherited from VKontakteOAuthService
 getCodeUrl ($redirect_uri)
 saveAccessToken ($token)
 restoreAccessToken ()
 fetchJsonError ($json)
- Protected Member Functions inherited from EOAuth2Service
 getTokenUrl ($code)
 getAccessToken ($code)
- Protected Member Functions inherited from EAuthServiceBase
 makeRequest ($url, $options=array(), $parseJson=true)
 initRequest ($url, $options=array())
 parseJson ($response)
 getStateKeyPrefix ()
 setState ($key, $value, $defaultValue=null)
 hasState ($key)
 getState ($key, $defaultValue=null)
 _fetchAttributes ()

Additional Inherited Members

- Public Member Functions inherited from EOAuth2Service
 authenticate ()
 makeSignedRequest ($url, $options=array(), $parseJson=true)
- Protected Attributes inherited from VKontakteOAuthService
 $name = 'vkontakte'
 $title = 'VK.com'
 $type = 'OAuth'
 $jsArguments = array('popup' => array('width' => 585, 'height' => 350))
 $client_id = ''
 $client_secret = ''
 $scope = ''
 $providerOptions
 $uid = null

Detailed Description

An example of extending the provider class.

Author
Maxim Zemskov nodge.nosp@m.@yan.nosp@m.dex.r.nosp@m.u http://www.opensource.org/licenses/bsd-license.php

Definition at line 12 of file CustomVKontakteService.php.

Member Function Documentation

CustomVKontakteService::fetchAttributes ( )
protected

Fetch attributes array.

Returns
boolean whether the attributes was successfully fetched.

Reimplemented from VKontakteOAuthService.

Definition at line 16 of file CustomVKontakteService.php.

References EOAuth2Service\makeSignedRequest().

{
$info = (array)$this->makeSignedRequest('https://api.vkontakte.ru/method/getProfiles', array(
'query' => array(
'uids' => $this->uid,
//'fields' => '', // uid, first_name and last_name is always available
'fields' => 'nickname, sex, bdate, city, country, timezone, photo, photo_medium, photo_big, photo_rec',
),
));
$info = $info['response'][0];
$this->attributes['id'] = $info->uid;
$this->attributes['name'] = $info->first_name.' '.$info->last_name;
$this->attributes['url'] = 'http://vkontakte.ru/id'.$info->uid;
if (!empty($info->nickname))
$this->attributes['username'] = $info->nickname;
else
$this->attributes['username'] = 'id'.$info->uid;
$this->attributes['gender'] = $info->sex == 1 ? 'F' : 'M';
$this->attributes['city'] = $info->city;
$this->attributes['country'] = $info->country;
$this->attributes['timezone'] = timezone_name_from_abbr('', $info->timezone*3600, date('I'));;
$this->attributes['photo'] = $info->photo;
$this->attributes['photo_medium'] = $info->photo_medium;
$this->attributes['photo_big'] = $info->photo_big;
$this->attributes['photo_rec'] = $info->photo_rec;
}

The documentation for this class was generated from the following file: