PHP 클래스 BaiduAPI, thinksns

저자: zhujianting([email protected])
파일 보기 프로젝트 열기: medz/thinksns-4 1 사용 예제들

보호된 프로퍼티들

프로퍼티 타입 설명
$clientId string The client_id of the app or access_key of the developer.
$clientSecret string The client_secret of the app or secret_key of the developer.
$oauth2 BaiduOAuth2
$redirectUri string Redirect uri of the app, where we will redirect to after user authorization.
$session array User session info.
$state string
$store BaiduStore Storage for the user session related datas, like state, authorization code, access token and so on.

공개 메소드들

메소드 설명
__construct ( string $clientId, string $clientSecret, string $redirectUri, BaiduStore $store = null ) Constructor
getAccessToken ( ) : string | false Get access token for openapi calls.
getBaiduApiClientService ( ) : BaiduApiClient Get an instance of BaiduApiClient class.
getBaiduOAuth2Service ( ) : BaiduOAuth2 Get an instance of BaiduOAuth2 class.
getLoggedInUser ( ) : uint | false Get currently logged in user's uid.
getLoginUrl ( string $scope = '', string $display = 'page' ) : string Get a Login URL for use with redirects. By default, full page redirect is assumed. If you are using the generated URL with a window.open() call in JavaScript, you can pass in display=popup as part of the $params.
getLogoutUrl ( string $next ) : string Get the Logout URL suitable for use with redirects.
getRefreshToken ( ) : string | false Get refresh token.
getSession ( ) : array Get user session info.
setSession ( array $session ) : Baidu Set user session.

보호된 메소드들

메소드 설명
doGetSession ( ) : array | false Get session info from Baidu server or from the store in app server side.
establishCSRFTokenState ( ) Lays down a CSRF state token for this process.
getCode ( ) : mixed Get the authorization code from the query parameters, if it exists, otherwise return false to signal no authorization code was discoverable.
getUser ( ) : array | false Get current user's uid and uname.
setStore ( BaiduStore $store ) : Baidu Set the session data storage instance.

메소드 상세

__construct() 공개 메소드

Constructor
public __construct ( string $clientId, string $clientSecret, string $redirectUri, BaiduStore $store = null )
$clientId string The client_id of the app or access_key of the developer.
$clientSecret string The client_secret of the app or secret_key of the developer.
$redirectUri string Redirect uri of the app.
$store BaiduStore Storage for the user session related datas.

doGetSession() 보호된 메소드

Get session info from Baidu server or from the store in app server side.
protected doGetSession ( ) : array | false
리턴 array | false

establishCSRFTokenState() 보호된 메소드

Lays down a CSRF state token for this process.
protected establishCSRFTokenState ( )

getAccessToken() 공개 메소드

Get access token for openapi calls.
public getAccessToken ( ) : string | false
리턴 string | false Returns access token if user has authorized the app, or false if not.

getBaiduApiClientService() 공개 메소드

Get an instance of BaiduApiClient class.
public getBaiduApiClientService ( ) : BaiduApiClient
리턴 BaiduApiClient

getBaiduOAuth2Service() 공개 메소드

Get an instance of BaiduOAuth2 class.
public getBaiduOAuth2Service ( ) : BaiduOAuth2
리턴 BaiduOAuth2

getCode() 보호된 메소드

Get the authorization code from the query parameters, if it exists, otherwise return false to signal no authorization code was discoverable.
protected getCode ( ) : mixed
리턴 mixed Returns the authorization code, or false if the authorization code could not be determined.

getLoggedInUser() 공개 메소드

Get currently logged in user's uid.
public getLoggedInUser ( ) : uint | false
리턴 uint | false Return uid of the loggedin user, or return false if user isn't loggedin.

getLoginUrl() 공개 메소드

Get a Login URL for use with redirects. By default, full page redirect is assumed. If you are using the generated URL with a window.open() call in JavaScript, you can pass in display=popup as part of the $params.
public getLoginUrl ( string $scope = '', string $display = 'page' ) : string
$scope string blank space separated list of requested extended perms
$display string Authorization page style, 'page', 'popup', 'touch' or 'mobile'
리턴 string the URL for the login flow

getLogoutUrl() 공개 메소드

Get the Logout URL suitable for use with redirects.
public getLogoutUrl ( string $next ) : string
$next string Url to go to after a successful logout.
리턴 string

getRefreshToken() 공개 메소드

Get refresh token.
public getRefreshToken ( ) : string | false
리턴 string | false Returns refresh token if app has, or false if not.

getSession() 공개 메소드

Get user session info.
public getSession ( ) : array
리턴 array

getUser() 보호된 메소드

Get current user's uid and uname.
protected getUser ( ) : array | false
리턴 array | false array('uid' => xx, 'uname' => xx)

setSession() 공개 메소드

Set user session.
public setSession ( array $session ) : Baidu
$session array User session info.
리턴 Baidu

setStore() 보호된 메소드

Set the session data storage instance.
protected setStore ( BaiduStore $store ) : Baidu
$store BaiduStore
리턴 Baidu

프로퍼티 상세

$clientId 보호되어 있는 프로퍼티

The client_id of the app or access_key of the developer.
protected string $clientId
리턴 string

$clientSecret 보호되어 있는 프로퍼티

The client_secret of the app or secret_key of the developer.
protected string $clientSecret
리턴 string

$oauth2 보호되어 있는 프로퍼티

protected BaiduOAuth2 $oauth2
리턴 BaiduOAuth2

$redirectUri 보호되어 있는 프로퍼티

Redirect uri of the app, where we will redirect to after user authorization.
protected string $redirectUri
리턴 string

$session 보호되어 있는 프로퍼티

User session info.
protected array $session
리턴 array

$state 보호되어 있는 프로퍼티

protected string $state
리턴 string

$store 보호되어 있는 프로퍼티

Storage for the user session related datas, like state, authorization code, access token and so on.
protected BaiduStore $store
리턴 BaiduStore