MediaWiki  REL1_20
Hooks Class Reference

Hooks class. More...

List of all members.

Static Public Member Functions

static getHandlers ($name)
 Returns an array of all the event functions attached to a hook.
static hookErrorHandler ($errno, $errstr)
 This REALLY should be protected...
static isRegistered ($name)
 Returns true if a hook has a function registered to it.
static register ($name, $callback)
 Attach an event handler to a given hook.
static run ($event, $args=array())
 Call hook functions defined in Hooks::register.

Static Protected Attributes

static $handlers = array()

Detailed Description

Hooks class.

Used to supersede $wgHooks, because globals are EVIL.

Definition at line 33 of file Hooks.php.


Member Function Documentation

static Hooks::getHandlers ( name) [static]

Returns an array of all the event functions attached to a hook.

Parameters:
$nameMixed: name of the hook
Returns:
array

Definition at line 72 of file Hooks.php.

static Hooks::hookErrorHandler ( errno,
errstr 
) [static]

This REALLY should be protected...

but it's public for compatibility

Parameters:
$errnoint Unused
$errstrString: error message
Returns:
Boolean: false

Definition at line 266 of file Hooks.php.

static Hooks::isRegistered ( name) [static]

Returns true if a hook has a function registered to it.

Parameters:
$nameMixed: name of hook
Returns:
Boolean: true if a hook has a function registered to it

Definition at line 58 of file Hooks.php.

static Hooks::register ( name,
callback 
) [static]

Attach an event handler to a given hook.

Parameters:
$nameMixed: name of hook
$callbackMixed: callback function to attach
Returns:
void

Definition at line 44 of file Hooks.php.

Referenced by HooksTest\testNewStyleHooks().

static Hooks::run ( event,
args = array() 
) [static]

Call hook functions defined in Hooks::register.

Because programmers assign to $wgHooks, we need to be very careful about its contents. So, there's a lot more error-checking in here than would normally be necessary.

Parameters:
$eventString: event name
$argsArray: parameters passed to hook functions
Returns:
Boolean True if no handler aborted the hook

Definition at line 91 of file Hooks.php.

References $wgHooks, wfProfileIn(), and wfProfileOut().

Referenced by wfRunHooks().


Member Data Documentation

Hooks::$handlers = array() [static, protected]

Definition at line 35 of file Hooks.php.


The documentation for this class was generated from the following file: