@@ -46,7 +46,7 @@ |
||
46 | 46 | ); |
47 | 47 | |
48 | 48 | if ( $this->network ) { |
49 | - $query_args['blog_id'] = false; |
|
49 | + $query_args[ 'blog_id' ] = false; |
|
50 | 50 | } |
51 | 51 | |
52 | 52 | $query = new WordPoints_Points_Logs_Query( $query_args ); |
@@ -76,9 +76,9 @@ discard block |
||
76 | 76 | |
77 | 77 | $routine = new WordPoints_Installer_Option( $option, $value ); |
78 | 78 | |
79 | - $install_routines['single'][] = $routine; |
|
80 | - $install_routines['site'][] = $routine; |
|
81 | - $install_routines['network'][] = new WordPoints_Installer_Option( |
|
79 | + $install_routines[ 'single' ][ ] = $routine; |
|
80 | + $install_routines[ 'site' ][ ] = $routine; |
|
81 | + $install_routines[ 'network' ][ ] = new WordPoints_Installer_Option( |
|
82 | 82 | $option |
83 | 83 | , $value |
84 | 84 | , true |
@@ -99,7 +99,7 @@ discard block |
||
99 | 99 | * network activation status. |
100 | 100 | */ |
101 | 101 | array_unshift( |
102 | - $install_routines['site'] |
|
102 | + $install_routines[ 'site' ] |
|
103 | 103 | , new WordPoints_Uninstaller_Caps( |
104 | 104 | array( 'manage_wordpoints_points_types' ) |
105 | 105 | ) |
@@ -116,7 +116,7 @@ discard block |
||
116 | 116 | $factories = parent::get_update_routine_factories(); |
117 | 117 | |
118 | 118 | // v1.2.0. |
119 | - $factories[] = new WordPoints_Updater_Factory( |
|
119 | + $factories[ ] = new WordPoints_Updater_Factory( |
|
120 | 120 | '1.2.0' |
121 | 121 | , array( 'global' => array( 'WordPoints_Points_Updater_1_2_0_Logs' ) ) |
122 | 122 | ); |
@@ -137,7 +137,7 @@ discard block |
||
137 | 137 | ), |
138 | 138 | ); |
139 | 139 | |
140 | - $factories[] = new WordPoints_Updater_Factory( |
|
140 | + $factories[ ] = new WordPoints_Updater_Factory( |
|
141 | 141 | '1.4.0' |
142 | 142 | , array( |
143 | 143 | 'local' => array( |
@@ -151,7 +151,7 @@ discard block |
||
151 | 151 | ); |
152 | 152 | |
153 | 153 | if ( is_wordpoints_network_active() ) { |
154 | - $factories[] = new WordPoints_Updater_Factory( |
|
154 | + $factories[ ] = new WordPoints_Updater_Factory( |
|
155 | 155 | '1.4.0' |
156 | 156 | , array( |
157 | 157 | 'network' => array( |
@@ -166,7 +166,7 @@ discard block |
||
166 | 166 | |
167 | 167 | // v1.5.0. |
168 | 168 | if ( is_wordpoints_network_active() ) { |
169 | - $factories[] = new WordPoints_Updater_Factory( |
|
169 | + $factories[ ] = new WordPoints_Updater_Factory( |
|
170 | 170 | '1.5.0' |
171 | 171 | , array( |
172 | 172 | 'site' => array( |
@@ -203,7 +203,7 @@ discard block |
||
203 | 203 | 'post' => 'post_delete', |
204 | 204 | ); |
205 | 205 | |
206 | - $factories[] = new WordPoints_Updater_Factory( |
|
206 | + $factories[ ] = new WordPoints_Updater_Factory( |
|
207 | 207 | '1.9.0' |
208 | 208 | , array( |
209 | 209 | 'local' => array( |
@@ -216,7 +216,7 @@ discard block |
||
216 | 216 | ); |
217 | 217 | |
218 | 218 | if ( is_wordpoints_network_active() ) { |
219 | - $factories[] = new WordPoints_Updater_Factory( |
|
219 | + $factories[ ] = new WordPoints_Updater_Factory( |
|
220 | 220 | '1.9.0' |
221 | 221 | , array( |
222 | 222 | 'network' => array( |
@@ -230,7 +230,7 @@ discard block |
||
230 | 230 | } |
231 | 231 | |
232 | 232 | // v1.10.0. |
233 | - $factories[] = new WordPoints_Updater_Factory( |
|
233 | + $factories[ ] = new WordPoints_Updater_Factory( |
|
234 | 234 | '1.10.0' |
235 | 235 | , array( |
236 | 236 | 'global' => array( |
@@ -243,7 +243,7 @@ discard block |
||
243 | 243 | ); |
244 | 244 | |
245 | 245 | // v2.0.0. |
246 | - $factories[] = new WordPoints_Updater_Factory( |
|
246 | + $factories[ ] = new WordPoints_Updater_Factory( |
|
247 | 247 | '2.0.0' |
248 | 248 | , array( |
249 | 249 | 'global' => array( |
@@ -262,7 +262,7 @@ discard block |
||
262 | 262 | ); |
263 | 263 | |
264 | 264 | // v2.1.0. |
265 | - $factories[] = new WordPoints_Updater_Factory( |
|
265 | + $factories[ ] = new WordPoints_Updater_Factory( |
|
266 | 266 | '2.1.0' |
267 | 267 | , array( |
268 | 268 | 'global' => array( |
@@ -279,7 +279,7 @@ discard block |
||
279 | 279 | ); |
280 | 280 | |
281 | 281 | // v2.1.4. |
282 | - $factories[] = new WordPoints_Updater_Factory( |
|
282 | + $factories[ ] = new WordPoints_Updater_Factory( |
|
283 | 283 | '2.1.4' |
284 | 284 | , array( 'global' => array( 'WordPoints_Points_Updater_2_1_4_Logs' ) ) |
285 | 285 | ); |
@@ -288,11 +288,11 @@ discard block |
||
288 | 288 | $entity_slugs = array( 'user' ); |
289 | 289 | |
290 | 290 | foreach ( wordpoints_get_post_types_for_auto_integration() as $post_type ) { |
291 | - $entity_slugs[] = "post\\{$post_type}"; |
|
292 | - $entity_slugs[] = "comment\\{$post_type}"; |
|
291 | + $entity_slugs[ ] = "post\\{$post_type}"; |
|
292 | + $entity_slugs[ ] = "comment\\{$post_type}"; |
|
293 | 293 | } |
294 | 294 | |
295 | - $factories[] = new WordPoints_Updater_Factory( |
|
295 | + $factories[ ] = new WordPoints_Updater_Factory( |
|
296 | 296 | '2.4.0-alpha-5' |
297 | 297 | , array( |
298 | 298 | 'global' => array( |
@@ -308,7 +308,7 @@ discard block |
||
308 | 308 | ); |
309 | 309 | |
310 | 310 | if ( is_wordpoints_network_active() ) { |
311 | - $factories[] = new WordPoints_Updater_Factory( |
|
311 | + $factories[ ] = new WordPoints_Updater_Factory( |
|
312 | 312 | '2.4.0-alpha-5' |
313 | 313 | , array( |
314 | 314 | 'site' => array( |
@@ -342,7 +342,7 @@ discard block |
||
342 | 342 | |
343 | 343 | $factories = parent::get_uninstall_routine_factories(); |
344 | 344 | |
345 | - $factories[] = new WordPoints_Uninstaller_Factory_Options( |
|
345 | + $factories[ ] = new WordPoints_Uninstaller_Factory_Options( |
|
346 | 346 | array( |
347 | 347 | 'local' => array( |
348 | 348 | 'wordpoints_%_hook_legacy', |
@@ -360,7 +360,7 @@ discard block |
||
360 | 360 | ) |
361 | 361 | ); |
362 | 362 | |
363 | - $factories[] = new WordPoints_Points_Uninstaller_Factory_Points_Hooks( |
|
363 | + $factories[ ] = new WordPoints_Points_Uninstaller_Factory_Points_Hooks( |
|
364 | 364 | array( |
365 | 365 | 'universal' => array( |
366 | 366 | 'wordpoints_registration_points_hook', |
@@ -374,7 +374,7 @@ discard block |
||
374 | 374 | ) |
375 | 375 | ); |
376 | 376 | |
377 | - $factories[] = new WordPoints_Uninstaller_Factory_Widgets( |
|
377 | + $factories[ ] = new WordPoints_Uninstaller_Factory_Widgets( |
|
378 | 378 | array( |
379 | 379 | 'wordpoints_points_logs_widget', |
380 | 380 | 'wordpoints_top_users_widget', |
@@ -382,7 +382,7 @@ discard block |
||
382 | 382 | ) |
383 | 383 | ); |
384 | 384 | |
385 | - $factories[] = new WordPoints_Uninstaller_Factory_Metadata( |
|
385 | + $factories[ ] = new WordPoints_Uninstaller_Factory_Metadata( |
|
386 | 386 | 'user' |
387 | 387 | , array( |
388 | 388 | 'universal' => array( |
@@ -392,7 +392,7 @@ discard block |
||
392 | 392 | ) |
393 | 393 | ); |
394 | 394 | |
395 | - $factories[] = new WordPoints_Uninstaller_Factory_Metadata( |
|
395 | + $factories[ ] = new WordPoints_Uninstaller_Factory_Metadata( |
|
396 | 396 | 'comment' |
397 | 397 | , array( |
398 | 398 | 'universal' => array( |
@@ -402,7 +402,7 @@ discard block |
||
402 | 402 | ) |
403 | 403 | ); |
404 | 404 | |
405 | - $factories[] = new WordPoints_Uninstaller_Factory_Admin_Screens_With_Meta_Boxes( |
|
405 | + $factories[ ] = new WordPoints_Uninstaller_Factory_Admin_Screens_With_Meta_Boxes( |
|
406 | 406 | array( |
407 | 407 | 'universal' => array( |
408 | 408 | 'wordpoints_points_types' => array(), |
@@ -36,7 +36,7 @@ |
||
36 | 36 | |
37 | 37 | foreach ( $points_hooks as $context => $slugs ) { |
38 | 38 | foreach ( $slugs as $slug ) { |
39 | - $options[ $context ][] = 'wordpoints_hook-' . $slug; |
|
39 | + $options[ $context ][ ] = 'wordpoints_hook-' . $slug; |
|
40 | 40 | } |
41 | 41 | } |
42 | 42 |
@@ -145,7 +145,7 @@ discard block |
||
145 | 145 | */ |
146 | 146 | protected function get_logs() { |
147 | 147 | |
148 | - if ( $this->args['searchable'] ) { |
|
148 | + if ( $this->args[ 'searchable' ] ) { |
|
149 | 149 | |
150 | 150 | $search_term = $this->get_search_term(); |
151 | 151 | |
@@ -161,7 +161,7 @@ discard block |
||
161 | 161 | } |
162 | 162 | } |
163 | 163 | |
164 | - if ( $this->args['paginate'] ) { |
|
164 | + if ( $this->args[ 'paginate' ] ) { |
|
165 | 165 | |
166 | 166 | $page = $this->get_page_number(); |
167 | 167 | $per_page = $this->get_per_page(); |
@@ -110,7 +110,7 @@ discard block |
||
110 | 110 | */ |
111 | 111 | public static function register( $class_name ) { |
112 | 112 | |
113 | - self::$classes[] = $class_name; |
|
113 | + self::$classes[ ] = $class_name; |
|
114 | 114 | } |
115 | 115 | |
116 | 116 | /** |
@@ -286,10 +286,10 @@ discard block |
||
286 | 286 | |
287 | 287 | $args = $hook_type->get_options(); |
288 | 288 | |
289 | - $args['_add'] = 'multi'; |
|
290 | - $args['_display'] = 'template'; |
|
291 | - $args['_multi_num'] = $hook_type->next_hook_id_number(); |
|
292 | - $args['_id_slug'] = $i; |
|
289 | + $args[ '_add' ] = 'multi'; |
|
290 | + $args[ '_display' ] = 'template'; |
|
291 | + $args[ '_multi_num' ] = $hook_type->next_hook_id_number(); |
|
292 | + $args[ '_id_slug' ] = $i; |
|
293 | 293 | |
294 | 294 | $hook_type->set_options( $args ); |
295 | 295 | |
@@ -338,11 +338,11 @@ discard block |
||
338 | 338 | |
339 | 339 | $options = $hook_type->get_options(); |
340 | 340 | |
341 | - $options['_display'] = 'instance'; |
|
341 | + $options[ '_display' ] = 'instance'; |
|
342 | 342 | |
343 | - unset( $options['_add'] ); |
|
343 | + unset( $options[ '_add' ] ); |
|
344 | 344 | |
345 | - $options['_id_slug'] = $slug; |
|
345 | + $options[ '_id_slug' ] = $slug; |
|
346 | 346 | |
347 | 347 | $hook_type->set_options( $options ); |
348 | 348 | |
@@ -596,15 +596,15 @@ discard block |
||
596 | 596 | |
597 | 597 | <p> |
598 | 598 | <label for="points-name-<?php echo esc_attr( $slug ); ?>"><?php echo esc_html_x( 'Name:', 'points type', 'wordpoints' ); ?></label> |
599 | - <input class="widefat" type="text" id="points-name-<?php echo esc_attr( $slug ); ?>" name="points-name" value="<?php echo esc_attr( $points_type['name'] ); ?>" /> |
|
599 | + <input class="widefat" type="text" id="points-name-<?php echo esc_attr( $slug ); ?>" name="points-name" value="<?php echo esc_attr( $points_type[ 'name' ] ); ?>" /> |
|
600 | 600 | </p> |
601 | 601 | <p> |
602 | 602 | <label for="points-prefix-<?php echo esc_attr( $slug ); ?>"><?php echo esc_html( $prefix ); ?></label> |
603 | - <input class="widefat" type="text" id="points-prefix-<?php echo esc_attr( $slug ); ?>" name="points-prefix" value="<?php echo esc_attr( $points_type['prefix'] ); ?>" /> |
|
603 | + <input class="widefat" type="text" id="points-prefix-<?php echo esc_attr( $slug ); ?>" name="points-prefix" value="<?php echo esc_attr( $points_type[ 'prefix' ] ); ?>" /> |
|
604 | 604 | </p> |
605 | 605 | <p> |
606 | 606 | <label for="points-suffix-<?php echo esc_attr( $slug ); ?>"><?php echo esc_html( $suffix ); ?></label> |
607 | - <input class="widefat" type="text" id="points-suffix-<?php echo esc_attr( $slug ); ?>" name="points-suffix" value="<?php echo esc_attr( $points_type['suffix'] ); ?>" /> |
|
607 | + <input class="widefat" type="text" id="points-suffix-<?php echo esc_attr( $slug ); ?>" name="points-suffix" value="<?php echo esc_attr( $points_type[ 'suffix' ] ); ?>" /> |
|
608 | 608 | </p> |
609 | 609 | |
610 | 610 | <?php |
@@ -679,28 +679,28 @@ discard block |
||
679 | 679 | |
680 | 680 | $id_format = $hook_id; |
681 | 681 | |
682 | - $multi_number = ( isset( $options['_multi_num'] ) ) ? $options['_multi_num'] : ''; |
|
683 | - $add_new = ( isset( $options['_add'] ) ) ? $options['_add'] : ''; |
|
682 | + $multi_number = ( isset( $options[ '_multi_num' ] ) ) ? $options[ '_multi_num' ] : ''; |
|
683 | + $add_new = ( isset( $options[ '_add' ] ) ) ? $options[ '_add' ] : ''; |
|
684 | 684 | |
685 | 685 | // Prepare the URL query string. |
686 | 686 | $query_arg = array( 'edithook' => $id_format ); |
687 | 687 | |
688 | 688 | if ( $add_new ) { |
689 | 689 | |
690 | - $query_arg['addnew'] = 1; |
|
690 | + $query_arg[ 'addnew' ] = 1; |
|
691 | 691 | |
692 | 692 | if ( $multi_number ) { |
693 | 693 | |
694 | - $query_arg['num'] = $multi_number; |
|
695 | - $query_arg['base'] = $id_base; |
|
694 | + $query_arg[ 'num' ] = $multi_number; |
|
695 | + $query_arg[ 'base' ] = $id_base; |
|
696 | 696 | } |
697 | 697 | |
698 | 698 | } else { |
699 | 699 | |
700 | - $query_arg['points_type'] = $points_type; |
|
700 | + $query_arg[ 'points_type' ] = $points_type; |
|
701 | 701 | } |
702 | 702 | |
703 | - if ( isset( $options['_display'] ) && 'template' === $options['_display'] ) { |
|
703 | + if ( isset( $options[ '_display' ] ) && 'template' === $options[ '_display' ] ) { |
|
704 | 704 | |
705 | 705 | /* |
706 | 706 | * We aren't outputting the form for a hook, but a template form for this |
@@ -716,7 +716,7 @@ discard block |
||
716 | 716 | |
717 | 717 | ?> |
718 | 718 | |
719 | - <div id="hook-<?php echo esc_html( $options['_id_slug'] ); ?>_<?php echo esc_attr( $id_format ); ?>" class="hook <?php echo esc_attr( $options['_classname'] ); ?>"> |
|
719 | + <div id="hook-<?php echo esc_html( $options[ '_id_slug' ] ); ?>_<?php echo esc_attr( $id_format ); ?>" class="hook <?php echo esc_attr( $options[ '_classname' ] ); ?>"> |
|
720 | 720 | <div class="hook-top"> |
721 | 721 | <div class="hook-title-action"> |
722 | 722 | <a class="hook-action hide-if-no-js" href="#available-hooks"></a> |
@@ -741,8 +741,8 @@ discard block |
||
741 | 741 | |
742 | 742 | <input type="hidden" name="hook-id" class="hook-id" value="<?php echo esc_attr( $id_format ); ?>" /> |
743 | 743 | <input type="hidden" name="id_base" class="id_base" value="<?php echo esc_attr( $id_base ); ?>" /> |
744 | - <input type="hidden" name="hook-width" class="hook-width" value="<?php echo isset( $options['width'] ) ? esc_attr( $options['width'] ) : ''; ?>" /> |
|
745 | - <input type="hidden" name="hook-height" class="hook-height" value="<?php echo isset( $options['height'] ) ? esc_attr( $options['height'] ) : ''; ?>" /> |
|
744 | + <input type="hidden" name="hook-width" class="hook-width" value="<?php echo isset( $options[ 'width' ] ) ? esc_attr( $options[ 'width' ] ) : ''; ?>" /> |
|
745 | + <input type="hidden" name="hook-height" class="hook-height" value="<?php echo isset( $options[ 'height' ] ) ? esc_attr( $options[ 'height' ] ) : ''; ?>" /> |
|
746 | 746 | <input type="hidden" name="hook_number" class="hook_number" value="<?php echo esc_attr( $number ); ?>" /> |
747 | 747 | <input type="hidden" name="multi_number" class="multi_number" value="<?php echo esc_attr( $multi_number ); ?>" /> |
748 | 748 | <input type="hidden" name="add_new" class="add_new" value="<?php echo esc_attr( $add_new ); ?>" /> |
@@ -762,8 +762,8 @@ discard block |
||
762 | 762 | </div> |
763 | 763 | |
764 | 764 | <div class="hook-description"> |
765 | - <?php if ( ! empty( $options['description'] ) ) : ?> |
|
766 | - <?php echo esc_html( $options['description'] ); ?> |
|
765 | + <?php if ( ! empty( $options[ 'description' ] ) ) : ?> |
|
766 | + <?php echo esc_html( $options[ 'description' ] ); ?> |
|
767 | 767 | <?php endif; ?> |
768 | 768 | </div> |
769 | 769 | </div> |
@@ -220,19 +220,19 @@ discard block |
||
220 | 220 | |
221 | 221 | $points_type = wordpoints_get_points_type( $type ); |
222 | 222 | |
223 | - if ( isset( $points_type['prefix'] ) ) { |
|
223 | + if ( isset( $points_type[ 'prefix' ] ) ) { |
|
224 | 224 | |
225 | 225 | if ( $points < 0 ) { |
226 | 226 | |
227 | 227 | $points = abs( $points ); |
228 | - $points_type['prefix'] = '-' . $points_type['prefix']; |
|
228 | + $points_type[ 'prefix' ] = '-' . $points_type[ 'prefix' ]; |
|
229 | 229 | } |
230 | 230 | |
231 | - $formatted = esc_html( $points_type['prefix'] . $points ); |
|
231 | + $formatted = esc_html( $points_type[ 'prefix' ] . $points ); |
|
232 | 232 | } |
233 | 233 | |
234 | - if ( isset( $points_type['suffix'] ) ) { |
|
235 | - $formatted = $formatted . esc_html( $points_type['suffix'] ); |
|
234 | + if ( isset( $points_type[ 'suffix' ] ) ) { |
|
235 | + $formatted = $formatted . esc_html( $points_type[ 'suffix' ] ); |
|
236 | 236 | } |
237 | 237 | |
238 | 238 | return $formatted; |
@@ -255,11 +255,11 @@ discard block |
||
255 | 255 | |
256 | 256 | foreach ( wordpoints_get_points_types() as $slug => $settings ) { |
257 | 257 | |
258 | - $points_types[ $slug ] = $settings['name']; |
|
258 | + $points_types[ $slug ] = $settings[ 'name' ]; |
|
259 | 259 | } |
260 | 260 | |
261 | - if ( isset( $args['options'] ) && is_array( $args['options'] ) ) { |
|
262 | - $points_types = $args['options'] + $points_types; |
|
261 | + if ( isset( $args[ 'options' ] ) && is_array( $args[ 'options' ] ) ) { |
|
262 | + $points_types = $args[ 'options' ] + $points_types; |
|
263 | 263 | } |
264 | 264 | |
265 | 265 | $dropdown = new WordPoints_Dropdown_Builder( $points_types, $args ); |
@@ -284,7 +284,7 @@ discard block |
||
284 | 284 | |
285 | 285 | // If the user is being deleted from all blogs on multisite. |
286 | 286 | if ( is_multisite() && ! get_userdata( $user_id ) ) { |
287 | - $query_args['blog_id'] = 0; |
|
287 | + $query_args[ 'blog_id' ] = 0; |
|
288 | 288 | } |
289 | 289 | |
290 | 290 | // Delete log meta. |
@@ -296,8 +296,8 @@ discard block |
||
296 | 296 | |
297 | 297 | $where = array( 'user_id' => $user_id ); |
298 | 298 | |
299 | - if ( ! isset( $query_args['blog_id'] ) ) { |
|
300 | - $where['blog_id'] = $wpdb->blogid; |
|
299 | + if ( ! isset( $query_args[ 'blog_id' ] ) ) { |
|
300 | + $where[ 'blog_id' ] = $wpdb->blogid; |
|
301 | 301 | } |
302 | 302 | |
303 | 303 | // Now delete the logs. |
@@ -408,7 +408,7 @@ discard block |
||
408 | 408 | ); |
409 | 409 | |
410 | 410 | if ( is_wordpoints_network_active() ) { |
411 | - $groups[] = 'wordpoints_points_top_users'; |
|
411 | + $groups[ ] = 'wordpoints_points_top_users'; |
|
412 | 412 | } |
413 | 413 | |
414 | 414 | wp_cache_add_global_groups( $groups ); |
@@ -582,9 +582,9 @@ discard block |
||
582 | 582 | |
583 | 583 | foreach ( $reactions as $i => $reaction ) { |
584 | 584 | |
585 | - $reaction['reactor'] = 'points'; |
|
586 | - $reaction['points_type'] = $points_type; |
|
587 | - $reaction['disable'] = true; |
|
585 | + $reaction[ 'reactor' ] = 'points'; |
|
586 | + $reaction[ 'points_type' ] = $points_type; |
|
587 | + $reaction[ 'disable' ] = true; |
|
588 | 588 | |
589 | 589 | $reaction_store->create_reaction( $reaction ); |
590 | 590 | } |
@@ -185,12 +185,12 @@ discard block |
||
185 | 185 | |
186 | 186 | $this->table_name = $wpdb->wordpoints_points_logs; |
187 | 187 | |
188 | - $this->columns['points_type']['values'] = array_keys( |
|
188 | + $this->columns[ 'points_type' ][ 'values' ] = array_keys( |
|
189 | 189 | wordpoints_get_points_types() |
190 | 190 | ); |
191 | 191 | |
192 | - $this->defaults['order_by'] = 'date'; |
|
193 | - $this->defaults['text__compare'] = 'LIKE'; |
|
192 | + $this->defaults[ 'order_by' ] = 'date'; |
|
193 | + $this->defaults[ 'text__compare' ] = 'LIKE'; |
|
194 | 194 | |
195 | 195 | // Back-compat for pre-2.3.0, in case an object or string is passed. |
196 | 196 | $args = wp_parse_args( $args ); |
@@ -225,7 +225,7 @@ discard block |
||
225 | 225 | protected function convert_deprecated_arg_values( $args ) { |
226 | 226 | |
227 | 227 | // Back-compat for pre-2.3.0, when the fields arg supported 'all'. |
228 | - if ( isset( $args['fields'] ) && 'all' === $args['fields'] ) { |
|
228 | + if ( isset( $args[ 'fields' ] ) && 'all' === $args[ 'fields' ] ) { |
|
229 | 229 | |
230 | 230 | _deprecated_argument( |
231 | 231 | __METHOD__ |
@@ -233,11 +233,11 @@ discard block |
||
233 | 233 | , esc_html( "Passing 'fields' => 'all' is deprecated, just omit the 'fields' arg instead, since all fields returned by default." ) |
234 | 234 | ); |
235 | 235 | |
236 | - unset( $args['fields'] ); |
|
236 | + unset( $args[ 'fields' ] ); |
|
237 | 237 | } |
238 | 238 | |
239 | 239 | // Back-compat for pre-2.3.0, when the orderby arg supported 'none'. |
240 | - if ( isset( $args['orderby'] ) && 'none' === $args['orderby'] ) { |
|
240 | + if ( isset( $args[ 'orderby' ] ) && 'none' === $args[ 'orderby' ] ) { |
|
241 | 241 | |
242 | 242 | _deprecated_argument( |
243 | 243 | __METHOD__ |
@@ -245,8 +245,8 @@ discard block |
||
245 | 245 | , esc_html( "Passing 'orderby' => 'none' is deprecated, pass 'order_by' => null instead." ) |
246 | 246 | ); |
247 | 247 | |
248 | - $args['order_by'] = null; |
|
249 | - unset( $args['orderby'] ); |
|
248 | + $args[ 'order_by' ] = null; |
|
249 | + unset( $args[ 'orderby' ] ); |
|
250 | 250 | |
251 | 251 | return $args; |
252 | 252 | } |
@@ -369,7 +369,7 @@ discard block |
||
369 | 369 | if ( false !== $cache ) { |
370 | 370 | return array_slice( |
371 | 371 | $cache |
372 | - , $offset - $this->args['offset'] |
|
372 | + , $offset - $this->args[ 'offset' ] |
|
373 | 373 | , $per_page |
374 | 374 | ); |
375 | 375 | } |
@@ -378,14 +378,14 @@ discard block |
||
378 | 378 | // Stash the args so we can restore them later. |
379 | 379 | $args = $this->args; |
380 | 380 | |
381 | - $this->args['offset'] += $offset; |
|
381 | + $this->args[ 'offset' ] += $offset; |
|
382 | 382 | |
383 | - if ( ! empty( $this->args['limit'] ) ) { |
|
384 | - $this->args['limit'] -= $offset; |
|
383 | + if ( ! empty( $this->args[ 'limit' ] ) ) { |
|
384 | + $this->args[ 'limit' ] -= $offset; |
|
385 | 385 | } |
386 | 386 | |
387 | - if ( empty( $this->args['limit'] ) || $this->args['limit'] > $per_page ) { |
|
388 | - $this->args['limit'] = $per_page; |
|
387 | + if ( empty( $this->args[ 'limit' ] ) || $this->args[ 'limit' ] > $per_page ) { |
|
388 | + $this->args[ 'limit' ] = $per_page; |
|
389 | 389 | } |
390 | 390 | |
391 | 391 | // Regenerate the query limit after changing the offset and limit args. |
@@ -468,8 +468,8 @@ discard block |
||
468 | 468 | '%user_id%', |
469 | 469 | ) |
470 | 470 | , array( |
471 | - isset( $this->args['points_type'] ) ? $this->args['points_type'] : '', |
|
472 | - isset( $this->args['user_id'] ) ? $this->args['user_id'] : 0, |
|
471 | + isset( $this->args[ 'points_type' ] ) ? $this->args[ 'points_type' ] : '', |
|
472 | + isset( $this->args[ 'user_id' ] ) ? $this->args[ 'user_id' ] : 0, |
|
473 | 473 | ) |
474 | 474 | , $key |
475 | 475 | ); |
@@ -95,7 +95,7 @@ discard block |
||
95 | 95 | continue; |
96 | 96 | } |
97 | 97 | |
98 | - $ranks[] = self::prepare_rank( $rank ); |
|
98 | + $ranks[ ] = self::prepare_rank( $rank ); |
|
99 | 99 | } |
100 | 100 | |
101 | 101 | return $ranks; |
@@ -287,7 +287,7 @@ discard block |
||
287 | 287 | private function verify_request( $action ) { |
288 | 288 | |
289 | 289 | if ( |
290 | - empty( $_POST['nonce'] ) |
|
290 | + empty( $_POST[ 'nonce' ] ) |
|
291 | 291 | || ! wordpoints_verify_nonce( 'nonce', $action, null, 'post' ) |
292 | 292 | ) { |
293 | 293 | wp_send_json_error( |
@@ -305,11 +305,11 @@ discard block |
||
305 | 305 | */ |
306 | 306 | private function get_group() { |
307 | 307 | |
308 | - if ( ! isset( $_POST['group'] ) ) { // WPCS: CSRF OK. |
|
308 | + if ( ! isset( $_POST[ 'group' ] ) ) { // WPCS: CSRF OK. |
|
309 | 309 | $this->unexpected_error( 'group' ); |
310 | 310 | } |
311 | 311 | |
312 | - $group = WordPoints_Rank_Groups::get_group( sanitize_key( $_POST['group'] ) ); // WPCS: CSRF OK. |
|
312 | + $group = WordPoints_Rank_Groups::get_group( sanitize_key( $_POST[ 'group' ] ) ); // WPCS: CSRF OK. |
|
313 | 313 | |
314 | 314 | if ( ! $group ) { |
315 | 315 | wp_send_json_error( array( 'message' => __( 'The rank group passed to the server is invalid. Perhaps it has been deleted. Try reloading the page.', 'wordpoints' ) ) ); |
@@ -327,11 +327,11 @@ discard block |
||
327 | 327 | */ |
328 | 328 | private function get_rank() { |
329 | 329 | |
330 | - if ( ! isset( $_POST['id'] ) ) { // WPCS: CSRF OK. |
|
330 | + if ( ! isset( $_POST[ 'id' ] ) ) { // WPCS: CSRF OK. |
|
331 | 331 | $this->unexpected_error( 'id' ); |
332 | 332 | } |
333 | 333 | |
334 | - $rank = wordpoints_get_rank( wordpoints_int( $_POST['id'] ) ); // WPCS: CSRF OK. |
|
334 | + $rank = wordpoints_get_rank( wordpoints_int( $_POST[ 'id' ] ) ); // WPCS: CSRF OK. |
|
335 | 335 | |
336 | 336 | if ( ! $rank ) { |
337 | 337 | wp_send_json_error( array( 'message' => __( 'The rank ID passed to the server is invalid. Perhaps it has been deleted. Try reloading the page.', 'wordpoints' ) ) ); |
@@ -351,8 +351,8 @@ discard block |
||
351 | 351 | |
352 | 352 | $name = ''; |
353 | 353 | |
354 | - if ( ! empty( $_POST['name'] ) ) { // WPCS: CSRF OK. |
|
355 | - $name = sanitize_text_field( wp_unslash( $_POST['name'] ) ); // WPCS: CSRF OK. |
|
354 | + if ( ! empty( $_POST[ 'name' ] ) ) { // WPCS: CSRF OK. |
|
355 | + $name = sanitize_text_field( wp_unslash( $_POST[ 'name' ] ) ); // WPCS: CSRF OK. |
|
356 | 356 | } |
357 | 357 | |
358 | 358 | if ( ! $name ) { |
@@ -376,11 +376,11 @@ discard block |
||
376 | 376 | */ |
377 | 377 | private function get_rank_type() { |
378 | 378 | |
379 | - if ( empty( $_POST['type'] ) ) { // WPCS: CSRF OK. |
|
379 | + if ( empty( $_POST[ 'type' ] ) ) { // WPCS: CSRF OK. |
|
380 | 380 | $this->unexpected_error( 'type' ); |
381 | 381 | } |
382 | 382 | |
383 | - $type = sanitize_text_field( wp_unslash( $_POST['type'] ) ); // WPCS: CSRF OK. |
|
383 | + $type = sanitize_text_field( wp_unslash( $_POST[ 'type' ] ) ); // WPCS: CSRF OK. |
|
384 | 384 | |
385 | 385 | if ( ! WordPoints_Rank_Types::is_type_registered( $type ) ) { |
386 | 386 | wp_send_json_error( array( 'message' => __( 'That rank type was not recognized. It may no longer be available. Try reloading the page.', 'wordpoints' ) ) ); |
@@ -401,13 +401,13 @@ discard block |
||
401 | 401 | private function get_rank_position() { |
402 | 402 | |
403 | 403 | if ( |
404 | - ! isset( $_POST['order'] ) // WPCS: CSRF OK. |
|
405 | - || false === wordpoints_int( $_POST['order'] ) // WPCS: CSRF OK. |
|
404 | + ! isset( $_POST[ 'order' ] ) // WPCS: CSRF OK. |
|
405 | + || false === wordpoints_int( $_POST[ 'order' ] ) // WPCS: CSRF OK. |
|
406 | 406 | ) { |
407 | 407 | $this->unexpected_error( 'order' ); |
408 | 408 | } |
409 | 409 | |
410 | - return (int) $_POST['order']; |
|
410 | + return (int) $_POST[ 'order' ]; |
|
411 | 411 | } |
412 | 412 | |
413 | 413 | /** |
@@ -305,7 +305,8 @@ discard block |
||
305 | 305 | */ |
306 | 306 | private function get_group() { |
307 | 307 | |
308 | - if ( ! isset( $_POST['group'] ) ) { // WPCS: CSRF OK. |
|
308 | + if ( ! isset( $_POST['group'] ) ) { |
|
309 | +// WPCS: CSRF OK. |
|
309 | 310 | $this->unexpected_error( 'group' ); |
310 | 311 | } |
311 | 312 | |
@@ -327,7 +328,8 @@ discard block |
||
327 | 328 | */ |
328 | 329 | private function get_rank() { |
329 | 330 | |
330 | - if ( ! isset( $_POST['id'] ) ) { // WPCS: CSRF OK. |
|
331 | + if ( ! isset( $_POST['id'] ) ) { |
|
332 | +// WPCS: CSRF OK. |
|
331 | 333 | $this->unexpected_error( 'id' ); |
332 | 334 | } |
333 | 335 | |
@@ -351,7 +353,8 @@ discard block |
||
351 | 353 | |
352 | 354 | $name = ''; |
353 | 355 | |
354 | - if ( ! empty( $_POST['name'] ) ) { // WPCS: CSRF OK. |
|
356 | + if ( ! empty( $_POST['name'] ) ) { |
|
357 | +// WPCS: CSRF OK. |
|
355 | 358 | $name = sanitize_text_field( wp_unslash( $_POST['name'] ) ); // WPCS: CSRF OK. |
356 | 359 | } |
357 | 360 | |
@@ -376,7 +379,8 @@ discard block |
||
376 | 379 | */ |
377 | 380 | private function get_rank_type() { |
378 | 381 | |
379 | - if ( empty( $_POST['type'] ) ) { // WPCS: CSRF OK. |
|
382 | + if ( empty( $_POST['type'] ) ) { |
|
383 | +// WPCS: CSRF OK. |
|
380 | 384 | $this->unexpected_error( 'type' ); |
381 | 385 | } |
382 | 386 |
@@ -97,8 +97,8 @@ discard block |
||
97 | 97 | |
98 | 98 | $this->table_name = $wpdb->wordpoints_user_ranks; |
99 | 99 | |
100 | - $this->defaults['blog_id'] = $wpdb->blogid; |
|
101 | - $this->defaults['site_id'] = $wpdb->siteid; |
|
100 | + $this->defaults[ 'blog_id' ] = $wpdb->blogid; |
|
101 | + $this->defaults[ 'site_id' ] = $wpdb->siteid; |
|
102 | 102 | |
103 | 103 | parent::__construct( $args ); |
104 | 104 | } |
@@ -140,10 +140,10 @@ discard block |
||
140 | 140 | public function maybe_fill_in_base_rank_for_users( $rank_id = null ) { |
141 | 141 | |
142 | 142 | if ( ! isset( $rank_id ) ) { |
143 | - if ( ! isset( $this->args['rank_id'] ) ) { |
|
143 | + if ( ! isset( $this->args[ 'rank_id' ] ) ) { |
|
144 | 144 | return true; |
145 | 145 | } else { |
146 | - $rank_id = $this->args['rank_id']; |
|
146 | + $rank_id = $this->args[ 'rank_id' ]; |
|
147 | 147 | } |
148 | 148 | } |
149 | 149 |