PHP Interface Themosis\Hook\IHook

Datei anzeigen Open project: themosis/framework Interface Usage Examples

Public Methods

Method Description
add ( string $hook, Closure | string $callback, integer $priority = 10, integer $accepted_args = 2 ) : mixed Add event using the WordPress hooks.
exists ( string $hook ) : boolean Check if a registered hook exists.
getCallback ( string $hook ) : array | boolean Return the callback registered with the given hook.
remove ( string $hook, integer $priority = 10, Closure | string $callback = null ) : mixed Remove a defined action or filter.
run ( string $hook, mixed $args = null ) : mixed Run all events registered with the hook.

Method Details

add() public method

Add event using the WordPress hooks.
public add ( string $hook, Closure | string $callback, integer $priority = 10, integer $accepted_args = 2 ) : mixed
$hook string The hook name.
$callback Closure | string Using a class method like so "MyClass@method"
$priority integer
$accepted_args integer
return mixed

exists() public method

Check if a registered hook exists.
public exists ( string $hook ) : boolean
$hook string
return boolean

getCallback() public method

Return the callback registered with the given hook.
public getCallback ( string $hook ) : array | boolean
$hook string The hook name.
return array | boolean

remove() public method

Remove a defined action or filter.
public remove ( string $hook, integer $priority = 10, Closure | string $callback = null ) : mixed
$hook string The hook name.
$priority integer The priority number.
$callback Closure | string The callback to remove.
return mixed

run() public method

Run all events registered with the hook.
public run ( string $hook, mixed $args = null ) : mixed
$hook string The event hook name.
$args mixed
return mixed