-
Notifications
You must be signed in to change notification settings - Fork 12
Function Reference
fnitschmann edited this page Sep 19, 2011
·
9 revisions
This is the full function reference of the plugin.
With $this->Twitter->function() you can access the main functions of the plugin wich will be described in following.
The following methods are about setting up and connection the app to and with Twitter.
| Function | Description | Parameters |
|---|---|---|
setupApp($consumer_key, $consumer_secret) |
Basic setup for the Twitter app, sets consumer key and consumer secret. You maybe call this method as first one of your connection to Twitter. |
$consumer_key (Required true) - Your personal app consumer key. Be carefull in usage! $consumer_secret (Required true) - Your personal app secret, be carfull in usage! |
connectApp($callback_url) |
Redirects the user to Twitter to authorize your application. Tipp: Call this one directly after setupApp(). |
$callback_url (Required: true) - The url where the user should be redirected to after the authentication, this should be some controller/action in your Cake app. |
The following methods handle everything related to the authenticated/logged in user.
| Function | Description | Parameters |
|---|---|---|
authorizeTwitterUser($oauth_token, $oauth_vertifier) |
The user authorisation, which should be called after the user was redirected by Twitter to your site again. |
$oauth_token (Required: true) - The OAuth token, send by the url, that can be accessed by $this->params['url']['oauth_token'], $oauth_vertifier (Required: true) - The OAuth verifier, send by the url, that can be accesed by $this->params['url']['oauth_verifier']
|
loginTwitterUser($oauth_token, $oauth_token_secret) |
Login the user, who already has an specific OAuth token and token secret and who is not logged in. |
$oauth_token (Required: true) - The raw OAuth token of the user, $oauth_token_secret (Required: true) - The raw OAuth token secret of the user |
getTwitterUser($show_full_profile = false) |
Get the current users, if he is logged, OAuth token, token secret and, optional, the full Twitter profile in an array(). NOTE: Be carefull in usage of this method, it contains user specific and non-public information! You have to prevent abuse! |
$show_full_profile (Required: false) - Set true to get the full user profile via accountVerifyCredentials()
|
logoutTwitterUser() |
Loggs out, if one is logged in, the current user and destroys the related session. | None |
The following method can be used to check the status of the app and user connection to/with the API.
| Function | Description | Parameters |
|---|---|---|
appStatus() |
Returns true if $this->consumer_key and $this->consumer_secrets (app keys) are set set and usable, else false. |
None |
userStatus() |
Returns true if $this->oauth_token and $this->oauth_token_secret, the user vars, are set and usable, else false. |
None |
status() |
Returns true if appStatus() and userStatus() are true, else false
|
None |