MediaWiki
REL1_22
|
Static Public Member Functions | |
static | clear ($name) |
Clears hooks registered via Hooks::register(). | |
static | getHandlers ($name) |
Returns an array of all the event functions attached to a hook This combines functions registered via Hooks::register and with $wgHooks. | |
static | hookErrorHandler ($errno, $errstr) |
Handle PHP errors issued inside a hook. | |
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, array $args=array()) |
Call hook functions defined in Hooks::register and $wgHooks. | |
Static Protected Attributes | |
static | $handlers = array() |
Array of events mapped to an array of callbacks to be run when that event is triggered. |
static Hooks::clear | ( | $ | name | ) | [static] |
Clears hooks registered via Hooks::register().
Does not touch $wgHooks. This is intended for use while testing and will fail if MW_PHPUNIT_TEST is not defined.
string | $name | the name of the hook to clear. |
MWException | if not in testing mode. |
Definition at line 72 of file Hooks.php.
References $name.
Referenced by PHPUnitMaintClass\finalSetup(), and HooksTest\setUp().
static Hooks::getHandlers | ( | $ | name | ) | [static] |
Returns an array of all the event functions attached to a hook This combines functions registered via Hooks::register and with $wgHooks.
string | $name | Name of the hook |
Definition at line 103 of file Hooks.php.
References $name, $wgHooks, array(), and global.
Referenced by ContentHandler\runLegacyHooks(), and HooksTest\testNewStyleHookInteraction().
static Hooks::hookErrorHandler | ( | $ | errno, |
$ | errstr | ||
) | [static] |
Handle PHP errors issued inside a hook.
Catch errors that have to do with a function expecting a reference, and let all others pass through.
This REALLY should be protected... but it's public for compatibility
int | $errno | Error number (unused) |
string | $errstr | Error message |
MWHookException | If the error has to do with the function signature |
static Hooks::isRegistered | ( | $ | name | ) | [static] |
Returns true if a hook has a function registered to it.
The function may have been registered either via Hooks::register or in $wgHooks.
string | $name | Name of hook |
Definition at line 89 of file Hooks.php.
References $name, $wgHooks, empty, and global.
Referenced by ContentHandler\runLegacyHooks(), and HooksTest\testNewStyleHookInteraction().
static Hooks::register | ( | $ | name, |
$ | callback | ||
) | [static] |
Attach an event handler to a given hook.
string | $name | Name of hook |
mixed | $callback | Callback function to attach |
Definition at line 55 of file Hooks.php.
References $name, and array().
Referenced by PHPUnitMaintClass\finalSetup(), HooksTest\testFalseReturn(), HooksTest\testFatalError(), HooksTest\testNewStyleHookInteraction(), HooksTest\testNewStyleHooks(), ContentHandlerTest\testRunLegacyHooks(), and HooksTest\testUncallableFunction().
static Hooks::run | ( | $ | event, |
array $ | args = array() |
||
) | [static] |
Call hook functions defined in Hooks::register and $wgHooks.
For a certain hook event, fetch the array of hook events and process them. Determine the proper callback for each hook and then call the actual hook using the appropriate arguments. Finally, process the return value and return/throw accordingly.
string | $event | Event name |
array | $args | Array of parameters passed to hook functions |
MWException | |
FatalError |
Definition at line 135 of file Hooks.php.
References $retval, array(), as, wfProfileIn(), and wfProfileOut().
Referenced by wfRunHooks().
Hooks::$handlers = array() [static, protected] |