phpBB API Documentation
Class

phpbb_hook

class phpbb_hook

phpBB Hook Class

Properties

$hooks Registered hooks
$hook_result Results returned by functions called
$current_hook internal pointer

Methods

phpbb_hook(array $valid_hooks)

Initialize hook class.

register(mixed $definition, mixed $hook, string $mode = 'normal')

Register function/method to be called within hook This function is normally called by the modification/application to attach/register the functions.

bool call_hook(mixed $definition)

Calling all functions/methods attached to a specified hook.

mixed previous_hook_result(mixed $definition)

Get result from previously called functions/methods for the same hook

bool hook_return(mixed $definition)

Check if the called functions/methods returned something.

mixed hook_return_result(mixed $definition)

Give actual result from called functions/methods back.

add_hook(mixed $definition)

Add new function to the allowed hooks.

remove_hook(mixed $definition)

Remove function from the allowed hooks.

Details

at line 47
public phpbb_hook(array $valid_hooks)

Initialize hook class.

Parameters

array $valid_hooks array containing the hookable functions/methods

at line 68
public register(mixed $definition, mixed $hook, string $mode = 'normal')

Register function/method to be called within hook This function is normally called by the modification/application to attach/register the functions.

Parameters

mixed $definition Declaring function (with FUNCTION) or class with array(CLASS, FUNCTION)
mixed $hook The replacement function/method to be called. Passing function name or array with object/class definition
string $mode Specify the priority/chain mode. 'normal' -> hook gets appended to the chain. 'standalone' -> only the specified hook gets called - later hooks are not able to overwrite this (E_NOTICE is triggered then). 'first' -> hook is called as the first one within the chain. 'last' -> hook is called as the last one within the chain.

at line 109
public bool call_hook(mixed $definition)

Calling all functions/methods attached to a specified hook.

Called by the function allowing hooks...

Parameters

mixed $definition Declaring function (with FUNCTION) or class with array(CLASS, FUNCTION)

Return Value

bool False if no hook got executed, true otherwise

at line 162
public mixed previous_hook_result(mixed $definition)

Get result from previously called functions/methods for the same hook

Parameters

mixed $definition Declaring function (with FUNCTION) or class with array(CLASS, FUNCTION)

Return Value

mixed False if nothing returned if there is no result, else array('result' => ... )

at line 181
public bool hook_return(mixed $definition)

Check if the called functions/methods returned something.

Parameters

mixed $definition Declaring function (with FUNCTION) or class with array(CLASS, FUNCTION)

Return Value

bool True if results are there, false if not

at line 200
public mixed hook_return_result(mixed $definition)

Give actual result from called functions/methods back.

Parameters

mixed $definition Declaring function (with FUNCTION) or class with array(CLASS, FUNCTION)

Return Value

mixed The result

at line 220
public add_hook(mixed $definition)

Add new function to the allowed hooks.

Parameters

mixed $definition Declaring function (with FUNCTION) or class with array(CLASS, FUNCTION)

at line 235
public remove_hook(mixed $definition)

Remove function from the allowed hooks.

Parameters

mixed $definition Declaring function (with FUNCTION) or class with array(CLASS, FUNCTION)