PluginProbe
Depicter — Popup & Slider Builder / trunk
Depicter — Popup & Slider Builder vtrunk
4.8.1 trunk 1.0.0 1.1.0 1.1.2 1.1.4 1.1.6 1.1.7 1.1.8 1.1.9 1.2.0 1.3.0 1.3.1 1.3.2 1.3.3 1.3.5 1.3.8 1.5.0 1.5.1 1.5.2 1.5.5 1.6.0 1.6.1 1.6.2 1.7.0 All 76 releases
depicter / vendor / averta / wordpress / src / Event / Action.php

Action.php in Depicter — Popup & Slider Builder trunk, at vendor/averta/wordpress/src/Event/Action.php

69 lines 1.5 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 namespace Averta\WordPress\Event;
3
4
5 class Action implements HookInterface
6 {
7 /**
8 * Adds a callback function to an action hook.
9 *
10 * @param string $hook_name
11 * @param callable $callback
12 * @param int $priority
13 * @param int $accepted_args
14 *
15 * @return mixed
16 */
17 public function add( $hook_name, $callback, $priority = 10, $accepted_args = 1 ){
18 return add_action( $hook_name, $callback, $priority, $accepted_args );
19 }
20
21 /**
22 * Removes a callback function from an action hook.
23 *
24 * @param string $hook_name
25 * @param callable $callback
26 * @param int $priority
27 *
28 * @return mixed
29 */
30 public function remove( $hook_name, $callback, $priority = 10 ){
31 return remove_action( $hook_name, $callback, $priority );
32 }
33
34 /**
35 * Checks if any action has been registered for a hook.
36 *
37 * @param string $hook_name
38 * @param callable|bool $callback
39 *
40 * @return mixed
41 */
42 public function has( $hook_name, $callback = false ){
43 return has_action( $hook_name, $callback );
44 }
45
46 /**
47 * Retrieves the number of times an action has been fired during the current request.
48 *
49 * @param string $hook_name
50 *
51 * @return mixed
52 */
53 public function did( $hook_name ){
54 return did_action( $hook_name );
55 }
56
57 /**
58 * Calls the callback functions that have been added to an action hook.
59 *
60 * @param string $hook_name
61 * @param mixed $arg
62 *
63 * @return mixed
64 */
65 public function do( $hook_name, ...$arg ){
66 return do_action( $hook_name, $arg );
67 }
68 }
69