Run all filters registered with the hook.

@param string $hook The filter hook name.
@param mixed  $args

@return mixed
323602
public function run($hook, $args = null)
    {
        if (is_array($args)) {
            return $this->applyFiltersRefArray($hook, $args);
        }

        return $this->applyFilters($hook, $args);
    }
624969
public function applyHook($name, $hookArg = null)
    {
        if (!isset($this->hooks[$name])) {
            $this->hooks[$name] = array(array());
        }
        if (!empty($this->hooks[$name])) {
            // Sort by priority, low to high, if there's more than one priority
            if (count($this->hooks[$name]) > 1) {
                ksort($this->hooks[$name]);
            }
            foreach ($this->hooks[$name] as $priority) {
                if (!empty($priority)) {
                    foreach ($priority as $callable) {
                        call_user_func($callable, $hookArg);
                    }
                }
            }
        }
    }
1341844
public static function execute($hook, $params = array())
    {
        $html = '';
        $modules = Hook::getModulesByName($hook);
        if (!$modules || !is_array($modules) || !count($modules))
            return $html;
        else
        {
            foreach ($modules as $module)
            {
                // check module is exists

                if (\File::exists(app_path('Modules/' . $module->author . '/' . $module->name . '/Module.php')))
                {
                    $object = Module::getInstance($module->author, $module->name);
                    if (method_exists($object, 'hook' . ucfirst($hook)))
                    {
                        $html .= $object->{'hook' . ucfirst($hook)}($params);
                    }
                }

            }
        }
        return $html;
    }
1102309
public function update(string $hook, array $params = [])
    {
        $path = $this->buildHooksPath($hook);

        return $this->put($path, $params);
    }
237307
private function _runHooks($hooks)
    {
        extract($this->_exports);
        
        foreach ($hooks as $__hook) {
            if (is_string($__hook)) {
                eval($__hook);
            } elseif (is_callable($__hook)) {
                call_user_func($__hook, $this, get_defined_vars());
            } else {
                throw new \RuntimeException(sprintf('Hooks must be closures or strings of PHP code. Got [%s].', gettype($__hook)));
            }
            
            // hooks may set locals
            extract($this->_exports);
        }
        
        return get_defined_vars();
    }
1064006
def run_command_hooks(cmd_obj, hook_kind):
    

    hooks = getattr(cmd_obj, hook_kind, None)

    if not hooks:
        return

    for modname, hook in hooks:
        if isinstance(hook, str):
            try:
                hook_obj = resolve_name(hook)
            except ImportError as exc:
                raise DistutilsModuleError(
                    'cannot find hook {0}: {1}'.format(hook, exc))
        else:
            hook_obj = hook

        if not callable(hook_obj):
            raise DistutilsOptionError('hook {0!r} is not callable' % hook)

        log.info('running {0} from {1} for {2} command'.format(
                 hook_kind.rstrip('s'), modname, cmd_obj.get_command_name()))

        try:
            hook_obj(cmd_obj)
        except Exception:
            log.error('{0} command hook {1} raised an exception: %s\n'.format(
                hook_obj.__name__, cmd_obj.get_command_name()))
            log.error(traceback.format_exc())
            sys.exit(1)
1288478
public function hook($hook_spot, $arg = null)
    {
        if (is_null($arg)) {
            $arg = [];
        } elseif (!is_array($arg)) {
            throw new Exception([
                'Arguments for callbacks should be passed as array',
                'arg' => $arg,
            ]);
        }

        $return = [];

        try {
            if (
                isset($this->hooks[$hook_spot])
                && is_array($this->hooks[$hook_spot])
            ) {
                krsort($this->hooks[$hook_spot]); // lower priority is called sooner
                $hook_backup = $this->hooks[$hook_spot];
                while ($_data = array_pop($this->hooks[$hook_spot])) {
                    foreach ($_data as &$data) {
                        $return[] = call_user_func_array(
                            $data[0],
                            array_merge(
                                [$this],
                                $arg,
                                $data[1]
                            )
                        );
                    }
                }

                $this->hooks[$hook_spot] = $hook_backup;
            }
        } catch (HookBreaker $e) {
            $this->hooks[$hook_spot] = $hook_backup;

            return $e->return_value;
        }

        return $return;
    }
1255604
public function applyFilters(string $hook, $value, ...$args)
    {
        return apply_filters($this->App->Config->©brand['©var'].'_'.$hook, $value, ...$args);
    }
350390
public static function filter_array( $list, $args, $operator = 'AND' ) {
		if ( ! is_array($args) ) {
			$args = array( 'slug' => $args );
		}

		if ( ! is_array( $list ) && ! is_a( $list, 'Traversable' ) ) {
			return array();
		}

		$util = new \WP_List_Util( $list );
		return $util->filter( $args, $operator );
	}
22831
protected function add( $hooks, $hook, $service, $method, $priority, $accepted_args ) {
		$hooks[] = array(
			'hook'     => $hook,
			'service'  => $service,
			'method'   => $method,
			'priority' => $priority,
			'args'     => $accepted_args,
		);

		return $hooks;
	}
700073
public static function mount($hook, $params = [])
    {
        is_array($params) || $params = [$params];
        if (isset(self::$mountInfo[$hook])) {
            self::$mountInfo[$hook] += $params;
        } else {
            self::$mountInfo[$hook] = $params;
        }
    }
776720
private function getHookScope($hook)
    {
        return isset($this->hooks[$hook]) && isset($this->hooks[$hook]['scope'])
            ? $this->hooks[$hook]['scope']
            : 'init';
    }
444613
public function applyFilter($filter, $args = null)
    {
        $args = func_get_args();
        $args[0] = $this;
        return call_user_func_array(
            $filter instanceof Closure ? $filter : $this->getConnection()->getFilterCallback($filter),
            $args
        );
    }
485983
public function call($args = [])
    {
        if (count($args) == 0 || empty($args[2]))
            throw new NoticeException('Command "'.$this->key.'": Expecting a hook (action|filter|shortcode).');

        $object = explode(':', $args[2]);

        // Validations
        if (!in_array($object[0], ['action', 'filter', 'shortcode']))
            throw new NoticeException('Command "'.$this->key.'": Invalid hook. Expecting action or filter.');

        if (!isset($object[1]))
            throw new NoticeException('Command "'.$this->key.'": Expecting a hook name. i.e. add:init (where "init" would be the hook name).');

        if (count($args) == 3)
            $args[] = 'AppController@'.$object[1];

        // View or controller
        $vc = explode('@', $args[3]);
        if (count($vc) == 1) {
            $vc[] = preg_replace('/\-\./', '_', $object[1]);
            $args[3] .= '@'.$vc[1];
        }
        switch ($vc[0]) {
            case 'view':
                $this->createView($vc[1]);
                break;
            default:
                $this->createController($vc[0]);
                $this->createControllerMethod(
                    $vc[0],
                    $vc[1],
                    $this->getHookParams($object[1]),
                    (ucfirst($object[0]).' "'.$object[1].'"'."\n".'     * Wordpress hook')
                );
                break;
        }

        // Add hook to bridge
        $builder = Builder::parser($this->rootPath.'/app/Main.php');
        $builder->addVisitor(new AddMethodCallVisitor($this->getHookScope($object[1]), 'add_'.$object[0], [$object[1], $args[3]]));
        $builder->build();
    }
435050
public static function runHook( $hook_name, $args = array() ) {
		global $pgHooks;

		if( !isset( $pgHooks[$hook_name] ) ) return null;

		if( !is_array( $pgHooks[$hook_name] ) ) {
			throw new HookError( "Hook assignment for event `$hook_name` is not an array. Syntax is " . '$pgHooks[\'hookname\'][] = "hook_function";' );
		}

		$method = null;
		foreach( $pgHooks[$hook_name] as $function ){
			if( is_array( $function ) ) {
				if( count( $function ) < 2 ) {
					throw new HookError( "Not enough parameters in array specified for `$hook_name` hook" );
				} elseif( is_object( $function[0] ) ) {
					$object = $function[0];
					$method = $function[1];
					if( count( $function ) > 2 ) {
						$data = $function[2];
					}
				} elseif( is_string( $function[0] ) ) {
					$method = $function[0];
					if( count( $function ) > 1 ) {
						$data = $function[1];
					}
				}

			} elseif( is_string( $function ) ) {
				$method = $function;
			}

			if( isset( $data ) ) {
				$args = array_merge( array( $data ), $args );
			}

			if( isset( $object ) ) {
				$fncarr = array( $object, $method );
			} elseif( is_string( $method ) && in_string( "::", $method ) ) {
				$fncarr = explode( "::", $method );
			} else {
				$fncarr = $method;
			}

			//is_callable( $fncarr ); //Apparently this is a bug. Thanks, MW!

			if( !is_callable( $fncarr ) ) {
				throw new BadEntryError( "MissingFunction", "Hook function $fncarr was not defined" );
			}

			$hookRet = call_user_func_array( $fncarr, $args );

			if( !is_null( $hookRet ) ) return $hookRet;

		}

	}
543449
public function remove($hook, $callback = null, $priority = 10)
    {
        // If $callback is null, it means we have chained the methods to
        // the action/filter instance. If the instance has no callback, return false.
        if (is_null($callback)) {
            if (! $callback = $this->getCallback($hook)) {
                return false;
            }

            list($callback, $priority, $accepted_args) = $callback;

            // Unset the hook.
            unset($this->hooks[$hook]);
        }

        $this->removeAction($hook, $callback, $priority);

        return $this;
    }
7412
public static function hook($hook, $params = [])
    {
        $hookRun = isset(self::$mountInfo[$hook]) ? self::$mountInfo[$hook] : null;
        if (!is_null($hookRun)) {
            foreach ($hookRun as $key => $val) {
                if (is_int($key)) {
                    $callBack = $val;
                } else {
                    $plugin = new $key();
                    $callBack = [$plugin, $val];
                }
                $return = call_user_func_array($callBack, array_slice(func_get_args(), 1));

                if (!is_null($return)) {
                    return $return;
                }
            }
        }
        return null;
    }