Gentics Portal.Node PHP API
 All Classes Namespaces Functions Variables Pages
FacebookService.php
1 <?php
2 /**
3  * Gentics Portal.Node PHP
4  * Author & Copyright (c) by Gentics Software GmbH
5  * sales@gentics.com
6  * http://www.gentics.com
7  * Licenses can be found in the LICENSE.txt file in the root-folder of this installation
8  * You must not use this software without a valid license agreement.
9  *
10  *
11  */
12 
13 /**
14  * Facebook provider class.
15  * @package application.extensions.eauth.services
16  */
18 {
19  protected function fetchAttributes() {
20  $info = (object) $this->makeSignedRequest('https://graph.facebook.com/me');
21 
22  $this->attributes['id'] = $info->id;
23  $this->attributes['name'] = $info->first_name.'_'.$info->last_name;
24  $this->attributes['url'] = $info->link;
25  $this->attributes['email'] = $info->email;
26 
27  $this->attributes['firstname'] = $info->first_name;
28  $this->attributes['lastname'] = $info->last_name;
29  $this->attributes['gender'] = $info->gender == 'male' ? 'M' : 'F';
30  }
31 
32  public function getName()
33  {
34  return $this->attributes['name'];
35  }
36 
37  public function getEmail()
38  {
39  return $this->attributes['email'];
40  }
41 
42  public function getError()
43  {
44  return UserModule::t('Facebook authorization error');
45  }
46 }