Moodle  2.2.1
http://www.collinsharper.com
Zend_Service_Twitter Class Reference
Inheritance diagram for Zend_Service_Twitter:
Collaboration diagram for Zend_Service_Twitter:

Public Member Functions

 __construct (array $options=null, Zend_Oauth_Consumer $consumer=null)
 setLocalHttpClient (Zend_Http_Client $client)
 getLocalHttpClient ()
 isAuthorised ()
 getUsername ()
 setUsername ($value)
 __get ($type)
 __call ($method, $params)
 statusPublicTimeline ()
 statusFriendsTimeline (array $params=array())
 statusUserTimeline (array $params=array())
 statusShow ($id)
 statusUpdate ($status, $inReplyToStatusId=null)
 statusReplies (array $params=array())
 statusDestroy ($id)
 userFriends (array $params=array())
 userFollowers ($lite=false)
 userShow ($id)
 directMessageMessages (array $params=array())
 directMessageSent (array $params=array())
 directMessageNew ($user, $text)
 directMessageDestroy ($id)
 friendshipCreate ($id)
 friendshipDestroy ($id)
 friendshipExists ($id)
 accountVerifyCredentials ()
 accountEndSession ()
 accountRateLimitStatus ()
 favoriteFavorites (array $params=array())
 favoriteCreate ($id)
 favoriteDestroy ($id)
 blockCreate ($id)
 blockDestroy ($id)
 blockExists ($id, $returnResult=false)
 blockBlocking ($page=1, $returnUserIds=false)

Data Fields

const STATUS_MAX_CHARACTERS = 246
const OAUTH_BASE_URI = 'http://twitter.com/oauth'

Protected Member Functions

 _init ()
 _setDate ($value)
 _validInteger ($int)
 _validateScreenName ($name)
 _prepare ($path)
 _get ($path, array $query=null)
 _post ($path, $data=null)
 _performPost ($method, $data=null)

Protected Attributes

 $_cookieJar
 $_dateFormat = 'D, d M Y H:i:s T'
 $_username
 $_methodType
 $_oauthConsumer = null
 $_methodTypes
 $_options = array()
 $_localHttpClient = null

Detailed Description

Definition at line 45 of file Twitter.php.


Constructor & Destructor Documentation

__construct ( array options = null,
Zend_Oauth_Consumer $  consumer = null 
)

Constructor

Parameters:
array$optionsOptional options array
Returns:
void

Definition at line 131 of file Twitter.php.

Here is the call graph for this function:


Member Function Documentation

__call ( method,
params 
)

Method overloading

Parameters:
string$method
array$params
Returns:
mixed
Exceptions:
Zend_Service_Twitter_Exceptionif unable to find method

Reimplemented from Zend_Rest_Client.

Definition at line 243 of file Twitter.php.

Here is the call graph for this function:

__get ( type)

Proxy service methods

Parameters:
string$type
Returns:
Zend_Service_Twitter
Exceptions:
Zend_Service_Twitter_ExceptionIf method not in method types list

Definition at line 223 of file Twitter.php.

_get ( path,
array query = null 
) [protected]

Performs an HTTP GET request to the $path.

Parameters:
string$path
array$queryArray of GET parameters
Exceptions:
Zend_Http_Client_Exception
Returns:
Zend_Http_Response

Definition at line 990 of file Twitter.php.

Here is the call graph for this function:

Here is the caller graph for this function:

_init ( ) [protected]

Initialize HTTP authentication

Returns:
void

Definition at line 274 of file Twitter.php.

Here is the call graph for this function:

Here is the caller graph for this function:

_performPost ( method,
data = null 
) [protected]

Perform a POST or PUT

Performs a POST or PUT request. Any data provided is set in the HTTP client. String data is pushed in as raw POST data; array or object data is pushed in as POST parameters.

Parameters:
mixed$method
mixed$data
Returns:
Zend_Http_Response

Reimplemented from Zend_Rest_Client.

Definition at line 1022 of file Twitter.php.

Here is the caller graph for this function:

_post ( path,
data = null 
) [protected]

Performs an HTTP POST request to $path.

Parameters:
string$path
mixed$dataRaw data to send
Exceptions:
Zend_Http_Client_Exception
Returns:
Zend_Http_Response

Definition at line 1005 of file Twitter.php.

Here is the call graph for this function:

Here is the caller graph for this function:

_prepare ( path) [protected]

Call a remote REST web service URI and return the Zend_Http_Response object

Parameters:
string$pathThe path to append to the URI
Exceptions:
Zend_Rest_Client_Exception
Returns:
void

Get the HTTP client and configure it for the endpoint URI. Do this each time because the Zend_Http_Client instance is shared among all Zend_Service_Abstract subclasses.

Definition at line 956 of file Twitter.php.

Here is the caller graph for this function:

_setDate ( value) [protected]

Set date header

Parameters:
int | string$value
Deprecated:
Not supported by Twitter since April 08, 2009
Returns:
void

Definition at line 302 of file Twitter.php.

_validateScreenName ( name) [protected]

Validate a screen name using Twitter rules

Parameters:
string$name
Exceptions:
Zend_Service_Twitter_Exception
Returns:
string

Definition at line 937 of file Twitter.php.

Here is the caller graph for this function:

_validInteger ( int) [protected]

Protected function to validate that the integer is valid or return a 0

Parameters:
$int
Exceptions:
Zend_Http_Client_Exceptionif HTTP request fails or times out
Returns:
integer

Definition at line 922 of file Twitter.php.

Here is the caller graph for this function:

End current session

Exceptions:
Zend_Http_Client_Exceptionif HTTP request fails or times out
Returns:
true

Definition at line 760 of file Twitter.php.

Here is the call graph for this function:

Returns the number of api requests you have left per hour.

Exceptions:
Zend_Http_Client_Exceptionif HTTP request fails or times out
Returns:
Zend_Rest_Client_Result

Definition at line 773 of file Twitter.php.

Here is the call graph for this function:

Verify Account Credentials

Exceptions:
Zend_Http_Client_Exceptionif HTTP request fails or times out
Returns:
Zend_Rest_Client_Result

Definition at line 747 of file Twitter.php.

Here is the call graph for this function:

blockBlocking ( page = 1,
returnUserIds = false 
)

Returns an array of user objects that the authenticating user is blocking

Parameters:
integer$pageOptional. Specifies the page number of the results beginning at 1. A single page contains 20 ids.
boolean$returnUserIdsOptional. Returns only the userid's instead of the whole user object
Returns:
Zend_Rest_Client_Result

Definition at line 904 of file Twitter.php.

Here is the call graph for this function:

blockCreate ( id)

Blocks the user specified in the ID parameter as the authenticating user. Destroys a friendship to the blocked user if it exists.

Parameters:
integer | string$idThe ID or screen name of a user to block.
Returns:
Zend_Rest_Client_Result

Definition at line 850 of file Twitter.php.

Here is the call graph for this function:

blockDestroy ( id)

Un-blocks the user specified in the ID parameter for the authenticating user

Parameters:
integer | string$idThe ID or screen_name of the user to un-block.
Returns:
Zend_Rest_Client_Result

Definition at line 864 of file Twitter.php.

Here is the call graph for this function:

blockExists ( id,
returnResult = false 
)

Returns if the authenticating user is blocking a target user.

Parameters:
string | integer$idThe ID or screen_name of the potentially blocked user.
boolean$returnResultInstead of returning a boolean return the rest response from twitter
Returns:
Boolean|Zend_Rest_Client_Result

Definition at line 879 of file Twitter.php.

Here is the call graph for this function:

Destroy a direct message

Parameters:
int$idID of message to destroy
Exceptions:
Zend_Http_Client_Exceptionif HTTP request fails or times out
Returns:
Zend_Rest_Client_Result

Definition at line 687 of file Twitter.php.

Here is the call graph for this function:

directMessageMessages ( array params = array())

Retrieve direct messages for the current user

$params may include one or more of the following keys

  • since_id: return statuses only greater than the one specified
  • page: return page X of results
Parameters:
array$params
Exceptions:
Zend_Http_Client_Exceptionif HTTP request fails or times out
Returns:
Zend_Rest_Client_Result

Definition at line 599 of file Twitter.php.

Here is the call graph for this function:

directMessageNew ( user,
text 
)

Send a direct message to a user

Parameters:
int | string$userUser to whom to send message
string$textMessage to send to user
Returns:
Zend_Rest_Client_Result
Exceptions:
Zend_Service_Twitter_Exceptionif message is too short or too long
Zend_Http_Client_Exceptionif HTTP request fails or times out

Definition at line 661 of file Twitter.php.

Here is the call graph for this function:

directMessageSent ( array params = array())

Retrieve list of direct messages sent by current user

$params may include one or more of the following keys

  • since_id: return statuses only greater than the one specified
  • page: return page X of results
Parameters:
array$params
Exceptions:
Zend_Http_Client_Exceptionif HTTP request fails or times out
Returns:
Zend_Rest_Client_Result

Definition at line 631 of file Twitter.php.

Here is the call graph for this function:

favoriteCreate ( id)

Mark a status as a favorite

Parameters:
int$idStatus ID you want to mark as a favorite
Exceptions:
Zend_Http_Client_Exceptionif HTTP request fails or times out
Returns:
Zend_Rest_Client_Result

Definition at line 820 of file Twitter.php.

Here is the call graph for this function:

favoriteDestroy ( id)

Remove a favorite

Parameters:
int$idStatus ID you want to de-list as a favorite
Exceptions:
Zend_Http_Client_Exceptionif HTTP request fails or times out
Returns:
Zend_Rest_Client_Result

Definition at line 835 of file Twitter.php.

Here is the call graph for this function:

favoriteFavorites ( array params = array())

Fetch favorites

$params may contain one or more of the following:

  • 'id': Id of a user for whom to fetch favorites
  • 'page': Retrieve a different page of resuls
Parameters:
array$params
Exceptions:
Zend_Http_Client_Exceptionif HTTP request fails or times out
Returns:
Zend_Rest_Client_Result

Definition at line 791 of file Twitter.php.

Here is the call graph for this function:

friendshipCreate ( id)

Create friendship

Parameters:
int | string$idUser ID or name of new friend
Exceptions:
Zend_Http_Client_Exceptionif HTTP request fails or times out
Returns:
Zend_Rest_Client_Result

Definition at line 702 of file Twitter.php.

Here is the call graph for this function:

friendshipDestroy ( id)

Destroy friendship

Parameters:
int | string$idUser ID or name of friend to remove
Exceptions:
Zend_Http_Client_Exceptionif HTTP request fails or times out
Returns:
Zend_Rest_Client_Result

Definition at line 717 of file Twitter.php.

Here is the call graph for this function:

friendshipExists ( id)

Friendship exists

Parameters:
int | string$idUser ID or name of friend to see if they are your friend
Exceptions:
Zend_Http_Client_Exceptionif HTTP request fails or times out
Returns:
Zend_Rest_Client_result

Definition at line 732 of file Twitter.php.

Here is the call graph for this function:

Get the local HTTP client as distinct from the static HTTP client inherited from Zend_Rest_Client

Returns:
Zend_Http_Client

Definition at line 176 of file Twitter.php.

Here is the caller graph for this function:

Retrieve username

Returns:
string

Definition at line 199 of file Twitter.php.

Here is the caller graph for this function:

Checks for an authorised state

Returns:
bool

Definition at line 186 of file Twitter.php.

Here is the call graph for this function:

Here is the caller graph for this function:

Set local HTTP client as distinct from the static HTTP client as inherited from Zend_Rest_Client.

Parameters:
Zend_Http_Client$client
Returns:
self

Definition at line 163 of file Twitter.php.

Here is the call graph for this function:

Here is the caller graph for this function:

setUsername ( value)

Set username

Parameters:
string$value
Returns:
Zend_Service_Twitter

Definition at line 210 of file Twitter.php.

Here is the caller graph for this function:

statusDestroy ( id)

Destroy a status message

Parameters:
int$idID of status to destroy
Exceptions:
Zend_Http_Client_Exceptionif HTTP request fails or times out
Returns:
Zend_Rest_Client_Result

Definition at line 516 of file Twitter.php.

Here is the call graph for this function:

statusFriendsTimeline ( array params = array())

Friend Timeline Status

$params may include one or more of the following keys

  • id: ID of a friend whose timeline you wish to receive
  • count: how many statuses to return
  • since_id: return results only after the specific tweet
  • page: return page X of results
Parameters:
array$params
Exceptions:
Zend_Http_Client_Exceptionif HTTP request fails or times out
Returns:
void

Definition at line 339 of file Twitter.php.

Here is the call graph for this function:

Public Timeline status

Exceptions:
Zend_Http_Client_Exceptionif HTTP request fails or times out
Returns:
Zend_Rest_Client_Result

Definition at line 318 of file Twitter.php.

Here is the call graph for this function:

statusReplies ( array params = array())

Get status replies

$params may include one or more of the following keys

  • since_id: return results only after the specified tweet id
  • page: return page X of results
Exceptions:
Zend_Http_Client_Exceptionif HTTP request fails or times out
Returns:
Zend_Rest_Client_Result

Definition at line 488 of file Twitter.php.

Here is the call graph for this function:

statusShow ( id)

Show a single status

Parameters:
int$idId of status to show
Exceptions:
Zend_Http_Client_Exceptionif HTTP request fails or times out
Returns:
Zend_Rest_Client_Result

Definition at line 435 of file Twitter.php.

Here is the call graph for this function:

statusUpdate ( status,
inReplyToStatusId = null 
)

Update user's current status

Parameters:
string$status
int$in_reply_to_status_id
Returns:
Zend_Rest_Client_Result
Exceptions:
Zend_Http_Client_Exceptionif HTTP request fails or times out
Zend_Service_Twitter_Exceptionif message is too short or too long

Definition at line 452 of file Twitter.php.

Here is the call graph for this function:

statusUserTimeline ( array params = array())

User Timeline status

$params may include one or more of the following keys

  • id: ID of a friend whose timeline you wish to receive
  • since_id: return results only after the tweet id specified
  • page: return page X of results
  • count: how many statuses to return
  • max_id: returns only statuses with an ID less than or equal to the specified ID
  • user_id: specfies the ID of the user for whom to return the user_timeline
  • screen_name: specfies the screen name of the user for whom to return the user_timeline
Exceptions:
Zend_Http_Client_Exceptionif HTTP request fails or times out
Returns:
Zend_Rest_Client_Result

Definition at line 385 of file Twitter.php.

Here is the call graph for this function:

userFollowers ( lite = false)

User Followers

Parameters:
bool$liteIf true, prevents inline inclusion of current status for followers; defaults to false
Exceptions:
Zend_Http_Client_Exceptionif HTTP request fails or times out
Returns:
Zend_Rest_Client_Result

Definition at line 562 of file Twitter.php.

Here is the call graph for this function:

userFriends ( array params = array())

User friends

Parameters:
int | string$idId or username of user for whom to fetch friends
Exceptions:
Zend_Http_Client_Exceptionif HTTP request fails or times out
Returns:
Zend_Rest_Client_Result

Definition at line 531 of file Twitter.php.

Here is the call graph for this function:

userShow ( id)

Show extended information on a user

Parameters:
int | string$idUser ID or name
Exceptions:
Zend_Http_Client_Exceptionif HTTP request fails or times out
Returns:
Zend_Rest_Client_Result

Definition at line 580 of file Twitter.php.

Here is the call graph for this function:


Field Documentation

$_cookieJar [protected]

Definition at line 66 of file Twitter.php.

$_dateFormat = 'D, d M Y H:i:s T' [protected]

Definition at line 73 of file Twitter.php.

$_localHttpClient = null [protected]

Definition at line 123 of file Twitter.php.

$_methodType [protected]

Definition at line 87 of file Twitter.php.

$_methodTypes [protected]
Initial value:
 array(
        'status',
        'user',
        'directMessage',
        'friendship',
        'account',
        'favorite',
        'block'
    )

Definition at line 101 of file Twitter.php.

$_oauthConsumer = null [protected]

Definition at line 94 of file Twitter.php.

$_options = array() [protected]

Definition at line 116 of file Twitter.php.

$_username [protected]

Definition at line 80 of file Twitter.php.

const OAUTH_BASE_URI = 'http://twitter.com/oauth'

OAuth Endpoint

Definition at line 61 of file Twitter.php.

const STATUS_MAX_CHARACTERS = 246

246 is the current limit for a status message, 140 characters are displayed initially, with the remainder linked from the web UI or client. The limit is applied to a html encoded UTF-8 string (i.e. entities are counted in the limit which may appear unusual but is a security measure).

This should be reviewed in the future...

Definition at line 56 of file Twitter.php.


The documentation for this class was generated from the following file:
 All Data Structures Namespaces Files Functions Variables Enumerations