Gentics Portal.Node PHP API
Main Page
Related Pages
Namespaces
Classes
Files
Examples
File List
All
Classes
Namespaces
Functions
Variables
Pages
common
extensions
eauth
services
TwitterOAuthService.php
1
<?php
2
/**
3
* TwitterOAuthService class file.
4
*
5
* Register application: https://dev.twitter.com/apps/new
6
*
7
* @author Maxim Zemskov <nodge@yandex.ru>
8
* @link http://code.google.com/p/yii-eauth/
9
* @license http://www.opensource.org/licenses/bsd-license.php
10
*/
11
12
require_once dirname(dirname(__FILE__)) .
'/EOAuthService.php'
;
13
14
/**
15
* Twitter provider class.
16
* @package application.extensions.eauth.services
17
*/
18
class
TwitterOAuthService
extends
EOAuthService
{
19
20
protected
$name =
'twitter'
;
21
protected
$title =
'Twitter'
;
22
protected
$type =
'OAuth'
;
23
protected
$jsArguments = array(
'popup'
=> array(
'width'
=> 900,
'height'
=> 550));
24
25
protected
$key =
''
;
26
protected
$secret =
''
;
27
protected
$providerOptions = array(
28
'request'
=>
'https://api.twitter.com/oauth/request_token'
,
29
'authorize'
=>
'https://api.twitter.com/oauth/authorize'
,
30
'access'
=>
'https://api.twitter.com/oauth/access_token'
,
31
);
32
33
protected
function
fetchAttributes
() {
34
$info = $this->
makeSignedRequest
(
'https://api.twitter.com/1/account/verify_credentials.json'
);
35
36
$this->attributes[
'id'
] = $info->id;
37
$this->attributes[
'name'
] = $info->name;
38
$this->attributes[
'url'
] =
'http://twitter.com/account/redirect_by_id?id='
.$info->id_str;
39
40
/*$this->attributes['username'] = $info->screen_name;
41
$this->attributes['language'] = $info->lang;
42
$this->attributes['timezone'] = timezone_name_from_abbr('', $info->utc_offset, date('I'));
43
$this->attributes['photo'] = $info->profile_image_url;*/
44
}
45
46
/**
47
* Authenticate the user.
48
* @return boolean whether user was successfuly authenticated.
49
*/
50
public
function
authenticate
() {
51
if
(isset($_GET[
'denied'
]))
52
$this->
cancel
();
53
54
return
parent::authenticate
();
55
}
56
}
Generated on Thu Feb 6 2014 15:47:54 for Gentics Portal.Node PHP API by
1.8.1.2