WPHookHelper
in package
Helper utilities for recognizing functions related to the WP Hook mechanism.
Tags
Table of Contents
Properties
- $hookInvokeFunctions : array<string, array<string, int|string|array<string|int, string>>>
- A list of functions that invoke WP hooks (filters/actions).
Methods
- get_functions() : array<string, bool>
- Retrieve a list of the WordPress functions which invoke hooks.
- get_hook_name_param() : array<string|int, mixed>|false
- Retrieve the parameter information for the hook name parameter from a stack of parameters passed to one of the WP hook functions.
Properties
$hookInvokeFunctions
A list of functions that invoke WP hooks (filters/actions).
private
static array<string, array<string, int|string|array<string|int, string>>>
$hookInvokeFunctions
= array('do_action' => array('position' => 1, 'name' => 'hook_name'), 'do_action_ref_array' => array('position' => 1, 'name' => 'hook_name'), 'do_action_deprecated' => array('position' => 1, 'name' => 'hook_name'), 'apply_filters' => array('position' => 1, 'name' => 'hook_name'), 'apply_filters_ref_array' => array('position' => 1, 'name' => 'hook_name'), 'apply_filters_deprecated' => array('position' => 1, 'name' => 'hook_name'))
Function name as key, array with target parameter position and name(s) as value.
Tags
Methods
get_functions()
Retrieve a list of the WordPress functions which invoke hooks.
public
static get_functions([bool $include_deprecated = true ]) : array<string, bool>
Parameters
- $include_deprecated : bool = true
-
Whether to include the names of functions which are used to invoke deprecated hooks. Defaults to
true.
Tags
Return values
array<string, bool> —Array with the function names as keys. The value is irrelevant.
get_hook_name_param()
Retrieve the parameter information for the hook name parameter from a stack of parameters passed to one of the WP hook functions.
public
static get_hook_name_param(string $function_name, array<string|int, mixed> $parameters) : array<string|int, mixed>|false
Parameters
- $function_name : string
-
The name of the WP hook function which the parameters were passed to.
- $parameters : array<string|int, mixed>
-
The output of a previous call to PassedParameters::getParameters().
Tags
Return values
array<string|int, mixed>|false —Array with information on the parameter at the specified offset,
or with the specified name.
Or FALSE if the specified parameter is not found.
See the PHPCSUtils PassedParameters::getParameters() documentation
for the format of the returned (single-dimensional) array.