[ Index ]

PHP Cross Reference of MediaWiki-1.24.0

title

Body

[close]

/includes/ -> Hooks.php (summary)

A tool for running hook functions. Copyright 2004, 2005 Evan Prodromou <[email protected]>.

Author: Evan Prodromou <[email protected]>
File Size: 256 lines (8 kb)
Included or required:0 times
Referenced: 2 times
Includes or requires: 0 files

Defines 2 classes

MWHookException:: (0 methods):

Hooks:: (6 methods):
  register()
  clear()
  isRegistered()
  getHandlers()
  run()
  hookErrorHandler()


Class: MWHookException  - X-Ref


Class: Hooks  - X-Ref

Hooks class.

Used to supersede $wgHooks, because globals are EVIL.

register( $name, $callback )   X-Ref
Attach an event handler to a given hook.

param: string $name Name of hook
param: callable $callback Callback function to attach

clear( $name )   X-Ref
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.

param: string $name The name of the hook to clear.

isRegistered( $name )   X-Ref
Returns true if a hook has a function registered to it.
The function may have been registered either via Hooks::register or in $wgHooks.

param: string $name Name of hook
return: bool True if the hook has a function registered to it

getHandlers( $name )   X-Ref
Returns an array of all the event functions attached to a hook
This combines functions registered via Hooks::register and with $wgHooks.

param: string $name Name of the hook
return: array

run( $event, array $args = array()   X-Ref
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.

param: string $event Event name
param: array $args Array of parameters passed to hook functions
param: string|null $deprecatedVersion Optionally, mark hook as deprecated with version number
return: bool True if no handler aborted the hook

hookErrorHandler( $errno, $errstr )   X-Ref
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

param: int $errno Error number (unused)
param: string $errstr Error message
return: bool Always returns false



Generated: Fri Nov 28 14:03:12 2014 Cross-referenced by PHPXref 0.7.1