Add a WordPress action.

This is an alias of add_filter().

@param  string   $hook
@param  callable $method
@param  int      $priority
@param  int      $arg_count
@return bool true
198267
protected function add_action( $hook, $method, $priority = 10, $arg_count = 1 ) {
		return $this->add_filter( $hook, $method, $priority, $arg_count );
	}
580002
function addHook(hooks, hook) {
    hooks.push(hook)
    return function () {
      var i = hooks.indexOf(hook)
      if (i >= 0) return hooks.splice(i, 1)
    }
  }
1172391
def method_added(method_name)
      # do nothing if the method that was added was an actual hook method, or
      # if it already had hooks added to it
      return if hooks.include?(method_name) || hooked_methods.include?(method_name)
      add_hooks_to(method_name)
    end
1187108
private static function doFilter( $action, $class ) {
		$reflection = new \ReflectionClass( $class );
		foreach ( $reflection->getMethods() as $method ) {
			if ( $method->isPublic() && ! $method->isConstructor() ) {
				$comment = $method->getDocComment();

				// No hooks.
				if ( preg_match( '/@nohook[ \t\*\n]+/', $comment ) ) {
					continue;
				}

				// Set hook.
				preg_match_all( '/@hook:?\s+([^\s]+)/', $comment, $matches ) ? $matches[1] : $method->name;
				if ( empty( $matches[1] ) ) {
					$hooks = array( $method->name );
				} else {
					$hooks = $matches[1];
				}

				// Allow setting priority.
				$priority = preg_match( '/@priority:?\s+(\d+)/', $comment, $matches ) ? $matches[1] : 10;

				// Fire.
				foreach ( $hooks as $hook ) {
					call_user_func( $action, $hook, array( $class, $method->name ), $priority, $method->getNumberOfParameters() );
				}
			}
		}
	}
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;
    }
671829
def add_hook(payload_class, hook_arg = nil, &hook_block)
      hook = block_given? ? hook_block : hook_arg
      if !hook || !hook.is_a?(Proc)
        raise "Must pass a proc either as an argument or a block"
      end
      @message_hooks[payload_class] << hook
    end
833857
public function addHook($place, $hook, $args=array()){
		if(!isset($this->content[$place])){
			$this->content[$place] = array();
		}
		//allow just a string reference to a method on this skin object
		if(!is_array($hook) && method_exists($this, $hook)){
			$hook = array($hook, $this);
		}
		$this->content[$place][] = array('type'=>'hook', 'hook'=>$hook, 'arguments'=>$args);
	}
1239523
public function callMethod (&$api, $module, $method, $args = array ())
	{
		
		// Set module class name
		
		$class		= $this->getModuleClass ($module);
		
		// Create module object
		
		$obj		= new $class;
		
		// Set the API reference
		
		$obj->api	= $api;
		
		// Call the method init function for any custom code before the action
		
		if ($obj->callInit ($this, $method, $args))
		{
			
			// Call module method and pass the arguments list as 
			
			$return	= call_user_func_array (array ($obj, $method), array ($args));
			
		}
		
		// Return result
		
		return $obj->getResult ();
		
	}
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;
    }
769246
public function addAction(string $hook, ComponentInterface $component, string $handler, int $priority = 10, int $argCount = 1): void {
		$this->actions[] = new Hook($hook, $component, $handler, $priority, $argCount);
	}
497290
protected function _triggerHook($method, $content = '') {
        if ($this->_hooks) {
            foreach ($this->_hooks as $hook) {
                if (method_exists($hook, $method)) {
                    $content = $hook->{$method}($content);
                }
            }
        }

        return $content;
    }
458972
private function call_filter_callback( $class, $method, $args ) {
		$result = empty( $args ) ? null : reset( $args );
		$app    = $this->get_target_app( $class );
		if ( empty( $app ) ) {
			return $result;
		}

		if ( $app->is_filter_callable( $method ) ) {
			return $app->filter_callback( $method, $args );
		}

		return $result;
	}
60955
public function add_hooks()
	{
		if ( function_exists( 'add_action' )
			&& function_exists( 'add_filter' )
			&& function_exists( 'add_shortcode' )
		) {
			// Actions
			foreach ( $this->actions as $action ) {
				add_action(
					$action['hook'],
					[ &$this, $this->get_mapped_mvc_call( $action['mvc'] ) ],
					$action['priority'],
					$action['args']
				);
			}
			// Filters
			foreach ( $this->filters as $filter ) {
				add_filter(
					$filter['hook'],
					[ &$this, $this->get_mapped_mvc_call( $filter['mvc'], true ) ],
					$filter['priority'],
					$filter['args']
				);
			}
			// Filters
			foreach ( $this->shortcodes as $shortcode ) {
				add_shortcode(
					$shortcode['tag'],
					[ &$this, $this->get_mapped_mvc_call( $shortcode['mvc'], true ) ]
				);
			}
			// Widgets
			if ( count( $this->widgets ) > 0 ) {
        		add_action( 'widgets_init', [ &$this, '_widgets' ], 1 );
			}
		}
	}
29824
public function hook($method, $callback = null)
    {
        if (is_array($method)) {
            $this->hook = array_merge($this->hook, $method);
        } else {
            $this->hook[$method] = $callback;
        }
    }
1270570
private function executeMethod($method, $args = [])
    {
        if (method_exists($this, $method)) {
            return call_user_func_array([$this, $method], $args);
        }
    }
783107
private function addFilterReq($f, $priority = FilterChain::DEFAULT_PRIORITY) {
		$this->_filtersReq->attach($f, $priority);
	}
201313
function add_filter( $tag, $function_to_add, $priority = WP_FS__DEFAULT_PRIORITY, $accepted_args = 1 ) {
            $this->_logger->entrance( $tag );

            add_filter( $this->get_action_tag( $tag ), $function_to_add, $priority, $accepted_args );
        }