PluginProbe ʕ •ᴥ•ʔ
Firebase Authentication / 1.6.5
Firebase Authentication v1.6.5
1.7.0 trunk 1.0.0 1.1.1 1.1.2 1.1.3 1.1.4 1.2.0 1.3.0 1.3.1 1.3.2 1.3.3 1.3.4 1.3.5 1.3.6 1.3.7 1.4.0 1.4.1 1.4.2 1.4.3 1.4.4 1.4.5 1.4.6 1.4.8 1.5.0 1.5.1 1.5.2 1.5.3 1.5.4 1.5.5 1.5.6 1.5.7 1.5.8 1.5.9 1.6.0 1.6.1 1.6.2 1.6.3 1.6.4 1.6.5 1.6.6 1.6.7 1.6.8 1.6.9
firebase-authentication / includes / class-mo-firebase-authentication-loader.php
firebase-authentication / includes Last commit date
images 2 years ago class-mo-firebase-authentication-deactivator.php 2 years ago class-mo-firebase-authentication-i18n.php 2 years ago class-mo-firebase-authentication-loader.php 2 years ago class-mo-firebase-authentication.php 2 years ago
class-mo-firebase-authentication-loader.php
129 lines
1 <?php
2 /**
3 * Register all actions and filters for the plugin
4 *
5 * @link https://miniorange.com
6 * @since 1.0.0
7 *
8 * @package Firebase_Authentication
9 * @subpackage Firebase_Authentication/includes
10 */
11
12 /**
13 * Register all actions and filters for the plugin.
14 *
15 * Maintain a list of all hooks that are registered throughout
16 * the plugin, and register them with the WordPress API. Call the
17 * run function to execute the list of actions and filters.
18 *
19 * @package Firebase_Authentication
20 * @subpackage Firebase_Authentication/includes
21 * @author miniOrange <info@miniorange.com>
22 */
23 class MO_Firebase_Authentication_Loader {
24
25 /**
26 * The array of actions registered with WordPress.
27 *
28 * @since 1.0.0
29 * @access protected
30 * @var array $actions The actions registered with WordPress to fire when the plugin loads.
31 */
32 protected $actions;
33
34 /**
35 * The array of filters registered with WordPress.
36 *
37 * @since 1.0.0
38 * @access protected
39 * @var array $filters The filters registered with WordPress to fire when the plugin loads.
40 */
41 protected $filters;
42
43 /**
44 * Initialize the collections used to maintain the actions and filters.
45 *
46 * @since 1.0.0
47 */
48 public function __construct() {
49
50 $this->actions = array();
51 $this->filters = array();
52
53 }
54
55 /**
56 * Add a new action to the collection to be registered with WordPress.
57 *
58 * @since 1.0.0
59 * @param string $hook The name of the WordPress action that is being registered.
60 * @param object $component A reference to the instance of the object on which the action is defined.
61 * @param string $callback The name of the function definition on the $component.
62 * @param int $priority Optional. The priority at which the function should be fired. Default is 10.
63 * @param int $accepted_args Optional. The number of arguments that should be passed to the $callback. Default is 1.
64 */
65 public function add_action( $hook, $component, $callback, $priority = 10, $accepted_args = 1 ) {
66 $this->actions = $this->add( $this->actions, $hook, $component, $callback, $priority, $accepted_args );
67 }
68
69 /**
70 * Add a new filter to the collection to be registered with WordPress.
71 *
72 * @since 1.0.0
73 * @param string $hook The name of the WordPress filter that is being registered.
74 * @param object $component A reference to the instance of the object on which the filter is defined.
75 * @param string $callback The name of the function definition on the $component.
76 * @param int $priority Optional. The priority at which the function should be fired. Default is 10.
77 * @param int $accepted_args Optional. The number of arguments that should be passed to the $callback. Default is 1.
78 */
79 public function add_filter( $hook, $component, $callback, $priority = 10, $accepted_args = 1 ) {
80 $this->filters = $this->add( $this->filters, $hook, $component, $callback, $priority, $accepted_args );
81 }
82
83 /**
84 * A utility function that is used to register the actions and hooks into a single
85 * collection.
86 *
87 * @since 1.0.0
88 * @access private
89 * @param array $hooks The collection of hooks that is being registered (that is, actions or filters).
90 * @param string $hook The name of the WordPress filter that is being registered.
91 * @param object $component A reference to the instance of the object on which the filter is defined.
92 * @param string $callback The name of the function definition on the $component.
93 * @param int $priority The priority at which the function should be fired.
94 * @param int $accepted_args The number of arguments that should be passed to the $callback.
95 * @return array The collection of actions and filters registered with WordPress.
96 */
97 private function add( $hooks, $hook, $component, $callback, $priority, $accepted_args ) {
98
99 $hooks[] = array(
100 'hook' => $hook,
101 'component' => $component,
102 'callback' => $callback,
103 'priority' => $priority,
104 'accepted_args' => $accepted_args,
105 );
106
107 return $hooks;
108
109 }
110
111 /**
112 * Register the filters and actions with WordPress.
113 *
114 * @since 1.0.0
115 */
116 public function run() {
117
118 foreach ( $this->filters as $hook ) {
119 add_filter( $hook['hook'], array( $hook['component'], $hook['callback'] ), $hook['priority'], $hook['accepted_args'] );
120 }
121
122 foreach ( $this->actions as $hook ) {
123 add_action( $hook['hook'], array( $hook['component'], $hook['callback'] ), $hook['priority'], $hook['accepted_args'] );
124 }
125
126 }
127
128 }
129