PHP Class Phergie_Plugin_Abstract, phergie

Author: Phergie Development Team ([email protected])
Mostrar archivo Open project: phergie/phergie Class Usage Examples

Protected Properties

Property Type Description
$config Phergie_Config Current configuration handler
$connection Phergie_Connection Current connection instance
$event Phergie_Event_Request | Phergie_Event_Response Current incoming event being handled
$events Phergie_Event_Handler Current event handler instance for outgoing events
$name string Plugin short name
$plugins Phergie_Plugin_Handler Plugin handler used to provide access to other plugins

Public Methods

Method Description
__call ( string $name, array $args ) : mixed Provides do* methods with signatures identical to those of Phergie_Driver_Abstract but that queue up events to be dispatched later.
findDataFile ( string $filename ) : string | null Locates a given data file used by this plugin and returns the path to it. This is currently used mainly for compatibility with PEAR packaging.
getConfig ( string $name = null, mixed $default = null ) : Phergie_Config | mixed Returns the current configuration handler or the value of a single setting from it.
getConnection ( ) : Phergie_Connection Returns the current event connection.
getEvent ( ) : Phergie_Event_Request | Phergie_Event_Response Returns the current incoming event to be handled.
getEventHandler ( ) : Phergie_Event_Handler Returns the current event handler.
getName ( ) : string Returns the short name for the plugin based on its class name.
getPluginHandler ( ) : Phergie_Plugin_Handler Returns the current plugin handler.
onAction ( ) : void Handler for when the bot receives a CTCP ACTION request.
onConnect ( ) : void Handler for when the bot initially connects to a server.
onCtcp ( ) : void Handler for when the bot receives a CTCP request of an unknown type.
onCtcpPing ( ) : void Handler for when the bot receives a CTCP PING request.
onCtcpReply ( ) : void Handler for when a reply received for a CTCP request of an unknown type.
onInvite ( ) : void Handler for when the bot receives an invitation to join a channel.
onJoin ( ) : void Handler for when a user joins a channel.
onKick ( ) : void Handler for when a user is kicked from a channel.
onKill ( ) : void Handler for when the bot receives a kill request from a server.
onLoad ( ) : void Handler for when the plugin is initially loaded - useful for checking runtime dependencies or performing any setup necessary for the plugin to function properly such as initializing a database.
onMode ( ) : void Handler for when a user or channel mode is changed.
onNick ( ) : void Handler for when the server prompts the client for a nick.
onNotice ( ) : void Handler for when a notice is received.
onOper ( ) : void Handler for when a user obtains operator privileges.
onPart ( ) : void Handler for when a user leaves a channel.
onPing ( ) : void Handler for when the bot receives a ping event from a server, at which point it is expected to respond with a pong request within a short period else the server may terminate its connection.
onPingReply ( ) : void Handler for when a reply is received for a CTCP PING request sent by the bot.
onPrivmsg ( ) : void Handler for when a message is received from a channel or user.
onQuit ( ) : void Handler for when the client session is about to be terminated.
onResponse ( ) : void Handler for when a server response is received to a command issued by the bot.
onTick ( ) : void Handler for each tick, a single iteration of the continuous loop executed by the bot to receive, handle, and send events - useful for repeated execution of tasks on a time interval.
onTime ( ) : void Handler for when the bot receives a CTCP TIME request.
onTimeReply ( ) : void Handler for when a reply is received for a CTCP TIME request sent by the bot.
onTopic ( ) : void Handler for when a channel topic is viewed or changed.
onVersion ( ) : void Handler for when the bot receives a CTCP VERSION request.
onVersionReply ( ) : void Handler for when a reply is received for a CTCP VERSION request sent by the bot.
postDispatch ( ) : void Handler for after any events triggered by plugins in response to a received event are sent to the server.
preDispatch ( ) : void Handler for after plugin processing of an event has concluded but before any events triggered in response by plugins are sent to the server - useful for modifying outgoing events before they are sent.
preEvent ( ) : boolean | null | void Handler for when any event is received but has not yet been dispatched to the plugin handler method specific to its event type.
setConfig ( Phergie_Config $config ) : Phergie_Plugin_Abstract Sets the current configuration handler.
setConnection ( Phergie_Connection $connection ) : Phergie_Plugin_Abstract Sets the current connection.
setEvent ( Phergie_Event_Request | Phergie_Event_Response $event ) : Phergie_Plugin_Abstract Sets the current incoming event to be handled.
setEventHandler ( Phergie_Event_Handler $handler ) : Phergie_Plugin_Abstract Sets the current event handler.
setName ( string $name ) : Phergie_Plugin_Abstract Sets the short name for the plugin.
setPluginHandler ( Phergie_Plugin_Handler $handler ) : Phergie_Plugin_Abstract Sets the current plugin handler.

Protected Methods

Method Description
fail ( string $message ) : Phergie_Plugin_Abstract Indicates that the plugin failed to load due to an unsatisfied runtime requirement, such as a missing dependency.

Method Details

__call() public method

Provides do* methods with signatures identical to those of Phergie_Driver_Abstract but that queue up events to be dispatched later.
public __call ( string $name, array $args ) : mixed
$name string Name of the method called
$args array Arguments passed in the call
return mixed

fail() protected method

Indicates that the plugin failed to load due to an unsatisfied runtime requirement, such as a missing dependency.
protected fail ( string $message ) : Phergie_Plugin_Abstract
$message string Error message to provide more information about the reason for the failure
return Phergie_Plugin_Abstract Provides a fluent interface

findDataFile() public method

Locates a given data file used by this plugin and returns the path to it. This is currently used mainly for compatibility with PEAR packaging.
public findDataFile ( string $filename ) : string | null
$filename string Name of the file
return string | null File path or NULL if the file cannot be found

getConfig() public method

Returns the current configuration handler or the value of a single setting from it.
public getConfig ( string $name = null, mixed $default = null ) : Phergie_Config | mixed
$name string Optional name of a setting for which the value should be returned instead of the entire configuration handler
$default mixed Optional default value to return if no value is set for the setting indicated by $name
return Phergie_Config | mixed Configuration handler or value of the setting specified by $name

getConnection() public method

Returns the current event connection.
public getConnection ( ) : Phergie_Connection
return Phergie_Connection

getEvent() public method

Returns the current incoming event to be handled.
public getEvent ( ) : Phergie_Event_Request | Phergie_Event_Response
return Phergie_Event_Request | Phergie_Event_Response

getEventHandler() public method

Returns the current event handler.
public getEventHandler ( ) : Phergie_Event_Handler
return Phergie_Event_Handler

getName() public method

Returns the short name for the plugin based on its class name.
public getName ( ) : string
return string

getPluginHandler() public method

Returns the current plugin handler.
public getPluginHandler ( ) : Phergie_Plugin_Handler
return Phergie_Plugin_Handler

onAction() public method

Handler for when the bot receives a CTCP ACTION request.
public onAction ( ) : void
return void

onConnect() public method

Handler for when the bot initially connects to a server.
public onConnect ( ) : void
return void

onCtcp() public method

Handler for when the bot receives a CTCP request of an unknown type.
public onCtcp ( ) : void
return void

onCtcpPing() public method

Handler for when the bot receives a CTCP PING request.
public onCtcpPing ( ) : void
return void

onCtcpReply() public method

Handler for when a reply received for a CTCP request of an unknown type.
public onCtcpReply ( ) : void
return void

onInvite() public method

Handler for when the bot receives an invitation to join a channel.
public onInvite ( ) : void
return void

onJoin() public method

Handler for when a user joins a channel.
public onJoin ( ) : void
return void

onKick() public method

Handler for when a user is kicked from a channel.
public onKick ( ) : void
return void

onKill() public method

Handler for when the bot receives a kill request from a server.
public onKill ( ) : void
return void

onLoad() public method

Handler for when the plugin is initially loaded - useful for checking runtime dependencies or performing any setup necessary for the plugin to function properly such as initializing a database.
public onLoad ( ) : void
return void

onMode() public method

Handler for when a user or channel mode is changed.
public onMode ( ) : void
return void

onNick() public method

Handler for when the server prompts the client for a nick.
public onNick ( ) : void
return void

onNotice() public method

Handler for when a notice is received.
public onNotice ( ) : void
return void

onOper() public method

Handler for when a user obtains operator privileges.
public onOper ( ) : void
return void

onPart() public method

Handler for when a user leaves a channel.
public onPart ( ) : void
return void

onPing() public method

Handler for when the bot receives a ping event from a server, at which point it is expected to respond with a pong request within a short period else the server may terminate its connection.
public onPing ( ) : void
return void

onPingReply() public method

Handler for when a reply is received for a CTCP PING request sent by the bot.
public onPingReply ( ) : void
return void

onPrivmsg() public method

Handler for when a message is received from a channel or user.
public onPrivmsg ( ) : void
return void

onQuit() public method

Handler for when the client session is about to be terminated.
public onQuit ( ) : void
return void

onResponse() public method

Handler for when a server response is received to a command issued by the bot.
public onResponse ( ) : void
return void

onTick() public method

Handler for each tick, a single iteration of the continuous loop executed by the bot to receive, handle, and send events - useful for repeated execution of tasks on a time interval.
public onTick ( ) : void
return void

onTime() public method

Handler for when the bot receives a CTCP TIME request.
public onTime ( ) : void
return void

onTimeReply() public method

Handler for when a reply is received for a CTCP TIME request sent by the bot.
public onTimeReply ( ) : void
return void

onTopic() public method

Handler for when a channel topic is viewed or changed.
public onTopic ( ) : void
return void

onVersion() public method

Handler for when the bot receives a CTCP VERSION request.
public onVersion ( ) : void
return void

onVersionReply() public method

Handler for when a reply is received for a CTCP VERSION request sent by the bot.
public onVersionReply ( ) : void
return void

postDispatch() public method

Handler for after any events triggered by plugins in response to a received event are sent to the server.
public postDispatch ( ) : void
return void

preDispatch() public method

Handler for after plugin processing of an event has concluded but before any events triggered in response by plugins are sent to the server - useful for modifying outgoing events before they are sent.
public preDispatch ( ) : void
return void

preEvent() public method

Handler for when any event is received but has not yet been dispatched to the plugin handler method specific to its event type.
public preEvent ( ) : boolean | null | void
return boolean | null | void FALSE to short-circuit further event processing, TRUE or NULL otherwise

setConfig() public method

Sets the current configuration handler.
public setConfig ( Phergie_Config $config ) : Phergie_Plugin_Abstract
$config Phergie_Config Configuration handler
return Phergie_Plugin_Abstract Provides a fluent interface

setConnection() public method

Sets the current connection.
public setConnection ( Phergie_Connection $connection ) : Phergie_Plugin_Abstract
$connection Phergie_Connection Connection
return Phergie_Plugin_Abstract Provides a fluent interface

setEvent() public method

Sets the current incoming event to be handled.
public setEvent ( Phergie_Event_Request | Phergie_Event_Response $event ) : Phergie_Plugin_Abstract
$event Phergie_Event_Request | Phergie_Event_Response Event
return Phergie_Plugin_Abstract Provides a fluent interface

setEventHandler() public method

Sets the current event handler.
public setEventHandler ( Phergie_Event_Handler $handler ) : Phergie_Plugin_Abstract
$handler Phergie_Event_Handler Event handler
return Phergie_Plugin_Abstract Provides a fluent interface

setName() public method

Sets the short name for the plugin.
public setName ( string $name ) : Phergie_Plugin_Abstract
$name string Plugin short name
return Phergie_Plugin_Abstract Provides a fluent interface

setPluginHandler() public method

Sets the current plugin handler.
public setPluginHandler ( Phergie_Plugin_Handler $handler ) : Phergie_Plugin_Abstract
$handler Phergie_Plugin_Handler Plugin handler
return Phergie_Plugin_Abstract Provides a fluent interface

Property Details

$config protected_oe property

Current configuration handler
protected Phergie_Config $config
return Phergie_Config

$connection protected_oe property

Current connection instance
protected Phergie_Connection $connection
return Phergie_Connection

$event protected_oe property

Current incoming event being handled
protected Phergie_Event_Request|Phergie_Event_Response $event
return Phergie_Event_Request | Phergie_Event_Response

$events protected_oe property

Current event handler instance for outgoing events
protected Phergie_Event_Handler $events
return Phergie_Event_Handler

$name protected_oe property

Plugin short name
protected string $name
return string

$plugins protected_oe property

Plugin handler used to provide access to other plugins
protected Phergie_Plugin_Handler $plugins
return Phergie_Plugin_Handler