@@ -19,11 +19,11 @@ |
||
19 | 19 | */ |
20 | 20 | public function should_fire() { |
21 | 21 | |
22 | - if ( ! isset( $this->args[1]->comment_approved ) ) { |
|
22 | + if ( ! isset($this->args[1]->comment_approved)) { |
|
23 | 23 | return false; |
24 | 24 | } |
25 | 25 | |
26 | - if ( 1 !== (int) $this->args[1]->comment_approved ) { |
|
26 | + if (1 !== (int) $this->args[1]->comment_approved) { |
|
27 | 27 | return false; |
28 | 28 | } |
29 | 29 |
@@ -12,17 +12,17 @@ |
||
12 | 12 | * |
13 | 13 | * @since 1.0.0 |
14 | 14 | */ |
15 | -require_once( dirname( __FILE__ ) . '/includes/functions.php' ); |
|
15 | +require_once(dirname(__FILE__).'/includes/functions.php'); |
|
16 | 16 | |
17 | 17 | /** |
18 | 18 | * The admin-side actions and filters. |
19 | 19 | * |
20 | 20 | * @since 1.0.0 |
21 | 21 | */ |
22 | -require_once( dirname( __FILE__ ) . '/includes/actions.php' ); |
|
22 | +require_once(dirname(__FILE__).'/includes/actions.php'); |
|
23 | 23 | |
24 | 24 | WordPoints_Class_Autoloader::register_dir( |
25 | - dirname( __FILE__ ) . '/includes/classes' |
|
25 | + dirname(__FILE__).'/includes/classes' |
|
26 | 26 | , 'WordPoints_Admin_' |
27 | 27 | ); |
28 | 28 |
@@ -52,7 +52,7 @@ discard block |
||
52 | 52 | * |
53 | 53 | * @return array The hook reaction data extracted into an array. |
54 | 54 | */ |
55 | - public static function prepare_hook_reaction( $reaction ) { |
|
55 | + public static function prepare_hook_reaction($reaction) { |
|
56 | 56 | |
57 | 57 | $reactor = $reaction->get_reactor_slug(); |
58 | 58 | |
@@ -95,17 +95,17 @@ discard block |
||
95 | 95 | |
96 | 96 | add_action( |
97 | 97 | 'wp_ajax_wordpoints_admin_create_hook_reaction' |
98 | - , array( $this, 'create_hook_reaction' ) |
|
98 | + , array($this, 'create_hook_reaction') |
|
99 | 99 | ); |
100 | 100 | |
101 | 101 | add_action( |
102 | 102 | 'wp_ajax_wordpoints_admin_update_hook_reaction' |
103 | - , array( $this, 'update_hook_reaction' ) |
|
103 | + , array($this, 'update_hook_reaction') |
|
104 | 104 | ); |
105 | 105 | |
106 | 106 | add_action( |
107 | 107 | 'wp_ajax_wordpoints_admin_delete_hook_reaction' |
108 | - , array( $this, 'delete_hook_reaction' ) |
|
108 | + , array($this, 'delete_hook_reaction') |
|
109 | 109 | ); |
110 | 110 | } |
111 | 111 | |
@@ -124,9 +124,9 @@ discard block |
||
124 | 124 | "wordpoints_create_hook_reaction|{$this->reactor_slug}" |
125 | 125 | ); |
126 | 126 | |
127 | - $reaction = $reactor->reactions->create_reaction( $this->get_data() ); |
|
127 | + $reaction = $reactor->reactions->create_reaction($this->get_data()); |
|
128 | 128 | |
129 | - $this->send_json_result( $reaction, 'create' ); |
|
129 | + $this->send_json_result($reaction, 'create'); |
|
130 | 130 | } |
131 | 131 | |
132 | 132 | /** |
@@ -150,7 +150,7 @@ discard block |
||
150 | 150 | , $this->get_data() |
151 | 151 | ); |
152 | 152 | |
153 | - $this->send_json_result( $reaction, 'update' ); |
|
153 | + $this->send_json_result($reaction, 'update'); |
|
154 | 154 | } |
155 | 155 | |
156 | 156 | /** |
@@ -169,10 +169,10 @@ discard block |
||
169 | 169 | "wordpoints_delete_hook_reaction|{$this->reactor_slug}|{$reaction->ID}" |
170 | 170 | ); |
171 | 171 | |
172 | - $result = $reactor->reactions->delete_reaction( $reaction->ID ); |
|
172 | + $result = $reactor->reactions->delete_reaction($reaction->ID); |
|
173 | 173 | |
174 | - if ( ! $result ) { |
|
175 | - wp_send_json_error( array( 'message' => __( 'There was an error deleting the reaction. Please try again.', 'wordpoints' ) ) ); |
|
174 | + if ( ! $result) { |
|
175 | + wp_send_json_error(array('message' => __('There was an error deleting the reaction. Please try again.', 'wordpoints'))); |
|
176 | 176 | } |
177 | 177 | |
178 | 178 | wp_send_json_success(); |
@@ -193,11 +193,11 @@ discard block |
||
193 | 193 | * |
194 | 194 | * @param string $debug_context Context sent with the message (for debugging). |
195 | 195 | */ |
196 | - private function unexpected_error( $debug_context ) { |
|
196 | + private function unexpected_error($debug_context) { |
|
197 | 197 | |
198 | 198 | wp_send_json_error( |
199 | 199 | array( |
200 | - 'message' => __( 'There was an unexpected error. Try reloading the page.', 'wordpoints' ), |
|
200 | + 'message' => __('There was an unexpected error. Try reloading the page.', 'wordpoints'), |
|
201 | 201 | 'debug' => $debug_context, |
202 | 202 | ) |
203 | 203 | ); |
@@ -213,8 +213,8 @@ discard block |
||
213 | 213 | */ |
214 | 214 | private function verify_user_can() { |
215 | 215 | |
216 | - if ( ! current_user_can( 'manage_options' ) ) { |
|
217 | - wp_send_json_error( array( 'message' => __( 'You do not have permission to perform this action. Maybe you have been logged out?', 'wordpoints' ) ) ); |
|
216 | + if ( ! current_user_can('manage_options')) { |
|
217 | + wp_send_json_error(array('message' => __('You do not have permission to perform this action. Maybe you have been logged out?', 'wordpoints'))); |
|
218 | 218 | } |
219 | 219 | } |
220 | 220 | |
@@ -227,14 +227,14 @@ discard block |
||
227 | 227 | * |
228 | 228 | * @param string $action The action the nonce should be for. |
229 | 229 | */ |
230 | - private function verify_request( $action ) { |
|
230 | + private function verify_request($action) { |
|
231 | 231 | |
232 | 232 | if ( |
233 | - empty( $_POST['nonce'] ) |
|
234 | - || ! wordpoints_verify_nonce( 'nonce', $action, null, 'post' ) |
|
233 | + empty($_POST['nonce']) |
|
234 | + || ! wordpoints_verify_nonce('nonce', $action, null, 'post') |
|
235 | 235 | ) { |
236 | 236 | wp_send_json_error( |
237 | - array( 'message' => __( 'Your security token for this action has expired. Refresh the page and try again.', 'wordpoints' ) ) |
|
237 | + array('message' => __('Your security token for this action has expired. Refresh the page and try again.', 'wordpoints')) |
|
238 | 238 | ); |
239 | 239 | } |
240 | 240 | } |
@@ -248,16 +248,16 @@ discard block |
||
248 | 248 | */ |
249 | 249 | protected function get_reactor() { |
250 | 250 | |
251 | - if ( ! isset( $_POST['reactor'] ) ) { // WPCS: CSRF OK. |
|
252 | - $this->unexpected_error( 'reactor' ); |
|
251 | + if ( ! isset($_POST['reactor'])) { // WPCS: CSRF OK. |
|
252 | + $this->unexpected_error('reactor'); |
|
253 | 253 | } |
254 | 254 | |
255 | - $reactor_slug = sanitize_key( $_POST['reactor'] ); // WPCS: CSRF OK. |
|
255 | + $reactor_slug = sanitize_key($_POST['reactor']); // WPCS: CSRF OK. |
|
256 | 256 | |
257 | - $reactor = wordpoints_hooks()->reactors->get( $reactor_slug ); |
|
257 | + $reactor = wordpoints_hooks()->reactors->get($reactor_slug); |
|
258 | 258 | |
259 | - if ( ! $reactor instanceof WordPoints_Hook_Reactor ) { |
|
260 | - $this->unexpected_error( 'reactor_invalid' ); |
|
259 | + if ( ! $reactor instanceof WordPoints_Hook_Reactor) { |
|
260 | + $this->unexpected_error('reactor_invalid'); |
|
261 | 261 | } |
262 | 262 | |
263 | 263 | $this->reactor_slug = $reactor_slug; |
@@ -275,16 +275,16 @@ discard block |
||
275 | 275 | */ |
276 | 276 | protected function get_reaction() { |
277 | 277 | |
278 | - if ( ! isset( $_POST['id'] ) ) { // WPCS: CSRF OK. |
|
279 | - $this->unexpected_error( 'id' ); |
|
278 | + if ( ! isset($_POST['id'])) { // WPCS: CSRF OK. |
|
279 | + $this->unexpected_error('id'); |
|
280 | 280 | } |
281 | 281 | |
282 | 282 | $reaction = $this->reactor->reactions->get_reaction( |
283 | - wordpoints_int( $_POST['id'] ) // WPCS: CSRF OK. |
|
283 | + wordpoints_int($_POST['id']) // WPCS: CSRF OK. |
|
284 | 284 | ); |
285 | 285 | |
286 | - if ( ! $reaction ) { |
|
287 | - wp_send_json_error( array( 'message' => __( 'The reaction ID passed to the server is invalid. Perhaps it has been deleted. Try reloading the page.', 'wordpoints' ) ) ); |
|
286 | + if ( ! $reaction) { |
|
287 | + wp_send_json_error(array('message' => __('The reaction ID passed to the server is invalid. Perhaps it has been deleted. Try reloading the page.', 'wordpoints'))); |
|
288 | 288 | } |
289 | 289 | |
290 | 290 | return $reaction; |
@@ -299,9 +299,9 @@ discard block |
||
299 | 299 | */ |
300 | 300 | protected function get_data() { |
301 | 301 | |
302 | - $data = wp_unslash( $_POST ); // WPCS: CSRF OK. |
|
302 | + $data = wp_unslash($_POST); // WPCS: CSRF OK. |
|
303 | 303 | |
304 | - unset( $data['id'], $data['action'], $data['nonce'], $data['reactor'] ); |
|
304 | + unset($data['id'], $data['action'], $data['nonce'], $data['reactor']); |
|
305 | 305 | |
306 | 306 | return $data; |
307 | 307 | } |
@@ -314,30 +314,30 @@ discard block |
||
314 | 314 | * @param mixed $result The result of the action. |
315 | 315 | * @param string $action The action being performed: 'create' or 'update'. |
316 | 316 | */ |
317 | - private function send_json_result( $result, $action ) { |
|
317 | + private function send_json_result($result, $action) { |
|
318 | 318 | |
319 | - if ( ! $result ) { |
|
319 | + if ( ! $result) { |
|
320 | 320 | |
321 | - if ( 'create' === $action ) { |
|
322 | - $message = __( 'There was an error adding the reaction. Please try again.', 'wordpoints' ); |
|
321 | + if ('create' === $action) { |
|
322 | + $message = __('There was an error adding the reaction. Please try again.', 'wordpoints'); |
|
323 | 323 | } else { |
324 | - $message = __( 'There was an error updating the reaction. Please try again.', 'wordpoints' ); |
|
324 | + $message = __('There was an error updating the reaction. Please try again.', 'wordpoints'); |
|
325 | 325 | } |
326 | 326 | |
327 | - wp_send_json_error( array( 'message' => $message ) ); |
|
327 | + wp_send_json_error(array('message' => $message)); |
|
328 | 328 | |
329 | - } elseif ( $result instanceof WordPoints_Hook_Reaction_Validator ) { |
|
329 | + } elseif ($result instanceof WordPoints_Hook_Reaction_Validator) { |
|
330 | 330 | |
331 | - wp_send_json_error( array( 'errors' => $result->get_errors() ) ); |
|
331 | + wp_send_json_error(array('errors' => $result->get_errors())); |
|
332 | 332 | } |
333 | 333 | |
334 | 334 | $data = null; |
335 | 335 | |
336 | - if ( 'create' === $action ) { |
|
337 | - $data = self::prepare_hook_reaction( $result ); |
|
336 | + if ('create' === $action) { |
|
337 | + $data = self::prepare_hook_reaction($result); |
|
338 | 338 | } |
339 | 339 | |
340 | - wp_send_json_success( $data ); |
|
340 | + wp_send_json_success($data); |
|
341 | 341 | } |
342 | 342 | } |
343 | 343 |
@@ -56,7 +56,7 @@ discard block |
||
56 | 56 | * @since 1.0.0 |
57 | 57 | */ |
58 | 58 | public function get_title() { |
59 | - return __( 'Contains', 'wordpoints' ); |
|
59 | + return __('Contains', 'wordpoints'); |
|
60 | 60 | } |
61 | 61 | |
62 | 62 | /** |
@@ -66,13 +66,13 @@ discard block |
||
66 | 66 | return array( |
67 | 67 | 'min' => array( |
68 | 68 | 'slug' => 'min', |
69 | - 'label' => __( 'Minimum number of items', 'wordpoints' ), |
|
69 | + 'label' => __('Minimum number of items', 'wordpoints'), |
|
70 | 70 | 'type' => 'number', |
71 | 71 | 'default' => 1, |
72 | 72 | ), |
73 | 73 | 'max' => array( |
74 | 74 | 'slug' => 'max', |
75 | - 'label' => __( 'Maximum number of items', 'wordpoints' ), |
|
75 | + 'label' => __('Maximum number of items', 'wordpoints'), |
|
76 | 76 | 'type' => 'number', |
77 | 77 | ), |
78 | 78 | ); |
@@ -92,8 +92,8 @@ discard block |
||
92 | 92 | |
93 | 93 | $this->validate_count(); |
94 | 94 | |
95 | - if ( isset( $settings['conditions'] ) ) { |
|
96 | - $this->validate_conditions( $arg ); |
|
95 | + if (isset($settings['conditions'])) { |
|
96 | + $this->validate_conditions($arg); |
|
97 | 97 | } |
98 | 98 | |
99 | 99 | return $this->settings; |
@@ -107,31 +107,31 @@ discard block |
||
107 | 107 | protected function validate_count() { |
108 | 108 | |
109 | 109 | if ( |
110 | - ! empty( $this->settings['max'] ) |
|
111 | - && ! wordpoints_posint( $this->settings['max'] ) |
|
110 | + ! empty($this->settings['max']) |
|
111 | + && ! wordpoints_posint($this->settings['max']) |
|
112 | 112 | ) { |
113 | 113 | $this->validator->add_error( |
114 | - __( 'The maximum must be a positive integer.', 'wordpoints' ) |
|
114 | + __('The maximum must be a positive integer.', 'wordpoints') |
|
115 | 115 | , 'max' |
116 | 116 | ); |
117 | 117 | } |
118 | 118 | |
119 | - if ( ! empty( $this->settings['min'] ) ) { |
|
119 | + if ( ! empty($this->settings['min'])) { |
|
120 | 120 | |
121 | - if ( ! wordpoints_posint( $this->settings['min'] ) ) { |
|
121 | + if ( ! wordpoints_posint($this->settings['min'])) { |
|
122 | 122 | |
123 | 123 | $this->validator->add_error( |
124 | - __( 'The minimum must be a positive integer.', 'wordpoints' ) |
|
124 | + __('The minimum must be a positive integer.', 'wordpoints') |
|
125 | 125 | , 'min' |
126 | 126 | ); |
127 | 127 | |
128 | 128 | } elseif ( |
129 | - ! empty( $this->settings['max'] ) |
|
129 | + ! empty($this->settings['max']) |
|
130 | 130 | && $this->settings['max'] < $this->settings['min'] |
131 | 131 | ) { |
132 | 132 | |
133 | 133 | $this->validator->add_error( |
134 | - __( 'The minimum must be less than the maximum.', 'wordpoints' ) |
|
134 | + __('The minimum must be less than the maximum.', 'wordpoints') |
|
135 | 135 | , 'min' |
136 | 136 | ); |
137 | 137 | } |
@@ -145,25 +145,25 @@ discard block |
||
145 | 145 | * |
146 | 146 | * @param WordPoints_EntityishI $current_arg The current arg. |
147 | 147 | */ |
148 | - protected function validate_conditions( $current_arg ) { |
|
148 | + protected function validate_conditions($current_arg) { |
|
149 | 149 | |
150 | - $args = new WordPoints_Hook_Event_Args( array() ); |
|
150 | + $args = new WordPoints_Hook_Event_Args(array()); |
|
151 | 151 | |
152 | - if ( $current_arg instanceof WordPoints_Entity_Array ) { |
|
152 | + if ($current_arg instanceof WordPoints_Entity_Array) { |
|
153 | 153 | |
154 | 154 | $entity = wordpoints_entities()->get( |
155 | 155 | $current_arg->get_entity_slug() |
156 | 156 | ); |
157 | 157 | |
158 | - if ( $entity instanceof WordPoints_Entity ) { |
|
159 | - $args->add_entity( $entity ); |
|
158 | + if ($entity instanceof WordPoints_Entity) { |
|
159 | + $args->add_entity($entity); |
|
160 | 160 | } |
161 | 161 | } |
162 | 162 | |
163 | - $args->set_validator( $this->validator ); |
|
163 | + $args->set_validator($this->validator); |
|
164 | 164 | |
165 | 165 | $conditions = $this->conditions_extension->validate_settings( |
166 | - array( 'conditions' => $this->settings['conditions'] ) |
|
166 | + array('conditions' => $this->settings['conditions']) |
|
167 | 167 | , $this->validator |
168 | 168 | , $args |
169 | 169 | ); |
@@ -174,7 +174,7 @@ discard block |
||
174 | 174 | /** |
175 | 175 | * @since 1.0.0 |
176 | 176 | */ |
177 | - public function is_met( array $settings, WordPoints_Hook_Event_Args $args ) { |
|
177 | + public function is_met(array $settings, WordPoints_Hook_Event_Args $args) { |
|
178 | 178 | |
179 | 179 | $this->settings = $settings; |
180 | 180 | |
@@ -182,16 +182,16 @@ discard block |
||
182 | 182 | |
183 | 183 | $entities = array(); |
184 | 184 | |
185 | - if ( $arg instanceof WordPoints_Entity_Array ) { |
|
185 | + if ($arg instanceof WordPoints_Entity_Array) { |
|
186 | 186 | |
187 | 187 | $entities = $arg->get_the_entities(); |
188 | 188 | |
189 | - if ( isset( $this->settings['conditions'] ) ) { |
|
190 | - $entities = $this->filter_entities( $entities ); |
|
189 | + if (isset($this->settings['conditions'])) { |
|
190 | + $entities = $this->filter_entities($entities); |
|
191 | 191 | } |
192 | 192 | } |
193 | 193 | |
194 | - return $this->check_count( count( $entities ) ); |
|
194 | + return $this->check_count(count($entities)); |
|
195 | 195 | } |
196 | 196 | |
197 | 197 | /** |
@@ -203,20 +203,20 @@ discard block |
||
203 | 203 | * |
204 | 204 | * @return WordPoints_Entity[] The entities that matched the sub-conditions. |
205 | 205 | */ |
206 | - protected function filter_entities( $entities ) { |
|
206 | + protected function filter_entities($entities) { |
|
207 | 207 | |
208 | - foreach ( $entities as $index => $entity ) { |
|
208 | + foreach ($entities as $index => $entity) { |
|
209 | 209 | |
210 | - $event_args = new WordPoints_Hook_Event_Args( array() ); |
|
211 | - $event_args->add_entity( $entity ); |
|
210 | + $event_args = new WordPoints_Hook_Event_Args(array()); |
|
211 | + $event_args->add_entity($entity); |
|
212 | 212 | |
213 | 213 | $matches = $this->conditions_extension->conditions_are_met( |
214 | 214 | $this->settings['conditions'] |
215 | 215 | , $event_args |
216 | 216 | ); |
217 | 217 | |
218 | - if ( ! $matches ) { |
|
219 | - unset( $entities[ $index ] ); |
|
218 | + if ( ! $matches) { |
|
219 | + unset($entities[$index]); |
|
220 | 220 | } |
221 | 221 | } |
222 | 222 | |
@@ -232,13 +232,13 @@ discard block |
||
232 | 232 | * |
233 | 233 | * @return bool Whether the count met the requirements. |
234 | 234 | */ |
235 | - protected function check_count( $count ) { |
|
235 | + protected function check_count($count) { |
|
236 | 236 | |
237 | - if ( isset( $this->settings['max'] ) && $count > $this->settings['max'] ) { |
|
237 | + if (isset($this->settings['max']) && $count > $this->settings['max']) { |
|
238 | 238 | return false; |
239 | 239 | } |
240 | 240 | |
241 | - if ( isset( $this->settings['min'] ) && $count < $this->settings['min'] ) { |
|
241 | + if (isset($this->settings['min']) && $count < $this->settings['min']) { |
|
242 | 242 | return false; |
243 | 243 | } |
244 | 244 |
@@ -19,7 +19,7 @@ discard block |
||
19 | 19 | */ |
20 | 20 | public function get_title() { |
21 | 21 | |
22 | - return __( 'Upload Media', 'wordpoints' ); |
|
22 | + return __('Upload Media', 'wordpoints'); |
|
23 | 23 | } |
24 | 24 | |
25 | 25 | /** |
@@ -27,7 +27,7 @@ discard block |
||
27 | 27 | */ |
28 | 28 | public function get_description() { |
29 | 29 | |
30 | - return __( 'When a file is uploaded to the Media Library.', 'wordpoints' ); |
|
30 | + return __('When a file is uploaded to the Media Library.', 'wordpoints'); |
|
31 | 31 | } |
32 | 32 | } |
33 | 33 |
@@ -36,9 +36,9 @@ discard block |
||
36 | 36 | */ |
37 | 37 | public function get_title() { |
38 | 38 | |
39 | - $post_type = get_post_type_object( substr( $this->slug, 5 /* post\ */ ) ); |
|
39 | + $post_type = get_post_type_object(substr($this->slug, 5 /* post\ */)); |
|
40 | 40 | |
41 | - if ( $post_type ) { |
|
41 | + if ($post_type) { |
|
42 | 42 | return $post_type->labels->singular_name; |
43 | 43 | } else { |
44 | 44 | return $this->slug; |
@@ -48,8 +48,8 @@ discard block |
||
48 | 48 | /** |
49 | 49 | * @since 1.0.0 |
50 | 50 | */ |
51 | - public function user_can_view( $user_id, $id ) { |
|
52 | - return user_can( $user_id, 'read_post', $id ); |
|
51 | + public function user_can_view($user_id, $id) { |
|
52 | + return user_can($user_id, 'read_post', $id); |
|
53 | 53 | } |
54 | 54 | } |
55 | 55 |
@@ -29,9 +29,9 @@ discard block |
||
29 | 29 | */ |
30 | 30 | public function get_title() { |
31 | 31 | |
32 | - $taxonomy = get_taxonomy( substr( $this->slug, 5 /* term\ */ ) ); |
|
32 | + $taxonomy = get_taxonomy(substr($this->slug, 5 /* term\ */)); |
|
33 | 33 | |
34 | - if ( $taxonomy ) { |
|
34 | + if ($taxonomy) { |
|
35 | 35 | return $taxonomy->labels->singular_name; |
36 | 36 | } else { |
37 | 37 | return $this->slug; |
@@ -41,8 +41,8 @@ discard block |
||
41 | 41 | /** |
42 | 42 | * @since 1.0.0 |
43 | 43 | */ |
44 | - public function get_entity( $id ) { |
|
45 | - return get_term( $id, 'taxonomy' ); |
|
44 | + public function get_entity($id) { |
|
45 | + return get_term($id, 'taxonomy'); |
|
46 | 46 | } |
47 | 47 | } |
48 | 48 |
@@ -29,9 +29,9 @@ discard block |
||
29 | 29 | */ |
30 | 30 | public function get_title() { |
31 | 31 | |
32 | - $taxonomy = get_taxonomy( substr( $this->slug, 6 /* terms\ */ ) ); |
|
32 | + $taxonomy = get_taxonomy(substr($this->slug, 6 /* terms\ */)); |
|
33 | 33 | |
34 | - if ( $taxonomy ) { |
|
34 | + if ($taxonomy) { |
|
35 | 35 | return $taxonomy->labels->name; |
36 | 36 | } else { |
37 | 37 | return parent::get_title(); |
@@ -41,13 +41,13 @@ discard block |
||
41 | 41 | /** |
42 | 42 | * @since 1.0.0 |
43 | 43 | */ |
44 | - protected function get_related_entity_ids( WordPoints_Entity $entity ) { |
|
44 | + protected function get_related_entity_ids(WordPoints_Entity $entity) { |
|
45 | 45 | |
46 | 46 | $id = $entity->get_the_id(); |
47 | 47 | |
48 | - $taxonomies = get_object_taxonomies( get_post( $id ) ); |
|
48 | + $taxonomies = get_object_taxonomies(get_post($id)); |
|
49 | 49 | |
50 | - return wp_get_object_terms( $id, $taxonomies, array( 'fields' => 'ids' ) ); |
|
50 | + return wp_get_object_terms($id, $taxonomies, array('fields' => 'ids')); |
|
51 | 51 | } |
52 | 52 | } |
53 | 53 |
@@ -97,16 +97,16 @@ discard block |
||
97 | 97 | /** |
98 | 98 | * @since 1.0.0 |
99 | 99 | */ |
100 | - public function __construct( $slug, $parent = null ) { |
|
100 | + public function __construct($slug, $parent = null) { |
|
101 | 101 | |
102 | 102 | $this->slug = $slug; |
103 | 103 | $this->full_slug = $slug; |
104 | 104 | |
105 | - if ( $parent instanceof WordPoints_App ) { |
|
105 | + if ($parent instanceof WordPoints_App) { |
|
106 | 106 | $this->parent = $parent; |
107 | 107 | |
108 | - if ( 'apps' !== $this->parent->full_slug ) { |
|
109 | - $this->full_slug = $this->parent->full_slug . '-' . $this->full_slug; |
|
108 | + if ('apps' !== $this->parent->full_slug) { |
|
109 | + $this->full_slug = $this->parent->full_slug.'-'.$this->full_slug; |
|
110 | 110 | } |
111 | 111 | } |
112 | 112 | |
@@ -118,32 +118,32 @@ discard block |
||
118 | 118 | /** |
119 | 119 | * @since 1.0.0 |
120 | 120 | */ |
121 | - public function __isset( $var ) { |
|
122 | - return $this->sub_apps->is_registered( $var ); |
|
121 | + public function __isset($var) { |
|
122 | + return $this->sub_apps->is_registered($var); |
|
123 | 123 | } |
124 | 124 | |
125 | 125 | /** |
126 | 126 | * @since 1.0.0 |
127 | 127 | */ |
128 | - public function __get( $var ) { |
|
128 | + public function __get($var) { |
|
129 | 129 | |
130 | - if ( 'sub_apps' === $var ) { |
|
130 | + if ('sub_apps' === $var) { |
|
131 | 131 | return $this->$var; |
132 | 132 | } |
133 | 133 | |
134 | - $sub = $this->sub_apps->get( $var, array( $this ) ); |
|
134 | + $sub = $this->sub_apps->get($var, array($this)); |
|
135 | 135 | |
136 | - if ( ! $sub ) { |
|
136 | + if ( ! $sub) { |
|
137 | 137 | return null; |
138 | 138 | } |
139 | 139 | |
140 | 140 | if ( |
141 | - empty( $this->did_init[ $var ] ) |
|
141 | + empty($this->did_init[$var]) |
|
142 | 142 | && ! self::$main->silent |
143 | - && $this->should_do_registry_init( $sub ) |
|
143 | + && $this->should_do_registry_init($sub) |
|
144 | 144 | ) { |
145 | 145 | |
146 | - $is_protected_property = array_key_exists( $var, get_object_vars( $this ) ); |
|
146 | + $is_protected_property = array_key_exists($var, get_object_vars($this)); |
|
147 | 147 | |
148 | 148 | // When the below action is called it is possible that some hooked code |
149 | 149 | // may attempt to access the property that is being initialized. However, |
@@ -152,7 +152,7 @@ discard block |
||
152 | 152 | // temporarily set this as a public property. However, we can't do this |
153 | 153 | // for properties that the class has declared, because otherwise it would |
154 | 154 | // be possible to modify and then unset protected class properties. |
155 | - if ( ! $is_protected_property ) { |
|
155 | + if ( ! $is_protected_property) { |
|
156 | 156 | $this->allow_set = true; |
157 | 157 | $this->$var = $sub; |
158 | 158 | $this->allow_set = false; |
@@ -168,25 +168,25 @@ discard block |
||
168 | 168 | * @param WordPoints_Class_RegistryI|WordPoints_Class_Registry_ChildrenI |
169 | 169 | * $registry The registry object. |
170 | 170 | */ |
171 | - do_action( "wordpoints_init_app_registry-{$this->full_slug}-{$var}", $sub ); |
|
171 | + do_action("wordpoints_init_app_registry-{$this->full_slug}-{$var}", $sub); |
|
172 | 172 | |
173 | 173 | // Because this property was public, it's possible that it might have |
174 | 174 | // been modified inadvertently. If this happens we give a warning. |
175 | - if ( $sub !== $this->$var ) { |
|
175 | + if ($sub !== $this->$var) { |
|
176 | 176 | _doing_it_wrong( |
177 | 177 | __METHOD__ |
178 | - , esc_html( "Do not modify the {$var} property directly." ) |
|
178 | + , esc_html("Do not modify the {$var} property directly.") |
|
179 | 179 | , '1.0.0' |
180 | 180 | ); |
181 | 181 | } |
182 | 182 | |
183 | - if ( ! $is_protected_property ) { |
|
183 | + if ( ! $is_protected_property) { |
|
184 | 184 | $this->allow_set = true; |
185 | - unset( $this->$var ); |
|
185 | + unset($this->$var); |
|
186 | 186 | $this->allow_set = false; |
187 | 187 | } |
188 | 188 | |
189 | - $this->did_init[ $var ] = true; |
|
189 | + $this->did_init[$var] = true; |
|
190 | 190 | } |
191 | 191 | |
192 | 192 | return $sub; |
@@ -195,9 +195,9 @@ discard block |
||
195 | 195 | /** |
196 | 196 | * @since 1.0.0 |
197 | 197 | */ |
198 | - public function __set( $var, $value ) { |
|
198 | + public function __set($var, $value) { |
|
199 | 199 | |
200 | - if ( $this->allow_set ) { |
|
200 | + if ($this->allow_set) { |
|
201 | 201 | $this->$var = $value; |
202 | 202 | } else { |
203 | 203 | _doing_it_wrong( |
@@ -211,10 +211,10 @@ discard block |
||
211 | 211 | /** |
212 | 212 | * @since 1.0.0 |
213 | 213 | */ |
214 | - public function __unset( $var ) { |
|
214 | + public function __unset($var) { |
|
215 | 215 | |
216 | - if ( $this->allow_set ) { |
|
217 | - unset( $this->$var ); |
|
216 | + if ($this->allow_set) { |
|
217 | + unset($this->$var); |
|
218 | 218 | } else { |
219 | 219 | _doing_it_wrong( |
220 | 220 | __METHOD__ |
@@ -233,7 +233,7 @@ discard block |
||
233 | 233 | * |
234 | 234 | * @return bool Whether to call the init action or not. |
235 | 235 | */ |
236 | - protected function should_do_registry_init( $registry ) { |
|
236 | + protected function should_do_registry_init($registry) { |
|
237 | 237 | return ( |
238 | 238 | $registry instanceof WordPoints_Class_RegistryI |
239 | 239 | || $registry instanceof WordPoints_Class_Registry_ChildrenI |
@@ -257,7 +257,7 @@ discard block |
||
257 | 257 | * |
258 | 258 | * @param WordPoints_App $app The app object. |
259 | 259 | */ |
260 | - do_action( "wordpoints_init_app-{$this->full_slug}", $this ); |
|
260 | + do_action("wordpoints_init_app-{$this->full_slug}", $this); |
|
261 | 261 | } |
262 | 262 | } |
263 | 263 |