public function applyFilters($hook, $value)
    {
        $hook = (string) $hook;
        if (empty($this->hooks[$hook])) {
            return $value; // No hooks.
        }
        $hook_filters = $this->hooks[$hook];
        $args         = func_get_args();
        ksort($hook_filters);

        foreach ($hook_filters as $_hook_filter) {
            foreach ($_hook_filter as $_filter) {
                if (!isset($_filter['function'], $_filter['accepted_args'])) {
                    continue; // Not a valid filter in this case.
                }
                $args[1] = $value; // Continously update the argument `$value`.
                $value   = call_user_func_array($_filter['function'], array_slice($args, 1, $_filter['accepted_args']));
            }
        }
        unset($_hook_filter, $_filter); // Housekeeping.

        return $value; // With applied filters.
    }
public function applyFilters($hook, $value)
    {
        $hook = (string) $hook;
        if (empty($this->hooks[$hook])) {
            return $value; // No hooks.
        }
        $hook_filters = $this->hooks[$hook];
        $args         = func_get_args();
        ksort($hook_filters);

        foreach ($hook_filters as $_hook_filter) {
            foreach ($_hook_filter as $_filter) {
                if (!isset($_filter['function'], $_filter['accepted_args'])) {
                    continue; // Not a valid filter in this case.
                }
                $args[1] = $value; // Continously update the argument `$value`.
                $value   = call_user_func_array($_filter['function'], array_slice($args, 1, $_filter['accepted_args']));
            }
        }
        unset($_hook_filter, $_filter); // Housekeeping.

        return $value; // With applied filters.
    }
public function applyFilters ( $ hook , $ value ) { $ hook = ( string ) $ hook ; if ( empty ( $ this -> hooks [ $ hook ] ) ) { return $ value ; // No hooks. } $ hook_filters = $ this -> hooks [ $ hook ] ; $ args = func_get_args ( ) ; ksort ( $ hook_filters ) ; foreach ( $ hook_filters as $ _hook_filter ) { foreach ( $ _hook_filter as $ _filter ) { if ( ! isset ( $ _filter [ 'function' ] , $ _filter [ 'accepted_args' ] ) ) { continue ; // Not a valid filter in this case. } $ args [ 1 ] = $ value ; // Continously update the argument `$value`. $ value = call_user_func_array ( $ _filter [ 'function' ] , array_slice ( $ args , 1 , $ _filter [ 'accepted_args' ] ) ) ; } } unset ( $ _hook_filter , $ _filter ) ; // Housekeeping. return $ value ; // With applied filters. }
Runs any callables attached to a filter.

@since 150321 Adding hook API for plugins.

@param string $hook  The name of a filter hook.
@param mixed  $value The value to filter.

@return mixed The filtered `$value`.
Runs any callables attached to a filter .