PHP Class Hybrid_Provider_Model

Basically, each provider adapter has to define at least 4 methods: Hybrid_Providers_{provider_name}::initialize() Hybrid_Providers_{provider_name}::loginBegin() Hybrid_Providers_{provider_name}::loginFinish() Hybrid_Providers_{provider_name}::getUserProfile() HybridAuth also come with three others models Class Hybrid_Provider_Model_OpenID for providers that uses the OpenID 1 and 2 protocol. Class Hybrid_Provider_Model_OAuth1 for providers that uses the OAuth 1 protocol. Class Hybrid_Provider_Model_OAuth2 for providers that uses the OAuth 2 protocol.
Mostra file Open project: hybridauth/hybridauth Class Usage Examples

Public Properties

Property Type Description
$api stdClass The provider api client (optional)
$compressed stdClass Model should use "gzip,deflate" for CURLOPT_ENCODING
$config array Specific provider adapter config
$endpoint string Endpoint URL for that provider
$params array Provider extra parameters
$providerId mixed IDp ID (or unique name)
$useSafeUrls boolean Enable this to replace '.' with '_' characters in the callback urls
$user Hybrid_User Hybrid_User obj, represents the current loggedin user

Public Methods

Method Description
__construct ( mixed $providerId, array $config, array $params = null ) Common providers adapter constructor
clearTokens ( ) : void Clear all existent tokens for this provider
deleteToken ( $token ) : void Delete a stored token
getUserActivity ( $stream ) : Hybrid_User_Activity[] Return the user activity stream
getUserContacts ( ) : Hybrid_User_Contact[] Load the current logged in user contacts list from the IDp api client
getUserProfile ( ) : Hybrid_User_Profile Grab the user profile from the IDp api client
getUserStatus ( $statusid ) : mixed Return the user status
isUserConnected ( ) : boolean Return true if the user is connected to the current provider
logout ( ) : boolean Generic logout, just erase current provider adapter stored data to let Hybrid_Auth all forget about it
setUserConnected ( ) : void Set user to connected
setUserStatus ( $status ) : mixed Set user status
setUserUnconnected ( ) : void Set user to unconnected
token ( $token, $value = null ) : string Get or set a token

Protected Methods

Method Description
initialize ( ) : void IDp wrappers initializer
loginBegin ( ) : void Begin login
loginFinish ( ) : void Finish login

Method Details

__construct() public method

Common providers adapter constructor
public __construct ( mixed $providerId, array $config, array $params = null )
$providerId mixed Provider ID
$config array Provider adapter config
$params array Provider extra params

clearTokens() public method

Clear all existent tokens for this provider
public clearTokens ( ) : void
return void

deleteToken() public method

Delete a stored token
public deleteToken ( $token ) : void
return void

getUserActivity() public method

Return the user activity stream
public getUserActivity ( $stream ) : Hybrid_User_Activity[]
return Hybrid_User_Activity[]

getUserContacts() public method

Load the current logged in user contacts list from the IDp api client
public getUserContacts ( ) : Hybrid_User_Contact[]
return Hybrid_User_Contact[]

getUserProfile() public method

Grab the user profile from the IDp api client
public getUserProfile ( ) : Hybrid_User_Profile
return Hybrid_User_Profile

getUserStatus() public method

Return the user status
public getUserStatus ( $statusid ) : mixed
return mixed Provider response

initialize() abstract protected method

The main job of wrappers initializer is to performs (depend on the IDp api client it self): - include some libs needed by this provider, - check IDp key and secret, - set some needed parameters (stored in $this->params) by this IDp api client - create and setup an instance of the IDp api client on $this->api
abstract protected initialize ( ) : void
return void

isUserConnected() public method

Return true if the user is connected to the current provider
public isUserConnected ( ) : boolean
return boolean

loginBegin() abstract protected method

Begin login
abstract protected loginBegin ( ) : void
return void

loginFinish() abstract protected method

Finish login
abstract protected loginFinish ( ) : void
return void

logout() public method

Generic logout, just erase current provider adapter stored data to let Hybrid_Auth all forget about it
public logout ( ) : boolean
return boolean

setUserConnected() public method

Set user to connected
public setUserConnected ( ) : void
return void

setUserStatus() public method

Set user status
public setUserStatus ( $status ) : mixed
return mixed Provider response

setUserUnconnected() public method

Set user to unconnected
public setUserUnconnected ( ) : void
return void

token() public method

Get or set a token
public token ( $token, $value = null ) : string
return string

Property Details

$api public_oe property

The provider api client (optional)
public stdClass $api
return stdClass

$compressed public_oe property

Model should use "gzip,deflate" for CURLOPT_ENCODING
public stdClass $compressed
return stdClass

$config public_oe property

Specific provider adapter config
public array $config
return array

$endpoint public_oe property

Endpoint URL for that provider
public string $endpoint
return string

$params public_oe property

Provider extra parameters
public array $params
return array

$providerId public_oe property

IDp ID (or unique name)
public mixed $providerId
return mixed

$useSafeUrls public_oe property

Enable this to replace '.' with '_' characters in the callback urls
public bool $useSafeUrls
return boolean

$user public_oe property

Hybrid_User obj, represents the current loggedin user
public Hybrid_User $user
return Hybrid_User