@@ -171,6 +171,7 @@ |
||
| 171 | 171 | * |
| 172 | 172 | * @since 2.4.0 |
| 173 | 173 | * |
| 174 | + * @param string[] $post_types |
|
| 174 | 175 | * @return array The slugs of the events. |
| 175 | 176 | */ |
| 176 | 177 | protected function get_reversal_log_types( $post_types ) { |
@@ -50,8 +50,8 @@ discard block |
||
| 50 | 50 | |
| 51 | 51 | $post_publish_log_id = min( array_keys( $original_log_ids ) ); |
| 52 | 52 | $post_update_log_id = max( array_keys( $original_log_ids ) ); |
| 53 | - $post_publish_reverse_log_id = $original_log_ids[ $post_publish_log_id ]; |
|
| 54 | - $post_update_reverse_log_id = $original_log_ids[ $post_update_log_id ]; |
|
| 53 | + $post_publish_reverse_log_id = $original_log_ids[$post_publish_log_id]; |
|
| 54 | + $post_update_reverse_log_id = $original_log_ids[$post_update_log_id]; |
|
| 55 | 55 | |
| 56 | 56 | $query = new WordPoints_Points_Logs_Query( |
| 57 | 57 | array( 'id__in' => array( $post_publish_reverse_log_id ) ) |
@@ -105,18 +105,18 @@ discard block |
||
| 105 | 105 | |
| 106 | 106 | foreach ( $post_ids as $post_id ) { |
| 107 | 107 | |
| 108 | - if ( ! isset( $legacy_logs[ $post_id ] ) ) { |
|
| 108 | + if ( ! isset( $legacy_logs[$post_id] ) ) { |
|
| 109 | 109 | continue; |
| 110 | 110 | } |
| 111 | 111 | |
| 112 | - array_map( array( $this, 'revert_log' ), $legacy_logs[ $post_id ] ); |
|
| 112 | + array_map( array( $this, 'revert_log' ), $legacy_logs[$post_id] ); |
|
| 113 | 113 | |
| 114 | 114 | $logs_to_delete = array_merge( |
| 115 | 115 | $logs_to_delete |
| 116 | - , wp_list_pluck( $legacy_logs[ $post_id ], 'id' ) |
|
| 116 | + , wp_list_pluck( $legacy_logs[$post_id], 'id' ) |
|
| 117 | 117 | ); |
| 118 | 118 | |
| 119 | - unset( $legacy_logs[ $post_id ] ); |
|
| 119 | + unset( $legacy_logs[$post_id] ); |
|
| 120 | 120 | } |
| 121 | 121 | |
| 122 | 122 | foreach ( $legacy_logs as $logs ) { |
@@ -178,7 +178,7 @@ discard block |
||
| 178 | 178 | $event_slugs = array(); |
| 179 | 179 | |
| 180 | 180 | foreach ( $post_types as $slug ) { |
| 181 | - $event_slugs[ "reverse-post_publish\\{$slug}" ] = true; |
|
| 181 | + $event_slugs["reverse-post_publish\\{$slug}"] = true; |
|
| 182 | 182 | } |
| 183 | 183 | |
| 184 | 184 | return $event_slugs; |
@@ -234,7 +234,7 @@ discard block |
||
| 234 | 234 | , true |
| 235 | 235 | ); |
| 236 | 236 | |
| 237 | - $original_log_ids[ $original_log_id ] = $log_id; |
|
| 237 | + $original_log_ids[$original_log_id] = $log_id; |
|
| 238 | 238 | } |
| 239 | 239 | |
| 240 | 240 | return $original_log_ids; |
@@ -372,7 +372,7 @@ discard block |
||
| 372 | 372 | , true |
| 373 | 373 | ); |
| 374 | 374 | |
| 375 | - $reversal_logs[ $original_log_id ] = $log; |
|
| 375 | + $reversal_logs[$original_log_id] = $log; |
|
| 376 | 376 | } |
| 377 | 377 | |
| 378 | 378 | foreach ( $other_logs as $index => $log ) { |
@@ -381,11 +381,11 @@ discard block |
||
| 381 | 381 | // of its occurrence, it is almost certainly the result of another |
| 382 | 382 | // update, and it is just cluttering things up. |
| 383 | 383 | if ( |
| 384 | - isset( $reversal_logs[ $log->id ] ) |
|
| 385 | - && strtotime( $reversal_logs[ $log->id ]->date ) - strtotime( $log->date ) < 2 |
|
| 384 | + isset( $reversal_logs[$log->id] ) |
|
| 385 | + && strtotime( $reversal_logs[$log->id]->date ) - strtotime( $log->date ) < 2 |
|
| 386 | 386 | ) { |
| 387 | 387 | $logs_to_delete[] = $log->id; |
| 388 | - $logs_to_delete[] = $reversal_logs[ $log->id ]->id; |
|
| 388 | + $logs_to_delete[] = $reversal_logs[$log->id]->id; |
|
| 389 | 389 | } |
| 390 | 390 | } |
| 391 | 391 | |
@@ -466,7 +466,7 @@ discard block |
||
| 466 | 466 | , true |
| 467 | 467 | ); |
| 468 | 468 | |
| 469 | - $legacy_logs[ $post_id ][] = $legacy_log; |
|
| 469 | + $legacy_logs[$post_id][] = $legacy_log; |
|
| 470 | 470 | } |
| 471 | 471 | |
| 472 | 472 | return $legacy_logs; |
@@ -368,7 +368,7 @@ discard block |
||
| 368 | 368 | * |
| 369 | 369 | * @since 1.7.0 |
| 370 | 370 | * |
| 371 | - * @return int|false The ID of the rank, or false if not found. |
|
| 371 | + * @return integer The ID of the rank, or false if not found. |
|
| 372 | 372 | */ |
| 373 | 373 | public function get_base_rank() { |
| 374 | 374 | |
@@ -402,7 +402,7 @@ discard block |
||
| 402 | 402 | * |
| 403 | 403 | * @param int $rank_id The ID of the rank to get the position of. |
| 404 | 404 | * |
| 405 | - * @return int|false The rank's position, or false. |
|
| 405 | + * @return integer The rank's position, or false. |
|
| 406 | 406 | */ |
| 407 | 407 | public function get_rank_position( $rank_id ) { |
| 408 | 408 | |
@@ -83,8 +83,8 @@ discard block |
||
| 83 | 83 | |
| 84 | 84 | if ( isset( $this->$key ) ) { |
| 85 | 85 | return $this->$key; |
| 86 | - } elseif ( isset( $this->data[ $key ] ) ) { |
|
| 87 | - return $this->data[ $key ]; |
|
| 86 | + } elseif ( isset( $this->data[$key] ) ) { |
|
| 87 | + return $this->data[$key]; |
|
| 88 | 88 | } else { |
| 89 | 89 | return null; |
| 90 | 90 | } |
@@ -128,7 +128,7 @@ discard block |
||
| 128 | 128 | return false; |
| 129 | 129 | } |
| 130 | 130 | |
| 131 | - return isset( $this->types[ $type ] ); |
|
| 131 | + return isset( $this->types[$type] ); |
|
| 132 | 132 | } |
| 133 | 133 | |
| 134 | 134 | /** |
@@ -146,11 +146,11 @@ discard block |
||
| 146 | 146 | return false; |
| 147 | 147 | } |
| 148 | 148 | |
| 149 | - if ( isset( $this->types[ $type ] ) ) { |
|
| 149 | + if ( isset( $this->types[$type] ) ) { |
|
| 150 | 150 | return false; |
| 151 | 151 | } |
| 152 | 152 | |
| 153 | - $this->types[ $type ] = $type; |
|
| 153 | + $this->types[$type] = $type; |
|
| 154 | 154 | |
| 155 | 155 | return true; |
| 156 | 156 | } |
@@ -176,11 +176,11 @@ discard block |
||
| 176 | 176 | return false; |
| 177 | 177 | } |
| 178 | 178 | |
| 179 | - if ( ! isset( $this->types[ $type ] ) ) { |
|
| 179 | + if ( ! isset( $this->types[$type] ) ) { |
|
| 180 | 180 | return false; |
| 181 | 181 | } |
| 182 | 182 | |
| 183 | - unset( $this->types[ $type ] ); |
|
| 183 | + unset( $this->types[$type] ); |
|
| 184 | 184 | |
| 185 | 185 | return true; |
| 186 | 186 | } |
@@ -250,7 +250,7 @@ discard block |
||
| 250 | 250 | |
| 251 | 251 | $ranks = $this->get_ranks(); |
| 252 | 252 | |
| 253 | - unset( $ranks[ $current_position ] ); |
|
| 253 | + unset( $ranks[$current_position] ); |
|
| 254 | 254 | |
| 255 | 255 | ksort( $ranks ); |
| 256 | 256 | |
@@ -295,16 +295,16 @@ discard block |
||
| 295 | 295 | |
| 296 | 296 | $ranks = $this->get_ranks(); |
| 297 | 297 | |
| 298 | - unset( $ranks[ $position ] ); |
|
| 298 | + unset( $ranks[$position] ); |
|
| 299 | 299 | |
| 300 | 300 | if ( ! $this->save_ranks( $ranks ) ) { |
| 301 | 301 | return false; |
| 302 | 302 | } |
| 303 | 303 | |
| 304 | 304 | // Assign the previous rank to users who have this rank. |
| 305 | - if ( isset( $ranks[ $position - 1 ] ) ) { |
|
| 305 | + if ( isset( $ranks[$position - 1] ) ) { |
|
| 306 | 306 | |
| 307 | - $this->move_users_from_rank_to_rank( $rank_id, $ranks[ $position - 1 ] ); |
|
| 307 | + $this->move_users_from_rank_to_rank( $rank_id, $ranks[$position - 1] ); |
|
| 308 | 308 | |
| 309 | 309 | } else { |
| 310 | 310 | |
@@ -316,7 +316,7 @@ discard block |
||
| 316 | 316 | ); |
| 317 | 317 | |
| 318 | 318 | $group_ranks = wp_cache_get( $this->slug, 'wordpoints_user_ranks' ); |
| 319 | - unset( $group_ranks[ $rank_id ] ); |
|
| 319 | + unset( $group_ranks[$rank_id] ); |
|
| 320 | 320 | wp_cache_set( $this->slug, $group_ranks, 'wordpoints_user_ranks' ); |
| 321 | 321 | |
| 322 | 322 | unset( $group_ranks ); |
@@ -388,11 +388,11 @@ discard block |
||
| 388 | 388 | |
| 389 | 389 | $ranks = $this->get_ranks(); |
| 390 | 390 | |
| 391 | - if ( ! isset( $ranks[ $position ] ) ) { |
|
| 391 | + if ( ! isset( $ranks[$position] ) ) { |
|
| 392 | 392 | return false; |
| 393 | 393 | } |
| 394 | 394 | |
| 395 | - return $ranks[ $position ]; |
|
| 395 | + return $ranks[$position]; |
|
| 396 | 396 | } |
| 397 | 397 | |
| 398 | 398 | /** |
@@ -434,7 +434,7 @@ discard block |
||
| 434 | 434 | |
| 435 | 435 | if ( $count === $position ) { |
| 436 | 436 | |
| 437 | - $ranks[ $position ] = $rank_id; |
|
| 437 | + $ranks[$position] = $rank_id; |
|
| 438 | 438 | |
| 439 | 439 | } elseif ( $count < $position ) { |
| 440 | 440 | |
@@ -473,7 +473,7 @@ discard block |
||
| 473 | 473 | |
| 474 | 474 | $group_ranks = wp_cache_get( $this->slug, 'wordpoints_user_ranks' ); |
| 475 | 475 | |
| 476 | - unset( $group_ranks[ $rank_from_id ], $group_ranks[ $rank_to_id ] ); |
|
| 476 | + unset( $group_ranks[$rank_from_id], $group_ranks[$rank_to_id] ); |
|
| 477 | 477 | |
| 478 | 478 | wp_cache_set( $this->slug, $group_ranks, 'wordpoints_user_ranks' ); |
| 479 | 479 | |
@@ -245,8 +245,11 @@ discard block |
||
| 245 | 245 | <p> |
| 246 | 246 | <?php if ( $slug ) : ?> |
| 247 | 247 | <?php esc_html_e( 'Changes to this points type’s settings will affect all sites on this network.', 'wordpoints' ); ?> |
| 248 | - <?php else : ?> |
|
| 249 | - <?php esc_html_e( 'The new points type will be global across all sites on this network.', 'wordpoints' ); ?> |
|
| 248 | + <?php else { |
|
| 249 | + : ?> |
|
| 250 | + <?php esc_html_e( 'The new points type will be global across all sites on this network.', 'wordpoints' ); |
|
| 251 | +} |
|
| 252 | +?> |
|
| 250 | 253 | <?php endif; ?> |
| 251 | 254 | </p> |
| 252 | 255 | </div> |
@@ -655,15 +658,18 @@ discard block |
||
| 655 | 658 | return; |
| 656 | 659 | } |
| 657 | 660 | |
| 658 | - if ( isset( $_POST['save-points-type'] ) ) { // WPCS: CSRF OK |
|
| 661 | + if ( isset( $_POST['save-points-type'] ) ) { |
|
| 662 | +// WPCS: CSRF OK |
|
| 659 | 663 | |
| 660 | - if ( ! empty( $_POST['add_new'] ) ) { // WPCS: CSRF OK |
|
| 664 | + if ( ! empty( $_POST['add_new'] ) ) { |
|
| 665 | +// WPCS: CSRF OK |
|
| 661 | 666 | $this->add_points_type(); |
| 662 | 667 | } else { |
| 663 | 668 | $this->update_points_type(); |
| 664 | 669 | } |
| 665 | 670 | |
| 666 | - } elseif ( ! empty( $_POST['delete-points-type'] ) ) { // WPCS: CSRF OK |
|
| 671 | + } elseif ( ! empty( $_POST['delete-points-type'] ) ) { |
|
| 672 | +// WPCS: CSRF OK |
|
| 667 | 673 | |
| 668 | 674 | $this->delete_points_type(); |
| 669 | 675 | } |
@@ -680,19 +686,22 @@ discard block |
||
| 680 | 686 | |
| 681 | 687 | $settings = array(); |
| 682 | 688 | |
| 683 | - if ( isset( $_POST['points-name'] ) ) { // WPCS: CSRF OK |
|
| 689 | + if ( isset( $_POST['points-name'] ) ) { |
|
| 690 | +// WPCS: CSRF OK |
|
| 684 | 691 | $settings['name'] = trim( |
| 685 | 692 | sanitize_text_field( wp_unslash( $_POST['points-name'] ) ) // WPCS: CSRF OK |
| 686 | 693 | ); |
| 687 | 694 | } |
| 688 | 695 | |
| 689 | - if ( isset( $_POST['points-prefix'] ) ) { // WPCS: CSRF OK |
|
| 696 | + if ( isset( $_POST['points-prefix'] ) ) { |
|
| 697 | +// WPCS: CSRF OK |
|
| 690 | 698 | $settings['prefix'] = ltrim( |
| 691 | 699 | sanitize_text_field( wp_unslash( $_POST['points-prefix'] ) ) // WPCS: CSRF OK |
| 692 | 700 | ); |
| 693 | 701 | } |
| 694 | 702 | |
| 695 | - if ( isset( $_POST['points-suffix'] ) ) { // WPCS: CSRF OK |
|
| 703 | + if ( isset( $_POST['points-suffix'] ) ) { |
|
| 704 | +// WPCS: CSRF OK |
|
| 696 | 705 | $settings['suffix'] = rtrim( |
| 697 | 706 | sanitize_text_field( wp_unslash( $_POST['points-suffix'] ) ) // WPCS: CSRF OK |
| 698 | 707 | ); |
@@ -514,7 +514,7 @@ discard block |
||
| 514 | 514 | |
| 515 | 515 | if ( |
| 516 | 516 | ! array_intersect_key( |
| 517 | - $event_action_types[ $slug ] |
|
| 517 | + $event_action_types[$slug] |
|
| 518 | 518 | , $reactor_action_types |
| 519 | 519 | ) |
| 520 | 520 | ) { |
@@ -567,13 +567,13 @@ discard block |
||
| 567 | 567 | |
| 568 | 568 | foreach ( $this->event_args->get_children( $event_slug ) as $slug => $arg ) { |
| 569 | 569 | |
| 570 | - $event_data['args'][ $slug ] = array( |
|
| 570 | + $event_data['args'][$slug] = array( |
|
| 571 | 571 | 'slug' => $slug, |
| 572 | 572 | ); |
| 573 | 573 | |
| 574 | 574 | if ( $arg instanceof WordPoints_Hook_ArgI ) { |
| 575 | - $event_data['args'][ $slug ]['title'] = $arg->get_title(); |
|
| 576 | - $event_data['args'][ $slug ]['is_stateful'] = $arg->is_stateful(); |
|
| 575 | + $event_data['args'][$slug]['title'] = $arg->get_title(); |
|
| 576 | + $event_data['args'][$slug]['is_stateful'] = $arg->is_stateful(); |
|
| 577 | 577 | } |
| 578 | 578 | } |
| 579 | 579 | |
@@ -628,7 +628,7 @@ discard block |
||
| 628 | 628 | $tabs = array(); |
| 629 | 629 | |
| 630 | 630 | foreach ( $points_types as $slug => $settings ) { |
| 631 | - $tabs[ $slug ] = $settings['name']; |
|
| 631 | + $tabs[$slug] = $settings['name']; |
|
| 632 | 632 | } |
| 633 | 633 | |
| 634 | 634 | $tabs['add-new'] = __( 'Add New', 'wordpoints' ); |
@@ -7,7 +7,8 @@ discard block |
||
| 7 | 7 | * @since 1.0.0 |
| 8 | 8 | */ |
| 9 | 9 | |
| 10 | -if ( ! isset( $_GET['edithook'] ) ) { // WPCS: CSRF OK. |
|
| 10 | +if ( ! isset( $_GET['edithook'] ) ) { |
|
| 11 | +// WPCS: CSRF OK. |
|
| 11 | 12 | return; |
| 12 | 13 | } |
| 13 | 14 | |
@@ -15,7 +16,8 @@ discard block |
||
| 15 | 16 | |
| 16 | 17 | $points_types = wordpoints_get_points_types(); |
| 17 | 18 | |
| 18 | -if ( isset( $_GET['addnew'] ) ) { // WPCS: CSRF OK. |
|
| 19 | +if ( isset( $_GET['addnew'] ) ) { |
|
| 20 | +// WPCS: CSRF OK. |
|
| 19 | 21 | |
| 20 | 22 | // - We are adding a new points hook. |
| 21 | 23 | |
@@ -33,7 +35,8 @@ discard block |
||
| 33 | 35 | return; |
| 34 | 36 | } |
| 35 | 37 | |
| 36 | - if ( isset( $_GET['base'], $_GET['num'] ) ) { // WPCS: CSRF OK. |
|
| 38 | + if ( isset( $_GET['base'], $_GET['num'] ) ) { |
|
| 39 | +// WPCS: CSRF OK. |
|
| 37 | 40 | |
| 38 | 41 | // Copy minimal info from an existing instance of this hook to a new instance. |
| 39 | 42 | $hook = WordPoints_Points_Hooks::get_handler_by_id_base( |
@@ -132,8 +135,11 @@ discard block |
||
| 132 | 135 | <div class="hook-control-actions"> |
| 133 | 136 | <?php if ( isset( $_GET['addnew'] ) ) : /* WPCS: CSRF OK. */ ?> |
| 134 | 137 | <a href="<?php echo esc_url( self_admin_url( 'admin.php?page=wordpoints_points_hooks' ) ); ?>" class="button alignleft"><?php esc_html_e( 'Cancel', 'wordpoints' ); ?></a> |
| 135 | - <?php else : ?> |
|
| 136 | - <?php submit_button( _x( 'Delete', 'points hook', 'wordpoints' ), 'button alignleft', 'removehook', false ); ?> |
|
| 138 | + <?php else { |
|
| 139 | + : ?> |
|
| 140 | + <?php submit_button( _x( 'Delete', 'points hook', 'wordpoints' ), 'button alignleft', 'removehook', false ); |
|
| 141 | +} |
|
| 142 | +?> |
|
| 137 | 143 | <?php endif; ?> |
| 138 | 144 | |
| 139 | 145 | <?php submit_button( __( 'Save Hook', 'wordpoints' ), 'button-primary alignright', 'savehook', false ); ?> |
@@ -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 | |
@@ -67,7 +67,7 @@ discard block |
||
| 67 | 67 | $ranks = array(); |
| 68 | 68 | |
| 69 | 69 | foreach ( $rank_groups as $group ) { |
| 70 | - $ranks[ $group->slug ] = self::prepare_group_ranks( $group ); |
|
| 70 | + $ranks[$group->slug] = self::prepare_group_ranks( $group ); |
|
| 71 | 71 | } |
| 72 | 72 | |
| 73 | 73 | return $ranks; |
@@ -503,7 +503,7 @@ discard block |
||
| 503 | 503 | $rank_type = WordPoints_Rank_Types::get_type( $rank->type ); |
| 504 | 504 | |
| 505 | 505 | foreach ( $rank_type->get_meta_fields() as $field => $data ) { |
| 506 | - $prepared_rank[ $field ] = $rank->{$field}; |
|
| 506 | + $prepared_rank[$field] = $rank->{$field}; |
|
| 507 | 507 | } |
| 508 | 508 | |
| 509 | 509 | return $prepared_rank; |
@@ -222,8 +222,11 @@ |
||
| 222 | 222 | name="<?php echo esc_attr( $name ); ?>" |
| 223 | 223 | <?php if ( $args['placeholders'] && 'hidden' !== $field['type'] ) : ?> |
| 224 | 224 | value="<% if ( typeof <?php echo preg_replace( '/[^a-z0-9_]/i', '', $name ); /* WPCS XSS OK. */ ?> !== "undefined" ) { print( <?php echo preg_replace( '/[^a-z0-9_]/i', '', $name ); /* WPCS XSS OK. */ ?> ); } %>" |
| 225 | - <?php else : ?> |
|
| 226 | - value="<?php echo esc_attr( $value ); ?>" |
|
| 225 | + <?php else { |
|
| 226 | + : ?> |
|
| 227 | + value="<?php echo esc_attr( $value ); |
|
| 228 | +} |
|
| 229 | +?>" |
|
| 227 | 230 | <?php endif; ?> |
| 228 | 231 | class="widefat" |
| 229 | 232 | /> |
@@ -199,8 +199,8 @@ discard block |
||
| 199 | 199 | $value = $field['default']; |
| 200 | 200 | |
| 201 | 201 | // If the value is set use that instead. |
| 202 | - if ( isset( $meta[ $name ] ) ) { |
|
| 203 | - $value = $meta[ $name ]; |
|
| 202 | + if ( isset( $meta[$name] ) ) { |
|
| 203 | + $value = $meta[$name]; |
|
| 204 | 204 | } |
| 205 | 205 | } |
| 206 | 206 | |
@@ -332,7 +332,7 @@ discard block |
||
| 332 | 332 | continue; |
| 333 | 333 | } |
| 334 | 334 | |
| 335 | - $user_ranks[ $user_id ] = $new_rank->ID; |
|
| 335 | + $user_ranks[$user_id] = $new_rank->ID; |
|
| 336 | 336 | } |
| 337 | 337 | } |
| 338 | 338 | |
@@ -425,7 +425,7 @@ discard block |
||
| 425 | 425 | continue; |
| 426 | 426 | } |
| 427 | 427 | |
| 428 | - $user_ranks[ $user_id ] = $new_rank->ID; |
|
| 428 | + $user_ranks[$user_id] = $new_rank->ID; |
|
| 429 | 429 | } |
| 430 | 430 | } |
| 431 | 431 | |
@@ -925,7 +925,8 @@ discard block |
||
| 925 | 925 | |
| 926 | 926 | $tab = ''; |
| 927 | 927 | |
| 928 | - if ( isset( $_GET['tab'] ) ) { // WPCS: CSRF OK. |
|
| 928 | + if ( isset( $_GET['tab'] ) ) { |
|
| 929 | +// WPCS: CSRF OK. |
|
| 929 | 930 | |
| 930 | 931 | $tab = sanitize_key( $_GET['tab'] ); // WPCS: CSRF OK. |
| 931 | 932 | } |
@@ -964,7 +965,8 @@ discard block |
||
| 964 | 965 | |
| 965 | 966 | $page = ''; |
| 966 | 967 | |
| 967 | - if ( isset( $_GET['page'] ) ) { // WPCS: CSRF OK. |
|
| 968 | + if ( isset( $_GET['page'] ) ) { |
|
| 969 | +// WPCS: CSRF OK. |
|
| 968 | 970 | $page = sanitize_key( $_GET['page'] ); // WPCS: CSRF OK. |
| 969 | 971 | } |
| 970 | 972 | |
@@ -1360,9 +1362,12 @@ discard block |
||
| 1360 | 1362 | > |
| 1361 | 1363 | <?php esc_html_e( 'Update now', 'wordpoints' ); ?> |
| 1362 | 1364 | </a> |
| 1363 | - <?php else : ?> |
|
| 1365 | + <?php else { |
|
| 1366 | + : ?> |
|
| 1364 | 1367 | <em> |
| 1365 | - <?php esc_html_e( 'Automatic update is unavailable for this extension.', 'wordpoints' ); ?> |
|
| 1368 | + <?php esc_html_e( 'Automatic update is unavailable for this extension.', 'wordpoints' ); |
|
| 1369 | +} |
|
| 1370 | +?> |
|
| 1366 | 1371 | </em> |
| 1367 | 1372 | <?php endif; ?> |
| 1368 | 1373 | <?php endif; ?> |
@@ -1711,8 +1716,11 @@ discard block |
||
| 1711 | 1716 | ?> |
| 1712 | 1717 | <a href="<?php echo esc_url( $license->get_renewal_url() ); ?>" aria-label="<?php echo esc_attr( sprintf( $aria_label, $extension['name'] ) ); ?>"><?php esc_html_e( 'Renew License', 'wordpoints' ); ?></a> |
| 1713 | 1718 | <?php endif; ?> |
| 1714 | - <?php else : ?> |
|
| 1715 | - <?php esc_html_e( 'This license key is expired.', 'wordpoints' ); ?> |
|
| 1719 | + <?php else { |
|
| 1720 | + : ?> |
|
| 1721 | + <?php esc_html_e( 'This license key is expired.', 'wordpoints' ); |
|
| 1722 | +} |
|
| 1723 | +?> |
|
| 1716 | 1724 | <?php endif; ?> |
| 1717 | 1725 | <?php endif; ?> |
| 1718 | 1726 | <?php endif; ?> |
@@ -1738,7 +1746,8 @@ discard block |
||
| 1738 | 1746 | wp_die( esc_html__( 'Sorry, you are not allowed to update WordPoints extensions for this site.', 'wordpoints' ), 403 ); |
| 1739 | 1747 | } |
| 1740 | 1748 | |
| 1741 | - if ( empty( $_GET['extension'] ) ) { // WPCS: CSRF OK. |
|
| 1749 | + if ( empty( $_GET['extension'] ) ) { |
|
| 1750 | +// WPCS: CSRF OK. |
|
| 1742 | 1751 | wp_die( esc_html__( 'No extension supplied.', 'wordpoints' ), 200 ); |
| 1743 | 1752 | } |
| 1744 | 1753 | |
@@ -2265,7 +2274,8 @@ discard block |
||
| 2265 | 2274 | */ |
| 2266 | 2275 | function wordpoints_admin_ajax_breaking_module_check() { |
| 2267 | 2276 | |
| 2268 | - if ( ! isset( $_GET['wordpoints_module_check'] ) ) { // WPCS: CSRF OK. |
|
| 2277 | + if ( ! isset( $_GET['wordpoints_module_check'] ) ) { |
|
| 2278 | +// WPCS: CSRF OK. |
|
| 2269 | 2279 | wp_die( '', 400 ); |
| 2270 | 2280 | } |
| 2271 | 2281 | |
@@ -2275,7 +2285,8 @@ discard block |
||
| 2275 | 2285 | $nonce = get_option( 'wordpoints_module_check_nonce' ); |
| 2276 | 2286 | } |
| 2277 | 2287 | |
| 2278 | - if ( ! $nonce || ! hash_equals( $nonce, sanitize_key( $_GET['wordpoints_module_check'] ) ) ) { // WPCS: CSRF OK. |
|
| 2288 | + if ( ! $nonce || ! hash_equals( $nonce, sanitize_key( $_GET['wordpoints_module_check'] ) ) ) { |
|
| 2289 | +// WPCS: CSRF OK. |
|
| 2279 | 2290 | wp_die( '', 403 ); |
| 2280 | 2291 | } |
| 2281 | 2292 | |
@@ -2571,7 +2582,8 @@ discard block |
||
| 2571 | 2582 | |
| 2572 | 2583 | // Don't show them on the extensions screen, because they would be shown before |
| 2573 | 2584 | // license activation notices, etc. |
| 2574 | - if ( isset( $_GET['page'] ) && 'wordpoints_extensions' === $_GET['page'] ) { // WPCS: CSRF OK. |
|
| 2585 | + if ( isset( $_GET['page'] ) && 'wordpoints_extensions' === $_GET['page'] ) { |
|
| 2586 | +// WPCS: CSRF OK. |
|
| 2575 | 2587 | return; |
| 2576 | 2588 | } |
| 2577 | 2589 | |
@@ -641,7 +641,7 @@ discard block |
||
| 641 | 641 | foreach ( $objects as $slug => $object ) { |
| 642 | 642 | |
| 643 | 643 | if ( $object instanceof WordPoints_Hook_UI_Script_Data_ProviderI ) { |
| 644 | - $data[ $slug ] = $object->get_ui_script_data(); |
|
| 644 | + $data[$slug] = $object->get_ui_script_data(); |
|
| 645 | 645 | } |
| 646 | 646 | |
| 647 | 647 | if ( wp_script_is( "wordpoints-hooks-{$type}-{$slug}", 'registered' ) ) { |
@@ -676,21 +676,21 @@ discard block |
||
| 676 | 676 | /** @var WordPoints_EntityishI $child */ |
| 677 | 677 | foreach ( $entity_children->get_children( $slug ) as $child_slug => $child ) { |
| 678 | 678 | |
| 679 | - $child_data[ $child_slug ] = array( |
|
| 679 | + $child_data[$child_slug] = array( |
|
| 680 | 680 | 'slug' => $child_slug, |
| 681 | 681 | 'title' => $child->get_title(), |
| 682 | 682 | ); |
| 683 | 683 | |
| 684 | 684 | if ( $child instanceof WordPoints_Entity_Attr ) { |
| 685 | 685 | |
| 686 | - $child_data[ $child_slug ]['_type'] = 'attr'; |
|
| 687 | - $child_data[ $child_slug ]['data_type'] = $child->get_data_type(); |
|
| 686 | + $child_data[$child_slug]['_type'] = 'attr'; |
|
| 687 | + $child_data[$child_slug]['data_type'] = $child->get_data_type(); |
|
| 688 | 688 | |
| 689 | 689 | } elseif ( $child instanceof WordPoints_Entity_Relationship ) { |
| 690 | 690 | |
| 691 | - $child_data[ $child_slug ]['_type'] = 'relationship'; |
|
| 692 | - $child_data[ $child_slug ]['primary'] = $child->get_primary_entity_slug(); |
|
| 693 | - $child_data[ $child_slug ]['secondary'] = $child->get_related_entity_slug(); |
|
| 691 | + $child_data[$child_slug]['_type'] = 'relationship'; |
|
| 692 | + $child_data[$child_slug]['primary'] = $child->get_primary_entity_slug(); |
|
| 693 | + $child_data[$child_slug]['secondary'] = $child->get_related_entity_slug(); |
|
| 694 | 694 | } |
| 695 | 695 | |
| 696 | 696 | /** |
@@ -701,14 +701,14 @@ discard block |
||
| 701 | 701 | * @param array $data The data for the entity child. |
| 702 | 702 | * @param WordPoints_Entityish $child The child's object. |
| 703 | 703 | */ |
| 704 | - $child_data[ $child_slug ] = apply_filters( |
|
| 704 | + $child_data[$child_slug] = apply_filters( |
|
| 705 | 705 | 'wordpoints_hooks_ui_data_entity_child' |
| 706 | - , $child_data[ $child_slug ] |
|
| 706 | + , $child_data[$child_slug] |
|
| 707 | 707 | , $child |
| 708 | 708 | ); |
| 709 | 709 | } |
| 710 | 710 | |
| 711 | - $entities_data[ $slug ] = array( |
|
| 711 | + $entities_data[$slug] = array( |
|
| 712 | 712 | 'slug' => $slug, |
| 713 | 713 | 'title' => $entity->get_title(), |
| 714 | 714 | 'children' => $child_data, |
@@ -729,7 +729,7 @@ discard block |
||
| 729 | 729 | } |
| 730 | 730 | } |
| 731 | 731 | |
| 732 | - $entities_data[ $slug ]['values'] = $values; |
|
| 732 | + $entities_data[$slug]['values'] = $values; |
|
| 733 | 733 | } |
| 734 | 734 | |
| 735 | 735 | /** |
@@ -738,9 +738,9 @@ discard block |
||
| 738 | 738 | * @param array $data The data for the entity. |
| 739 | 739 | * @param WordPoints_Entity $entity The entity object. |
| 740 | 740 | */ |
| 741 | - $entities_data[ $slug ] = apply_filters( |
|
| 741 | + $entities_data[$slug] = apply_filters( |
|
| 742 | 742 | 'wordpoints_hooks_ui_data_entity' |
| 743 | - , $entities_data[ $slug ] |
|
| 743 | + , $entities_data[$slug] |
|
| 744 | 744 | , $entity |
| 745 | 745 | ); |
| 746 | 746 | |
@@ -773,7 +773,7 @@ discard block |
||
| 773 | 773 | // this, so that we have the action types indexed by event slug. |
| 774 | 774 | foreach ( $event_index as $action_type => $events ) { |
| 775 | 775 | foreach ( $events as $event => $unused ) { |
| 776 | - $event_action_types[ $event ][ $action_type ] = true; |
|
| 776 | + $event_action_types[$event][$action_type] = true; |
|
| 777 | 777 | } |
| 778 | 778 | } |
| 779 | 779 | |
@@ -930,7 +930,7 @@ discard block |
||
| 930 | 930 | $tab = sanitize_key( $_GET['tab'] ); // WPCS: CSRF OK. |
| 931 | 931 | } |
| 932 | 932 | |
| 933 | - if ( isset( $tabs ) && ! isset( $tabs[ $tab ] ) ) { |
|
| 933 | + if ( isset( $tabs ) && ! isset( $tabs[$tab] ) ) { |
|
| 934 | 934 | |
| 935 | 935 | reset( $tabs ); |
| 936 | 936 | $tab = key( $tabs ); |
@@ -957,7 +957,7 @@ discard block |
||
| 957 | 957 | if ( $show_heading ) { |
| 958 | 958 | |
| 959 | 959 | // translators: Current tab name. |
| 960 | - echo '<h1>', esc_html( sprintf( __( 'WordPoints — %s', 'wordpoints' ), $tabs[ $current ] ) ), '</h1>'; |
|
| 960 | + echo '<h1>', esc_html( sprintf( __( 'WordPoints — %s', 'wordpoints' ), $tabs[$current] ) ), '</h1>'; |
|
| 961 | 961 | } |
| 962 | 962 | |
| 963 | 963 | echo '<h2 class="nav-tab-wrapper">'; |
@@ -1431,20 +1431,20 @@ discard block |
||
| 1431 | 1431 | |
| 1432 | 1432 | $url = sanitize_title_with_dashes( $server->get_slug() ); |
| 1433 | 1433 | |
| 1434 | - if ( ! isset( $_POST[ "license_key-{$url}-{$extension['ID']}" ] ) ) { |
|
| 1434 | + if ( ! isset( $_POST["license_key-{$url}-{$extension['ID']}"] ) ) { |
|
| 1435 | 1435 | continue; |
| 1436 | 1436 | } |
| 1437 | 1437 | |
| 1438 | 1438 | $license_key = sanitize_key( |
| 1439 | - $_POST[ "license_key-{$url}-{$extension['ID']}" ] |
|
| 1439 | + $_POST["license_key-{$url}-{$extension['ID']}"] |
|
| 1440 | 1440 | ); |
| 1441 | 1441 | |
| 1442 | 1442 | $license = $api->get_extension_license_object( $extension_data, $license_key ); |
| 1443 | 1443 | |
| 1444 | 1444 | if ( |
| 1445 | 1445 | isset( |
| 1446 | - $_POST[ "activate-license-{$extension['ID']}" ] |
|
| 1447 | - , $_POST[ "wordpoints_activate_license_key-{$extension['ID']}" ] |
|
| 1446 | + $_POST["activate-license-{$extension['ID']}"] |
|
| 1447 | + , $_POST["wordpoints_activate_license_key-{$extension['ID']}"] |
|
| 1448 | 1448 | ) |
| 1449 | 1449 | && wordpoints_verify_nonce( |
| 1450 | 1450 | "wordpoints_activate_license_key-{$extension['ID']}" |
@@ -1489,8 +1489,8 @@ discard block |
||
| 1489 | 1489 | |
| 1490 | 1490 | } elseif ( |
| 1491 | 1491 | isset( |
| 1492 | - $_POST[ "deactivate-license-{$extension['ID']}" ] |
|
| 1493 | - , $_POST[ "wordpoints_deactivate_license_key-{$extension['ID']}" ] |
|
| 1492 | + $_POST["deactivate-license-{$extension['ID']}"] |
|
| 1493 | + , $_POST["wordpoints_deactivate_license_key-{$extension['ID']}"] |
|
| 1494 | 1494 | ) |
| 1495 | 1495 | && wordpoints_verify_nonce( |
| 1496 | 1496 | "wordpoints_deactivate_license_key-{$extension['ID']}" |
@@ -1746,11 +1746,11 @@ discard block |
||
| 1746 | 1746 | |
| 1747 | 1747 | $extensions = wordpoints_get_modules(); |
| 1748 | 1748 | |
| 1749 | - if ( ! isset( $extensions[ $extension_file ] ) ) { |
|
| 1749 | + if ( ! isset( $extensions[$extension_file] ) ) { |
|
| 1750 | 1750 | wp_die( esc_html__( 'That extension does not exist.', 'wordpoints' ), 200 ); |
| 1751 | 1751 | } |
| 1752 | 1752 | |
| 1753 | - $server = wordpoints_get_server_for_extension( $extensions[ $extension_file ] ); |
|
| 1753 | + $server = wordpoints_get_server_for_extension( $extensions[$extension_file] ); |
|
| 1754 | 1754 | |
| 1755 | 1755 | if ( ! $server ) { |
| 1756 | 1756 | wp_die( esc_html__( 'There is no server specified for this extension.', 'wordpoints' ), 200 ); |
@@ -1763,7 +1763,7 @@ discard block |
||
| 1763 | 1763 | } |
| 1764 | 1764 | |
| 1765 | 1765 | $extension_data = new WordPoints_Extension_Server_API_Extension_Data( |
| 1766 | - $extensions[ $extension_file ]['ID'] |
|
| 1766 | + $extensions[$extension_file]['ID'] |
|
| 1767 | 1767 | , $server |
| 1768 | 1768 | ); |
| 1769 | 1769 | |
@@ -2140,7 +2140,7 @@ discard block |
||
| 2140 | 2140 | |
| 2141 | 2141 | foreach ( $merged_extensions as $i => $extension ) { |
| 2142 | 2142 | if ( true !== wordpoints_validate_module( $extension ) ) { |
| 2143 | - unset( $merged_extensions[ $i ] ); |
|
| 2143 | + unset( $merged_extensions[$i] ); |
|
| 2144 | 2144 | } |
| 2145 | 2145 | } |
| 2146 | 2146 | |
@@ -2318,11 +2318,11 @@ discard block |
||
| 2318 | 2318 | // this transient. |
| 2319 | 2319 | $updates = get_site_transient( 'update_plugins' ); |
| 2320 | 2320 | |
| 2321 | - if ( ! isset( $updates->response[ $plugin_basename ] ) ) { |
|
| 2321 | + if ( ! isset( $updates->response[$plugin_basename] ) ) { |
|
| 2322 | 2322 | return false; |
| 2323 | 2323 | } |
| 2324 | 2324 | |
| 2325 | - if ( ! isset( $updates->response[ $plugin_basename ]->wordpoints_required_php ) ) { |
|
| 2325 | + if ( ! isset( $updates->response[$plugin_basename]->wordpoints_required_php ) ) { |
|
| 2326 | 2326 | |
| 2327 | 2327 | /** |
| 2328 | 2328 | * The plugin install functions. |
@@ -2357,13 +2357,13 @@ discard block |
||
| 2357 | 2357 | $version = $matches[1]; |
| 2358 | 2358 | } |
| 2359 | 2359 | |
| 2360 | - $updates->response[ $plugin_basename ]->wordpoints_required_php = $version; |
|
| 2360 | + $updates->response[$plugin_basename]->wordpoints_required_php = $version; |
|
| 2361 | 2361 | |
| 2362 | 2362 | set_site_transient( 'update_plugins', $updates ); |
| 2363 | 2363 | |
| 2364 | 2364 | } // End if ( PHP requirements not in cache ). |
| 2365 | 2365 | |
| 2366 | - return $updates->response[ $plugin_basename ]->wordpoints_required_php; |
|
| 2366 | + return $updates->response[$plugin_basename]->wordpoints_required_php; |
|
| 2367 | 2367 | } |
| 2368 | 2368 | |
| 2369 | 2369 | /** |
@@ -2445,11 +2445,11 @@ discard block |
||
| 2445 | 2445 | // First check that there is actually an update available. |
| 2446 | 2446 | $updates = get_site_transient( 'update_plugins' ); |
| 2447 | 2447 | |
| 2448 | - if ( ! isset( $updates->response[ $file ] ) ) { |
|
| 2448 | + if ( ! isset( $updates->response[$file] ) ) { |
|
| 2449 | 2449 | return; |
| 2450 | 2450 | } |
| 2451 | 2451 | |
| 2452 | - $response = $updates->response[ $file ]; |
|
| 2452 | + $response = $updates->response[$file]; |
|
| 2453 | 2453 | |
| 2454 | 2454 | $wp_list_table = _get_list_table( 'WP_Plugins_List_Table' ); |
| 2455 | 2455 | |
@@ -2553,8 +2553,8 @@ discard block |
||
| 2553 | 2553 | |
| 2554 | 2554 | $plugin_basename = plugin_basename( WORDPOINTS_DIR . '/wordpoints.php' ); |
| 2555 | 2555 | |
| 2556 | - if ( isset( $data->response[ $plugin_basename ] ) ) { |
|
| 2557 | - unset( $data->response[ $plugin_basename ] ); |
|
| 2556 | + if ( isset( $data->response[$plugin_basename] ) ) { |
|
| 2557 | + unset( $data->response[$plugin_basename] ); |
|
| 2558 | 2558 | } |
| 2559 | 2559 | |
| 2560 | 2560 | return $data; |
@@ -487,7 +487,7 @@ discard block |
||
| 487 | 487 | |
| 488 | 488 | $fields = implode( ', ', array_map( 'wordpoints_escape_mysql_identifier', $fields ) ); |
| 489 | 489 | |
| 490 | - $this->select = "SELECT {$fields}"; |
|
| 490 | + $this->select = "select {$fields}"; |
|
| 491 | 491 | } |
| 492 | 492 | |
| 493 | 493 | /** |
@@ -777,7 +777,7 @@ discard block |
||
| 777 | 777 | } |
| 778 | 778 | |
| 779 | 779 | if ( $this->args['limit'] > 0 && $this->args['offset'] >= 0 ) { |
| 780 | - $this->limit = "LIMIT {$this->args['offset']}, {$this->args['limit']}"; |
|
| 780 | + $this->limit = "limit {$this->args['offset']}, {$this->args['limit']}"; |
|
| 781 | 781 | } |
| 782 | 782 | } |
| 783 | 783 | |
@@ -243,7 +243,7 @@ discard block |
||
| 243 | 243 | } |
| 244 | 244 | |
| 245 | 245 | foreach ( $this->deprecated_args as $arg => $data ) { |
| 246 | - if ( isset( $args[ $arg ] ) ) { |
|
| 246 | + if ( isset( $args[$arg] ) ) { |
|
| 247 | 247 | |
| 248 | 248 | _deprecated_argument( |
| 249 | 249 | esc_html( "{$data['class']}::__construct" ) |
@@ -251,9 +251,9 @@ discard block |
||
| 251 | 251 | , esc_html( "{$arg} is deprecated, use {$data['replacement']} instead" ) |
| 252 | 252 | ); |
| 253 | 253 | |
| 254 | - $args[ $data['replacement'] ] = $args[ $arg ]; |
|
| 254 | + $args[$data['replacement']] = $args[$arg]; |
|
| 255 | 255 | |
| 256 | - unset( $args[ $arg ] ); |
|
| 256 | + unset( $args[$arg] ); |
|
| 257 | 257 | } |
| 258 | 258 | } |
| 259 | 259 | |
@@ -271,19 +271,19 @@ discard block |
||
| 271 | 271 | */ |
| 272 | 272 | public function get_arg( $arg ) { |
| 273 | 273 | |
| 274 | - if ( isset( $this->deprecated_args[ $arg ] ) ) { |
|
| 274 | + if ( isset( $this->deprecated_args[$arg] ) ) { |
|
| 275 | 275 | |
| 276 | 276 | _deprecated_argument( |
| 277 | - esc_html( "{$this->deprecated_args[ $arg ]['class']}::get_arg" ) |
|
| 278 | - , esc_html( $this->deprecated_args[ $arg ]['version'] ) |
|
| 279 | - , esc_html( "{$arg} is deprecated, use {$this->deprecated_args[ $arg ]['replacement']} instead" ) |
|
| 277 | + esc_html( "{$this->deprecated_args[$arg]['class']}::get_arg" ) |
|
| 278 | + , esc_html( $this->deprecated_args[$arg]['version'] ) |
|
| 279 | + , esc_html( "{$arg} is deprecated, use {$this->deprecated_args[$arg]['replacement']} instead" ) |
|
| 280 | 280 | ); |
| 281 | 281 | |
| 282 | - $arg = $this->deprecated_args[ $arg ]['replacement']; |
|
| 282 | + $arg = $this->deprecated_args[$arg]['replacement']; |
|
| 283 | 283 | } |
| 284 | 284 | |
| 285 | - if ( isset( $this->args[ $arg ] ) ) { |
|
| 286 | - return $this->args[ $arg ]; |
|
| 285 | + if ( isset( $this->args[$arg] ) ) { |
|
| 286 | + return $this->args[$arg]; |
|
| 287 | 287 | } else { |
| 288 | 288 | return null; |
| 289 | 289 | } |
@@ -304,7 +304,7 @@ discard block |
||
| 304 | 304 | public function set_args( array $args ) { |
| 305 | 305 | |
| 306 | 306 | foreach ( $this->deprecated_args as $arg => $data ) { |
| 307 | - if ( isset( $args[ $arg ] ) ) { |
|
| 307 | + if ( isset( $args[$arg] ) ) { |
|
| 308 | 308 | |
| 309 | 309 | _deprecated_argument( |
| 310 | 310 | esc_html( "{$data['class']}::set_args" ) |
@@ -312,9 +312,9 @@ discard block |
||
| 312 | 312 | , esc_html( "{$arg} is deprecated, use {$data['replacement']} instead" ) |
| 313 | 313 | ); |
| 314 | 314 | |
| 315 | - $args[ $data['replacement'] ] = $args[ $arg ]; |
|
| 315 | + $args[$data['replacement']] = $args[$arg]; |
|
| 316 | 316 | |
| 317 | - unset( $args[ $arg ] ); |
|
| 317 | + unset( $args[$arg] ); |
|
| 318 | 318 | } |
| 319 | 319 | } |
| 320 | 320 | |
@@ -531,7 +531,7 @@ discard block |
||
| 531 | 531 | $value = $this->validate_value( $value, $validators ); |
| 532 | 532 | |
| 533 | 533 | if ( false === $value ) { |
| 534 | - unset( $values[ $index ] ); |
|
| 534 | + unset( $values[$index] ); |
|
| 535 | 535 | } |
| 536 | 536 | } |
| 537 | 537 | |
@@ -595,11 +595,11 @@ discard block |
||
| 595 | 595 | protected function prepare_column_where( $column, $data ) { |
| 596 | 596 | |
| 597 | 597 | // If a single value has been supplied for the column, it takes precedence. |
| 598 | - if ( isset( $this->args[ $column ] ) ) { |
|
| 598 | + if ( isset( $this->args[$column] ) ) { |
|
| 599 | 599 | $this->prepare_column( $column, $data ); |
| 600 | - } elseif ( isset( $this->args[ "{$column}__in" ] ) ) { |
|
| 600 | + } elseif ( isset( $this->args["{$column}__in"] ) ) { |
|
| 601 | 601 | $this->prepare_column__in( $column, $data ); |
| 602 | - } elseif ( isset( $this->args[ "{$column}__not_in" ] ) ) { |
|
| 602 | + } elseif ( isset( $this->args["{$column}__not_in"] ) ) { |
|
| 603 | 603 | $this->prepare_column__in( $column, $data, 'NOT IN' ); |
| 604 | 604 | } |
| 605 | 605 | } |
@@ -618,13 +618,13 @@ discard block |
||
| 618 | 618 | |
| 619 | 619 | if ( |
| 620 | 620 | isset( $data['values'] ) |
| 621 | - && ! in_array( $this->args[ $column ], $data['values'], true ) |
|
| 621 | + && ! in_array( $this->args[$column], $data['values'], true ) |
|
| 622 | 622 | ) { |
| 623 | 623 | return; |
| 624 | 624 | } |
| 625 | 625 | |
| 626 | 626 | $value = $this->validate_value( |
| 627 | - $this->args[ $column ] |
|
| 627 | + $this->args[$column] |
|
| 628 | 628 | , $this->get_validators_for_column( $data ) |
| 629 | 629 | ); |
| 630 | 630 | |
@@ -665,10 +665,10 @@ discard block |
||
| 665 | 665 | $comparator = '='; |
| 666 | 666 | |
| 667 | 667 | if ( |
| 668 | - isset( $this->args[ "{$column}__compare" ] ) |
|
| 669 | - && in_array( $this->args[ "{$column}__compare" ], $comparisons, true ) |
|
| 668 | + isset( $this->args["{$column}__compare"] ) |
|
| 669 | + && in_array( $this->args["{$column}__compare"], $comparisons, true ) |
|
| 670 | 670 | ) { |
| 671 | - $comparator = $this->args[ "{$column}__compare" ]; |
|
| 671 | + $comparator = $this->args["{$column}__compare"]; |
|
| 672 | 672 | } |
| 673 | 673 | |
| 674 | 674 | return $comparator; |
@@ -687,11 +687,11 @@ discard block |
||
| 687 | 687 | |
| 688 | 688 | $key = "{$column}__" . strtolower( str_replace( ' ', '_', $type ) ); |
| 689 | 689 | |
| 690 | - if ( empty( $this->args[ $key ] ) || ! is_array( $this->args[ $key ] ) ) { |
|
| 690 | + if ( empty( $this->args[$key] ) || ! is_array( $this->args[$key] ) ) { |
|
| 691 | 691 | return; |
| 692 | 692 | } |
| 693 | 693 | |
| 694 | - $values = $this->args[ $key ]; |
|
| 694 | + $values = $this->args[$key]; |
|
| 695 | 695 | |
| 696 | 696 | if ( isset( $data['values'] ) ) { |
| 697 | 697 | $values = array_intersect( $values, $data['values'] ); |
@@ -758,9 +758,9 @@ discard block |
||
| 758 | 758 | foreach ( array( 'limit', 'offset' ) as $key ) { |
| 759 | 759 | |
| 760 | 760 | // Save a backup of the arg value since wordpoints_int() is by reference. |
| 761 | - $arg = $this->args[ $key ]; |
|
| 761 | + $arg = $this->args[$key]; |
|
| 762 | 762 | |
| 763 | - if ( false === wordpoints_int( $this->args[ $key ] ) ) { |
|
| 763 | + if ( false === wordpoints_int( $this->args[$key] ) ) { |
|
| 764 | 764 | |
| 765 | 765 | _doing_it_wrong( |
| 766 | 766 | __METHOD__ |
@@ -772,7 +772,7 @@ discard block |
||
| 772 | 772 | , '1.0.0' |
| 773 | 773 | ); |
| 774 | 774 | |
| 775 | - $this->args[ $key ] = 0; |
|
| 775 | + $this->args[$key] = 0; |
|
| 776 | 776 | } |
| 777 | 777 | } |
| 778 | 778 | |
@@ -820,7 +820,7 @@ discard block |
||
| 820 | 820 | $order_by = "{$meta_table_name}.meta_value"; |
| 821 | 821 | } |
| 822 | 822 | |
| 823 | - } elseif ( isset( $this->columns[ $order_by ] ) ) { |
|
| 823 | + } elseif ( isset( $this->columns[$order_by] ) ) { |
|
| 824 | 824 | |
| 825 | 825 | $order_by = wordpoints_escape_mysql_identifier( $order_by ); |
| 826 | 826 | |
@@ -843,15 +843,15 @@ discard block |
||
| 843 | 843 | protected function prepare_date_where( $column ) { |
| 844 | 844 | |
| 845 | 845 | if ( |
| 846 | - empty( $this->args[ "{$column}_query" ] ) |
|
| 847 | - || ! is_array( $this->args[ "{$column}_query" ] ) |
|
| 846 | + empty( $this->args["{$column}_query"] ) |
|
| 847 | + || ! is_array( $this->args["{$column}_query"] ) |
|
| 848 | 848 | ) { |
| 849 | 849 | return; |
| 850 | 850 | } |
| 851 | 851 | |
| 852 | 852 | add_filter( 'date_query_valid_columns', array( $this, 'date_query_valid_columns_filter' ) ); |
| 853 | 853 | |
| 854 | - $date_query = new WP_Date_Query( $this->args[ "{$column}_query" ], $column ); |
|
| 854 | + $date_query = new WP_Date_Query( $this->args["{$column}_query"], $column ); |
|
| 855 | 855 | $date_query = $date_query->get_sql(); |
| 856 | 856 | |
| 857 | 857 | if ( ! empty( $date_query ) ) { |
@@ -39,7 +39,8 @@ |
||
| 39 | 39 | add_action( 'wordpoints_extensions_loaded', 'wordpoints_installables_maybe_update', 5 ); |
| 40 | 40 | add_action( 'wpmu_new_blog', 'wordpoints_installables_install_on_new_site' ); |
| 41 | 41 | |
| 42 | -if ( isset( $_GET['wordpoints_module_check'], $_GET['check_module'] ) ) { // WPCS: CSRF OK. |
|
| 42 | +if ( isset( $_GET['wordpoints_module_check'], $_GET['check_module'] ) ) { |
|
| 43 | +// WPCS: CSRF OK. |
|
| 43 | 44 | |
| 44 | 45 | add_action( 'shutdown', 'wordpoints_maintenance_shutdown_print_rand_str' ); |
| 45 | 46 | |