@@ -45,8 +45,8 @@ discard block |
||
45 | 45 | */ |
46 | 46 | protected function verify_settings( $instance ) { |
47 | 47 | |
48 | - if ( ! wordpoints_posint( $instance['number_logs'] ) ) { |
|
49 | - $instance['number_logs'] = $this->defaults['number_logs']; |
|
48 | + if ( ! wordpoints_posint( $instance[ 'number_logs' ] ) ) { |
|
49 | + $instance[ 'number_logs' ] = $this->defaults[ 'number_logs' ]; |
|
50 | 50 | } |
51 | 51 | |
52 | 52 | return parent::verify_settings( $instance ); |
@@ -58,9 +58,9 @@ discard block |
||
58 | 58 | */ |
59 | 59 | public function widget_body( $instance ) { |
60 | 60 | |
61 | - $query_args = wordpoints_get_points_logs_query_args( $instance['points_type'] ); |
|
61 | + $query_args = wordpoints_get_points_logs_query_args( $instance[ 'points_type' ] ); |
|
62 | 62 | |
63 | - $query_args['limit'] = $instance['number_logs']; |
|
63 | + $query_args[ 'limit' ] = $instance[ 'number_logs' ]; |
|
64 | 64 | |
65 | 65 | $logs_query = new WordPoints_Points_Logs_Query( $query_args ); |
66 | 66 | $logs_query->prime_cache(); |
@@ -83,8 +83,8 @@ discard block |
||
83 | 83 | |
84 | 84 | parent::update( $new_instance, $old_instance ); |
85 | 85 | |
86 | - if ( ! wordpoints_posint( $this->instance['number_logs'] ) ) { |
|
87 | - $this->instance['number_logs'] = $this->defaults['number_logs']; |
|
86 | + if ( ! wordpoints_posint( $this->instance[ 'number_logs' ] ) ) { |
|
87 | + $this->instance[ 'number_logs' ] = $this->defaults[ 'number_logs' ]; |
|
88 | 88 | } |
89 | 89 | |
90 | 90 | return $this->instance; |
@@ -98,15 +98,15 @@ discard block |
||
98 | 98 | |
99 | 99 | parent::form( $instance ); |
100 | 100 | |
101 | - if ( ! wordpoints_posint( $this->instance['number_logs'] ) ) { |
|
102 | - $this->instance['number_logs'] = $this->defaults['number_logs']; |
|
101 | + if ( ! wordpoints_posint( $this->instance[ 'number_logs' ] ) ) { |
|
102 | + $this->instance[ 'number_logs' ] = $this->defaults[ 'number_logs' ]; |
|
103 | 103 | } |
104 | 104 | |
105 | 105 | ?> |
106 | 106 | |
107 | 107 | <p> |
108 | 108 | <label for="<?php echo esc_attr( $this->get_field_id( 'number_logs' ) ); ?>"><?php esc_html_e( 'Number of log entries to display', 'wordpoints' ); ?></label> |
109 | - <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'] ); ?>" /> |
|
109 | + <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' ] ); ?>" /> |
|
110 | 110 | </p> |
111 | 111 | |
112 | 112 | <?php |
@@ -55,22 +55,22 @@ discard block |
||
55 | 55 | */ |
56 | 56 | protected function verify_settings( $instance ) { |
57 | 57 | |
58 | - if ( ! is_user_logged_in() && empty( $instance['alt_text'] ) ) { |
|
58 | + if ( ! is_user_logged_in() && empty( $instance[ 'alt_text' ] ) ) { |
|
59 | 59 | return new WP_Error; |
60 | 60 | } |
61 | 61 | |
62 | 62 | if ( |
63 | - ! isset( $instance['number_logs'] ) |
|
64 | - || ! wordpoints_posint( $instance['number_logs'] ) |
|
63 | + ! isset( $instance[ 'number_logs' ] ) |
|
64 | + || ! wordpoints_posint( $instance[ 'number_logs' ] ) |
|
65 | 65 | ) { |
66 | - $instance['number_logs'] = 0; |
|
66 | + $instance[ 'number_logs' ] = 0; |
|
67 | 67 | } |
68 | 68 | |
69 | 69 | // In case the points type isn't set, we do this first. |
70 | 70 | $instance = parent::verify_settings( $instance ); |
71 | 71 | |
72 | - if ( ! is_wp_error( $instance ) && is_user_logged_in() && empty( $instance['text'] ) ) { |
|
73 | - $instance['text'] = wordpoints_get_points_type_setting( $instance['points_type'], 'name' ) . ': %points%'; |
|
72 | + if ( ! is_wp_error( $instance ) && is_user_logged_in() && empty( $instance[ 'text' ] ) ) { |
|
73 | + $instance[ 'text' ] = wordpoints_get_points_type_setting( $instance[ 'points_type' ], 'name' ) . ': %points%'; |
|
74 | 74 | } |
75 | 75 | |
76 | 76 | return $instance; |
@@ -87,16 +87,16 @@ discard block |
||
87 | 87 | $text = str_replace( |
88 | 88 | '%points%', |
89 | 89 | wordpoints_format_points( |
90 | - wordpoints_get_points( get_current_user_id(), $instance['points_type'] ), |
|
91 | - $instance['points_type'], |
|
90 | + wordpoints_get_points( get_current_user_id(), $instance[ 'points_type' ] ), |
|
91 | + $instance[ 'points_type' ], |
|
92 | 92 | 'my_points_widget' |
93 | 93 | ), |
94 | - $instance['text'] |
|
94 | + $instance[ 'text' ] |
|
95 | 95 | ); |
96 | 96 | |
97 | 97 | } else { |
98 | 98 | |
99 | - $text = $instance['alt_text']; |
|
99 | + $text = $instance[ 'alt_text' ]; |
|
100 | 100 | } |
101 | 101 | |
102 | 102 | /** |
@@ -117,11 +117,11 @@ discard block |
||
117 | 117 | |
118 | 118 | echo '<div class="wordpoints-points-widget-text">', $text, '</div><br />'; // XSS OK, WPCS |
119 | 119 | |
120 | - if ( is_user_logged_in() && 0 !== $instance['number_logs'] ) { |
|
120 | + if ( is_user_logged_in() && 0 !== $instance[ 'number_logs' ] ) { |
|
121 | 121 | |
122 | - $query_args = wordpoints_get_points_logs_query_args( $instance['points_type'], 'current_user' ); |
|
122 | + $query_args = wordpoints_get_points_logs_query_args( $instance[ 'points_type' ], 'current_user' ); |
|
123 | 123 | |
124 | - $query_args['limit'] = $instance['number_logs']; |
|
124 | + $query_args[ 'limit' ] = $instance[ 'number_logs' ]; |
|
125 | 125 | |
126 | 126 | $logs_query = new WordPoints_Points_Logs_Query( $query_args ); |
127 | 127 | $logs_query->prime_cache( 'current_user:%points_type%:%user_id%' ); |
@@ -145,11 +145,11 @@ discard block |
||
145 | 145 | |
146 | 146 | parent::update( $new_instance, $old_instance ); |
147 | 147 | |
148 | - $this->instance['text'] = trim( $this->instance['text'] ); |
|
149 | - $this->instance['alt_text'] = trim( $this->instance['alt_text'] ); |
|
148 | + $this->instance[ 'text' ] = trim( $this->instance[ 'text' ] ); |
|
149 | + $this->instance[ 'alt_text' ] = trim( $this->instance[ 'alt_text' ] ); |
|
150 | 150 | |
151 | - if ( ! wordpoints_posint( $this->instance['number_logs'] ) ) { |
|
152 | - $this->instance['number_logs'] = 0; |
|
151 | + if ( ! wordpoints_posint( $this->instance[ 'number_logs' ] ) ) { |
|
152 | + $this->instance[ 'number_logs' ] = 0; |
|
153 | 153 | } |
154 | 154 | |
155 | 155 | return $this->instance; |
@@ -167,7 +167,7 @@ discard block |
||
167 | 167 | |
168 | 168 | <p> |
169 | 169 | <label for="<?php echo esc_attr( $this->get_field_id( 'text' ) ); ?>"><?php esc_html_e( 'Widget text', 'wordpoints' ); ?></label> |
170 | - <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'] ); ?>" /> |
|
170 | + <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' ] ); ?>" /> |
|
171 | 171 | <?php // translators: Placeholder name. ?> |
172 | 172 | <small><i><?php echo esc_html( sprintf( __( '%s will be replaced with the points of the logged in user', 'wordpoints' ), '%points%' ) ); ?></i></small> |
173 | 173 | <?php |
@@ -185,12 +185,12 @@ discard block |
||
185 | 185 | </p> |
186 | 186 | <p> |
187 | 187 | <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> |
188 | - <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'] ); ?>" /> |
|
188 | + <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' ] ); ?>" /> |
|
189 | 189 | <small><i><?php esc_html_e( 'Leave this field blank to hide the widget if the user is not logged in', 'wordpoints' ); ?></i></small> |
190 | 190 | </p> |
191 | 191 | <p> |
192 | 192 | <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> |
193 | - <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'] ); ?>" /> |
|
193 | + <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' ] ); ?>" /> |
|
194 | 194 | <small><i><?php esc_html_e( 'Set this to 0 to keep from showing any logs', 'wordpoints' ); ?></i></small> |
195 | 195 | </p> |
196 | 196 |
@@ -50,8 +50,8 @@ discard block |
||
50 | 50 | */ |
51 | 51 | protected function verify_settings( $instance ) { |
52 | 52 | |
53 | - if ( empty( $instance['num_users'] ) ) { |
|
54 | - $instance['num_users'] = $this->defaults['num_users']; |
|
53 | + if ( empty( $instance[ 'num_users' ] ) ) { |
|
54 | + $instance[ 'num_users' ] = $this->defaults[ 'num_users' ]; |
|
55 | 55 | } |
56 | 56 | |
57 | 57 | return parent::verify_settings( $instance ); |
@@ -64,8 +64,8 @@ discard block |
||
64 | 64 | protected function widget_body( $instance ) { |
65 | 65 | |
66 | 66 | wordpoints_points_show_top_users( |
67 | - $instance['num_users'] |
|
68 | - , $instance['points_type'] |
|
67 | + $instance[ 'num_users' ] |
|
68 | + , $instance[ 'points_type' ] |
|
69 | 69 | , 'widget' |
70 | 70 | ); |
71 | 71 | } |
@@ -85,8 +85,8 @@ discard block |
||
85 | 85 | |
86 | 86 | parent::update( $new_instance, $old_instance ); |
87 | 87 | |
88 | - if ( ! wordpoints_posint( $this->instance['num_users'] ) ) { |
|
89 | - $this->instance['num_users'] = $this->defaults['num_users']; |
|
88 | + if ( ! wordpoints_posint( $this->instance[ 'num_users' ] ) ) { |
|
89 | + $this->instance[ 'num_users' ] = $this->defaults[ 'num_users' ]; |
|
90 | 90 | } |
91 | 91 | |
92 | 92 | return $this->instance; |
@@ -100,15 +100,15 @@ discard block |
||
100 | 100 | |
101 | 101 | parent::form( $instance ); |
102 | 102 | |
103 | - if ( ! wordpoints_posint( $this->instance['num_users'] ) ) { |
|
104 | - $this->instance['num_users'] = $this->defaults['num_users']; |
|
103 | + if ( ! wordpoints_posint( $this->instance[ 'num_users' ] ) ) { |
|
104 | + $this->instance[ 'num_users' ] = $this->defaults[ 'num_users' ]; |
|
105 | 105 | } |
106 | 106 | |
107 | 107 | ?> |
108 | 108 | |
109 | 109 | <p> |
110 | 110 | <label for="<?php echo esc_attr( $this->get_field_id( 'num_users' ) ); ?>"><?php esc_html_e( 'Number of top users to show', 'wordpoints' ); ?></label> |
111 | - <input type="number" min="1" class="widefat" id="<?php echo esc_attr( $this->get_field_id( 'num_users' ) ); ?>" name="<?php echo esc_attr( $this->get_field_name( 'num_users' ) ); ?>" value="<?php echo absint( $this->instance['num_users'] ); ?>" /> |
|
111 | + <input type="number" min="1" class="widefat" id="<?php echo esc_attr( $this->get_field_id( 'num_users' ) ); ?>" name="<?php echo esc_attr( $this->get_field_name( 'num_users' ) ); ?>" value="<?php echo absint( $this->instance[ 'num_users' ] ); ?>" /> |
|
112 | 112 | </p> |
113 | 113 | |
114 | 114 | <?php |
@@ -80,7 +80,7 @@ |
||
80 | 80 | protected function before_update() { |
81 | 81 | |
82 | 82 | if ( $this->network_wide ) { |
83 | - unset( $this->updates['1_8_0'] ); |
|
83 | + unset( $this->updates[ '1_8_0' ] ); |
|
84 | 84 | } |
85 | 85 | } |
86 | 86 |
@@ -60,7 +60,7 @@ |
||
60 | 60 | return false; |
61 | 61 | } |
62 | 62 | |
63 | - $args['slug'] = $type; |
|
63 | + $args[ 'slug' ] = $type; |
|
64 | 64 | |
65 | 65 | self::$types[ $type ] = new $class( $args ); |
66 | 66 |
@@ -20,7 +20,7 @@ discard block |
||
20 | 20 | |
21 | 21 | $rank = wordpoints_get_formatted_user_rank( |
22 | 22 | get_current_user_id() |
23 | - , "points_type-{$instance['points_type']}" |
|
23 | + , "points_type-{$instance[ 'points_type' ]}" |
|
24 | 24 | , 'my-points-widget' |
25 | 25 | , array( 'widget_settings' => $instance ) |
26 | 26 | ); |
@@ -76,18 +76,18 @@ discard block |
||
76 | 76 | */ |
77 | 77 | function wordpoints_user_rank_shortcode_points_type_attr( $out, $pairs, $atts ) { |
78 | 78 | |
79 | - if ( empty( $out['rank_group'] ) ) { |
|
79 | + if ( empty( $out[ 'rank_group' ] ) ) { |
|
80 | 80 | |
81 | - if ( isset( $atts['points_type'] ) ) { |
|
81 | + if ( isset( $atts[ 'points_type' ] ) ) { |
|
82 | 82 | |
83 | - $out['rank_group'] = "points_type-{$atts['points_type']}"; |
|
83 | + $out[ 'rank_group' ] = "points_type-{$atts[ 'points_type' ]}"; |
|
84 | 84 | |
85 | 85 | } else { |
86 | 86 | |
87 | 87 | $points_type = wordpoints_get_default_points_type(); |
88 | 88 | |
89 | 89 | if ( $points_type ) { |
90 | - $out['rank_group'] = "points_type-{$points_type}"; |
|
90 | + $out[ 'rank_group' ] = "points_type-{$points_type}"; |
|
91 | 91 | } |
92 | 92 | } |
93 | 93 | } |
@@ -109,11 +109,11 @@ discard block |
||
109 | 109 | WordPoints_Rank_Groups::register_group( |
110 | 110 | "points_type-{$slug}" |
111 | 111 | , array( |
112 | - 'name' => $points_type['name'], |
|
112 | + 'name' => $points_type[ 'name' ], |
|
113 | 113 | 'description' => sprintf( |
114 | 114 | // translators: Points type name. |
115 | 115 | __( 'This rank group is associated with the “%s” points type.', 'wordpoints' ) |
116 | - , $points_type['name'] |
|
116 | + , $points_type[ 'name' ] |
|
117 | 117 | ), |
118 | 118 | ) |
119 | 119 | ); |
@@ -170,7 +170,7 @@ discard block |
||
170 | 170 | |
171 | 171 | ?> |
172 | 172 | |
173 | - <a href="<?php echo esc_url( self_admin_url( 'admin.php?page=wordpoints_ranks&tab=points_type-' . $points_type['slug'] ) ); ?>"> |
|
173 | + <a href="<?php echo esc_url( self_admin_url( 'admin.php?page=wordpoints_ranks&tab=points_type-' . $points_type[ 'slug' ] ) ); ?>"> |
|
174 | 174 | <?php esc_html_e( 'Go to the ranks for this points type.', 'wordpoints' ); ?> |
175 | 175 | </a> |
176 | 176 |
@@ -44,7 +44,7 @@ discard block |
||
44 | 44 | |
45 | 45 | $this->name = _x( 'Points', 'rank type', 'wordpoints' ); |
46 | 46 | |
47 | - if ( ! isset( $args['points_type'] ) ) { |
|
47 | + if ( ! isset( $args[ 'points_type' ] ) ) { |
|
48 | 48 | _doing_it_wrong( |
49 | 49 | __METHOD__ |
50 | 50 | , 'WordPoints Error: The "points_type" argument is required.' |
@@ -53,8 +53,8 @@ discard block |
||
53 | 53 | return; |
54 | 54 | } |
55 | 55 | |
56 | - $this->meta_fields['points']['label'] = _x( 'Points', 'form label', 'wordpoints' ); |
|
57 | - $this->meta_fields['points_type']['default'] = $args['points_type']; |
|
56 | + $this->meta_fields[ 'points' ][ 'label' ] = _x( 'Points', 'form label', 'wordpoints' ); |
|
57 | + $this->meta_fields[ 'points_type' ][ 'default' ] = $args[ 'points_type' ]; |
|
58 | 58 | |
59 | 59 | add_action( 'wordpoints_points_altered', array( $this, 'hook' ), 10, 3 ); |
60 | 60 | } |
@@ -80,7 +80,7 @@ discard block |
||
80 | 80 | */ |
81 | 81 | public function hook( $user_id, $points, $points_type ) { |
82 | 82 | |
83 | - if ( $points_type !== $this->meta_fields['points_type']['default'] ) { |
|
83 | + if ( $points_type !== $this->meta_fields[ 'points_type' ][ 'default' ] ) { |
|
84 | 84 | return; |
85 | 85 | } |
86 | 86 | |
@@ -92,7 +92,7 @@ discard block |
||
92 | 92 | */ |
93 | 93 | public function validate_rank_meta( array $meta ) { |
94 | 94 | |
95 | - if ( ! isset( $meta['points'] ) || false === wordpoints_int( $meta['points'] ) ) { |
|
95 | + if ( ! isset( $meta[ 'points' ] ) || false === wordpoints_int( $meta[ 'points' ] ) ) { |
|
96 | 96 | return new WP_Error( |
97 | 97 | 'wordpoints_points_rank_type_invalid_points' |
98 | 98 | , __( 'The amount of points is required, and must be a valid number.', 'wordpoints' ) |
@@ -101,22 +101,22 @@ discard block |
||
101 | 101 | } |
102 | 102 | |
103 | 103 | if ( |
104 | - ! isset( $meta['points_type'] ) |
|
105 | - || ! wordpoints_is_points_type( $meta['points_type'] ) |
|
104 | + ! isset( $meta[ 'points_type' ] ) |
|
105 | + || ! wordpoints_is_points_type( $meta[ 'points_type' ] ) |
|
106 | 106 | ) { |
107 | 107 | return false; |
108 | 108 | } |
109 | 109 | |
110 | - $minimum = wordpoints_get_points_minimum( $meta['points_type'] ); |
|
110 | + $minimum = wordpoints_get_points_minimum( $meta[ 'points_type' ] ); |
|
111 | 111 | |
112 | - if ( $meta['points'] < $minimum ) { |
|
112 | + if ( $meta[ 'points' ] < $minimum ) { |
|
113 | 113 | |
114 | 114 | return new WP_Error( |
115 | 115 | 'wordpoints_points_rank_type_points_less_than_minimum' |
116 | 116 | , sprintf( |
117 | 117 | // translators: Minimum number of points. |
118 | 118 | __( 'The number of points must be more than the minimum (%s).', 'wordpoints' ) |
119 | - , wordpoints_format_points( $minimum, $meta['points_type'], 'points_rank_error' ) |
|
119 | + , wordpoints_format_points( $minimum, $meta[ 'points_type' ], 'points_rank_error' ) |
|
120 | 120 | ) |
121 | 121 | , array( 'field' => 'points' ) |
122 | 122 | ); |
@@ -143,7 +143,7 @@ discard block |
||
143 | 143 | */ |
144 | 144 | protected function can_transition_user_rank( $user_id, $rank, array $args ) { |
145 | 145 | |
146 | - if ( $rank->points_type !== $this->meta_fields['points_type']['default'] ) { |
|
146 | + if ( $rank->points_type !== $this->meta_fields[ 'points_type' ][ 'default' ] ) { |
|
147 | 147 | return false; |
148 | 148 | } |
149 | 149 |
@@ -95,7 +95,7 @@ discard block |
||
95 | 95 | continue; |
96 | 96 | } |
97 | 97 | |
98 | - $ranks[] = self::_prepare_rank( $rank ); |
|
98 | + $ranks[ ] = self::_prepare_rank( $rank ); |
|
99 | 99 | } |
100 | 100 | |
101 | 101 | return $ranks; |
@@ -287,7 +287,7 @@ discard block |
||
287 | 287 | private function _verify_request( $action ) { |
288 | 288 | |
289 | 289 | if ( |
290 | - empty( $_POST['nonce'] ) |
|
290 | + empty( $_POST[ 'nonce' ] ) |
|
291 | 291 | || ! wordpoints_verify_nonce( 'nonce', $action, null, 'post' ) |
292 | 292 | ) { |
293 | 293 | wp_send_json_error( |
@@ -305,11 +305,11 @@ discard block |
||
305 | 305 | */ |
306 | 306 | private function _get_group() { |
307 | 307 | |
308 | - if ( ! isset( $_POST['group'] ) ) { // WPCS: CSRF OK. |
|
308 | + if ( ! isset( $_POST[ 'group' ] ) ) { // WPCS: CSRF OK. |
|
309 | 309 | $this->_unexpected_error( 'group' ); |
310 | 310 | } |
311 | 311 | |
312 | - $group = WordPoints_Rank_Groups::get_group( sanitize_key( $_POST['group'] ) ); // WPCS: CSRF OK. |
|
312 | + $group = WordPoints_Rank_Groups::get_group( sanitize_key( $_POST[ 'group' ] ) ); // WPCS: CSRF OK. |
|
313 | 313 | |
314 | 314 | if ( ! $group ) { |
315 | 315 | wp_send_json_error( array( 'message' => __( 'The rank group passed to the server is invalid. Perhaps it has been deleted. Try reloading the page.', 'wordpoints' ) ) ); |
@@ -327,11 +327,11 @@ discard block |
||
327 | 327 | */ |
328 | 328 | private function _get_rank() { |
329 | 329 | |
330 | - if ( ! isset( $_POST['id'] ) ) { // WPCS: CSRF OK. |
|
330 | + if ( ! isset( $_POST[ 'id' ] ) ) { // WPCS: CSRF OK. |
|
331 | 331 | $this->_unexpected_error( 'id' ); |
332 | 332 | } |
333 | 333 | |
334 | - $rank = wordpoints_get_rank( wordpoints_int( $_POST['id'] ) ); // WPCS: CSRF OK. |
|
334 | + $rank = wordpoints_get_rank( wordpoints_int( $_POST[ 'id' ] ) ); // WPCS: CSRF OK. |
|
335 | 335 | |
336 | 336 | if ( ! $rank ) { |
337 | 337 | wp_send_json_error( array( 'message' => __( 'The rank ID passed to the server is invalid. Perhaps it has been deleted. Try reloading the page.', 'wordpoints' ) ) ); |
@@ -351,8 +351,8 @@ discard block |
||
351 | 351 | |
352 | 352 | $name = ''; |
353 | 353 | |
354 | - if ( ! empty( $_POST['name'] ) ) { // WPCS: CSRF OK. |
|
355 | - $name = sanitize_text_field( wp_unslash( $_POST['name'] ) ); // WPCS: CSRF OK. |
|
354 | + if ( ! empty( $_POST[ 'name' ] ) ) { // WPCS: CSRF OK. |
|
355 | + $name = sanitize_text_field( wp_unslash( $_POST[ 'name' ] ) ); // WPCS: CSRF OK. |
|
356 | 356 | } |
357 | 357 | |
358 | 358 | if ( ! $name ) { |
@@ -376,11 +376,11 @@ discard block |
||
376 | 376 | */ |
377 | 377 | private function _get_rank_type() { |
378 | 378 | |
379 | - if ( empty( $_POST['type'] ) ) { // WPCS: CSRF OK. |
|
379 | + if ( empty( $_POST[ 'type' ] ) ) { // WPCS: CSRF OK. |
|
380 | 380 | $this->_unexpected_error( 'type' ); |
381 | 381 | } |
382 | 382 | |
383 | - $type = sanitize_text_field( wp_unslash( $_POST['type'] ) ); // WPCS: CSRF OK. |
|
383 | + $type = sanitize_text_field( wp_unslash( $_POST[ 'type' ] ) ); // WPCS: CSRF OK. |
|
384 | 384 | |
385 | 385 | if ( ! WordPoints_Rank_Types::is_type_registered( $type ) ) { |
386 | 386 | wp_send_json_error( array( 'message' => __( 'That rank type was not recognized. It may no longer be available. Try reloading the page.', 'wordpoints' ) ) ); |
@@ -401,13 +401,13 @@ discard block |
||
401 | 401 | private function _get_rank_position() { |
402 | 402 | |
403 | 403 | if ( |
404 | - ! isset( $_POST['order'] ) // WPCS: CSRF OK. |
|
405 | - || false === wordpoints_int( $_POST['order'] ) // WPCS: CSRF OK. |
|
404 | + ! isset( $_POST[ 'order' ] ) // WPCS: CSRF OK. |
|
405 | + || false === wordpoints_int( $_POST[ 'order' ] ) // WPCS: CSRF OK. |
|
406 | 406 | ) { |
407 | 407 | $this->_unexpected_error( 'order' ); |
408 | 408 | } |
409 | 409 | |
410 | - return (int) $_POST['order']; |
|
410 | + return (int) $_POST[ 'order' ]; |
|
411 | 411 | } |
412 | 412 | |
413 | 413 | /** |
@@ -305,7 +305,8 @@ discard block |
||
305 | 305 | */ |
306 | 306 | private function _get_group() { |
307 | 307 | |
308 | - if ( ! isset( $_POST['group'] ) ) { // WPCS: CSRF OK. |
|
308 | + if ( ! isset( $_POST['group'] ) ) { |
|
309 | +// WPCS: CSRF OK. |
|
309 | 310 | $this->_unexpected_error( 'group' ); |
310 | 311 | } |
311 | 312 | |
@@ -327,7 +328,8 @@ discard block |
||
327 | 328 | */ |
328 | 329 | private function _get_rank() { |
329 | 330 | |
330 | - if ( ! isset( $_POST['id'] ) ) { // WPCS: CSRF OK. |
|
331 | + if ( ! isset( $_POST['id'] ) ) { |
|
332 | +// WPCS: CSRF OK. |
|
331 | 333 | $this->_unexpected_error( 'id' ); |
332 | 334 | } |
333 | 335 | |
@@ -351,7 +353,8 @@ discard block |
||
351 | 353 | |
352 | 354 | $name = ''; |
353 | 355 | |
354 | - if ( ! empty( $_POST['name'] ) ) { // WPCS: CSRF OK. |
|
356 | + if ( ! empty( $_POST['name'] ) ) { |
|
357 | +// WPCS: CSRF OK. |
|
355 | 358 | $name = sanitize_text_field( wp_unslash( $_POST['name'] ) ); // WPCS: CSRF OK. |
356 | 359 | } |
357 | 360 | |
@@ -376,7 +379,8 @@ discard block |
||
376 | 379 | */ |
377 | 380 | private function _get_rank_type() { |
378 | 381 | |
379 | - if ( empty( $_POST['type'] ) ) { // WPCS: CSRF OK. |
|
382 | + if ( empty( $_POST['type'] ) ) { |
|
383 | +// WPCS: CSRF OK. |
|
380 | 384 | $this->_unexpected_error( 'type' ); |
381 | 385 | } |
382 | 386 |
@@ -19,7 +19,7 @@ |
||
19 | 19 | */ |
20 | 20 | protected function verify_atts() { |
21 | 21 | |
22 | - if ( isset( $this->pairs['rank_group'] ) && empty( $this->atts['rank_group'] ) ) { |
|
22 | + if ( isset( $this->pairs[ 'rank_group' ] ) && empty( $this->atts[ 'rank_group' ] ) ) { |
|
23 | 23 | |
24 | 24 | return sprintf( |
25 | 25 | // translators: 1. Attribute name; 2. Shortcode name. |