@@ -22,7 +22,7 @@ |
||
22 | 22 | * @param string $event_slug The event slug. |
23 | 23 | * @param WordPoints_Hook_Event_Args $event_args The event args. |
24 | 24 | */ |
25 | - public function do_event( $event_slug, WordPoints_Hook_Event_Args $event_args ); |
|
25 | + public function do_event($event_slug, WordPoints_Hook_Event_Args $event_args); |
|
26 | 26 | } |
27 | 27 | |
28 | 28 | // EOF |
@@ -25,13 +25,13 @@ discard block |
||
25 | 25 | * @since 1.0.0 |
26 | 26 | */ |
27 | 27 | public function get_event_slug() { |
28 | - return $this->storage->get_reaction_event_from_index( $this->ID ); |
|
28 | + return $this->storage->get_reaction_event_from_index($this->ID); |
|
29 | 29 | } |
30 | 30 | |
31 | 31 | /** |
32 | 32 | * @since 1.0.0 |
33 | 33 | */ |
34 | - public function update_event_slug( $event_slug ) { |
|
34 | + public function update_event_slug($event_slug) { |
|
35 | 35 | return $this->storage->update_reaction_event_in_index( |
36 | 36 | $this->ID |
37 | 37 | , $event_slug |
@@ -41,63 +41,63 @@ discard block |
||
41 | 41 | /** |
42 | 42 | * @since 1.0.0 |
43 | 43 | */ |
44 | - public function get_meta( $key ) { |
|
44 | + public function get_meta($key) { |
|
45 | 45 | |
46 | 46 | $settings = $this->get_settings(); |
47 | 47 | |
48 | - if ( ! is_array( $settings ) || ! isset( $settings[ $key ] ) ) { |
|
48 | + if ( ! is_array($settings) || ! isset($settings[$key])) { |
|
49 | 49 | return false; |
50 | 50 | } |
51 | 51 | |
52 | - return $settings[ $key ]; |
|
52 | + return $settings[$key]; |
|
53 | 53 | } |
54 | 54 | |
55 | 55 | /** |
56 | 56 | * @since 1.0.0 |
57 | 57 | */ |
58 | - public function add_meta( $key, $value ) { |
|
58 | + public function add_meta($key, $value) { |
|
59 | 59 | |
60 | 60 | $settings = $this->get_settings(); |
61 | 61 | |
62 | - if ( ! is_array( $settings ) || isset( $settings[ $key ] ) ) { |
|
62 | + if ( ! is_array($settings) || isset($settings[$key])) { |
|
63 | 63 | return false; |
64 | 64 | } |
65 | 65 | |
66 | - $settings[ $key ] = $value; |
|
66 | + $settings[$key] = $value; |
|
67 | 67 | |
68 | - return $this->update_settings( $settings ); |
|
68 | + return $this->update_settings($settings); |
|
69 | 69 | } |
70 | 70 | |
71 | 71 | /** |
72 | 72 | * @since 1.0.0 |
73 | 73 | */ |
74 | - public function update_meta( $key, $value ) { |
|
74 | + public function update_meta($key, $value) { |
|
75 | 75 | |
76 | 76 | $settings = $this->get_settings(); |
77 | 77 | |
78 | - if ( ! is_array( $settings ) ) { |
|
78 | + if ( ! is_array($settings)) { |
|
79 | 79 | return false; |
80 | 80 | } |
81 | 81 | |
82 | - $settings[ $key ] = $value; |
|
82 | + $settings[$key] = $value; |
|
83 | 83 | |
84 | - return $this->update_settings( $settings ); |
|
84 | + return $this->update_settings($settings); |
|
85 | 85 | } |
86 | 86 | |
87 | 87 | /** |
88 | 88 | * @since 1.0.0 |
89 | 89 | */ |
90 | - public function delete_meta( $key ) { |
|
90 | + public function delete_meta($key) { |
|
91 | 91 | |
92 | 92 | $settings = $this->get_settings(); |
93 | 93 | |
94 | - if ( ! is_array( $settings ) || ! isset( $settings[ $key ] ) ) { |
|
94 | + if ( ! is_array($settings) || ! isset($settings[$key])) { |
|
95 | 95 | return false; |
96 | 96 | } |
97 | 97 | |
98 | - unset( $settings[ $key ] ); |
|
98 | + unset($settings[$key]); |
|
99 | 99 | |
100 | - return $this->update_settings( $settings ); |
|
100 | + return $this->update_settings($settings); |
|
101 | 101 | } |
102 | 102 | |
103 | 103 | /** |
@@ -117,7 +117,7 @@ discard block |
||
117 | 117 | protected function get_settings() { |
118 | 118 | |
119 | 119 | return $this->storage->get_option( |
120 | - $this->storage->get_settings_option_name( $this->ID ) |
|
120 | + $this->storage->get_settings_option_name($this->ID) |
|
121 | 121 | ); |
122 | 122 | } |
123 | 123 | |
@@ -130,10 +130,10 @@ discard block |
||
130 | 130 | * |
131 | 131 | * @return bool Whether the settings were updated successfully. |
132 | 132 | */ |
133 | - protected function update_settings( $settings ) { |
|
133 | + protected function update_settings($settings) { |
|
134 | 134 | |
135 | 135 | return $this->storage->update_option( |
136 | - $this->storage->get_settings_option_name( $this->ID ) |
|
136 | + $this->storage->get_settings_option_name($this->ID) |
|
137 | 137 | , $settings |
138 | 138 | ); |
139 | 139 | } |
@@ -22,25 +22,25 @@ discard block |
||
22 | 22 | /** |
23 | 23 | * @since 1.0.0 |
24 | 24 | */ |
25 | - public function reaction_exists( $id ) { |
|
26 | - return (bool) $this->get_option( $this->get_settings_option_name( $id ) ); |
|
25 | + public function reaction_exists($id) { |
|
26 | + return (bool) $this->get_option($this->get_settings_option_name($id)); |
|
27 | 27 | } |
28 | 28 | |
29 | 29 | /** |
30 | 30 | * @since 1.0.0 |
31 | 31 | */ |
32 | 32 | public function get_reactions() { |
33 | - return $this->create_reaction_objects( $this->get_reaction_index() ); |
|
33 | + return $this->create_reaction_objects($this->get_reaction_index()); |
|
34 | 34 | } |
35 | 35 | |
36 | 36 | /** |
37 | 37 | * @since 1.0.0 |
38 | 38 | */ |
39 | - public function get_reactions_to_event( $event_slug ) { |
|
39 | + public function get_reactions_to_event($event_slug) { |
|
40 | 40 | |
41 | 41 | $index = $this->get_reaction_index(); |
42 | - $index = wp_list_filter( $index, array( 'event' => $event_slug ) ); |
|
43 | - return $this->create_reaction_objects( $index ); |
|
42 | + $index = wp_list_filter($index, array('event' => $event_slug)); |
|
43 | + return $this->create_reaction_objects($index); |
|
44 | 44 | } |
45 | 45 | |
46 | 46 | /** |
@@ -59,9 +59,9 @@ discard block |
||
59 | 59 | */ |
60 | 60 | protected function get_reaction_index() { |
61 | 61 | |
62 | - $index = $this->get_option( $this->get_reaction_index_option_name() ); |
|
62 | + $index = $this->get_option($this->get_reaction_index_option_name()); |
|
63 | 63 | |
64 | - if ( ! is_array( $index ) ) { |
|
64 | + if ( ! is_array($index)) { |
|
65 | 65 | $index = array(); |
66 | 66 | } |
67 | 67 | |
@@ -77,7 +77,7 @@ discard block |
||
77 | 77 | * |
78 | 78 | * @return bool Whether the index was updated successfully. |
79 | 79 | */ |
80 | - protected function update_reaction_index( $index ) { |
|
80 | + protected function update_reaction_index($index) { |
|
81 | 81 | |
82 | 82 | return $this->update_option( |
83 | 83 | $this->get_reaction_index_option_name() |
@@ -96,15 +96,15 @@ discard block |
||
96 | 96 | * |
97 | 97 | * @return string|false The event slug, or false if not found. |
98 | 98 | */ |
99 | - public function get_reaction_event_from_index( $id ) { |
|
99 | + public function get_reaction_event_from_index($id) { |
|
100 | 100 | |
101 | 101 | $index = $this->get_reaction_index(); |
102 | 102 | |
103 | - if ( ! isset( $index[ $id ]['event'] ) ) { |
|
103 | + if ( ! isset($index[$id]['event'])) { |
|
104 | 104 | return false; |
105 | 105 | } |
106 | 106 | |
107 | - return $index[ $id ]['event']; |
|
107 | + return $index[$id]['event']; |
|
108 | 108 | } |
109 | 109 | |
110 | 110 | /** |
@@ -119,17 +119,17 @@ discard block |
||
119 | 119 | * |
120 | 120 | * @return bool Whether the event was updated successfully. |
121 | 121 | */ |
122 | - public function update_reaction_event_in_index( $id, $event ) { |
|
122 | + public function update_reaction_event_in_index($id, $event) { |
|
123 | 123 | |
124 | 124 | $index = $this->get_reaction_index(); |
125 | 125 | |
126 | - if ( ! isset( $index[ $id ] ) ) { |
|
126 | + if ( ! isset($index[$id])) { |
|
127 | 127 | return false; |
128 | 128 | } |
129 | 129 | |
130 | - $index[ $id ]['event'] = $event; |
|
130 | + $index[$id]['event'] = $event; |
|
131 | 131 | |
132 | - return $this->update_reaction_index( $index ); |
|
132 | + return $this->update_reaction_index($index); |
|
133 | 133 | } |
134 | 134 | |
135 | 135 | /** |
@@ -141,15 +141,15 @@ discard block |
||
141 | 141 | * |
142 | 142 | * @return WordPoints_Hook_Reaction_Options[] The objects for the reactions. |
143 | 143 | */ |
144 | - protected function create_reaction_objects( $index ) { |
|
144 | + protected function create_reaction_objects($index) { |
|
145 | 145 | |
146 | 146 | $reactions = array(); |
147 | 147 | |
148 | - foreach ( $index as $reaction ) { |
|
148 | + foreach ($index as $reaction) { |
|
149 | 149 | |
150 | - $object = $this->get_reaction( $reaction['id'] ); |
|
150 | + $object = $this->get_reaction($reaction['id']); |
|
151 | 151 | |
152 | - if ( ! $object ) { |
|
152 | + if ( ! $object) { |
|
153 | 153 | continue; |
154 | 154 | } |
155 | 155 | |
@@ -162,53 +162,53 @@ discard block |
||
162 | 162 | /** |
163 | 163 | * @since 1.0.0 |
164 | 164 | */ |
165 | - public function delete_reaction( $id ) { |
|
165 | + public function delete_reaction($id) { |
|
166 | 166 | |
167 | - if ( ! $this->reaction_exists( $id ) ) { |
|
167 | + if ( ! $this->reaction_exists($id)) { |
|
168 | 168 | return false; |
169 | 169 | } |
170 | 170 | |
171 | - $result = $this->delete_option( $this->get_settings_option_name( $id ) ); |
|
171 | + $result = $this->delete_option($this->get_settings_option_name($id)); |
|
172 | 172 | |
173 | - if ( ! $result ) { |
|
173 | + if ( ! $result) { |
|
174 | 174 | return false; |
175 | 175 | } |
176 | 176 | |
177 | 177 | $index = $this->get_reaction_index(); |
178 | 178 | |
179 | - unset( $index[ $id ] ); |
|
179 | + unset($index[$id]); |
|
180 | 180 | |
181 | - return $this->update_reaction_index( $index ); |
|
181 | + return $this->update_reaction_index($index); |
|
182 | 182 | } |
183 | 183 | |
184 | 184 | /** |
185 | 185 | * @since 1.0.0 |
186 | 186 | */ |
187 | - protected function _create_reaction( $event_slug ) { |
|
187 | + protected function _create_reaction($event_slug) { |
|
188 | 188 | |
189 | 189 | $index = $this->get_reaction_index(); |
190 | 190 | |
191 | 191 | $id = 1; |
192 | 192 | |
193 | 193 | // TODO this is fragile when the newest reaction gets deleted. |
194 | - if ( ! empty( $index ) ) { |
|
195 | - $id = 1 + max( array_keys( $index ) ); |
|
194 | + if ( ! empty($index)) { |
|
195 | + $id = 1 + max(array_keys($index)); |
|
196 | 196 | } |
197 | 197 | |
198 | - $settings = array( 'event' => $event_slug ); |
|
198 | + $settings = array('event' => $event_slug); |
|
199 | 199 | |
200 | 200 | $result = $this->add_option( |
201 | - $this->get_settings_option_name( $id ) |
|
201 | + $this->get_settings_option_name($id) |
|
202 | 202 | , $settings |
203 | 203 | ); |
204 | 204 | |
205 | - if ( ! $result ) { |
|
205 | + if ( ! $result) { |
|
206 | 206 | return false; |
207 | 207 | } |
208 | 208 | |
209 | - $index[ $id ] = array( 'event' => $event_slug, 'id' => $id ); |
|
209 | + $index[$id] = array('event' => $event_slug, 'id' => $id); |
|
210 | 210 | |
211 | - if ( ! $this->update_reaction_index( $index ) ) { |
|
211 | + if ( ! $this->update_reaction_index($index)) { |
|
212 | 212 | return false; |
213 | 213 | } |
214 | 214 | |
@@ -226,8 +226,8 @@ discard block |
||
226 | 226 | * |
227 | 227 | * @return mixed The option value, or false. |
228 | 228 | */ |
229 | - public function get_option( $name ) { |
|
230 | - return get_option( $name ); |
|
229 | + public function get_option($name) { |
|
230 | + return get_option($name); |
|
231 | 231 | } |
232 | 232 | |
233 | 233 | /** |
@@ -240,8 +240,8 @@ discard block |
||
240 | 240 | * |
241 | 241 | * @return bool Whether the option was added successfully. |
242 | 242 | */ |
243 | - protected function add_option( $name, $value ) { |
|
244 | - return add_option( $name, $value ); |
|
243 | + protected function add_option($name, $value) { |
|
244 | + return add_option($name, $value); |
|
245 | 245 | } |
246 | 246 | |
247 | 247 | /** |
@@ -256,8 +256,8 @@ discard block |
||
256 | 256 | * |
257 | 257 | * @return bool Whether the option was updated successfully. |
258 | 258 | */ |
259 | - public function update_option( $name, $value ) { |
|
260 | - return update_option( $name, $value ); |
|
259 | + public function update_option($name, $value) { |
|
260 | + return update_option($name, $value); |
|
261 | 261 | } |
262 | 262 | |
263 | 263 | /** |
@@ -269,8 +269,8 @@ discard block |
||
269 | 269 | * |
270 | 270 | * @return bool Whether the option was deleted successfully. |
271 | 271 | */ |
272 | - protected function delete_option( $name ) { |
|
273 | - return delete_option( $name ); |
|
272 | + protected function delete_option($name) { |
|
273 | + return delete_option($name); |
|
274 | 274 | } |
275 | 275 | |
276 | 276 | /** |
@@ -282,7 +282,7 @@ discard block |
||
282 | 282 | * |
283 | 283 | * @return string The name of the option where the settings are stored. |
284 | 284 | */ |
285 | - public function get_settings_option_name( $id ) { |
|
285 | + public function get_settings_option_name($id) { |
|
286 | 286 | return "wordpoints_{$this->reactor_slug}_hook_reaction-{$id}"; |
287 | 287 | } |
288 | 288 |
@@ -22,29 +22,29 @@ |
||
22 | 22 | /** |
23 | 23 | * @since 1.0.0 |
24 | 24 | */ |
25 | - public function get_option( $name ) { |
|
26 | - return get_site_option( $name ); |
|
25 | + public function get_option($name) { |
|
26 | + return get_site_option($name); |
|
27 | 27 | } |
28 | 28 | |
29 | 29 | /** |
30 | 30 | * @since 1.0.0 |
31 | 31 | */ |
32 | - protected function add_option( $name, $value ) { |
|
33 | - return add_site_option( $name, $value ); |
|
32 | + protected function add_option($name, $value) { |
|
33 | + return add_site_option($name, $value); |
|
34 | 34 | } |
35 | 35 | |
36 | 36 | /** |
37 | 37 | * @since 1.0.0 |
38 | 38 | */ |
39 | - public function update_option( $name, $value ) { |
|
40 | - return update_site_option( $name, $value ); |
|
39 | + public function update_option($name, $value) { |
|
40 | + return update_site_option($name, $value); |
|
41 | 41 | } |
42 | 42 | |
43 | 43 | /** |
44 | 44 | * @since 1.0.0 |
45 | 45 | */ |
46 | - protected function delete_option( $name ) { |
|
47 | - return delete_site_option( $name ); |
|
46 | + protected function delete_option($name) { |
|
47 | + return delete_site_option($name); |
|
48 | 48 | } |
49 | 49 | } |
50 | 50 |
@@ -25,7 +25,7 @@ discard block |
||
25 | 25 | * @param int $id The ID of a hook reaction. |
26 | 26 | * @param WordPoints_Hook_Reaction_StorageI $storage The storage object. |
27 | 27 | */ |
28 | - public function __construct( $id, WordPoints_Hook_Reaction_StorageI $storage ); |
|
28 | + public function __construct($id, WordPoints_Hook_Reaction_StorageI $storage); |
|
29 | 29 | |
30 | 30 | /** |
31 | 31 | * Check whether this reaction is network-wide. |
@@ -54,7 +54,7 @@ discard block |
||
54 | 54 | * |
55 | 55 | * @return bool Whether the event was updated successfully. |
56 | 56 | */ |
57 | - public function update_event_slug( $event_slug ); |
|
57 | + public function update_event_slug($event_slug); |
|
58 | 58 | |
59 | 59 | /** |
60 | 60 | * Get the slug of the reactor this reaction is for. |
@@ -74,7 +74,7 @@ discard block |
||
74 | 74 | * |
75 | 75 | * @return mixed|false The meta value, or false if not found. |
76 | 76 | */ |
77 | - public function get_meta( $key ); |
|
77 | + public function get_meta($key); |
|
78 | 78 | |
79 | 79 | /** |
80 | 80 | * Add a piece of metadata for this reaction. |
@@ -88,7 +88,7 @@ discard block |
||
88 | 88 | * |
89 | 89 | * @return bool Whether the metadata was added successfully. |
90 | 90 | */ |
91 | - public function add_meta( $key, $value ); |
|
91 | + public function add_meta($key, $value); |
|
92 | 92 | |
93 | 93 | /** |
94 | 94 | * Update a piece of metadata for this reaction. |
@@ -100,7 +100,7 @@ discard block |
||
100 | 100 | * |
101 | 101 | * @return bool Whether the metadata was updated successfully. |
102 | 102 | */ |
103 | - public function update_meta( $key, $value ); |
|
103 | + public function update_meta($key, $value); |
|
104 | 104 | |
105 | 105 | /** |
106 | 106 | * Delete a piece of metadata for this reaction. |
@@ -111,7 +111,7 @@ discard block |
||
111 | 111 | * |
112 | 112 | * @return bool Whether the metadata was deleted successfully. |
113 | 113 | */ |
114 | - public function delete_meta( $key ); |
|
114 | + public function delete_meta($key); |
|
115 | 115 | |
116 | 116 | /** |
117 | 117 | * Get all of the metadata for this reaction. |
@@ -8,7 +8,7 @@ |
||
8 | 8 | */ |
9 | 9 | |
10 | 10 | interface WordPoints_Hook_Retroactive_Query_ModifierI { |
11 | - public function modify_retroactive_query( WordPoints_Hook_Retroactive_QueryI $query ); |
|
11 | + public function modify_retroactive_query(WordPoints_Hook_Retroactive_QueryI $query); |
|
12 | 12 | } |
13 | 13 | |
14 | 14 | // EOF |
@@ -50,7 +50,7 @@ discard block |
||
50 | 50 | |
51 | 51 | interface WordPoints_Hook_Retroactive_QueryI { |
52 | 52 | |
53 | - public function __construct( WordPoints_Hook_ReactionI $reaction ); |
|
53 | + public function __construct(WordPoints_Hook_ReactionI $reaction); |
|
54 | 54 | |
55 | 55 | /** |
56 | 56 | * |
@@ -61,13 +61,13 @@ discard block |
||
61 | 61 | public function get_reaction(); |
62 | 62 | public function get_validator(); |
63 | 63 | |
64 | - public function arg_hierarchy_push( $slug ); |
|
64 | + public function arg_hierarchy_push($slug); |
|
65 | 65 | public function arg_hierarchy_pop(); |
66 | 66 | public function get_arg(); |
67 | 67 | |
68 | - public function set_target( $target_arg ); |
|
68 | + public function set_target($target_arg); |
|
69 | 69 | public function select_value(); |
70 | - public function add_condition( array $condition ); |
|
70 | + public function add_condition(array $condition); |
|
71 | 71 | |
72 | 72 | public function get_results(); |
73 | 73 | } |
@@ -80,13 +80,13 @@ discard block |
||
80 | 80 | /** |
81 | 81 | * @since 1.0.0 |
82 | 82 | */ |
83 | - public function __call( $name, $args ) { |
|
83 | + public function __call($name, $args) { |
|
84 | 84 | |
85 | - $this->route_action( $name, $args ); |
|
85 | + $this->route_action($name, $args); |
|
86 | 86 | |
87 | 87 | // Return the first value, in case it is hooked to a filter. |
88 | 88 | $return = null; |
89 | - if ( isset( $args[0] ) ) { |
|
89 | + if (isset($args[0])) { |
|
90 | 90 | $return = $args[0]; |
91 | 91 | } |
92 | 92 | |
@@ -103,13 +103,13 @@ discard block |
||
103 | 103 | * action name and the priority. |
104 | 104 | * @param array $args The args the action was fired with. |
105 | 105 | */ |
106 | - protected function route_action( $name, $args ) { |
|
106 | + protected function route_action($name, $args) { |
|
107 | 107 | |
108 | - if ( ! isset( $this->action_index[ $name ] ) ) { |
|
108 | + if ( ! isset($this->action_index[$name])) { |
|
109 | 109 | return; |
110 | 110 | } |
111 | 111 | |
112 | - if ( ! isset( $this->actions ) ) { |
|
112 | + if ( ! isset($this->actions)) { |
|
113 | 113 | |
114 | 114 | $hooks = wordpoints_hooks(); |
115 | 115 | |
@@ -118,41 +118,41 @@ discard block |
||
118 | 118 | $this->firers = $hooks->firers; |
119 | 119 | } |
120 | 120 | |
121 | - foreach ( $this->action_index[ $name ]['actions'] as $slug => $data ) { |
|
121 | + foreach ($this->action_index[$name]['actions'] as $slug => $data) { |
|
122 | 122 | |
123 | - if ( ! isset( $this->event_index[ $slug ] ) ) { |
|
123 | + if ( ! isset($this->event_index[$slug])) { |
|
124 | 124 | continue; |
125 | 125 | } |
126 | 126 | |
127 | - $action_object = $this->actions->get( $slug, $args, $data ); |
|
127 | + $action_object = $this->actions->get($slug, $args, $data); |
|
128 | 128 | |
129 | - if ( ! ( $action_object instanceof WordPoints_Hook_ActionI ) ) { |
|
129 | + if ( ! ($action_object instanceof WordPoints_Hook_ActionI)) { |
|
130 | 130 | continue; |
131 | 131 | } |
132 | 132 | |
133 | - if ( ! $action_object->should_fire() ) { |
|
133 | + if ( ! $action_object->should_fire()) { |
|
134 | 134 | continue; |
135 | 135 | } |
136 | 136 | |
137 | - foreach ( $this->event_index[ $slug ] as $type => $events ) { |
|
138 | - foreach ( $events as $event_slug => $unused ) { |
|
137 | + foreach ($this->event_index[$slug] as $type => $events) { |
|
138 | + foreach ($events as $event_slug => $unused) { |
|
139 | 139 | |
140 | - if ( ! $this->events->is_registered( $event_slug ) ) { |
|
140 | + if ( ! $this->events->is_registered($event_slug)) { |
|
141 | 141 | continue; |
142 | 142 | } |
143 | 143 | |
144 | - $event_args = $this->events->args->get_children( $event_slug, array( $action_object ) ); |
|
144 | + $event_args = $this->events->args->get_children($event_slug, array($action_object)); |
|
145 | 145 | |
146 | - if ( empty( $event_args ) ) { |
|
146 | + if (empty($event_args)) { |
|
147 | 147 | continue; |
148 | 148 | } |
149 | 149 | |
150 | - $event_args = new WordPoints_Hook_Event_Args( $event_args ); |
|
150 | + $event_args = new WordPoints_Hook_Event_Args($event_args); |
|
151 | 151 | |
152 | - $firer = $this->firers->get( $type ); |
|
152 | + $firer = $this->firers->get($type); |
|
153 | 153 | |
154 | - if ( $firer instanceof WordPoints_Hook_FirerI ) { |
|
155 | - $firer->do_event( $event_slug, $event_args ); |
|
154 | + if ($firer instanceof WordPoints_Hook_FirerI) { |
|
155 | + $firer->do_event($event_slug, $event_args); |
|
156 | 156 | } |
157 | 157 | } |
158 | 158 | } |
@@ -182,56 +182,56 @@ discard block |
||
182 | 182 | * } |
183 | 183 | * } |
184 | 184 | */ |
185 | - public function add_action( $slug, array $args ) { |
|
185 | + public function add_action($slug, array $args) { |
|
186 | 186 | |
187 | 187 | $priority = 10; |
188 | - if ( isset( $args['priority'] ) ) { |
|
188 | + if (isset($args['priority'])) { |
|
189 | 189 | $priority = $args['priority']; |
190 | 190 | } |
191 | 191 | |
192 | - if ( ! isset( $args['action'] ) ) { |
|
192 | + if ( ! isset($args['action'])) { |
|
193 | 193 | return; |
194 | 194 | } |
195 | 195 | |
196 | 196 | $method = "{$args['action']},{$priority}"; |
197 | 197 | |
198 | - $this->action_index[ $method ]['actions'][ $slug ] = array(); |
|
198 | + $this->action_index[$method]['actions'][$slug] = array(); |
|
199 | 199 | |
200 | 200 | $arg_number = 1; |
201 | 201 | |
202 | - if ( isset( $args['data'] ) ) { |
|
202 | + if (isset($args['data'])) { |
|
203 | 203 | |
204 | - if ( isset( $args['data']['arg_index'] ) ) { |
|
205 | - $arg_number = 1 + max( $args['data']['arg_index'] ); |
|
204 | + if (isset($args['data']['arg_index'])) { |
|
205 | + $arg_number = 1 + max($args['data']['arg_index']); |
|
206 | 206 | } |
207 | 207 | |
208 | - if ( isset( $args['data']['requirements'] ) ) { |
|
209 | - $requirements = 1 + max( array_keys( $args['data']['requirements'] ) ); |
|
208 | + if (isset($args['data']['requirements'])) { |
|
209 | + $requirements = 1 + max(array_keys($args['data']['requirements'])); |
|
210 | 210 | |
211 | - if ( $requirements > $arg_number ) { |
|
211 | + if ($requirements > $arg_number) { |
|
212 | 212 | $arg_number = $requirements; |
213 | 213 | } |
214 | 214 | } |
215 | 215 | |
216 | - $this->action_index[ $method ]['actions'][ $slug ] = $args['data']; |
|
216 | + $this->action_index[$method]['actions'][$slug] = $args['data']; |
|
217 | 217 | } |
218 | 218 | |
219 | - if ( isset( $args['arg_number'] ) ) { |
|
219 | + if (isset($args['arg_number'])) { |
|
220 | 220 | $arg_number = $args['arg_number']; |
221 | 221 | } |
222 | 222 | |
223 | 223 | // If this action is already being routed, and will have enough args, we |
224 | 224 | // don't need to hook to it again. |
225 | 225 | if ( |
226 | - isset( $this->action_index[ $method ]['arg_number'] ) |
|
227 | - && $this->action_index[ $method ]['arg_number'] >= $arg_number |
|
226 | + isset($this->action_index[$method]['arg_number']) |
|
227 | + && $this->action_index[$method]['arg_number'] >= $arg_number |
|
228 | 228 | ) { |
229 | 229 | return; |
230 | 230 | } |
231 | 231 | |
232 | - $this->action_index[ $method ]['arg_number'] = $arg_number; |
|
232 | + $this->action_index[$method]['arg_number'] = $arg_number; |
|
233 | 233 | |
234 | - add_action( $args['action'], array( $this, $method ), $priority, $arg_number ); |
|
234 | + add_action($args['action'], array($this, $method), $priority, $arg_number); |
|
235 | 235 | } |
236 | 236 | |
237 | 237 | /** |
@@ -241,20 +241,20 @@ discard block |
||
241 | 241 | * |
242 | 242 | * @param string $slug The action slug. |
243 | 243 | */ |
244 | - public function remove_action( $slug ) { |
|
244 | + public function remove_action($slug) { |
|
245 | 245 | |
246 | - foreach ( $this->action_index as $method => $data ) { |
|
247 | - if ( isset( $data['actions'][ $slug ] ) ) { |
|
246 | + foreach ($this->action_index as $method => $data) { |
|
247 | + if (isset($data['actions'][$slug])) { |
|
248 | 248 | |
249 | - unset( $this->action_index[ $method ]['actions'][ $slug ] ); |
|
249 | + unset($this->action_index[$method]['actions'][$slug]); |
|
250 | 250 | |
251 | - if ( empty( $this->action_index[ $method ]['actions'] ) ) { |
|
251 | + if (empty($this->action_index[$method]['actions'])) { |
|
252 | 252 | |
253 | - unset( $this->action_index[ $method ] ); |
|
253 | + unset($this->action_index[$method]); |
|
254 | 254 | |
255 | - list( $action, $priority ) = explode( ',', $method ); |
|
255 | + list($action, $priority) = explode(',', $method); |
|
256 | 256 | |
257 | - remove_action( $action, array( $this, $method ), $priority ); |
|
257 | + remove_action($action, array($this, $method), $priority); |
|
258 | 258 | } |
259 | 259 | } |
260 | 260 | } |
@@ -269,8 +269,8 @@ discard block |
||
269 | 269 | * @param string $action_slug The slug of the action. |
270 | 270 | * @param string $action_type The type of action. Default is 'fire'. |
271 | 271 | */ |
272 | - public function add_event_to_action( $event_slug, $action_slug, $action_type = 'fire' ) { |
|
273 | - $this->event_index[ $action_slug ][ $action_type ][ $event_slug ] = true; |
|
272 | + public function add_event_to_action($event_slug, $action_slug, $action_type = 'fire') { |
|
273 | + $this->event_index[$action_slug][$action_type][$event_slug] = true; |
|
274 | 274 | } |
275 | 275 | |
276 | 276 | /** |
@@ -282,8 +282,8 @@ discard block |
||
282 | 282 | * @param string $action_slug The slug of the action. |
283 | 283 | * @param string $action_type The type of action. Default is 'fire'. |
284 | 284 | */ |
285 | - public function remove_event_from_action( $event_slug, $action_slug, $action_type = 'fire' ) { |
|
286 | - unset( $this->event_index[ $action_slug ][ $action_type ][ $event_slug ] ); |
|
285 | + public function remove_event_from_action($event_slug, $action_slug, $action_type = 'fire') { |
|
286 | + unset($this->event_index[$action_slug][$action_type][$event_slug]); |
|
287 | 287 | } |
288 | 288 | } |
289 | 289 |
@@ -26,7 +26,7 @@ |
||
26 | 26 | /** |
27 | 27 | * @since 1.0.0 |
28 | 28 | */ |
29 | - public function __construct( $slug ) { |
|
29 | + public function __construct($slug) { |
|
30 | 30 | |
31 | 31 | $this->slug = $slug; |
32 | 32 | } |