PluginProbe
WpStream – Live Streaming, Video on Demand, Pay Per View / 3.7
WpStream – Live Streaming, Video on Demand, Pay Per View v3.7
4.14.1 4.14.0 4.13.2 4.13.1 4.13 4.12.5 4.12.4 4.12.3 4.12.2 4.12.1 4.12 4.4.4 4.4.5 4.4.6 4.4.7 4.4.8 4.4.9 4.5 4.5.1 4.5.11 4.5.11.1 4.5.11.2 4.5.11.4 4.5.11.5 4.5.11.6 All 181 releases
← All changes | includes/class-wpstream-loader.php +5 -22 4.14.13.7 View file →
@@ -9,14 +9,8 @@
9 9 * @package Wpstream
10 10 * @subpackage Wpstream/includes
11 11 */
12 12
13 -
14 -// Exit if accessed directly.
15 -if ( ! defined( 'ABSPATH' ) ) {
16 - exit;
17 -}
18 -
19 13 /**
20 14 * Register all actions and filters for the plugin.
21 15 *
22 16 * Maintain a list of all hooks that are registered throughout
@@ -53,11 +47,9 @@
53 47 * @since 3.0.1
54 48 */
55 49 public function __construct() {
56 50
57 - // Start with an empty queue of actions; hooks get appended via add_action().
58 51 $this->actions = array();
59 - // Start with an empty queue of filters; hooks get appended via add_filter().
60 52 $this->filters = array();
61 53
62 54 }
63 55
@@ -71,9 +63,8 @@
71 63 * @param int $priority Optional. The priority at which the function should be fired. Default is 10.
72 64 * @param int $accepted_args Optional. The number of arguments that should be passed to the $callback. Default is 1.
73 65 */
74 66 public function add_action( $hook, $component, $callback, $priority = 10, $accepted_args = 1 ) {
75 - // Append the action to the internal collection via the shared add() helper.
76 67 $this->actions = $this->add( $this->actions, $hook, $component, $callback, $priority, $accepted_args );
77 68 }
78 69
79 70 /**
@@ -86,9 +77,8 @@
86 77 * @param int $priority Optional. The priority at which the function should be fired. Default is 10.
87 78 * @param int $accepted_args Optional. The number of arguments that should be passed to the $callback. Default is 1
88 79 */
89 80 public function add_filter( $hook, $component, $callback, $priority = 10, $accepted_args = 1 ) {
90 - // Append the filter to the internal collection via the shared add() helper.
91 81 $this->filters = $this->add( $this->filters, $hook, $component, $callback, $priority, $accepted_args );
92 82 }
93 83
94 84 /**
@@ -106,19 +96,16 @@
106 96 * @return array The collection of actions and filters registered with WordPress.
107 97 */
108 98 private function add( $hooks, $hook, $component, $callback, $priority, $accepted_args ) {
109 99
110 - // Push one normalized record onto the collection, capturing everything
111 - // WordPress needs later to wire the callback up in run().
112 100 $hooks[] = array(
113 - 'hook' => $hook, // WordPress hook name to attach to
114 - 'component' => $component, // object instance owning the callback
115 - 'callback' => $callback, // method name on that object
116 - 'priority' => $priority, // execution priority for this hook
117 - 'accepted_args' => $accepted_args // number of args passed to the callback
101 + 'hook' => $hook,
102 + 'component' => $component,
103 + 'callback' => $callback,
104 + 'priority' => $priority,
105 + 'accepted_args' => $accepted_args
118 106 );
119 107
120 - // Return the grown collection so the caller can reassign its property.
121 108 return $hooks;
122 109
123 110 }
124 111
@@ -128,17 +115,13 @@
128 115 * @since 3.0.1
129 116 */
130 117 public function run() {
131 118
132 - // Register every queued filter with WordPress core.
133 119 foreach ( $this->filters as $hook ) {
134 - // Bind the stored component/callback pair at its recorded priority and arg count.
135 120 add_filter( $hook['hook'], array( $hook['component'], $hook['callback'] ), $hook['priority'], $hook['accepted_args'] );
136 121 }
137 122
138 - // Register every queued action with WordPress core.
139 123 foreach ( $this->actions as $hook ) {
140 - // Bind the stored component/callback pair at its recorded priority and arg count.
141 124 add_action( $hook['hook'], array( $hook['component'], $hook['callback'] ), $hook['priority'], $hook['accepted_args'] );
142 125 }
143 126
144 127 }