PluginProbe
Send Users Email – Email Subscribers, Email Marketing Newsletter / trunk
Send Users Email – Email Subscribers, Email Marketing Newsletter vtrunk
2.0.3 2.0.2 2.0.1 trunk 1.0.0 1.0.1 1.0.2 1.0.3 1.0.4 1.0.5 1.0.6 1.1.0 1.1.1 1.1.2 1.2.0 1.2.1 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.3.8 All 51 releases
send-users-email / includes / class-send-users-email-loader.php

class-send-users-email-loader.php in Send Users Email – Email Subscribers, Email Marketing Newsletter trunk, at includes/class-send-users-email-loader.php

75 lines 1.8 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 /**
4 * Register all actions and filters for the plugin.
5 */
6 class Send_Users_Email_Loader {
7
8 protected $actions;
9
10 protected $filters;
11
12 /**
13 * Initialize the collections used to maintain the actions and filters.
14 */
15 public function __construct() {
16
17 $this->actions = array();
18 $this->filters = array();
19
20 }
21
22 /**
23 * Add a new action to the collection to be registered with WordPress.
24 */
25 public function add_action( $hook, $component, $callback, $priority = 10, $accepted_args = 1 ) {
26 $this->actions = $this->add( $this->actions, $hook, $component, $callback, $priority, $accepted_args );
27 }
28
29 /**
30 * Add a new filter to the collection to be registered with WordPress.
31 */
32 public function add_filter( $hook, $component, $callback, $priority = 10, $accepted_args = 1 ) {
33 $this->filters = $this->add( $this->filters, $hook, $component, $callback, $priority, $accepted_args );
34 }
35
36 /**
37 * A utility function that is used to register the actions and hooks into a single collection.
38 */
39 private function add( $hooks, $hook, $component, $callback, $priority, $accepted_args ) {
40
41 $hooks[] = array(
42 'hook' => $hook,
43 'component' => $component,
44 'callback' => $callback,
45 'priority' => $priority,
46 'accepted_args' => $accepted_args
47 );
48
49 return $hooks;
50
51 }
52
53 /**
54 * Register the filters and actions with WordPress.
55 */
56 public function run() {
57
58 foreach ( $this->filters as $hook ) {
59 add_filter( $hook['hook'], array(
60 $hook['component'],
61 $hook['callback']
62 ), $hook['priority'], $hook['accepted_args'] );
63 }
64
65 foreach ( $this->actions as $hook ) {
66 add_action( $hook['hook'], array(
67 $hook['component'],
68 $hook['callback']
69 ), $hook['priority'], $hook['accepted_args'] );
70 }
71
72 }
73
74 }
75