PHP Class Phergie_Plugin_Twitter, phergie

Usage: tweet text to tweet (sends a message to twitter and Phergie will give you the link) twitter username (fetches and displays the last tweet by @username) twitter username 3 (fetches and displays the third last tweet by @username) twitter 1234567 (fetches and displays tweet number 1234567) http://twitter.com/username/statuses/1234567 (same as twitter 1234567)
Inheritance: extends Phergie_Plugin_Abstract
Show file Open project: phergie/phergie

Protected Properties

Property Type Description
$twitter Twitter Twitter object (from Simpletweet)

Public Methods

Method Description
getTwitter ( ) : Twitter Returns the Twitter client instance in use.
onCommandTweet ( $tweet = null )
onCommandTwitter ( string $tweeter, integer $num = 1 ) : void Fetches the associated tweet and relays it to the channel.
onConnect ( ) : void Register with the URL plugin, if possible
onLoad ( ) : void Initialize (set up configuration vars)
renderUrl ( array $parsed ) : boolean Renders Twitter URLs.
setTwitter ( Twitter $twitter ) : Phergie_Plugin_Twitter Sets the Twitter client instance to use.

Protected Methods

Method Description
formatTweet ( StdClass $tweet, boolean $includeUrl = true ) : string Formats a Tweet into a message suitable for output.

Method Details

formatTweet() protected method

Formats a Tweet into a message suitable for output.
protected formatTweet ( StdClass $tweet, boolean $includeUrl = true ) : string
$tweet StdClass JSON-decoded tweet object from Twitter
$includeUrl boolean whether or not to include the URL in the formatted output
return string

getTwitter() public method

Returns the Twitter client instance in use.
public getTwitter ( ) : Twitter
return Twitter Twitter client instance

onCommandTweet() public method

public onCommandTweet ( $tweet = null )

onCommandTwitter() public method

Fetches the associated tweet and relays it to the channel.
public onCommandTwitter ( string $tweeter, integer $num = 1 ) : void
$tweeter string if numeric the tweet number/id, otherwise the twitter user name (optionally prefixed with @, or a URL to a tweet)
$num integer optional offset for this user (number of tweets ago)
return void

onConnect() public method

Register with the URL plugin, if possible
public onConnect ( ) : void
return void

onLoad() public method

Initialize (set up configuration vars)
public onLoad ( ) : void
return void

renderUrl() public method

Renders Twitter URLs.
public renderUrl ( array $parsed ) : boolean
$parsed array parse_url() output for the URL to render
return boolean

setTwitter() public method

Sets the Twitter client instance to use.
public setTwitter ( Twitter $twitter ) : Phergie_Plugin_Twitter
$twitter Twitter Twitter instance to set
return Phergie_Plugin_Twitter Provides a fluent interface

Property Details

$twitter protected property

Twitter object (from Simpletweet)
protected Twitter $twitter
return Twitter