@@ -62,8 +62,8 @@ discard block |
||
62 | 62 | public function hooks() { |
63 | 63 | |
64 | 64 | /* Load the JavaScript needed for the settings screen. */ |
65 | - add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_scripts' ) ); |
|
66 | - add_action( "admin_footer-{$this->id}", array( $this, 'footer_scripts' ) ); |
|
65 | + add_action('admin_enqueue_scripts', array($this, 'enqueue_scripts')); |
|
66 | + add_action("admin_footer-{$this->id}", array($this, 'footer_scripts')); |
|
67 | 67 | } |
68 | 68 | |
69 | 69 | /** |
@@ -98,11 +98,11 @@ discard block |
||
98 | 98 | |
99 | 99 | <div class="wrap"> |
100 | 100 | |
101 | - <h1><?php echo esc_html( $this->get_title() ); ?></h1> |
|
101 | + <h1><?php echo esc_html($this->get_title()); ?></h1> |
|
102 | 102 | |
103 | 103 | <?php settings_errors(); ?> |
104 | 104 | |
105 | - <?php wordpoints_admin_show_tabs( $this->tabs, false ); ?> |
|
105 | + <?php wordpoints_admin_show_tabs($this->tabs, false); ?> |
|
106 | 106 | |
107 | 107 | <?php $this->display_content(); ?> |
108 | 108 |
@@ -56,7 +56,7 @@ discard block |
||
56 | 56 | * @since 1.0.0 |
57 | 57 | */ |
58 | 58 | protected function get_title() { |
59 | - return _x( 'Points Types', 'page title', 'wordpoints' ); |
|
59 | + return _x('Points Types', 'page title', 'wordpoints'); |
|
60 | 60 | } |
61 | 61 | |
62 | 62 | /** |
@@ -66,8 +66,8 @@ discard block |
||
66 | 66 | |
67 | 67 | parent::hooks(); |
68 | 68 | |
69 | - add_action( 'add_meta_boxes', array( $this, 'add_points_settings_meta_box' ) ); |
|
70 | - add_action( 'add_meta_boxes', array( $this, 'add_event_meta_boxes' ) ); |
|
69 | + add_action('add_meta_boxes', array($this, 'add_points_settings_meta_box')); |
|
70 | + add_action('add_meta_boxes', array($this, 'add_event_meta_boxes')); |
|
71 | 71 | } |
72 | 72 | |
73 | 73 | /** |
@@ -75,9 +75,9 @@ discard block |
||
75 | 75 | */ |
76 | 76 | public function enqueue_scripts() { |
77 | 77 | |
78 | - wp_enqueue_style( 'wordpoints-hooks-admin' ); |
|
78 | + wp_enqueue_style('wordpoints-hooks-admin'); |
|
79 | 79 | |
80 | - wp_enqueue_script( 'postbox' ); |
|
80 | + wp_enqueue_script('postbox'); |
|
81 | 81 | |
82 | 82 | wordpoints_hooks_ui_setup_script_data(); |
83 | 83 | } |
@@ -97,7 +97,7 @@ discard block |
||
97 | 97 | .addClass( 'closed' ); |
98 | 98 | |
99 | 99 | postboxes.add_postbox_toggles( |
100 | - <?php echo wp_json_encode( $this->id ); ?> |
|
100 | + <?php echo wp_json_encode($this->id); ?> |
|
101 | 101 | ); |
102 | 102 | } ); |
103 | 103 | </script> |
@@ -112,14 +112,14 @@ discard block |
||
112 | 112 | */ |
113 | 113 | public function add_points_settings_meta_box() { |
114 | 114 | |
115 | - if ( ! current_user_can( 'manage_wordpoints_points_types' ) ) { |
|
115 | + if ( ! current_user_can('manage_wordpoints_points_types')) { |
|
116 | 116 | return; |
117 | 117 | } |
118 | 118 | |
119 | 119 | add_meta_box( |
120 | 120 | 'settings' |
121 | - , __( 'Settings', 'wordpoints' ) |
|
122 | - , array( $this, 'display_points_settings_meta_box' ) |
|
121 | + , __('Settings', 'wordpoints') |
|
122 | + , array($this, 'display_points_settings_meta_box') |
|
123 | 123 | , $this->id |
124 | 124 | , 'side' |
125 | 125 | , 'default' |
@@ -133,7 +133,7 @@ discard block |
||
133 | 133 | */ |
134 | 134 | public function display_points_settings_meta_box() { |
135 | 135 | |
136 | - if ( ! current_user_can( 'manage_wordpoints_points_types' ) ) { |
|
136 | + if ( ! current_user_can('manage_wordpoints_points_types')) { |
|
137 | 137 | return; |
138 | 138 | } |
139 | 139 | |
@@ -141,12 +141,12 @@ discard block |
||
141 | 141 | |
142 | 142 | $add_new = 0; |
143 | 143 | |
144 | - $points_type = wordpoints_get_points_type( $slug ); |
|
144 | + $points_type = wordpoints_get_points_type($slug); |
|
145 | 145 | |
146 | - if ( ! $points_type ) { |
|
146 | + if ( ! $points_type) { |
|
147 | 147 | |
148 | 148 | $points_type = array(); |
149 | - $add_new = wp_create_nonce( 'wordpoints_add_new_points_type' ); |
|
149 | + $add_new = wp_create_nonce('wordpoints_add_new_points_type'); |
|
150 | 150 | } |
151 | 151 | |
152 | 152 | $points_type = array_merge( |
@@ -161,15 +161,15 @@ discard block |
||
161 | 161 | ?> |
162 | 162 | |
163 | 163 | <form method="post"> |
164 | - <?php if ( $slug ) : ?> |
|
164 | + <?php if ($slug) : ?> |
|
165 | 165 | <p> |
166 | 166 | <span class="wordpoints-points-slug"> |
167 | 167 | <em> |
168 | - <?php echo esc_html( sprintf( __( 'Slug: %s', 'wordpoints' ), $slug ) ); ?> |
|
168 | + <?php echo esc_html(sprintf(__('Slug: %s', 'wordpoints'), $slug)); ?> |
|
169 | 169 | </em> |
170 | 170 | </span> |
171 | 171 | </p> |
172 | - <?php wp_nonce_field( "wordpoints_update_points_type-$slug", 'update_points_type' ); ?> |
|
172 | + <?php wp_nonce_field("wordpoints_update_points_type-$slug", 'update_points_type'); ?> |
|
173 | 173 | <?php endif; ?> |
174 | 174 | |
175 | 175 | <?php |
@@ -183,45 +183,45 @@ discard block |
||
183 | 183 | * |
184 | 184 | * @param string $points_type The slug of the points type. |
185 | 185 | */ |
186 | - do_action( 'wordpoints_points_type_form_top', $slug ); |
|
186 | + do_action('wordpoints_points_type_form_top', $slug); |
|
187 | 187 | |
188 | - if ( $add_new ) { |
|
188 | + if ($add_new) { |
|
189 | 189 | |
190 | 190 | // Mark the prefix and suffix optional on the add new form. |
191 | - $prefix = _x( 'Prefix (optional):', 'points type', 'wordpoints' ); |
|
192 | - $suffix = _x( 'Suffix (optional):', 'points type', 'wordpoints' ); |
|
191 | + $prefix = _x('Prefix (optional):', 'points type', 'wordpoints'); |
|
192 | + $suffix = _x('Suffix (optional):', 'points type', 'wordpoints'); |
|
193 | 193 | |
194 | 194 | } else { |
195 | 195 | |
196 | - $prefix = _x( 'Prefix:', 'points type', 'wordpoints' ); |
|
197 | - $suffix = _x( 'Suffix:', 'points type', 'wordpoints' ); |
|
196 | + $prefix = _x('Prefix:', 'points type', 'wordpoints'); |
|
197 | + $suffix = _x('Suffix:', 'points type', 'wordpoints'); |
|
198 | 198 | } |
199 | 199 | |
200 | 200 | ?> |
201 | 201 | |
202 | 202 | <p> |
203 | 203 | <label |
204 | - for="points-name-<?php echo esc_attr( $slug ); ?>"><?php echo esc_html_x( 'Name:', 'points type', 'wordpoints' ); ?></label> |
|
204 | + for="points-name-<?php echo esc_attr($slug); ?>"><?php echo esc_html_x('Name:', 'points type', 'wordpoints'); ?></label> |
|
205 | 205 | <input class="widefat" type="text" |
206 | - id="points-name-<?php echo esc_attr( $slug ); ?>" |
|
206 | + id="points-name-<?php echo esc_attr($slug); ?>" |
|
207 | 207 | name="points-name" |
208 | - value="<?php echo esc_attr( $points_type['name'] ); ?>"/> |
|
208 | + value="<?php echo esc_attr($points_type['name']); ?>"/> |
|
209 | 209 | </p> |
210 | 210 | <p> |
211 | 211 | <label |
212 | - for="points-prefix-<?php echo esc_attr( $slug ); ?>"><?php echo esc_html( $prefix ); ?></label> |
|
212 | + for="points-prefix-<?php echo esc_attr($slug); ?>"><?php echo esc_html($prefix); ?></label> |
|
213 | 213 | <input class="widefat" type="text" |
214 | - id="points-prefix-<?php echo esc_attr( $slug ); ?>" |
|
214 | + id="points-prefix-<?php echo esc_attr($slug); ?>" |
|
215 | 215 | name="points-prefix" |
216 | - value="<?php echo esc_attr( $points_type['prefix'] ); ?>"/> |
|
216 | + value="<?php echo esc_attr($points_type['prefix']); ?>"/> |
|
217 | 217 | </p> |
218 | 218 | <p> |
219 | 219 | <label |
220 | - for="points-suffix-<?php echo esc_attr( $slug ); ?>"><?php echo esc_html( $suffix ); ?></label> |
|
220 | + for="points-suffix-<?php echo esc_attr($slug); ?>"><?php echo esc_html($suffix); ?></label> |
|
221 | 221 | <input class="widefat" type="text" |
222 | - id="points-suffix-<?php echo esc_attr( $slug ); ?>" |
|
222 | + id="points-suffix-<?php echo esc_attr($slug); ?>" |
|
223 | 223 | name="points-suffix" |
224 | - value="<?php echo esc_attr( $points_type['suffix'] ); ?>"/> |
|
224 | + value="<?php echo esc_attr($points_type['suffix']); ?>"/> |
|
225 | 225 | </p> |
226 | 226 | |
227 | 227 | <?php |
@@ -235,28 +235,28 @@ discard block |
||
235 | 235 | * |
236 | 236 | * @param string $points_type The slug of the points type. |
237 | 237 | */ |
238 | - do_action( 'wordpoints_points_type_form_bottom', $slug ); |
|
238 | + do_action('wordpoints_points_type_form_bottom', $slug); |
|
239 | 239 | |
240 | 240 | ?> |
241 | 241 | |
242 | 242 | <input type="hidden" name="points-slug" |
243 | - value="<?php echo esc_attr( $slug ); ?>"/> |
|
243 | + value="<?php echo esc_attr($slug); ?>"/> |
|
244 | 244 | <input type="hidden" name="add_new" class="add_new" |
245 | - value="<?php echo esc_attr( $add_new ); ?>"/> |
|
245 | + value="<?php echo esc_attr($add_new); ?>"/> |
|
246 | 246 | |
247 | 247 | <div class="hook-control-actions"> |
248 | 248 | <div class="alignleft"> |
249 | 249 | <?php |
250 | 250 | |
251 | - if ( ! $add_new ) { |
|
252 | - wp_nonce_field( "wordpoints_delete_points_type-{$slug}", 'delete-points-type-nonce' ); |
|
253 | - submit_button( _x( 'Delete', 'points type', 'wordpoints' ), 'delete', 'delete-points-type', false, array( 'id' => "delete_points_type-{$slug}" ) ); |
|
251 | + if ( ! $add_new) { |
|
252 | + wp_nonce_field("wordpoints_delete_points_type-{$slug}", 'delete-points-type-nonce'); |
|
253 | + submit_button(_x('Delete', 'points type', 'wordpoints'), 'delete', 'delete-points-type', false, array('id' => "delete_points_type-{$slug}")); |
|
254 | 254 | } |
255 | 255 | |
256 | 256 | ?> |
257 | 257 | </div> |
258 | 258 | <div class="alignright"> |
259 | - <?php submit_button( _x( 'Save', 'points type', 'wordpoints' ), 'button-primary hook-control-save right', 'save-points-type', false, array( 'id' => "points-{$slug}-save" ) ); ?> |
|
259 | + <?php submit_button(_x('Save', 'points type', 'wordpoints'), 'button-primary hook-control-save right', 'save-points-type', false, array('id' => "points-{$slug}-save")); ?> |
|
260 | 260 | <span class="spinner"></span> |
261 | 261 | </div> |
262 | 262 | <br class="clear"/> |
@@ -273,17 +273,17 @@ discard block |
||
273 | 273 | */ |
274 | 274 | public function add_event_meta_boxes() { |
275 | 275 | |
276 | - if ( ! $this->current_points_type ) { |
|
276 | + if ( ! $this->current_points_type) { |
|
277 | 277 | return; |
278 | 278 | } |
279 | 279 | |
280 | 280 | /** @var WordPoints_Hook_EventI $event */ |
281 | - foreach ( $this->hooks->events->get_all() as $slug => $event ) { |
|
281 | + foreach ($this->hooks->events->get_all() as $slug => $event) { |
|
282 | 282 | |
283 | 283 | add_meta_box( |
284 | 284 | "{$this->current_points_type}-{$slug}" |
285 | 285 | , $event->get_title() |
286 | - , array( $this, 'display_event_meta_box' ) |
|
286 | + , array($this, 'display_event_meta_box') |
|
287 | 287 | , $this->id |
288 | 288 | , 'events' |
289 | 289 | , 'default' |
@@ -303,50 +303,50 @@ discard block |
||
303 | 303 | * @param array $points_type The points type this meta-box relates to. |
304 | 304 | * @param array $meta_box The data the meta-box was created with. |
305 | 305 | */ |
306 | - public function display_event_meta_box( $points_type, $meta_box ) { |
|
306 | + public function display_event_meta_box($points_type, $meta_box) { |
|
307 | 307 | |
308 | 308 | $event_slug = $meta_box['args']['slug']; |
309 | 309 | |
310 | 310 | /** @var WordPoints_Hook_Reactor $points_reactor */ |
311 | - $points_reactor = $this->hooks->reactors->get( 'points' ); |
|
311 | + $points_reactor = $this->hooks->reactors->get('points'); |
|
312 | 312 | |
313 | 313 | $data = array(); |
314 | 314 | |
315 | - foreach ( $points_reactor->reactions->get_reactions_to_event( $event_slug ) as $id => $reaction ) { |
|
316 | - if ( $reaction->get_meta( 'points_type' ) === $this->current_points_type ) { |
|
315 | + foreach ($points_reactor->reactions->get_reactions_to_event($event_slug) as $id => $reaction) { |
|
316 | + if ($reaction->get_meta('points_type') === $this->current_points_type) { |
|
317 | 317 | $data[] = WordPoints_Admin_Ajax_Hooks::prepare_hook_reaction( |
318 | 318 | $reaction |
319 | 319 | ); |
320 | 320 | } |
321 | 321 | } |
322 | 322 | |
323 | - $args = $this->hooks->events->args->get_children( $event_slug ); |
|
323 | + $args = $this->hooks->events->args->get_children($event_slug); |
|
324 | 324 | |
325 | - $event_data = array( 'args' => array() ); |
|
325 | + $event_data = array('args' => array()); |
|
326 | 326 | |
327 | - foreach ( $args as $slug => $arg ) { |
|
327 | + foreach ($args as $slug => $arg) { |
|
328 | 328 | |
329 | - $event_data['args'][ $slug ] = array( |
|
329 | + $event_data['args'][$slug] = array( |
|
330 | 330 | 'slug' => $slug, |
331 | 331 | ); |
332 | 332 | |
333 | - if ( $arg instanceof WordPoints_Hook_Arg ) { |
|
334 | - $event_data['args'][ $slug ]['title'] = $arg->get_title(); |
|
333 | + if ($arg instanceof WordPoints_Hook_Arg) { |
|
334 | + $event_data['args'][$slug]['title'] = $arg->get_title(); |
|
335 | 335 | } |
336 | 336 | } |
337 | 337 | |
338 | 338 | ?> |
339 | 339 | |
340 | 340 | <script> |
341 | - WordPointsHooksAdminData.events[<?php echo wp_json_encode( $event_slug ); ?>] = <?php echo wp_json_encode( $event_data ); ?>; |
|
342 | - WordPointsHooksAdminData.reactions[<?php echo wp_json_encode( $event_slug ); ?>] = <?php echo wp_json_encode( $data ); ?>; |
|
341 | + WordPointsHooksAdminData.events[<?php echo wp_json_encode($event_slug); ?>] = <?php echo wp_json_encode($event_data); ?>; |
|
342 | + WordPointsHooksAdminData.reactions[<?php echo wp_json_encode($event_slug); ?>] = <?php echo wp_json_encode($data); ?>; |
|
343 | 343 | </script> |
344 | 344 | |
345 | 345 | <div class="wordpoints-hook-reaction-group-container"> |
346 | 346 | <div class="wordpoints-hook-reaction-group" |
347 | - data-wordpoints-hooks-hook-event="<?php echo esc_attr( $event_slug ); ?>" |
|
348 | - data-wordpoints-hooks-points-type="<?php echo esc_attr( $this->current_points_type ); ?>" |
|
349 | - data-wordpoints-hooks-create-nonce="<?php echo esc_attr( wp_create_nonce( 'wordpoints_create_hook_reaction|points' ) ); ?>" |
|
347 | + data-wordpoints-hooks-hook-event="<?php echo esc_attr($event_slug); ?>" |
|
348 | + data-wordpoints-hooks-points-type="<?php echo esc_attr($this->current_points_type); ?>" |
|
349 | + data-wordpoints-hooks-create-nonce="<?php echo esc_attr(wp_create_nonce('wordpoints_create_hook_reaction|points')); ?>" |
|
350 | 350 | data-wordpoints-hooks-reactor="points"> |
351 | 351 | </div> |
352 | 352 | |
@@ -360,7 +360,7 @@ discard block |
||
360 | 360 | |
361 | 361 | <div class="controls"> |
362 | 362 | <button type="button" class="button-primary add-reaction"> |
363 | - <?php esc_html_e( 'Add New', 'wordpoints' ); ?> |
|
363 | + <?php esc_html_e('Add New', 'wordpoints'); ?> |
|
364 | 364 | </button> |
365 | 365 | </div> |
366 | 366 | </div> |
@@ -380,19 +380,19 @@ discard block |
||
380 | 380 | // Show a tab for each points type. |
381 | 381 | $tabs = array(); |
382 | 382 | |
383 | - foreach ( $points_types as $slug => $settings ) { |
|
384 | - $tabs[ $slug ] = $settings['name']; |
|
383 | + foreach ($points_types as $slug => $settings) { |
|
384 | + $tabs[$slug] = $settings['name']; |
|
385 | 385 | } |
386 | 386 | |
387 | - $tabs['add-new'] = __( 'Add New', 'wordpoints' ); |
|
387 | + $tabs['add-new'] = __('Add New', 'wordpoints'); |
|
388 | 388 | |
389 | - $tab = wordpoints_admin_get_current_tab( $tabs ); |
|
389 | + $tab = wordpoints_admin_get_current_tab($tabs); |
|
390 | 390 | |
391 | - if ( 'add-new' !== $tab ) { |
|
391 | + if ('add-new' !== $tab) { |
|
392 | 392 | $this->current_points_type = $tab; |
393 | 393 | } |
394 | 394 | |
395 | - do_action( 'add_meta_boxes', $this->id ); |
|
395 | + do_action('add_meta_boxes', $this->id); |
|
396 | 396 | |
397 | 397 | $this->tabs = $tabs; |
398 | 398 | } |
@@ -404,7 +404,7 @@ discard block |
||
404 | 404 | */ |
405 | 405 | public function save_points_type() { |
406 | 406 | |
407 | - if ( ! current_user_can( 'manage_wordpoints_points_types' ) ) { |
|
407 | + if ( ! current_user_can('manage_wordpoints_points_types')) { |
|
408 | 408 | return; |
409 | 409 | } |
410 | 410 | |
@@ -419,43 +419,43 @@ discard block |
||
419 | 419 | |
420 | 420 | $settings = array(); |
421 | 421 | |
422 | - $settings['name'] = trim( sanitize_text_field( wp_unslash( $_POST['points-name'] ) ) ); // WPCS: CSRF OK |
|
423 | - $settings['prefix'] = ltrim( sanitize_text_field( wp_unslash( $_POST['points-prefix'] ) ) ); // WPCS: CSRF OK |
|
424 | - $settings['suffix'] = rtrim( sanitize_text_field( wp_unslash( $_POST['points-suffix'] ) ) ); // WPCS: CSRF OK |
|
422 | + $settings['name'] = trim(sanitize_text_field(wp_unslash($_POST['points-name']))); // WPCS: CSRF OK |
|
423 | + $settings['prefix'] = ltrim(sanitize_text_field(wp_unslash($_POST['points-prefix']))); // WPCS: CSRF OK |
|
424 | + $settings['suffix'] = rtrim(sanitize_text_field(wp_unslash($_POST['points-suffix']))); // WPCS: CSRF OK |
|
425 | 425 | |
426 | 426 | if ( |
427 | - isset( $_POST['points-slug'] ) |
|
428 | - && wordpoints_verify_nonce( 'update_points_type', 'wordpoints_update_points_type-%s', array( 'points-slug' ), 'post' ) |
|
427 | + isset($_POST['points-slug']) |
|
428 | + && wordpoints_verify_nonce('update_points_type', 'wordpoints_update_points_type-%s', array('points-slug'), 'post') |
|
429 | 429 | ) { |
430 | 430 | |
431 | 431 | // - We are updating an existing points type. |
432 | 432 | |
433 | - $points_type = sanitize_key( $_POST['points-slug'] ); |
|
433 | + $points_type = sanitize_key($_POST['points-slug']); |
|
434 | 434 | |
435 | - $old_settings = wordpoints_get_points_type( $points_type ); |
|
435 | + $old_settings = wordpoints_get_points_type($points_type); |
|
436 | 436 | |
437 | - if ( false === $old_settings ) { |
|
437 | + if (false === $old_settings) { |
|
438 | 438 | |
439 | 439 | add_settings_error( |
440 | 440 | '' |
441 | 441 | , 'wordpoints_points_type_update' |
442 | - , __( 'Error: failed updating points type.', 'wordpoints' ) |
|
442 | + , __('Error: failed updating points type.', 'wordpoints') |
|
443 | 443 | , 'updated' |
444 | 444 | ); |
445 | 445 | |
446 | 446 | return; |
447 | 447 | } |
448 | 448 | |
449 | - if ( is_array( $old_settings ) ) { |
|
450 | - $settings = array_merge( $old_settings, $settings ); |
|
449 | + if (is_array($old_settings)) { |
|
450 | + $settings = array_merge($old_settings, $settings); |
|
451 | 451 | } |
452 | 452 | |
453 | - if ( ! wordpoints_update_points_type( $points_type, $settings ) ) { |
|
453 | + if ( ! wordpoints_update_points_type($points_type, $settings)) { |
|
454 | 454 | |
455 | 455 | add_settings_error( |
456 | 456 | '' |
457 | 457 | , 'wordpoints_points_type_update' |
458 | - , __( 'Error: failed updating points type.', 'wordpoints' ) |
|
458 | + , __('Error: failed updating points type.', 'wordpoints') |
|
459 | 459 | , 'updated' |
460 | 460 | ); |
461 | 461 | |
@@ -464,23 +464,23 @@ discard block |
||
464 | 464 | add_settings_error( |
465 | 465 | '' |
466 | 466 | , 'wordpoints_points_type_update' |
467 | - , __( 'Points type updated.', 'wordpoints' ) |
|
467 | + , __('Points type updated.', 'wordpoints') |
|
468 | 468 | , 'updated' |
469 | 469 | ); |
470 | 470 | } |
471 | 471 | |
472 | - } elseif ( wordpoints_verify_nonce( 'add_new', 'wordpoints_add_new_points_type', null, 'post' ) ) { |
|
472 | + } elseif (wordpoints_verify_nonce('add_new', 'wordpoints_add_new_points_type', null, 'post')) { |
|
473 | 473 | |
474 | 474 | // - We are creating a new points type. |
475 | 475 | |
476 | - $slug = wordpoints_add_points_type( $settings ); |
|
476 | + $slug = wordpoints_add_points_type($settings); |
|
477 | 477 | |
478 | - if ( ! $slug ) { |
|
478 | + if ( ! $slug) { |
|
479 | 479 | |
480 | 480 | add_settings_error( |
481 | 481 | '' |
482 | 482 | , 'wordpoints_points_type_create' |
483 | - , __( 'Please choose a unique name for this points type.', 'wordpoints' ) |
|
483 | + , __('Please choose a unique name for this points type.', 'wordpoints') |
|
484 | 484 | ); |
485 | 485 | |
486 | 486 | } else { |
@@ -490,26 +490,26 @@ discard block |
||
490 | 490 | add_settings_error( |
491 | 491 | '' |
492 | 492 | , 'wordpoints_points_type_create' |
493 | - , __( 'Points type created.', 'wordpoints' ) |
|
493 | + , __('Points type created.', 'wordpoints') |
|
494 | 494 | , 'updated' |
495 | 495 | ); |
496 | 496 | } |
497 | 497 | } |
498 | 498 | |
499 | 499 | } elseif ( |
500 | - ! empty( $_POST['delete-points-type'] ) |
|
501 | - && isset( $_POST['points-slug'] ) |
|
502 | - && wordpoints_verify_nonce( 'delete-points-type-nonce', 'wordpoints_delete_points_type-%s', array( 'points-slug' ), 'post' ) |
|
500 | + ! empty($_POST['delete-points-type']) |
|
501 | + && isset($_POST['points-slug']) |
|
502 | + && wordpoints_verify_nonce('delete-points-type-nonce', 'wordpoints_delete_points_type-%s', array('points-slug'), 'post') |
|
503 | 503 | ) { |
504 | 504 | |
505 | 505 | // - We are deleting a points type. |
506 | 506 | |
507 | - if ( wordpoints_delete_points_type( sanitize_key( $_POST['points-slug'] ) ) ) { |
|
507 | + if (wordpoints_delete_points_type(sanitize_key($_POST['points-slug']))) { |
|
508 | 508 | |
509 | 509 | add_settings_error( |
510 | 510 | '' |
511 | 511 | , 'wordpoints_points_type_delete' |
512 | - , __( 'Points type deleted.', 'wordpoints' ) |
|
512 | + , __('Points type deleted.', 'wordpoints') |
|
513 | 513 | , 'updated' |
514 | 514 | ); |
515 | 515 | |
@@ -518,7 +518,7 @@ discard block |
||
518 | 518 | add_settings_error( |
519 | 519 | '' |
520 | 520 | , 'wordpoints_points_type_delete' |
521 | - , __( 'Error while deleting.', 'wordpoints' ) |
|
521 | + , __('Error while deleting.', 'wordpoints') |
|
522 | 522 | ); |
523 | 523 | } |
524 | 524 | } |
@@ -534,25 +534,25 @@ discard block |
||
534 | 534 | * |
535 | 535 | * @since 1.0.0 |
536 | 536 | */ |
537 | - do_action( 'wordpoints_admin_points_events_head' ); |
|
537 | + do_action('wordpoints_admin_points_events_head'); |
|
538 | 538 | |
539 | - if ( is_network_admin() ) { |
|
540 | - $title = __( 'Network Events', 'wordpoints' ); |
|
541 | - $description = __( 'Award points when various events happen on this network.', 'wordpoints' ); |
|
539 | + if (is_network_admin()) { |
|
540 | + $title = __('Network Events', 'wordpoints'); |
|
541 | + $description = __('Award points when various events happen on this network.', 'wordpoints'); |
|
542 | 542 | } else { |
543 | - $title = __( 'Events', 'wordpoints' ); |
|
544 | - $description = __( 'Award points when various events happen on this site.', 'wordpoints' ); |
|
543 | + $title = __('Events', 'wordpoints'); |
|
544 | + $description = __('Award points when various events happen on this site.', 'wordpoints'); |
|
545 | 545 | } |
546 | 546 | |
547 | - $points_type = wordpoints_get_points_type( $this->current_points_type ); |
|
547 | + $points_type = wordpoints_get_points_type($this->current_points_type); |
|
548 | 548 | |
549 | 549 | ?> |
550 | 550 | |
551 | 551 | <div class="wordpoints-points-type-meta-box-wrap"> |
552 | 552 | |
553 | 553 | <form> |
554 | - <?php wp_nonce_field( 'closedpostboxes', 'closedpostboxesnonce', false ); ?> |
|
555 | - <?php wp_nonce_field( 'meta-box-order', 'meta-box-order-nonce', false ); ?> |
|
554 | + <?php wp_nonce_field('closedpostboxes', 'closedpostboxesnonce', false); ?> |
|
555 | + <?php wp_nonce_field('meta-box-order', 'meta-box-order-nonce', false); ?> |
|
556 | 556 | </form> |
557 | 557 | |
558 | 558 | <div id="poststuff"> |
@@ -560,17 +560,17 @@ discard block |
||
560 | 560 | <div id="post-body" class="metabox-holder columns-<?php echo 1 === (int) get_current_screen()->get_columns() ? '1' : '2'; ?>"> |
561 | 561 | |
562 | 562 | <div id="postbox-container-1" class="postbox-container"> |
563 | - <?php do_meta_boxes( $this->id, 'side', $points_type ); ?> |
|
563 | + <?php do_meta_boxes($this->id, 'side', $points_type); ?> |
|
564 | 564 | </div> |
565 | 565 | |
566 | - <?php if ( isset( $this->current_points_type ) ) : ?> |
|
566 | + <?php if (isset($this->current_points_type)) : ?> |
|
567 | 567 | <div class="wordpoints-hook-events-heading"> |
568 | - <h2><?php echo esc_html( $title ); ?></h2> |
|
569 | - <p class="description"><?php echo esc_html( $description ); ?></p> |
|
568 | + <h2><?php echo esc_html($title); ?></h2> |
|
569 | + <p class="description"><?php echo esc_html($description); ?></p> |
|
570 | 570 | </div> |
571 | 571 | |
572 | 572 | <div id="postbox-container-2" class="postbox-container"> |
573 | - <?php do_meta_boxes( $this->id, 'events', $points_type ); ?> |
|
573 | + <?php do_meta_boxes($this->id, 'events', $points_type); ?> |
|
574 | 574 | </div> |
575 | 575 | <?php endif; ?> |
576 | 576 | |
@@ -589,7 +589,7 @@ discard block |
||
589 | 589 | * |
590 | 590 | * @since 1.0.0 |
591 | 591 | */ |
592 | - do_action( 'wordpoints_admin_points_events_foot' ); |
|
592 | + do_action('wordpoints_admin_points_events_foot'); |
|
593 | 593 | } |
594 | 594 | } |
595 | 595 |
@@ -27,7 +27,7 @@ discard block |
||
27 | 27 | * @since 1.0.0 |
28 | 28 | */ |
29 | 29 | public function __construct() { |
30 | - add_action( 'current_screen', array( $this, 'set_current_screen' ) ); |
|
30 | + add_action('current_screen', array($this, 'set_current_screen')); |
|
31 | 31 | } |
32 | 32 | |
33 | 33 | /** |
@@ -37,11 +37,11 @@ discard block |
||
37 | 37 | * |
38 | 38 | * @param WP_Screen $current_screen The WP_Screen object for the current screen. |
39 | 39 | */ |
40 | - public function set_current_screen( $current_screen ) { |
|
40 | + public function set_current_screen($current_screen) { |
|
41 | 41 | |
42 | - $screen = $this->get( $current_screen->id ); |
|
42 | + $screen = $this->get($current_screen->id); |
|
43 | 43 | |
44 | - if ( ! ( $screen instanceof WordPoints_Admin_Screen ) ) { |
|
44 | + if ( ! ($screen instanceof WordPoints_Admin_Screen)) { |
|
45 | 45 | return; |
46 | 46 | } |
47 | 47 | |
@@ -49,7 +49,7 @@ discard block |
||
49 | 49 | |
50 | 50 | add_action( |
51 | 51 | "load-{$current_screen->id}" |
52 | - , array( $this->current_screen, 'load' ) |
|
52 | + , array($this->current_screen, 'load') |
|
53 | 53 | ); |
54 | 54 | } |
55 | 55 |
@@ -44,21 +44,21 @@ discard block |
||
44 | 44 | * |
45 | 45 | * @since 1.0.0 |
46 | 46 | */ |
47 | -require_once( dirname( __FILE__ ) . '/includes/constants.php' ); |
|
47 | +require_once(dirname(__FILE__).'/includes/constants.php'); |
|
48 | 48 | |
49 | 49 | /** |
50 | 50 | * The module's functions. |
51 | 51 | * |
52 | 52 | * @since 1.0.0 |
53 | 53 | */ |
54 | -require_once( dirname( __FILE__ ) . '/includes/functions.php' ); |
|
54 | +require_once(dirname(__FILE__).'/includes/functions.php'); |
|
55 | 55 | |
56 | 56 | /** |
57 | 57 | * The module's actions and filters. |
58 | 58 | * |
59 | 59 | * @since 1.0.0 |
60 | 60 | */ |
61 | -require_once( dirname( __FILE__ ) . '/includes/actions.php' ); |
|
61 | +require_once(dirname(__FILE__).'/includes/actions.php'); |
|
62 | 62 | |
63 | 63 | /** |
64 | 64 | * Class autoloader. |
@@ -67,22 +67,22 @@ discard block |
||
67 | 67 | * |
68 | 68 | * @since 1.0.0 |
69 | 69 | */ |
70 | -require_once( dirname( __FILE__ ) . '/includes/classes/class/autoloader.php' ); |
|
70 | +require_once(dirname(__FILE__).'/includes/classes/class/autoloader.php'); |
|
71 | 71 | |
72 | 72 | // Register the classes to autoload. |
73 | 73 | WordPoints_Class_Autoloader::register_dir( |
74 | - dirname( __FILE__ ) . '/includes/classes' |
|
74 | + dirname(__FILE__).'/includes/classes' |
|
75 | 75 | , 'WordPoints_' |
76 | 76 | ); |
77 | 77 | |
78 | -if ( is_admin() ) { |
|
78 | +if (is_admin()) { |
|
79 | 79 | |
80 | 80 | /** |
81 | 81 | * Administration-side code. |
82 | 82 | * |
83 | 83 | * @since 1.0.0 |
84 | 84 | */ |
85 | - require_once( dirname( __FILE__ ) . '/admin/admin.php' ); |
|
85 | + require_once(dirname(__FILE__).'/admin/admin.php'); |
|
86 | 86 | } |
87 | 87 | |
88 | 88 | // EOF |
@@ -7,21 +7,21 @@ |
||
7 | 7 | * @since 1.0.0 |
8 | 8 | */ |
9 | 9 | |
10 | -add_action( 'wordpoints_init_app-apps', 'wordpoints_apps_init' ); |
|
11 | -add_action( 'wordpoints_init_app-entities', 'wordpoints_entities_app_init' ); |
|
10 | +add_action('wordpoints_init_app-apps', 'wordpoints_apps_init'); |
|
11 | +add_action('wordpoints_init_app-entities', 'wordpoints_entities_app_init'); |
|
12 | 12 | |
13 | -add_action( 'wordpoints_init_app_registry-apps-entities', 'wordpoints_entities_init' ); |
|
14 | -add_action( 'wordpoints_init_app_registry-apps-data_types', 'wordpoints_data_types_init' ); |
|
13 | +add_action('wordpoints_init_app_registry-apps-entities', 'wordpoints_entities_init'); |
|
14 | +add_action('wordpoints_init_app_registry-apps-data_types', 'wordpoints_data_types_init'); |
|
15 | 15 | |
16 | -add_action( 'wordpoints_init_app_registry-hooks-firers', 'wordpoints_hook_firers_init' ); |
|
17 | -add_action( 'wordpoints_init_app_registry-hooks-events', 'wordpoints_hook_events_init' ); |
|
18 | -add_action( 'wordpoints_init_app_registry-hooks-actions', 'wordpoints_hook_actions_init' ); |
|
19 | -add_action( 'wordpoints_init_app_registry-hooks-reactors', 'wordpoints_hook_reactors_init' ); |
|
20 | -add_action( 'wordpoints_init_app_registry-hooks-extensions', 'wordpoints_hook_extension_init' ); |
|
21 | -add_action( 'wordpoints_init_app_registry-hooks-conditions', 'wordpoints_hook_conditions_init' ); |
|
16 | +add_action('wordpoints_init_app_registry-hooks-firers', 'wordpoints_hook_firers_init'); |
|
17 | +add_action('wordpoints_init_app_registry-hooks-events', 'wordpoints_hook_events_init'); |
|
18 | +add_action('wordpoints_init_app_registry-hooks-actions', 'wordpoints_hook_actions_init'); |
|
19 | +add_action('wordpoints_init_app_registry-hooks-reactors', 'wordpoints_hook_reactors_init'); |
|
20 | +add_action('wordpoints_init_app_registry-hooks-extensions', 'wordpoints_hook_extension_init'); |
|
21 | +add_action('wordpoints_init_app_registry-hooks-conditions', 'wordpoints_hook_conditions_init'); |
|
22 | 22 | |
23 | -add_action( 'wordpoints_modules_loaded', 'wordpoints_init_hooks' ); |
|
23 | +add_action('wordpoints_modules_loaded', 'wordpoints_init_hooks'); |
|
24 | 24 | |
25 | -add_filter( 'wordpoints_user_can_view_points_log', 'wordpoints_hooks_user_can_view_points_log' ); |
|
25 | +add_filter('wordpoints_user_can_view_points_log', 'wordpoints_hooks_user_can_view_points_log'); |
|
26 | 26 | |
27 | 27 | // EOF |
@@ -88,16 +88,16 @@ discard block |
||
88 | 88 | /** |
89 | 89 | * @since 1.0.0 |
90 | 90 | */ |
91 | - public function __construct( $slug, $parent = null ) { |
|
91 | + public function __construct($slug, $parent = null) { |
|
92 | 92 | |
93 | 93 | $this->slug = $slug; |
94 | 94 | $this->full_slug = $slug; |
95 | 95 | |
96 | - if ( $parent instanceof WordPoints_App ) { |
|
96 | + if ($parent instanceof WordPoints_App) { |
|
97 | 97 | $this->parent = $parent; |
98 | 98 | |
99 | - if ( 'apps' !== $this->parent->full_slug ) { |
|
100 | - $this->full_slug = $this->parent->full_slug . '-' . $this->full_slug; |
|
99 | + if ('apps' !== $this->parent->full_slug) { |
|
100 | + $this->full_slug = $this->parent->full_slug.'-'.$this->full_slug; |
|
101 | 101 | } |
102 | 102 | } |
103 | 103 | |
@@ -109,29 +109,29 @@ discard block |
||
109 | 109 | /** |
110 | 110 | * @since 1.0.0 |
111 | 111 | */ |
112 | - public function __isset( $var ) { |
|
113 | - return $this->sub_apps->is_registered( $var ); |
|
112 | + public function __isset($var) { |
|
113 | + return $this->sub_apps->is_registered($var); |
|
114 | 114 | } |
115 | 115 | |
116 | 116 | /** |
117 | 117 | * @since 1.0.0 |
118 | 118 | */ |
119 | - public function __get( $var ) { |
|
119 | + public function __get($var) { |
|
120 | 120 | |
121 | - if ( 'sub_apps' === $var ) { |
|
121 | + if ('sub_apps' === $var) { |
|
122 | 122 | return $this->$var; |
123 | 123 | } |
124 | 124 | |
125 | - $sub = $this->sub_apps->get( $var, array( $this ) ); |
|
125 | + $sub = $this->sub_apps->get($var, array($this)); |
|
126 | 126 | |
127 | - if ( ! $sub ) { |
|
127 | + if ( ! $sub) { |
|
128 | 128 | return null; |
129 | 129 | } |
130 | 130 | |
131 | 131 | if ( |
132 | - empty( $this->did_init[ $var ] ) |
|
132 | + empty($this->did_init[$var]) |
|
133 | 133 | && ! self::$main->silent |
134 | - && $this->should_do_registry_init( $sub ) |
|
134 | + && $this->should_do_registry_init($sub) |
|
135 | 135 | ) { |
136 | 136 | |
137 | 137 | /** |
@@ -144,9 +144,9 @@ discard block |
||
144 | 144 | * @param WordPoints_Class_RegistryI|WordPoints_Class_Registry_ChildrenI |
145 | 145 | * $registry The registry object. |
146 | 146 | */ |
147 | - do_action( "wordpoints_init_app_registry-{$this->full_slug}-{$var}", $sub ); |
|
147 | + do_action("wordpoints_init_app_registry-{$this->full_slug}-{$var}", $sub); |
|
148 | 148 | |
149 | - $this->did_init[ $var ] = true; |
|
149 | + $this->did_init[$var] = true; |
|
150 | 150 | } |
151 | 151 | |
152 | 152 | return $sub; |
@@ -155,7 +155,7 @@ discard block |
||
155 | 155 | /** |
156 | 156 | * @since 1.0.0 |
157 | 157 | */ |
158 | - public function __set( $var, $value ) { |
|
158 | + public function __set($var, $value) { |
|
159 | 159 | |
160 | 160 | _doing_it_wrong( |
161 | 161 | __METHOD__ |
@@ -167,7 +167,7 @@ discard block |
||
167 | 167 | /** |
168 | 168 | * @since 1.0.0 |
169 | 169 | */ |
170 | - public function __unset( $var ) { |
|
170 | + public function __unset($var) { |
|
171 | 171 | |
172 | 172 | _doing_it_wrong( |
173 | 173 | __METHOD__ |
@@ -185,7 +185,7 @@ discard block |
||
185 | 185 | * |
186 | 186 | * @return bool Whether to call the init action or not. |
187 | 187 | */ |
188 | - protected function should_do_registry_init( $registry ) { |
|
188 | + protected function should_do_registry_init($registry) { |
|
189 | 189 | return ( |
190 | 190 | $registry instanceof WordPoints_Class_RegistryI |
191 | 191 | || $registry instanceof WordPoints_Class_Registry_ChildrenI |
@@ -209,7 +209,7 @@ discard block |
||
209 | 209 | * |
210 | 210 | * @param WordPoints_App $app The app object. |
211 | 211 | */ |
212 | - do_action( "wordpoints_init_app-{$this->full_slug}", $this ); |
|
212 | + do_action("wordpoints_init_app-{$this->full_slug}", $this); |
|
213 | 213 | } |
214 | 214 | } |
215 | 215 |
@@ -28,46 +28,46 @@ |
||
28 | 28 | /** |
29 | 29 | * @since 1.0.0 |
30 | 30 | */ |
31 | - public function __construct( $slug ) { |
|
31 | + public function __construct($slug) { |
|
32 | 32 | |
33 | 33 | $this->registry = new WordPoints_Class_Registry(); |
34 | 34 | |
35 | - parent::__construct( $slug ); |
|
35 | + parent::__construct($slug); |
|
36 | 36 | } |
37 | 37 | |
38 | 38 | /** |
39 | 39 | * @since 1.0.0 |
40 | 40 | */ |
41 | - public function get_all( array $args = array() ) { |
|
42 | - return $this->registry->get_all( $args ); |
|
41 | + public function get_all(array $args = array()) { |
|
42 | + return $this->registry->get_all($args); |
|
43 | 43 | } |
44 | 44 | |
45 | 45 | /** |
46 | 46 | * @since 1.0.0 |
47 | 47 | */ |
48 | - public function get( $slug, array $args = array() ) { |
|
49 | - return $this->registry->get( $slug, $args ); |
|
48 | + public function get($slug, array $args = array()) { |
|
49 | + return $this->registry->get($slug, $args); |
|
50 | 50 | } |
51 | 51 | |
52 | 52 | /** |
53 | 53 | * @since 1.0.0 |
54 | 54 | */ |
55 | - public function register( $slug, $class, array $args = array() ) { |
|
56 | - return $this->registry->register( $slug, $class, $args ); |
|
55 | + public function register($slug, $class, array $args = array()) { |
|
56 | + return $this->registry->register($slug, $class, $args); |
|
57 | 57 | } |
58 | 58 | |
59 | 59 | /** |
60 | 60 | * @since 1.0.0 |
61 | 61 | */ |
62 | - public function deregister( $slug ) { |
|
63 | - $this->registry->deregister( $slug ); |
|
62 | + public function deregister($slug) { |
|
63 | + $this->registry->deregister($slug); |
|
64 | 64 | } |
65 | 65 | |
66 | 66 | /** |
67 | 67 | * @since 1.0.0 |
68 | 68 | */ |
69 | - public function is_registered( $slug ) { |
|
70 | - return $this->registry->is_registered( $slug ); |
|
69 | + public function is_registered($slug) { |
|
70 | + return $this->registry->is_registered($slug); |
|
71 | 71 | } |
72 | 72 | } |
73 | 73 |
@@ -62,15 +62,15 @@ discard block |
||
62 | 62 | * @param string $dir The full path of the directory. |
63 | 63 | * @param string $prefix The prefix used for class names in this directory. |
64 | 64 | */ |
65 | - public static function register_dir( $dir, $prefix ) { |
|
65 | + public static function register_dir($dir, $prefix) { |
|
66 | 66 | |
67 | - if ( ! self::$added_action ) { |
|
68 | - add_action( 'wordpoints_modules_loaded', __CLASS__ . '::init', 0 ); |
|
67 | + if ( ! self::$added_action) { |
|
68 | + add_action('wordpoints_modules_loaded', __CLASS__.'::init', 0); |
|
69 | 69 | self::$added_action = true; |
70 | 70 | } |
71 | 71 | |
72 | - self::$prefixes[ $prefix ]['length'] = strlen( $prefix ); |
|
73 | - self::$prefixes[ $prefix ]['dirs'][] = trailingslashit( $dir ); |
|
72 | + self::$prefixes[$prefix]['length'] = strlen($prefix); |
|
73 | + self::$prefixes[$prefix]['dirs'][] = trailingslashit($dir); |
|
74 | 74 | |
75 | 75 | self::$sorted = false; |
76 | 76 | } |
@@ -86,31 +86,31 @@ discard block |
||
86 | 86 | * |
87 | 87 | * @param string $class_name The name fo the class to load. |
88 | 88 | */ |
89 | - public static function load_class( $class_name ) { |
|
89 | + public static function load_class($class_name) { |
|
90 | 90 | |
91 | - if ( ! self::$sorted ) { |
|
92 | - arsort( self::$prefixes ); |
|
91 | + if ( ! self::$sorted) { |
|
92 | + arsort(self::$prefixes); |
|
93 | 93 | self::$sorted = true; |
94 | 94 | } |
95 | 95 | |
96 | - foreach ( self::$prefixes as $prefix => $data ) { |
|
96 | + foreach (self::$prefixes as $prefix => $data) { |
|
97 | 97 | |
98 | - if ( substr( $class_name, 0, $data['length'] ) !== $prefix ) { |
|
98 | + if (substr($class_name, 0, $data['length']) !== $prefix) { |
|
99 | 99 | continue; |
100 | 100 | } |
101 | 101 | |
102 | - $trimmed_class_name = substr( $class_name, $data['length'] ); |
|
102 | + $trimmed_class_name = substr($class_name, $data['length']); |
|
103 | 103 | |
104 | - $file_name = str_replace( '_', '/', strtolower( $trimmed_class_name ) ); |
|
105 | - $file_name = $file_name . '.php'; |
|
104 | + $file_name = str_replace('_', '/', strtolower($trimmed_class_name)); |
|
105 | + $file_name = $file_name.'.php'; |
|
106 | 106 | |
107 | - foreach ( $data['dirs'] as $dir ) { |
|
107 | + foreach ($data['dirs'] as $dir) { |
|
108 | 108 | |
109 | - if ( ! file_exists( $dir . $file_name ) ) { |
|
109 | + if ( ! file_exists($dir.$file_name)) { |
|
110 | 110 | continue; |
111 | 111 | } |
112 | 112 | |
113 | - require_once( $dir . $file_name ); |
|
113 | + require_once($dir.$file_name); |
|
114 | 114 | |
115 | 115 | return; |
116 | 116 | } |
@@ -135,16 +135,16 @@ discard block |
||
135 | 135 | */ |
136 | 136 | public static function init() { |
137 | 137 | |
138 | - if ( function_exists( 'spl_autoload_register' ) ) { |
|
138 | + if (function_exists('spl_autoload_register')) { |
|
139 | 139 | |
140 | - spl_autoload_register( __CLASS__ . '::load_class' ); |
|
140 | + spl_autoload_register(__CLASS__.'::load_class'); |
|
141 | 141 | |
142 | 142 | } else { |
143 | 143 | |
144 | - foreach ( self::$prefixes as $prefix => $data ) { |
|
145 | - foreach ( $data['dirs'] as $dir ) { |
|
146 | - if ( file_exists( $dir . '/index.php' ) ) { |
|
147 | - require( $dir . '/index.php' ); |
|
144 | + foreach (self::$prefixes as $prefix => $data) { |
|
145 | + foreach ($data['dirs'] as $dir) { |
|
146 | + if (file_exists($dir.'/index.php')) { |
|
147 | + require($dir.'/index.php'); |
|
148 | 148 | } |
149 | 149 | } |
150 | 150 | } |
@@ -30,39 +30,39 @@ discard block |
||
30 | 30 | /** |
31 | 31 | * @since 1.0.0 |
32 | 32 | */ |
33 | - public function get_all( array $args = array() ) { |
|
34 | - return self::construct_with_args( $this->classes, $args ); |
|
33 | + public function get_all(array $args = array()) { |
|
34 | + return self::construct_with_args($this->classes, $args); |
|
35 | 35 | } |
36 | 36 | |
37 | 37 | /** |
38 | 38 | * @since 1.0.0 |
39 | 39 | */ |
40 | - public function get( $slug, array $args = array() ) { |
|
40 | + public function get($slug, array $args = array()) { |
|
41 | 41 | |
42 | - if ( ! isset( $this->classes[ $slug ] ) ) { |
|
42 | + if ( ! isset($this->classes[$slug])) { |
|
43 | 43 | return false; |
44 | 44 | } |
45 | 45 | |
46 | - if ( ! empty( $args ) ) { |
|
46 | + if ( ! empty($args)) { |
|
47 | 47 | |
48 | - array_unshift( $args, $slug ); |
|
48 | + array_unshift($args, $slug); |
|
49 | 49 | |
50 | 50 | return wordpoints_construct_class_with_args( |
51 | - $this->classes[ $slug ] |
|
51 | + $this->classes[$slug] |
|
52 | 52 | , $args |
53 | 53 | ); |
54 | 54 | |
55 | 55 | } else { |
56 | - return new $this->classes[ $slug ]( $slug ); |
|
56 | + return new $this->classes[$slug]($slug); |
|
57 | 57 | } |
58 | 58 | } |
59 | 59 | |
60 | 60 | /** |
61 | 61 | * @since 1.0.0 |
62 | 62 | */ |
63 | - public function register( $slug, $class, array $args = array() ) { |
|
63 | + public function register($slug, $class, array $args = array()) { |
|
64 | 64 | |
65 | - $this->classes[ $slug ] = $class; |
|
65 | + $this->classes[$slug] = $class; |
|
66 | 66 | |
67 | 67 | return true; |
68 | 68 | } |
@@ -70,17 +70,17 @@ discard block |
||
70 | 70 | /** |
71 | 71 | * @since 1.0.0 |
72 | 72 | */ |
73 | - public function deregister( $slug ) { |
|
73 | + public function deregister($slug) { |
|
74 | 74 | |
75 | - unset( $this->classes[ $slug ] ); |
|
75 | + unset($this->classes[$slug]); |
|
76 | 76 | } |
77 | 77 | |
78 | 78 | /** |
79 | 79 | * @since 1.0.0 |
80 | 80 | */ |
81 | - public function is_registered( $slug ) { |
|
81 | + public function is_registered($slug) { |
|
82 | 82 | |
83 | - return isset( $this->classes[ $slug ] ); |
|
83 | + return isset($this->classes[$slug]); |
|
84 | 84 | } |
85 | 85 | |
86 | 86 | /** |
@@ -94,24 +94,24 @@ discard block |
||
94 | 94 | * |
95 | 95 | * @return object[] An array of the constructed objects. |
96 | 96 | */ |
97 | - public static function construct_with_args( array $classes, array $args ) { |
|
97 | + public static function construct_with_args(array $classes, array $args) { |
|
98 | 98 | |
99 | 99 | $objects = array(); |
100 | 100 | |
101 | - if ( empty( $args ) ) { |
|
101 | + if (empty($args)) { |
|
102 | 102 | |
103 | - foreach ( $classes as $slug => $class ) { |
|
104 | - $objects[ $slug ] = new $class( $slug ); |
|
103 | + foreach ($classes as $slug => $class) { |
|
104 | + $objects[$slug] = new $class($slug); |
|
105 | 105 | } |
106 | 106 | |
107 | 107 | } else { |
108 | 108 | |
109 | - array_unshift( $args, null ); |
|
109 | + array_unshift($args, null); |
|
110 | 110 | |
111 | - foreach ( $classes as $slug => $class ) { |
|
112 | - $objects[ $slug ] = wordpoints_construct_class_with_args( |
|
111 | + foreach ($classes as $slug => $class) { |
|
112 | + $objects[$slug] = wordpoints_construct_class_with_args( |
|
113 | 113 | $class |
114 | - , array( $slug ) + $args |
|
114 | + , array($slug) + $args |
|
115 | 115 | ); |
116 | 116 | } |
117 | 117 | } |