@@ -48,7 +48,7 @@ discard block |
||
48 | 48 | parent::__construct( |
49 | 49 | array( |
50 | 50 | 'plural' => 'modules', |
51 | - 'screen' => ( isset( $args['screen'] ) ) ? $args['screen'] : null, |
|
51 | + 'screen' => ( isset( $args[ 'screen' ] ) ) ? $args[ 'screen' ] : null, |
|
52 | 52 | ) |
53 | 53 | ); |
54 | 54 | |
@@ -68,12 +68,12 @@ discard block |
||
68 | 68 | */ |
69 | 69 | $module_statuses = apply_filters( 'wordpoints_module_statuses', $module_statuses ); |
70 | 70 | |
71 | - if ( isset( $_REQUEST['module_status'] ) && in_array( wp_unslash( $_REQUEST['module_status'] ), $module_statuses, true ) ) { // WPCS: CSRF OK. |
|
72 | - $status = sanitize_key( $_REQUEST['module_status'] ); // WPCS: CSRF OK. |
|
71 | + if ( isset( $_REQUEST[ 'module_status' ] ) && in_array( wp_unslash( $_REQUEST[ 'module_status' ] ), $module_statuses, true ) ) { // WPCS: CSRF OK. |
|
72 | + $status = sanitize_key( $_REQUEST[ 'module_status' ] ); // WPCS: CSRF OK. |
|
73 | 73 | } |
74 | 74 | |
75 | - if ( isset( $_REQUEST['s'] ) ) { // WPCS: CSRF OK. |
|
76 | - $_SERVER['REQUEST_URI'] = add_query_arg( 's', sanitize_text_field( wp_unslash( $_REQUEST['s'] ) ) ); // WPCS: CSRF OK. |
|
75 | + if ( isset( $_REQUEST[ 's' ] ) ) { // WPCS: CSRF OK. |
|
76 | + $_SERVER[ 'REQUEST_URI' ] = add_query_arg( 's', sanitize_text_field( wp_unslash( $_REQUEST[ 's' ] ) ) ); // WPCS: CSRF OK. |
|
77 | 77 | } |
78 | 78 | |
79 | 79 | $page = $this->get_pagenum(); |
@@ -88,7 +88,7 @@ discard block |
||
88 | 88 | */ |
89 | 89 | public function get_table_classes() { |
90 | 90 | |
91 | - return array( 'widefat', $this->_args['plural'], 'plugins' ); |
|
91 | + return array( 'widefat', $this->_args[ 'plural' ], 'plugins' ); |
|
92 | 92 | } |
93 | 93 | |
94 | 94 | /** |
@@ -180,7 +180,7 @@ discard block |
||
180 | 180 | |
181 | 181 | } // End if ( not network admin ). |
182 | 182 | |
183 | - foreach ( (array) $modules['all'] as $module_file => $module_data ) { |
|
183 | + foreach ( (array) $modules[ 'all' ] as $module_file => $module_data ) { |
|
184 | 184 | |
185 | 185 | // Filter into individual sections. |
186 | 186 | if ( |
@@ -190,9 +190,9 @@ discard block |
||
190 | 190 | ) { |
191 | 191 | |
192 | 192 | if ( $show_network_active ) { |
193 | - $modules['inactive'][ $module_file ] = $module_data; |
|
193 | + $modules[ 'inactive' ][ $module_file ] = $module_data; |
|
194 | 194 | } else { |
195 | - unset( $modules['all'][ $module_file ] ); |
|
195 | + unset( $modules[ 'all' ][ $module_file ] ); |
|
196 | 196 | } |
197 | 197 | |
198 | 198 | } elseif ( |
@@ -201,9 +201,9 @@ discard block |
||
201 | 201 | ) { |
202 | 202 | |
203 | 203 | if ( $show_network_active ) { |
204 | - $modules['active'][ $module_file ] = $module_data; |
|
204 | + $modules[ 'active' ][ $module_file ] = $module_data; |
|
205 | 205 | } else { |
206 | - unset( $modules['all'][ $module_file ] ); |
|
206 | + unset( $modules[ 'all' ][ $module_file ] ); |
|
207 | 207 | } |
208 | 208 | |
209 | 209 | } elseif ( |
@@ -216,16 +216,16 @@ discard block |
||
216 | 216 | ) |
217 | 217 | ) { |
218 | 218 | |
219 | - $modules['active'][ $module_file ] = $module_data; |
|
219 | + $modules[ 'active' ][ $module_file ] = $module_data; |
|
220 | 220 | |
221 | 221 | } else { |
222 | 222 | |
223 | 223 | // Was the module recently activated? |
224 | 224 | if ( ! $this->screen->in_admin( 'network' ) && isset( $recently_activated[ $module_file ] ) ) { |
225 | - $modules['recently_activated'][ $module_file ] = $module_data; |
|
225 | + $modules[ 'recently_activated' ][ $module_file ] = $module_data; |
|
226 | 226 | } |
227 | 227 | |
228 | - $modules['inactive'][ $module_file ] = $module_data; |
|
228 | + $modules[ 'inactive' ][ $module_file ] = $module_data; |
|
229 | 229 | |
230 | 230 | } // End if (). |
231 | 231 | |
@@ -234,7 +234,7 @@ discard block |
||
234 | 234 | if ( $s ) { |
235 | 235 | |
236 | 236 | $status = 'search'; |
237 | - $modules['search'] = array_filter( $modules['all'], array( $this, '_search_callback' ) ); |
|
237 | + $modules[ 'search' ] = array_filter( $modules[ 'all' ], array( $this, '_search_callback' ) ); |
|
238 | 238 | } |
239 | 239 | |
240 | 240 | /** |
@@ -311,8 +311,8 @@ discard block |
||
311 | 311 | |
312 | 312 | static $term; |
313 | 313 | |
314 | - if ( is_null( $term ) && isset( $_REQUEST['s'] ) ) { // WPCS: CSRF OK. |
|
315 | - $term = sanitize_text_field( wp_unslash( $_REQUEST['s'] ) ); // WPCS: CSRF OK. |
|
314 | + if ( is_null( $term ) && isset( $_REQUEST[ 's' ] ) ) { // WPCS: CSRF OK. |
|
315 | + $term = sanitize_text_field( wp_unslash( $_REQUEST[ 's' ] ) ); // WPCS: CSRF OK. |
|
316 | 316 | } |
317 | 317 | |
318 | 318 | foreach ( $module_data as $value ) { |
@@ -364,7 +364,7 @@ discard block |
||
364 | 364 | |
365 | 365 | global $modules; |
366 | 366 | |
367 | - if ( ! empty( $modules['all'] ) ) { |
|
367 | + if ( ! empty( $modules[ 'all' ] ) ) { |
|
368 | 368 | esc_html_e( 'No modules found.', 'wordpoints' ); |
369 | 369 | } else { |
370 | 370 | esc_html_e( 'There are not any modules installed.', 'wordpoints' ); |
@@ -478,11 +478,11 @@ discard block |
||
478 | 478 | $actions = array(); |
479 | 479 | |
480 | 480 | if ( 'active' !== $status ) { |
481 | - $actions['activate-selected'] = ( $this->screen->in_admin( 'network' ) ) ? esc_html__( 'Network Activate', 'wordpoints' ) : esc_html__( 'Activate', 'wordpoints' ); |
|
481 | + $actions[ 'activate-selected' ] = ( $this->screen->in_admin( 'network' ) ) ? esc_html__( 'Network Activate', 'wordpoints' ) : esc_html__( 'Activate', 'wordpoints' ); |
|
482 | 482 | } |
483 | 483 | |
484 | 484 | if ( 'inactive' !== $status && 'recent' !== $status ) { |
485 | - $actions['deactivate-selected'] = ( $this->screen->in_admin( 'network' ) ) ? esc_html__( 'Network Deactivate', 'wordpoints' ) : esc_html__( 'Deactivate', 'wordpoints' ); |
|
485 | + $actions[ 'deactivate-selected' ] = ( $this->screen->in_admin( 'network' ) ) ? esc_html__( 'Network Deactivate', 'wordpoints' ) : esc_html__( 'Deactivate', 'wordpoints' ); |
|
486 | 486 | } |
487 | 487 | |
488 | 488 | if ( |
@@ -490,7 +490,7 @@ discard block |
||
490 | 490 | && current_user_can( 'delete_wordpoints_modules' ) |
491 | 491 | && 'active' !== $status |
492 | 492 | ) { |
493 | - $actions['delete-selected'] = esc_html__( 'Delete', 'wordpoints' ); |
|
493 | + $actions[ 'delete-selected' ] = esc_html__( 'Delete', 'wordpoints' ); |
|
494 | 494 | } |
495 | 495 | |
496 | 496 | /** |
@@ -578,7 +578,7 @@ discard block |
||
578 | 578 | $class = apply_filters( 'wordpoints_module_list_row_class', $class, $module_file, $module_data, $context ); |
579 | 579 | |
580 | 580 | ?> |
581 | - <tr id="<?php echo esc_attr( sanitize_title( $module_data['name'] ) ); ?>" class="<?php echo esc_attr( $class ); ?>"> |
|
581 | + <tr id="<?php echo esc_attr( sanitize_title( $module_data[ 'name' ] ) ); ?>" class="<?php echo esc_attr( $class ); ?>"> |
|
582 | 582 | <?php $this->single_row_columns( $item, $class, $is_active ); ?> |
583 | 583 | </tr> |
584 | 584 | <?php |
@@ -618,7 +618,7 @@ discard block |
||
618 | 618 | |
619 | 619 | list( $module_file, $module_data ) = $item; |
620 | 620 | |
621 | - $module_data['extra']['module_file'] = $module_file; |
|
621 | + $module_data[ 'extra' ][ 'module_file' ] = $module_file; |
|
622 | 622 | |
623 | 623 | if ( $this->screen->in_admin( 'network' ) ) { |
624 | 624 | |
@@ -631,11 +631,11 @@ discard block |
||
631 | 631 | $restricted_network_only = ( is_multisite() && is_network_only_wordpoints_module( $module_file ) && ! $is_active ); |
632 | 632 | } |
633 | 633 | |
634 | - $module_data['extra']['is_active'] = $is_active; |
|
635 | - $module_data['extra']['restricted_network_active'] = $restricted_network_active; |
|
636 | - $module_data['extra']['restricted_network_only'] = $restricted_network_only; |
|
634 | + $module_data[ 'extra' ][ 'is_active' ] = $is_active; |
|
635 | + $module_data[ 'extra' ][ 'restricted_network_active' ] = $restricted_network_active; |
|
636 | + $module_data[ 'extra' ][ 'restricted_network_only' ] = $restricted_network_only; |
|
637 | 637 | |
638 | - list( $columns, $hidden, , $primary ) = $this->get_column_info(); |
|
638 | + list( $columns, $hidden,, $primary ) = $this->get_column_info(); |
|
639 | 639 | |
640 | 640 | foreach ( $columns as $column_name => $column_display_name ) { |
641 | 641 | |
@@ -672,11 +672,11 @@ discard block |
||
672 | 672 | */ |
673 | 673 | protected function column_cb( $module_data ) { |
674 | 674 | |
675 | - $checkbox_id = 'checkbox_' . sanitize_key( $module_data['extra']['module_file'] ); |
|
675 | + $checkbox_id = 'checkbox_' . sanitize_key( $module_data[ 'extra' ][ 'module_file' ] ); |
|
676 | 676 | |
677 | 677 | ?> |
678 | 678 | <th scope="row" class="check-column"> |
679 | - <?php if ( ! $module_data['extra']['restricted_network_active'] && ! $module_data['extra']['restricted_network_only'] ) : ?> |
|
679 | + <?php if ( ! $module_data[ 'extra' ][ 'restricted_network_active' ] && ! $module_data[ 'extra' ][ 'restricted_network_only' ] ) : ?> |
|
680 | 680 | <label class="screen-reader-text" for="<?php echo esc_attr( $checkbox_id ); ?>"> |
681 | 681 | <?php |
682 | 682 | |
@@ -684,13 +684,13 @@ discard block |
||
684 | 684 | sprintf( |
685 | 685 | // translators: Module name. |
686 | 686 | __( 'Select %s', 'wordpoints' ) |
687 | - , $module_data['name'] |
|
687 | + , $module_data[ 'name' ] |
|
688 | 688 | ) |
689 | 689 | ); |
690 | 690 | |
691 | 691 | ?> |
692 | 692 | </label> |
693 | - <input type="checkbox" name="checked[]" value="<?php echo esc_attr( $module_data['extra']['module_file'] ); ?>" id="<?php echo esc_attr( $checkbox_id ); ?>" /> |
|
693 | + <input type="checkbox" name="checked[]" value="<?php echo esc_attr( $module_data[ 'extra' ][ 'module_file' ] ); ?>" id="<?php echo esc_attr( $checkbox_id ); ?>" /> |
|
694 | 694 | <?php endif; ?> |
695 | 695 | </th> |
696 | 696 | <?php |
@@ -709,7 +709,7 @@ discard block |
||
709 | 709 | |
710 | 710 | ?> |
711 | 711 | <td class="module-title<?php echo ( $is_hidden ) ? ' hidden' : ''; ?><?php echo ( $is_primary ) ? ' has-row-actions column-primary' : ''; ?>"> |
712 | - <strong><?php echo esc_html( $module_data['name'] ); ?></strong> |
|
712 | + <strong><?php echo esc_html( $module_data[ 'name' ] ); ?></strong> |
|
713 | 713 | <?php if ( $is_primary ) : ?> |
714 | 714 | <?php echo $this->row_actions( $this->get_module_row_actions( $module_data ), true ); // WPCS XSS OK. ?> |
715 | 715 | <?php endif; ?> |
@@ -735,8 +735,8 @@ discard block |
||
735 | 735 | <td class="column-description desc<?php echo ( $is_hidden ) ? ' hidden' : ''; ?><?php echo ( $is_primary ) ? ' has-row-actions column-primary' : ''; ?>"> |
736 | 736 | <div class="module-description"> |
737 | 737 | <p> |
738 | - <?php if ( ! empty( $module_data['description'] ) ) : ?> |
|
739 | - <?php echo wp_kses( $module_data['description'] , 'wordpoints_module_description' ); ?> |
|
738 | + <?php if ( ! empty( $module_data[ 'description' ] ) ) : ?> |
|
739 | + <?php echo wp_kses( $module_data[ 'description' ], 'wordpoints_module_description' ); ?> |
|
740 | 740 | <?php else : ?> |
741 | 741 | |
742 | 742 | <?php endif; ?> |
@@ -747,25 +747,25 @@ discard block |
||
747 | 747 | |
748 | 748 | $module_meta = array(); |
749 | 749 | |
750 | - if ( ! empty( $module_data['version'] ) ) { |
|
750 | + if ( ! empty( $module_data[ 'version' ] ) ) { |
|
751 | 751 | // translators: Module version. |
752 | - $module_meta[] = sprintf( esc_html__( 'Version %s', 'wordpoints' ), $module_data['version'] ); |
|
752 | + $module_meta[ ] = sprintf( esc_html__( 'Version %s', 'wordpoints' ), $module_data[ 'version' ] ); |
|
753 | 753 | } |
754 | 754 | |
755 | - if ( ! empty( $module_data['author'] ) ) { |
|
755 | + if ( ! empty( $module_data[ 'author' ] ) ) { |
|
756 | 756 | |
757 | - $author = $module_data['author']; |
|
757 | + $author = $module_data[ 'author' ]; |
|
758 | 758 | |
759 | - if ( ! empty( $module_data['author_uri'] ) ) { |
|
760 | - $author = '<a href="' . esc_url( $module_data['author_uri'] ) . '">' . esc_html( $module_data['author'] ) . '</a>'; |
|
759 | + if ( ! empty( $module_data[ 'author_uri' ] ) ) { |
|
760 | + $author = '<a href="' . esc_url( $module_data[ 'author_uri' ] ) . '">' . esc_html( $module_data[ 'author' ] ) . '</a>'; |
|
761 | 761 | } |
762 | 762 | |
763 | 763 | // translators: Author name. |
764 | - $module_meta[] = sprintf( __( 'By %s', 'wordpoints' ), $author ); |
|
764 | + $module_meta[ ] = sprintf( __( 'By %s', 'wordpoints' ), $author ); |
|
765 | 765 | } |
766 | 766 | |
767 | - if ( ! empty( $module_data['module_uri'] ) ) { |
|
768 | - $module_meta[] = '<a href="' . esc_url( $module_data['module_uri'] ) . '">' . esc_html__( 'Visit module site', 'wordpoints' ) . '</a>'; |
|
767 | + if ( ! empty( $module_data[ 'module_uri' ] ) ) { |
|
768 | + $module_meta[ ] = '<a href="' . esc_url( $module_data[ 'module_uri' ] ) . '">' . esc_html__( 'Visit module site', 'wordpoints' ) . '</a>'; |
|
769 | 769 | } |
770 | 770 | |
771 | 771 | /** |
@@ -781,7 +781,7 @@ discard block |
||
781 | 781 | * @param array $module_data The info about the module. |
782 | 782 | * @param string $status The module status being displayed. |
783 | 783 | */ |
784 | - $module_meta = apply_filters( 'wordpoints_module_row_meta', $module_meta, $module_data['extra']['module_file'], $module_data, $status ); |
|
784 | + $module_meta = apply_filters( 'wordpoints_module_row_meta', $module_meta, $module_data[ 'extra' ][ 'module_file' ], $module_data, $status ); |
|
785 | 785 | |
786 | 786 | echo wp_kses( implode( ' | ', $module_meta ), 'data' ); |
787 | 787 | |
@@ -818,7 +818,7 @@ discard block |
||
818 | 818 | * @param string $module_file The main file of the current module. |
819 | 819 | * @param array $module_data The module's info. |
820 | 820 | */ |
821 | - do_action( 'wordpoints_manage_modules_custom_column', $column_name, $module_data['module_file'], $module_data ); |
|
821 | + do_action( 'wordpoints_manage_modules_custom_column', $column_name, $module_data[ 'module_file' ], $module_data ); |
|
822 | 822 | ?> |
823 | 823 | <?php if ( $is_primary ) : ?> |
824 | 824 | <?php echo $this->row_actions( $this->get_module_row_actions( $module_data ), true ); // WPCS XSS OK. ?> |
@@ -847,8 +847,8 @@ discard block |
||
847 | 847 | |
848 | 848 | $context = $status; |
849 | 849 | |
850 | - $module_file = $module_data['extra']['module_file']; |
|
851 | - $args = $module_data['extra']; |
|
850 | + $module_file = $module_data[ 'extra' ][ 'module_file' ]; |
|
851 | + $args = $module_data[ 'extra' ]; |
|
852 | 852 | |
853 | 853 | // Pre-order. |
854 | 854 | $actions = array( |
@@ -861,49 +861,49 @@ discard block |
||
861 | 861 | |
862 | 862 | if ( $this->screen->in_admin( 'network' ) ) { |
863 | 863 | |
864 | - if ( $args['is_active'] ) { |
|
864 | + if ( $args[ 'is_active' ] ) { |
|
865 | 865 | |
866 | 866 | if ( current_user_can( 'manage_network_wordpoints_modules' ) ) { |
867 | 867 | // translators: Module name. |
868 | - $actions['deactivate'] = '<a href="' . wp_nonce_url( add_query_arg( 'action', 'deactivate', $url ), "deactivate-module_{$module_file}" ) . '" aria-label="' . esc_attr( sprintf( __( 'Network deactivate %s', 'wordpoints' ), $module_data['name'] ) ) . '">' . esc_html__( 'Network Deactivate', 'wordpoints' ) . '</a>'; |
|
868 | + $actions[ 'deactivate' ] = '<a href="' . wp_nonce_url( add_query_arg( 'action', 'deactivate', $url ), "deactivate-module_{$module_file}" ) . '" aria-label="' . esc_attr( sprintf( __( 'Network deactivate %s', 'wordpoints' ), $module_data[ 'name' ] ) ) . '">' . esc_html__( 'Network Deactivate', 'wordpoints' ) . '</a>'; |
|
869 | 869 | } |
870 | 870 | |
871 | 871 | } else { |
872 | 872 | |
873 | 873 | if ( current_user_can( 'manage_network_wordpoints_modules' ) ) { |
874 | 874 | // translators: Module name. |
875 | - $actions['activate'] = '<a href="' . wp_nonce_url( add_query_arg( 'action', 'activate', $url ), "activate-module_{$module_file}" ) . '" aria-label="' . esc_attr( sprintf( __( 'Network activate %s', 'wordpoints' ), $module_data['name'] ) ) . '" class="edit">' . esc_html__( 'Network Activate', 'wordpoints' ) . '</a>'; |
|
875 | + $actions[ 'activate' ] = '<a href="' . wp_nonce_url( add_query_arg( 'action', 'activate', $url ), "activate-module_{$module_file}" ) . '" aria-label="' . esc_attr( sprintf( __( 'Network activate %s', 'wordpoints' ), $module_data[ 'name' ] ) ) . '" class="edit">' . esc_html__( 'Network Activate', 'wordpoints' ) . '</a>'; |
|
876 | 876 | } |
877 | 877 | |
878 | 878 | if ( current_user_can( 'delete_wordpoints_modules' ) && ! is_wordpoints_module_active( $module_file ) ) { |
879 | 879 | // translators: Module name. |
880 | - $actions['delete'] = '<a href="' . wp_nonce_url( self_admin_url( 'admin.php?page=wordpoints_modules&action=delete-selected&checked[]=' . $module_file . '&module_status=' . $context . '&paged=' . $page . '&s=' . $s ), 'bulk-modules' ) . '" aria-label="' . esc_attr( sprintf( __( 'Delete %s', 'wordpoints' ), $module_data['name'] ) ) . '" class="delete">' . esc_html__( 'Delete', 'wordpoints' ) . '</a>'; |
|
880 | + $actions[ 'delete' ] = '<a href="' . wp_nonce_url( self_admin_url( 'admin.php?page=wordpoints_modules&action=delete-selected&checked[]=' . $module_file . '&module_status=' . $context . '&paged=' . $page . '&s=' . $s ), 'bulk-modules' ) . '" aria-label="' . esc_attr( sprintf( __( 'Delete %s', 'wordpoints' ), $module_data[ 'name' ] ) ) . '" class="delete">' . esc_html__( 'Delete', 'wordpoints' ) . '</a>'; |
|
881 | 881 | } |
882 | 882 | } |
883 | 883 | |
884 | 884 | } else { |
885 | 885 | |
886 | - if ( $args['restricted_network_active'] ) { |
|
886 | + if ( $args[ 'restricted_network_active' ] ) { |
|
887 | 887 | |
888 | 888 | $actions = array( 'network_active' => __( 'Network Active', 'wordpoints' ) ); |
889 | 889 | |
890 | - } elseif ( $args['restricted_network_only'] ) { |
|
890 | + } elseif ( $args[ 'restricted_network_only' ] ) { |
|
891 | 891 | |
892 | 892 | $actions = array( 'network_only' => __( 'Network Only', 'wordpoints' ) ); |
893 | 893 | |
894 | - } elseif ( $args['is_active'] ) { |
|
894 | + } elseif ( $args[ 'is_active' ] ) { |
|
895 | 895 | |
896 | 896 | // translators: Module name. |
897 | - $actions['deactivate'] = '<a href="' . wp_nonce_url( add_query_arg( 'action', 'deactivate', $url ), "deactivate-module_{$module_file}" ) . '" aria-label="' . esc_attr( sprintf( __( 'Deactivate %s', 'wordpoints' ), $module_data['name'] ) ) . '">' . esc_html__( 'Deactivate', 'wordpoints' ) . '</a>'; |
|
897 | + $actions[ 'deactivate' ] = '<a href="' . wp_nonce_url( add_query_arg( 'action', 'deactivate', $url ), "deactivate-module_{$module_file}" ) . '" aria-label="' . esc_attr( sprintf( __( 'Deactivate %s', 'wordpoints' ), $module_data[ 'name' ] ) ) . '">' . esc_html__( 'Deactivate', 'wordpoints' ) . '</a>'; |
|
898 | 898 | |
899 | 899 | } else { |
900 | 900 | |
901 | 901 | // translators: Module name. |
902 | - $actions['activate'] = '<a href="' . wp_nonce_url( add_query_arg( 'action', 'activate', $url ), "activate-module_{$module_file}" ) . '" aria-label="' . esc_attr( sprintf( __( 'Activate %s', 'wordpoints' ), $module_data['name'] ) ) . '" class="edit">' . esc_html__( 'Activate', 'wordpoints' ) . '</a>'; |
|
902 | + $actions[ 'activate' ] = '<a href="' . wp_nonce_url( add_query_arg( 'action', 'activate', $url ), "activate-module_{$module_file}" ) . '" aria-label="' . esc_attr( sprintf( __( 'Activate %s', 'wordpoints' ), $module_data[ 'name' ] ) ) . '" class="edit">' . esc_html__( 'Activate', 'wordpoints' ) . '</a>'; |
|
903 | 903 | |
904 | 904 | if ( ! is_multisite() && current_user_can( 'delete_wordpoints_modules' ) ) { |
905 | 905 | // translators: Module name. |
906 | - $actions['delete'] = '<a href="' . wp_nonce_url( self_admin_url( 'admin.php?page=wordpoints_modules&action=delete-selected&checked[]=' . $module_file . '&module_status=' . $context . '&paged=' . $page . '&s=' . $s ), 'bulk-modules' ) . '" aria-label="' . esc_attr( sprintf( __( 'Delete %s', 'wordpoints' ), $module_data['name'] ) ) . '" class="delete">' . esc_html__( 'Delete', 'wordpoints' ) . '</a>'; |
|
906 | + $actions[ 'delete' ] = '<a href="' . wp_nonce_url( self_admin_url( 'admin.php?page=wordpoints_modules&action=delete-selected&checked[]=' . $module_file . '&module_status=' . $context . '&paged=' . $page . '&s=' . $s ), 'bulk-modules' ) . '" aria-label="' . esc_attr( sprintf( __( 'Delete %s', 'wordpoints' ), $module_data[ 'name' ] ) ) . '" class="delete">' . esc_html__( 'Delete', 'wordpoints' ) . '</a>'; |
|
907 | 907 | } |
908 | 908 | } |
909 | 909 |
@@ -68,11 +68,13 @@ discard block |
||
68 | 68 | */ |
69 | 69 | $module_statuses = apply_filters( 'wordpoints_module_statuses', $module_statuses ); |
70 | 70 | |
71 | - if ( isset( $_REQUEST['module_status'] ) && in_array( wp_unslash( $_REQUEST['module_status'] ), $module_statuses, true ) ) { // WPCS: CSRF OK. |
|
71 | + if ( isset( $_REQUEST['module_status'] ) && in_array( wp_unslash( $_REQUEST['module_status'] ), $module_statuses, true ) ) { |
|
72 | +// WPCS: CSRF OK. |
|
72 | 73 | $status = sanitize_key( $_REQUEST['module_status'] ); // WPCS: CSRF OK. |
73 | 74 | } |
74 | 75 | |
75 | - if ( isset( $_REQUEST['s'] ) ) { // WPCS: CSRF OK. |
|
76 | + if ( isset( $_REQUEST['s'] ) ) { |
|
77 | +// WPCS: CSRF OK. |
|
76 | 78 | $_SERVER['REQUEST_URI'] = add_query_arg( 's', sanitize_text_field( wp_unslash( $_REQUEST['s'] ) ) ); // WPCS: CSRF OK. |
77 | 79 | } |
78 | 80 | |
@@ -311,7 +313,8 @@ discard block |
||
311 | 313 | |
312 | 314 | static $term; |
313 | 315 | |
314 | - if ( is_null( $term ) && isset( $_REQUEST['s'] ) ) { // WPCS: CSRF OK. |
|
316 | + if ( is_null( $term ) && isset( $_REQUEST['s'] ) ) { |
|
317 | +// WPCS: CSRF OK. |
|
315 | 318 | $term = sanitize_text_field( wp_unslash( $_REQUEST['s'] ) ); // WPCS: CSRF OK. |
316 | 319 | } |
317 | 320 | |
@@ -737,9 +740,12 @@ discard block |
||
737 | 740 | <p> |
738 | 741 | <?php if ( ! empty( $module_data['description'] ) ) : ?> |
739 | 742 | <?php echo wp_kses( $module_data['description'] , 'wordpoints_module_description' ); ?> |
740 | - <?php else : ?> |
|
743 | + <?php else { |
|
744 | + : ?> |
|
741 | 745 | |
742 | - <?php endif; ?> |
|
746 | + <?php endif; |
|
747 | +} |
|
748 | +?> |
|
743 | 749 | </p> |
744 | 750 | </div> |
745 | 751 | <div class="<?php echo esc_attr( $class ); ?> second module-version-author-uri"> |
@@ -48,7 +48,7 @@ discard block |
||
48 | 48 | $points_heading = _x( 'Points', 'column name', 'wordpoints' ); |
49 | 49 | |
50 | 50 | $points_type_name = wordpoints_get_points_type_setting( |
51 | - $this->atts['points_type'] |
|
51 | + $this->atts[ 'points_type' ] |
|
52 | 52 | , 'name' |
53 | 53 | ); |
54 | 54 | |
@@ -95,7 +95,7 @@ discard block |
||
95 | 95 | } |
96 | 96 | |
97 | 97 | $hooks = WordPoints_Points_Hooks::get_points_type_hooks( |
98 | - $this->atts['points_type'] |
|
98 | + $this->atts[ 'points_type' ] |
|
99 | 99 | ); |
100 | 100 | |
101 | 101 | $html = ''; |
@@ -116,7 +116,7 @@ discard block |
||
116 | 116 | |
117 | 117 | $points = wordpoints_format_points( |
118 | 118 | $points |
119 | - , $this->atts['points_type'] |
|
119 | + , $this->atts[ 'points_type' ] |
|
120 | 120 | , 'how-to-get-points-shortcode' |
121 | 121 | ); |
122 | 122 | |
@@ -150,7 +150,7 @@ discard block |
||
150 | 150 | |
151 | 151 | foreach ( $store->get_reactions() as $reaction ) { |
152 | 152 | |
153 | - if ( $reaction->get_meta( 'points_type' ) !== $this->atts['points_type'] ) { |
|
153 | + if ( $reaction->get_meta( 'points_type' ) !== $this->atts[ 'points_type' ] ) { |
|
154 | 154 | continue; |
155 | 155 | } |
156 | 156 | |
@@ -186,7 +186,7 @@ discard block |
||
186 | 186 | if ( $points ) { |
187 | 187 | $points = wordpoints_format_points( |
188 | 188 | $points |
189 | - , $this->atts['points_type'] |
|
189 | + , $this->atts[ 'points_type' ] |
|
190 | 190 | , 'how-to-get-points-shortcode' |
191 | 191 | ); |
192 | 192 | } |
@@ -21,21 +21,21 @@ discard block |
||
21 | 21 | */ |
22 | 22 | protected function verify_settings( $instance ) { |
23 | 23 | |
24 | - if ( isset( $this->defaults['points_type'] ) ) { |
|
24 | + if ( isset( $this->defaults[ 'points_type' ] ) ) { |
|
25 | 25 | |
26 | 26 | // This happens when the widget is first created in the Customizer; the |
27 | 27 | // settings are completely empty. |
28 | - if ( empty( $instance['points_type'] ) ) { |
|
29 | - $default = $this->defaults['points_type']; |
|
28 | + if ( empty( $instance[ 'points_type' ] ) ) { |
|
29 | + $default = $this->defaults[ 'points_type' ]; |
|
30 | 30 | |
31 | 31 | if ( ! $default ) { |
32 | 32 | $this->make_a_points_type( $default ); |
33 | 33 | } |
34 | 34 | |
35 | - $instance['points_type'] = $default; |
|
35 | + $instance[ 'points_type' ] = $default; |
|
36 | 36 | } |
37 | 37 | |
38 | - if ( ! wordpoints_is_points_type( $instance['points_type'] ) ) { |
|
38 | + if ( ! wordpoints_is_points_type( $instance[ 'points_type' ] ) ) { |
|
39 | 39 | return new WP_Error( |
40 | 40 | 'wordpoints_widget_invalid_points_type' |
41 | 41 | , esc_html__( 'Please select a valid points type.', 'wordpoints' ) |
@@ -79,7 +79,7 @@ discard block |
||
79 | 79 | |
80 | 80 | parent::update( $new_instance, $old_instance ); |
81 | 81 | |
82 | - $this->make_a_points_type( $this->instance['points_type'] ); |
|
82 | + $this->make_a_points_type( $this->instance[ 'points_type' ] ); |
|
83 | 83 | |
84 | 84 | return $this->instance; |
85 | 85 | } |
@@ -104,7 +104,7 @@ discard block |
||
104 | 104 | public function form_points_type_field() { |
105 | 105 | |
106 | 106 | $dropdown_args = array( |
107 | - 'selected' => $this->instance['points_type'], |
|
107 | + 'selected' => $this->instance[ 'points_type' ], |
|
108 | 108 | 'id' => $this->get_field_id( 'points_type' ), |
109 | 109 | 'name' => $this->get_field_name( 'points_type' ), |
110 | 110 | 'class' => 'widefat', |
@@ -113,7 +113,7 @@ discard block |
||
113 | 113 | ?> |
114 | 114 | |
115 | 115 | <p> |
116 | - <label for="<?php echo esc_attr( $dropdown_args['id'] ); ?>"><?php echo esc_html_x( 'Points type', 'form label', 'wordpoints' ); ?></label> |
|
116 | + <label for="<?php echo esc_attr( $dropdown_args[ 'id' ] ); ?>"><?php echo esc_html_x( 'Points type', 'form label', 'wordpoints' ); ?></label> |
|
117 | 117 | <?php wordpoints_points_types_dropdown( $dropdown_args ); ?> |
118 | 118 | </p> |
119 | 119 |
@@ -78,8 +78,8 @@ discard block |
||
78 | 78 | */ |
79 | 79 | protected function verify_settings( $instance ) { |
80 | 80 | |
81 | - if ( ! wordpoints_posint( $instance['number_logs'] ) ) { |
|
82 | - $instance['number_logs'] = $this->defaults['number_logs']; |
|
81 | + if ( ! wordpoints_posint( $instance[ 'number_logs' ] ) ) { |
|
82 | + $instance[ 'number_logs' ] = $this->defaults[ 'number_logs' ]; |
|
83 | 83 | } |
84 | 84 | |
85 | 85 | return parent::verify_settings( $instance ); |
@@ -92,11 +92,11 @@ discard block |
||
92 | 92 | protected function widget_body( $instance ) { |
93 | 93 | |
94 | 94 | $query_args = wordpoints_get_points_logs_query_args( |
95 | - $instance['points_type'] |
|
95 | + $instance[ 'points_type' ] |
|
96 | 96 | , $this->query_slug |
97 | 97 | ); |
98 | 98 | |
99 | - $query_args['limit'] = $instance['number_logs']; |
|
99 | + $query_args[ 'limit' ] = $instance[ 'number_logs' ]; |
|
100 | 100 | |
101 | 101 | $logs_query = new WordPoints_Points_Logs_Query( $query_args ); |
102 | 102 | $logs_query->prime_cache( $this->cache_key ); |
@@ -127,20 +127,20 @@ discard block |
||
127 | 127 | */ |
128 | 128 | public function add_points_logs_table_extra_classes( $classes ) { |
129 | 129 | |
130 | - if ( $this->instance && isset( $this->instance['columns'] ) ) { |
|
131 | - foreach ( $this->defaults['columns'] as $column => $unused ) { |
|
132 | - if ( empty( $this->instance['columns'][ $column ] ) ) { |
|
133 | - $classes[] = "wordpoints-hide-{$column}-column"; |
|
130 | + if ( $this->instance && isset( $this->instance[ 'columns' ] ) ) { |
|
131 | + foreach ( $this->defaults[ 'columns' ] as $column => $unused ) { |
|
132 | + if ( empty( $this->instance[ 'columns' ][ $column ] ) ) { |
|
133 | + $classes[ ] = "wordpoints-hide-{$column}-column"; |
|
134 | 134 | } |
135 | 135 | } |
136 | 136 | } |
137 | 137 | |
138 | - if ( ! empty( $this->instance['hide_user_names'] ) ) { |
|
139 | - $classes[] = 'wordpoints-hide-user-names'; |
|
138 | + if ( ! empty( $this->instance[ 'hide_user_names' ] ) ) { |
|
139 | + $classes[ ] = 'wordpoints-hide-user-names'; |
|
140 | 140 | } |
141 | 141 | |
142 | - if ( ! empty( $this->instance['horizontal_scrolling'] ) ) { |
|
143 | - $classes[] = 'wordpoints-force-horizontal-scrolling'; |
|
142 | + if ( ! empty( $this->instance[ 'horizontal_scrolling' ] ) ) { |
|
143 | + $classes[ ] = 'wordpoints-force-horizontal-scrolling'; |
|
144 | 144 | } |
145 | 145 | |
146 | 146 | return $classes; |
@@ -161,29 +161,29 @@ discard block |
||
161 | 161 | |
162 | 162 | parent::update( $new_instance, $old_instance ); |
163 | 163 | |
164 | - if ( ! wordpoints_posint( $this->instance['number_logs'] ) ) { |
|
165 | - $this->instance['number_logs'] = $this->defaults['number_logs']; |
|
164 | + if ( ! wordpoints_posint( $this->instance[ 'number_logs' ] ) ) { |
|
165 | + $this->instance[ 'number_logs' ] = $this->defaults[ 'number_logs' ]; |
|
166 | 166 | } |
167 | 167 | |
168 | - foreach ( $this->instance['columns'] as $column => $value ) { |
|
168 | + foreach ( $this->instance[ 'columns' ] as $column => $value ) { |
|
169 | 169 | |
170 | - if ( ! isset( $this->defaults['columns'][ $column ] ) ) { |
|
171 | - unset( $this->instance['columns'][ $column ] ); |
|
170 | + if ( ! isset( $this->defaults[ 'columns' ][ $column ] ) ) { |
|
171 | + unset( $this->instance[ 'columns' ][ $column ] ); |
|
172 | 172 | } elseif ( $value ) { |
173 | - $this->instance['columns'][ $column ] = '1'; |
|
173 | + $this->instance[ 'columns' ][ $column ] = '1'; |
|
174 | 174 | } |
175 | 175 | } |
176 | 176 | |
177 | - if ( ! isset( $new_instance['hide_user_names'] ) ) { |
|
178 | - unset( $this->instance['hide_user_names'] ); |
|
179 | - } elseif ( ! empty( $this->instance['hide_user_names'] ) ) { |
|
180 | - $this->instance['hide_user_names'] = '1'; |
|
177 | + if ( ! isset( $new_instance[ 'hide_user_names' ] ) ) { |
|
178 | + unset( $this->instance[ 'hide_user_names' ] ); |
|
179 | + } elseif ( ! empty( $this->instance[ 'hide_user_names' ] ) ) { |
|
180 | + $this->instance[ 'hide_user_names' ] = '1'; |
|
181 | 181 | } |
182 | 182 | |
183 | - if ( ! isset( $new_instance['horizontal_scrolling'] ) ) { |
|
184 | - unset( $this->instance['horizontal_scrolling'] ); |
|
185 | - } elseif ( ! empty( $this->instance['horizontal_scrolling'] ) ) { |
|
186 | - $this->instance['horizontal_scrolling'] = '1'; |
|
183 | + if ( ! isset( $new_instance[ 'horizontal_scrolling' ] ) ) { |
|
184 | + unset( $this->instance[ 'horizontal_scrolling' ] ); |
|
185 | + } elseif ( ! empty( $this->instance[ 'horizontal_scrolling' ] ) ) { |
|
186 | + $this->instance[ 'horizontal_scrolling' ] = '1'; |
|
187 | 187 | } |
188 | 188 | |
189 | 189 | return $this->instance; |
@@ -197,15 +197,15 @@ discard block |
||
197 | 197 | |
198 | 198 | parent::form( $instance ); |
199 | 199 | |
200 | - if ( ! wordpoints_posint( $this->instance['number_logs'] ) ) { |
|
201 | - $this->instance['number_logs'] = $this->defaults['number_logs']; |
|
200 | + if ( ! wordpoints_posint( $this->instance[ 'number_logs' ] ) ) { |
|
201 | + $this->instance[ 'number_logs' ] = $this->defaults[ 'number_logs' ]; |
|
202 | 202 | } |
203 | 203 | |
204 | 204 | ?> |
205 | 205 | |
206 | 206 | <p> |
207 | 207 | <label for="<?php echo esc_attr( $this->get_field_id( 'number_logs' ) ); ?>"><?php esc_html_e( 'Number of log entries to display', 'wordpoints' ); ?></label> |
208 | - <input type="number" min="1" class="widefat" id="<?php echo esc_attr( $this->get_field_id( 'number_logs' ) ); ?>" name="<?php echo esc_attr( $this->get_field_name( 'number_logs' ) ); ?>" value="<?php echo absint( $this->instance['number_logs'] ); ?>" /> |
|
208 | + <input type="number" min="1" class="widefat" id="<?php echo esc_attr( $this->get_field_id( 'number_logs' ) ); ?>" name="<?php echo esc_attr( $this->get_field_name( 'number_logs' ) ); ?>" value="<?php echo absint( $this->instance[ 'number_logs' ] ); ?>" /> |
|
209 | 209 | </p> |
210 | 210 | |
211 | 211 | <?php |
@@ -238,7 +238,7 @@ discard block |
||
238 | 238 | id="<?php echo esc_attr( $this->get_field_id( 'columns[user]' ) ); ?>" |
239 | 239 | name="<?php echo esc_attr( $this->get_field_name( 'columns[user]' ) ); ?>" |
240 | 240 | value="1" |
241 | - <?php checked( ! empty( $this->instance['columns']['user'] ) ); ?> |
|
241 | + <?php checked( ! empty( $this->instance[ 'columns' ][ 'user' ] ) ); ?> |
|
242 | 242 | /> |
243 | 243 | <?php esc_html_e( 'User', 'wordpoints' ); ?> |
244 | 244 | </label> |
@@ -250,7 +250,7 @@ discard block |
||
250 | 250 | id="<?php echo esc_attr( $this->get_field_id( 'columns[points]' ) ); ?>" |
251 | 251 | name="<?php echo esc_attr( $this->get_field_name( 'columns[points]' ) ); ?>" |
252 | 252 | value="1" |
253 | - <?php checked( ! empty( $this->instance['columns']['points'] ) ); ?> |
|
253 | + <?php checked( ! empty( $this->instance[ 'columns' ][ 'points' ] ) ); ?> |
|
254 | 254 | /> |
255 | 255 | <?php esc_html_e( 'Points', 'wordpoints' ); ?> |
256 | 256 | </label> |
@@ -262,7 +262,7 @@ discard block |
||
262 | 262 | id="<?php echo esc_attr( $this->get_field_id( 'columns[description]' ) ); ?>" |
263 | 263 | name="<?php echo esc_attr( $this->get_field_name( 'columns[description]' ) ); ?>" |
264 | 264 | value="1" |
265 | - <?php checked( ! empty( $this->instance['columns']['description'] ) ); ?> |
|
265 | + <?php checked( ! empty( $this->instance[ 'columns' ][ 'description' ] ) ); ?> |
|
266 | 266 | /> |
267 | 267 | <?php esc_html_e( 'Description', 'wordpoints' ); ?> |
268 | 268 | </label> |
@@ -274,7 +274,7 @@ discard block |
||
274 | 274 | id="<?php echo esc_attr( $this->get_field_id( 'columns[time]' ) ); ?>" |
275 | 275 | name="<?php echo esc_attr( $this->get_field_name( 'columns[time]' ) ); ?>" |
276 | 276 | value="1" |
277 | - <?php checked( ! empty( $this->instance['columns']['time'] ) ); ?> |
|
277 | + <?php checked( ! empty( $this->instance[ 'columns' ][ 'time' ] ) ); ?> |
|
278 | 278 | /> |
279 | 279 | <?php esc_html_e( 'Time', 'wordpoints' ); ?> |
280 | 280 | </label> |
@@ -301,7 +301,7 @@ discard block |
||
301 | 301 | id="<?php echo esc_attr( $this->get_field_id( 'hide_user_names' ) ); ?>" |
302 | 302 | name="<?php echo esc_attr( $this->get_field_name( 'hide_user_names' ) ); ?>" |
303 | 303 | value="1" |
304 | - <?php checked( ! empty( $this->instance['hide_user_names'] ) ); ?> |
|
304 | + <?php checked( ! empty( $this->instance[ 'hide_user_names' ] ) ); ?> |
|
305 | 305 | /> |
306 | 306 | <?php esc_html_e( 'Hide user names (but not avatars)', 'wordpoints' ); ?> |
307 | 307 | </label> |
@@ -327,7 +327,7 @@ discard block |
||
327 | 327 | id="<?php echo esc_attr( $this->get_field_id( 'horizontal_scrolling' ) ); ?>" |
328 | 328 | name="<?php echo esc_attr( $this->get_field_name( 'horizontal_scrolling' ) ); ?>" |
329 | 329 | value="1" |
330 | - <?php checked( ! empty( $this->instance['horizontal_scrolling'] ) ); ?> |
|
330 | + <?php checked( ! empty( $this->instance[ 'horizontal_scrolling' ] ) ); ?> |
|
331 | 331 | /> |
332 | 332 | <?php esc_html_e( 'Enable horizontal scrolling', 'wordpoints' ); ?> |
333 | 333 | </label> |
@@ -72,22 +72,22 @@ discard block |
||
72 | 72 | */ |
73 | 73 | protected function verify_settings( $instance ) { |
74 | 74 | |
75 | - if ( ! is_user_logged_in() && empty( $instance['alt_text'] ) ) { |
|
75 | + if ( ! is_user_logged_in() && empty( $instance[ 'alt_text' ] ) ) { |
|
76 | 76 | return new WP_Error; |
77 | 77 | } |
78 | 78 | |
79 | 79 | if ( |
80 | - ! isset( $instance['number_logs'] ) |
|
81 | - || ! wordpoints_posint( $instance['number_logs'] ) |
|
80 | + ! isset( $instance[ 'number_logs' ] ) |
|
81 | + || ! wordpoints_posint( $instance[ 'number_logs' ] ) |
|
82 | 82 | ) { |
83 | - $instance['number_logs'] = 0; |
|
83 | + $instance[ 'number_logs' ] = 0; |
|
84 | 84 | } |
85 | 85 | |
86 | 86 | // In case the points type isn't set, we do this first. |
87 | 87 | $instance = WordPoints_Points_Widget::verify_settings( $instance ); |
88 | 88 | |
89 | - if ( ! is_wp_error( $instance ) && is_user_logged_in() && empty( $instance['text'] ) ) { |
|
90 | - $instance['text'] = wordpoints_get_points_type_setting( $instance['points_type'], 'name' ) . ': %points%'; |
|
89 | + if ( ! is_wp_error( $instance ) && is_user_logged_in() && empty( $instance[ 'text' ] ) ) { |
|
90 | + $instance[ 'text' ] = wordpoints_get_points_type_setting( $instance[ 'points_type' ], 'name' ) . ': %points%'; |
|
91 | 91 | } |
92 | 92 | |
93 | 93 | return $instance; |
@@ -104,16 +104,16 @@ discard block |
||
104 | 104 | $text = str_replace( |
105 | 105 | '%points%', |
106 | 106 | wordpoints_format_points( |
107 | - wordpoints_get_points( get_current_user_id(), $instance['points_type'] ), |
|
108 | - $instance['points_type'], |
|
107 | + wordpoints_get_points( get_current_user_id(), $instance[ 'points_type' ] ), |
|
108 | + $instance[ 'points_type' ], |
|
109 | 109 | 'my_points_widget' |
110 | 110 | ), |
111 | - $instance['text'] |
|
111 | + $instance[ 'text' ] |
|
112 | 112 | ); |
113 | 113 | |
114 | 114 | } else { |
115 | 115 | |
116 | - $text = $instance['alt_text']; |
|
116 | + $text = $instance[ 'alt_text' ]; |
|
117 | 117 | } |
118 | 118 | |
119 | 119 | /** |
@@ -134,7 +134,7 @@ discard block |
||
134 | 134 | |
135 | 135 | echo '<div class="wordpoints-points-widget-text">', $text, '</div><br />'; // XSS OK, WPCS |
136 | 136 | |
137 | - if ( is_user_logged_in() && 0 !== $instance['number_logs'] ) { |
|
137 | + if ( is_user_logged_in() && 0 !== $instance[ 'number_logs' ] ) { |
|
138 | 138 | parent::widget_body( $instance ); |
139 | 139 | } |
140 | 140 | } |
@@ -152,12 +152,12 @@ discard block |
||
152 | 152 | */ |
153 | 153 | public function update( $new_instance, $old_instance ) { |
154 | 154 | |
155 | - $this->defaults['number_logs'] = 0; |
|
155 | + $this->defaults[ 'number_logs' ] = 0; |
|
156 | 156 | |
157 | 157 | parent::update( $new_instance, $old_instance ); |
158 | 158 | |
159 | - $this->instance['text'] = trim( $this->instance['text'] ); |
|
160 | - $this->instance['alt_text'] = trim( $this->instance['alt_text'] ); |
|
159 | + $this->instance[ 'text' ] = trim( $this->instance[ 'text' ] ); |
|
160 | + $this->instance[ 'alt_text' ] = trim( $this->instance[ 'alt_text' ] ); |
|
161 | 161 | |
162 | 162 | return $this->instance; |
163 | 163 | } |
@@ -174,7 +174,7 @@ discard block |
||
174 | 174 | |
175 | 175 | <p> |
176 | 176 | <label for="<?php echo esc_attr( $this->get_field_id( 'text' ) ); ?>"><?php esc_html_e( 'Widget text', 'wordpoints' ); ?></label> |
177 | - <input type="text" class="widefat" id="<?php echo esc_attr( $this->get_field_id( 'text' ) ); ?>" name="<?php echo esc_attr( $this->get_field_name( 'text' ) ); ?>" value="<?php echo esc_attr( $this->instance['text'] ); ?>" /> |
|
177 | + <input type="text" class="widefat" id="<?php echo esc_attr( $this->get_field_id( 'text' ) ); ?>" name="<?php echo esc_attr( $this->get_field_name( 'text' ) ); ?>" value="<?php echo esc_attr( $this->instance[ 'text' ] ); ?>" /> |
|
178 | 178 | <?php // translators: Placeholder name. ?> |
179 | 179 | <small><i><?php echo esc_html( sprintf( __( '%s will be replaced with the points of the logged in user', 'wordpoints' ), '%points%' ) ); ?></i></small> |
180 | 180 | <?php |
@@ -192,12 +192,12 @@ discard block |
||
192 | 192 | </p> |
193 | 193 | <p> |
194 | 194 | <label for="<?php echo esc_attr( $this->get_field_id( 'alt_text' ) ); ?>"><?php esc_html_e( 'Text if the user is not logged in', 'wordpoints' ); ?></label> |
195 | - <input type="text" class="widefat" id="<?php echo esc_attr( $this->get_field_id( 'alt_text' ) ); ?>" name="<?php echo esc_attr( $this->get_field_name( 'alt_text' ) ); ?>" value="<?php echo esc_attr( $this->instance['alt_text'] ); ?>" /> |
|
195 | + <input type="text" class="widefat" id="<?php echo esc_attr( $this->get_field_id( 'alt_text' ) ); ?>" name="<?php echo esc_attr( $this->get_field_name( 'alt_text' ) ); ?>" value="<?php echo esc_attr( $this->instance[ 'alt_text' ] ); ?>" /> |
|
196 | 196 | <small><i><?php esc_html_e( 'Leave this field blank to hide the widget if the user is not logged in', 'wordpoints' ); ?></i></small> |
197 | 197 | </p> |
198 | 198 | <p> |
199 | 199 | <label for="<?php echo esc_attr( $this->get_field_id( 'number_logs' ) ); ?>"><?php esc_html_e( 'Number of latest log entries for this user to display', 'wordpoints' ); ?></label> |
200 | - <input type="number" min="0" class="widefat" id="<?php echo esc_attr( $this->get_field_id( 'number_logs' ) ); ?>" name="<?php echo esc_attr( $this->get_field_name( 'number_logs' ) ); ?>" value="<?php echo esc_attr( $this->instance['number_logs'] ); ?>" /> |
|
200 | + <input type="number" min="0" class="widefat" id="<?php echo esc_attr( $this->get_field_id( 'number_logs' ) ); ?>" name="<?php echo esc_attr( $this->get_field_name( 'number_logs' ) ); ?>" value="<?php echo esc_attr( $this->instance[ 'number_logs' ] ); ?>" /> |
|
201 | 201 | <small><i><?php esc_html_e( 'Set this to 0 to keep from showing any logs', 'wordpoints' ); ?></i></small> |
202 | 202 | </p> |
203 | 203 |
@@ -61,7 +61,7 @@ discard block |
||
61 | 61 | ); |
62 | 62 | |
63 | 63 | if ( ! empty( $points_type_name ) ) { |
64 | - $this->column_headings['points'] = $points_type_name; |
|
64 | + $this->column_headings[ 'points' ] = $points_type_name; |
|
65 | 65 | } |
66 | 66 | } |
67 | 67 | |
@@ -69,7 +69,7 @@ discard block |
||
69 | 69 | |
70 | 70 | foreach ( array( 'searchable', 'paginate' ) as $arg ) { |
71 | 71 | if ( $this->args[ $arg ] ) { |
72 | - $extra_classes[] = $arg; |
|
72 | + $extra_classes[ ] = $arg; |
|
73 | 73 | } |
74 | 74 | } |
75 | 75 | |
@@ -92,19 +92,19 @@ discard block |
||
92 | 92 | ?> |
93 | 93 | |
94 | 94 | <div class="wordpoints-points-logs-wrapper"> |
95 | - <?php if ( $this->args['searchable'] ) : ?> |
|
95 | + <?php if ( $this->args[ 'searchable' ] ) : ?> |
|
96 | 96 | <?php $this->search_box(); ?> |
97 | 97 | <?php endif; ?> |
98 | 98 | |
99 | 99 | <table class="wordpoints-points-logs widefat <?php echo esc_attr( implode( ' ', $extra_classes ) ); ?>"> |
100 | 100 | <thead> |
101 | 101 | <tr> |
102 | - <?php if ( $this->args['show_users'] ) : ?> |
|
103 | - <th scope="col"><?php echo esc_html( $this->column_headings['user'] ); ?></th> |
|
102 | + <?php if ( $this->args[ 'show_users' ] ) : ?> |
|
103 | + <th scope="col"><?php echo esc_html( $this->column_headings[ 'user' ] ); ?></th> |
|
104 | 104 | <?php endif; ?> |
105 | - <th scope="col"><?php echo esc_html( $this->column_headings['points'] ); ?></th> |
|
106 | - <th scope="col"><?php echo esc_html( $this->column_headings['description'] ); ?></th> |
|
107 | - <th scope="col"><?php echo esc_html( $this->column_headings['time'] ); ?></th> |
|
105 | + <th scope="col"><?php echo esc_html( $this->column_headings[ 'points' ] ); ?></th> |
|
106 | + <th scope="col"><?php echo esc_html( $this->column_headings[ 'description' ] ); ?></th> |
|
107 | + <th scope="col"><?php echo esc_html( $this->column_headings[ 'time' ] ); ?></th> |
|
108 | 108 | </tr> |
109 | 109 | </thead> |
110 | 110 | <tbody> |
@@ -118,7 +118,7 @@ discard block |
||
118 | 118 | |
119 | 119 | ?> |
120 | 120 | <tr> |
121 | - <td colspan="<?php echo ( $this->args['show_users'] ) ? 4 : 3; ?>"> |
|
121 | + <td colspan="<?php echo ( $this->args[ 'show_users' ] ) ? 4 : 3; ?>"> |
|
122 | 122 | <?php esc_html_e( 'No matching logs found.', 'wordpoints' ); ?> |
123 | 123 | </td> |
124 | 124 | </tr> |
@@ -135,7 +135,7 @@ discard block |
||
135 | 135 | ?> |
136 | 136 | |
137 | 137 | <tr class="wordpoints-log-id-<?php echo (int) $log->id; ?> <?php echo ( $this->i % 2 ) ? 'odd' : 'even'; ?>"> |
138 | - <?php if ( $this->args['show_users'] ) : ?> |
|
138 | + <?php if ( $this->args[ 'show_users' ] ) : ?> |
|
139 | 139 | <td> |
140 | 140 | <?php echo get_avatar( $user->ID, 32 ); ?> |
141 | 141 | <span class="wordpoints-points-log-user-name"> |
@@ -199,17 +199,17 @@ discard block |
||
199 | 199 | </tbody> |
200 | 200 | <tfoot> |
201 | 201 | <tr> |
202 | - <?php if ( $this->args['show_users'] ) : ?> |
|
203 | - <th scope="col"><?php echo esc_html( $this->column_headings['user'] ); ?></th> |
|
202 | + <?php if ( $this->args[ 'show_users' ] ) : ?> |
|
203 | + <th scope="col"><?php echo esc_html( $this->column_headings[ 'user' ] ); ?></th> |
|
204 | 204 | <?php endif; ?> |
205 | - <th scope="col"><?php echo esc_html( $this->column_headings['points'] ); ?></th> |
|
206 | - <th scope="col"><?php echo esc_html( $this->column_headings['description'] ); ?></th> |
|
207 | - <th scope="col"><?php echo esc_html( $this->column_headings['time'] ); ?></th> |
|
205 | + <th scope="col"><?php echo esc_html( $this->column_headings[ 'points' ] ); ?></th> |
|
206 | + <th scope="col"><?php echo esc_html( $this->column_headings[ 'description' ] ); ?></th> |
|
207 | + <th scope="col"><?php echo esc_html( $this->column_headings[ 'time' ] ); ?></th> |
|
208 | 208 | </tr> |
209 | 209 | </tfoot> |
210 | 210 | </table> |
211 | 211 | |
212 | - <?php if ( $this->args['paginate'] ) : ?> |
|
212 | + <?php if ( $this->args[ 'paginate' ] ) : ?> |
|
213 | 213 | <?php $this->pagination(); ?> |
214 | 214 | <?php endif; ?> |
215 | 215 | </div> |
@@ -224,10 +224,10 @@ discard block |
||
224 | 224 | |
225 | 225 | $search_term = ''; |
226 | 226 | |
227 | - if ( isset( $_POST['wordpoints_points_logs_search'] ) ) { // WPCS: CSRF OK |
|
227 | + if ( isset( $_POST[ 'wordpoints_points_logs_search' ] ) ) { // WPCS: CSRF OK |
|
228 | 228 | $search_term = trim( |
229 | 229 | sanitize_text_field( |
230 | - wp_unslash( $_POST['wordpoints_points_logs_search'] ) // WPCS: CSRF OK |
|
230 | + wp_unslash( $_POST[ 'wordpoints_points_logs_search' ] ) // WPCS: CSRF OK |
|
231 | 231 | ) |
232 | 232 | ); |
233 | 233 | |
@@ -245,10 +245,10 @@ discard block |
||
245 | 245 | $page = 1; |
246 | 246 | |
247 | 247 | if ( |
248 | - isset( $_GET['wordpoints_points_logs_page'] ) // WPCS: CSRF OK. |
|
249 | - && wordpoints_posint( $_GET['wordpoints_points_logs_page'] ) // WPCS: CSRF OK. |
|
248 | + isset( $_GET[ 'wordpoints_points_logs_page' ] ) // WPCS: CSRF OK. |
|
249 | + && wordpoints_posint( $_GET[ 'wordpoints_points_logs_page' ] ) // WPCS: CSRF OK. |
|
250 | 250 | ) { |
251 | - $page = (int) $_GET['wordpoints_points_logs_page']; |
|
251 | + $page = (int) $_GET[ 'wordpoints_points_logs_page' ]; |
|
252 | 252 | } |
253 | 253 | |
254 | 254 | return $page; |
@@ -262,10 +262,10 @@ discard block |
||
262 | 262 | $per_page = 25; |
263 | 263 | |
264 | 264 | if ( |
265 | - isset( $_GET['wordpoints_points_logs_per_page'] ) // WPCS: CSRF OK. |
|
266 | - && wordpoints_posint( $_GET['wordpoints_points_logs_per_page'] ) // WPCS: CSRF OK. |
|
265 | + isset( $_GET[ 'wordpoints_points_logs_per_page' ] ) // WPCS: CSRF OK. |
|
266 | + && wordpoints_posint( $_GET[ 'wordpoints_points_logs_per_page' ] ) // WPCS: CSRF OK. |
|
267 | 267 | ) { |
268 | - $per_page = (int) $_GET['wordpoints_points_logs_per_page']; |
|
268 | + $per_page = (int) $_GET[ 'wordpoints_points_logs_per_page' ]; |
|
269 | 269 | } |
270 | 270 | |
271 | 271 | return $per_page; |
@@ -117,11 +117,11 @@ discard block |
||
117 | 117 | */ |
118 | 118 | function wordpoints_add_points_type( $settings ) { |
119 | 119 | |
120 | - if ( ! is_array( $settings ) || ! isset( $settings['name'] ) ) { |
|
120 | + if ( ! is_array( $settings ) || ! isset( $settings[ 'name' ] ) ) { |
|
121 | 121 | return false; |
122 | 122 | } |
123 | 123 | |
124 | - $slug = $settings['name']; |
|
124 | + $slug = $settings[ 'name' ]; |
|
125 | 125 | $slug = preg_replace( '/\s+/', '-', $slug ); |
126 | 126 | $slug = preg_replace( '/-+/', '-', $slug ); |
127 | 127 | $slug = trim( $slug, '-' ); |
@@ -165,7 +165,7 @@ discard block |
||
165 | 165 | |
166 | 166 | $points_types = wordpoints_get_points_types(); |
167 | 167 | |
168 | - if ( ! is_array( $settings ) || ! isset( $points_types[ $slug ], $settings['name'] ) ) { |
|
168 | + if ( ! is_array( $settings ) || ! isset( $points_types[ $slug ], $settings[ 'name' ] ) ) { |
|
169 | 169 | return false; |
170 | 170 | } |
171 | 171 | |
@@ -1094,13 +1094,13 @@ discard block |
||
1094 | 1094 | , array( '%d' ) |
1095 | 1095 | ); |
1096 | 1096 | |
1097 | - if ( ! isset( $flushed['points_types'][ $log->points_type ], $flushed['user_ids'][ $log->user_id ] ) ) { |
|
1097 | + if ( ! isset( $flushed[ 'points_types' ][ $log->points_type ], $flushed[ 'user_ids' ][ $log->user_id ] ) ) { |
|
1098 | 1098 | wordpoints_flush_points_logs_caches( |
1099 | 1099 | array( 'user_id' => $log->user_id, 'points_type' => $log->points_type ) |
1100 | 1100 | ); |
1101 | 1101 | |
1102 | - $flushed['points_types'][ $log->points_type ] = true; |
|
1103 | - $flushed['user_ids'][ $log->user_id ] = true; |
|
1102 | + $flushed[ 'points_types' ][ $log->points_type ] = true; |
|
1103 | + $flushed[ 'user_ids' ][ $log->user_id ] = true; |
|
1104 | 1104 | } |
1105 | 1105 | } |
1106 | 1106 | |
@@ -1134,9 +1134,9 @@ discard block |
||
1134 | 1134 | $cache = array( 'is_max' => false, 'top_users' => array() ); |
1135 | 1135 | } |
1136 | 1136 | |
1137 | - $cached_users = count( $cache['top_users'] ); |
|
1137 | + $cached_users = count( $cache[ 'top_users' ] ); |
|
1138 | 1138 | |
1139 | - if ( $num_users > $cached_users && ! $cache['is_max'] ) { |
|
1139 | + if ( $num_users > $cached_users && ! $cache[ 'is_max' ] ) { |
|
1140 | 1140 | |
1141 | 1141 | global $wpdb; |
1142 | 1142 | |
@@ -1185,19 +1185,19 @@ discard block |
||
1185 | 1185 | return array(); |
1186 | 1186 | } |
1187 | 1187 | |
1188 | - $cache['top_users'] = array_merge( $cache['top_users'], $top_users ); |
|
1188 | + $cache[ 'top_users' ] = array_merge( $cache[ 'top_users' ], $top_users ); |
|
1189 | 1189 | |
1190 | - if ( count( $cache['top_users'] ) < $num_users ) { |
|
1191 | - $cache['is_max'] = true; |
|
1190 | + if ( count( $cache[ 'top_users' ] ) < $num_users ) { |
|
1191 | + $cache[ 'is_max' ] = true; |
|
1192 | 1192 | } |
1193 | 1193 | |
1194 | - $cache['top_users'] = array_map( 'intval', $cache['top_users'] ); |
|
1194 | + $cache[ 'top_users' ] = array_map( 'intval', $cache[ 'top_users' ] ); |
|
1195 | 1195 | |
1196 | 1196 | wp_cache_set( $points_type, $cache, 'wordpoints_points_top_users' ); |
1197 | 1197 | |
1198 | 1198 | } // End if ( not cached ). |
1199 | 1199 | |
1200 | - return array_slice( $cache['top_users'], 0, $num_users ); |
|
1200 | + return array_slice( $cache[ 'top_users' ], 0, $num_users ); |
|
1201 | 1201 | } |
1202 | 1202 | |
1203 | 1203 | /** |
@@ -1229,7 +1229,7 @@ discard block |
||
1229 | 1229 | $points_type_name = wordpoints_get_points_type_setting( $points_type, 'name' ); |
1230 | 1230 | |
1231 | 1231 | if ( ! empty( $points_type_name ) ) { |
1232 | - $column_headers['points'] = $points_type_name; |
|
1232 | + $column_headers[ 'points' ] = $points_type_name; |
|
1233 | 1233 | } |
1234 | 1234 | |
1235 | 1235 | /** |
@@ -1254,11 +1254,11 @@ discard block |
||
1254 | 1254 | <thead> |
1255 | 1255 | <tr> |
1256 | 1256 | <th scope="col"> |
1257 | - <span aria-hidden="true"><?php echo esc_html( $column_headers['#'] ); ?></span> |
|
1258 | - <span class="screen-reader-text"><?php echo esc_html( $column_headers['position'] ); ?></span> |
|
1257 | + <span aria-hidden="true"><?php echo esc_html( $column_headers[ '#' ] ); ?></span> |
|
1258 | + <span class="screen-reader-text"><?php echo esc_html( $column_headers[ 'position' ] ); ?></span> |
|
1259 | 1259 | </th> |
1260 | - <th scope="col"><?php echo esc_html( $column_headers['user'] ); ?></th> |
|
1261 | - <th scope="col"><?php echo esc_html( $column_headers['points'] ); ?></th> |
|
1260 | + <th scope="col"><?php echo esc_html( $column_headers[ 'user' ] ); ?></th> |
|
1261 | + <th scope="col"><?php echo esc_html( $column_headers[ 'points' ] ); ?></th> |
|
1262 | 1262 | </tr> |
1263 | 1263 | </thead> |
1264 | 1264 | <tbody> |
@@ -1317,11 +1317,11 @@ discard block |
||
1317 | 1317 | <tfoot> |
1318 | 1318 | <tr> |
1319 | 1319 | <th scope="col"> |
1320 | - <span aria-hidden="true"><?php echo esc_html( $column_headers['#'] ); ?></span> |
|
1321 | - <span class="screen-reader-text"><?php echo esc_html( $column_headers['position'] ); ?></span> |
|
1320 | + <span aria-hidden="true"><?php echo esc_html( $column_headers[ '#' ] ); ?></span> |
|
1321 | + <span class="screen-reader-text"><?php echo esc_html( $column_headers[ 'position' ] ); ?></span> |
|
1322 | 1322 | </th> |
1323 | - <th scope="col"><?php echo esc_html( $column_headers['user'] ); ?></th> |
|
1324 | - <th scope="col"><?php echo esc_html( $column_headers['points'] ); ?></th> |
|
1323 | + <th scope="col"><?php echo esc_html( $column_headers[ 'user' ] ); ?></th> |
|
1324 | + <th scope="col"><?php echo esc_html( $column_headers[ 'points' ] ); ?></th> |
|
1325 | 1325 | </tr> |
1326 | 1326 | </tfoot> |
1327 | 1327 | </table> |
@@ -1360,7 +1360,7 @@ discard block |
||
1360 | 1360 | $cache = wp_cache_get( $slug, 'wordpoints_points_top_users' ); |
1361 | 1361 | |
1362 | 1362 | // If there aren't fewer users than the cache holds, we don't need to clear it. |
1363 | - if ( ! is_array( $cache ) || ! $cache['is_max'] ) { |
|
1363 | + if ( ! is_array( $cache ) || ! $cache[ 'is_max' ] ) { |
|
1364 | 1364 | continue; |
1365 | 1365 | } |
1366 | 1366 | |
@@ -1385,7 +1385,7 @@ discard block |
||
1385 | 1385 | $cache = wp_cache_get( $slug, 'wordpoints_points_top_users' ); |
1386 | 1386 | |
1387 | 1387 | // If this user isn't in the cache, we don't need to clear it. |
1388 | - if ( ! is_array( $cache ) || ! in_array( (int) $user_id, array_map( 'intval', $cache['top_users'] ), true ) ) { |
|
1388 | + if ( ! is_array( $cache ) || ! in_array( (int) $user_id, array_map( 'intval', $cache[ 'top_users' ] ), true ) ) { |
|
1389 | 1389 | continue; |
1390 | 1390 | } |
1391 | 1391 |