@@ -22,7 +22,7 @@ discard block |
||
22 | 22 | */ |
23 | 23 | protected function verify_atts() { |
24 | 24 | |
25 | - if ( isset( $this->pairs['points_type'] ) ) { |
|
25 | + if ( isset( $this->pairs[ 'points_type' ] ) ) { |
|
26 | 26 | |
27 | 27 | $points_type = $this->get_points_type(); |
28 | 28 | |
@@ -30,7 +30,7 @@ discard block |
||
30 | 30 | return $points_type; |
31 | 31 | } |
32 | 32 | |
33 | - $this->atts['points_type'] = $points_type; |
|
33 | + $this->atts[ 'points_type' ] = $points_type; |
|
34 | 34 | } |
35 | 35 | |
36 | 36 | return parent::verify_atts(); |
@@ -50,7 +50,7 @@ discard block |
||
50 | 50 | */ |
51 | 51 | protected function get_points_type() { |
52 | 52 | |
53 | - $points_type = $this->atts['points_type']; |
|
53 | + $points_type = $this->atts[ 'points_type' ]; |
|
54 | 54 | |
55 | 55 | if ( ! wordpoints_is_points_type( $points_type ) ) { |
56 | 56 |
@@ -40,7 +40,7 @@ discard block |
||
40 | 40 | */ |
41 | 41 | protected function verify_atts() { |
42 | 42 | |
43 | - if ( ! wordpoints_is_points_logs_query( $this->atts['query'] ) ) { |
|
43 | + if ( ! wordpoints_is_points_logs_query( $this->atts[ 'query' ] ) ) { |
|
44 | 44 | return sprintf( |
45 | 45 | // translators: 1. Attribute name; 2. Shortcode name; 3. Example of proper usage. |
46 | 46 | __( 'The “%1$s” attribute of the %2$s shortcode must be the slug of a registered points log query. Example: %3$s.', 'wordpoints' ) |
@@ -50,17 +50,17 @@ discard block |
||
50 | 50 | ); |
51 | 51 | } |
52 | 52 | |
53 | - if ( false === wordpoints_int( $this->atts['paginate'] ) ) { |
|
54 | - $this->atts['paginate'] = 1; |
|
53 | + if ( false === wordpoints_int( $this->atts[ 'paginate' ] ) ) { |
|
54 | + $this->atts[ 'paginate' ] = 1; |
|
55 | 55 | } |
56 | 56 | |
57 | 57 | // Back-compat. Needs to stay here "forever" for legacy installs. |
58 | - if ( isset( $this->atts['datatables'] ) ) { |
|
59 | - $this->atts['paginate'] = wordpoints_int( $this->atts['datatables'] ); |
|
58 | + if ( isset( $this->atts[ 'datatables' ] ) ) { |
|
59 | + $this->atts[ 'paginate' ] = wordpoints_int( $this->atts[ 'datatables' ] ); |
|
60 | 60 | } |
61 | 61 | |
62 | - if ( false === wordpoints_int( $this->atts['show_users'] ) ) { |
|
63 | - $this->atts['show_users'] = 1; |
|
62 | + if ( false === wordpoints_int( $this->atts[ 'show_users' ] ) ) { |
|
63 | + $this->atts[ 'show_users' ] = 1; |
|
64 | 64 | } |
65 | 65 | |
66 | 66 | return parent::verify_atts(); |
@@ -74,12 +74,12 @@ discard block |
||
74 | 74 | |
75 | 75 | ob_start(); |
76 | 76 | wordpoints_show_points_logs_query( |
77 | - $this->atts['points_type'] |
|
78 | - , $this->atts['query'] |
|
77 | + $this->atts[ 'points_type' ] |
|
78 | + , $this->atts[ 'query' ] |
|
79 | 79 | , array( |
80 | - 'paginate' => $this->atts['paginate'], |
|
81 | - 'show_users' => $this->atts['show_users'], |
|
82 | - 'searchable' => $this->atts['searchable'], |
|
80 | + 'paginate' => $this->atts[ 'paginate' ], |
|
81 | + 'show_users' => $this->atts[ 'show_users' ], |
|
82 | + 'searchable' => $this->atts[ 'searchable' ], |
|
83 | 83 | ) |
84 | 84 | ); |
85 | 85 |
@@ -37,8 +37,8 @@ |
||
37 | 37 | protected function generate() { |
38 | 38 | |
39 | 39 | return wordpoints_get_formatted_points( |
40 | - $this->atts['user_id'] |
|
41 | - , $this->atts['points_type'] |
|
40 | + $this->atts[ 'user_id' ] |
|
41 | + , $this->atts[ 'points_type' ] |
|
42 | 42 | , 'points-shortcode' |
43 | 43 | ); |
44 | 44 | } |
@@ -36,7 +36,7 @@ discard block |
||
36 | 36 | */ |
37 | 37 | protected function verify_atts() { |
38 | 38 | |
39 | - if ( ! wordpoints_posint( $this->atts['users'] ) ) { |
|
39 | + if ( ! wordpoints_posint( $this->atts[ 'users' ] ) ) { |
|
40 | 40 | return sprintf( |
41 | 41 | // translators: 1. Attribute name; 2. Shortcode name; 3. Example of proper usage. |
42 | 42 | __( 'The “%1$s” attribute of the %2$s shortcode must be a positive integer. Example: %3$s.', 'wordpoints' ) |
@@ -57,8 +57,8 @@ discard block |
||
57 | 57 | |
58 | 58 | ob_start(); |
59 | 59 | wordpoints_points_show_top_users( |
60 | - $this->atts['users'] |
|
61 | - , $this->atts['points_type'] |
|
60 | + $this->atts[ 'users' ] |
|
61 | + , $this->atts[ 'points_type' ] |
|
62 | 62 | , 'shortcode' |
63 | 63 | ); |
64 | 64 |
@@ -145,7 +145,7 @@ discard block |
||
145 | 145 | */ |
146 | 146 | protected function get_logs() { |
147 | 147 | |
148 | - if ( $this->args['searchable'] ) { |
|
148 | + if ( $this->args[ 'searchable' ] ) { |
|
149 | 149 | |
150 | 150 | $search_term = $this->get_search_term(); |
151 | 151 | |
@@ -161,7 +161,7 @@ discard block |
||
161 | 161 | } |
162 | 162 | } |
163 | 163 | |
164 | - if ( $this->args['paginate'] ) { |
|
164 | + if ( $this->args[ 'paginate' ] ) { |
|
165 | 165 | |
166 | 166 | $page = $this->get_page_number(); |
167 | 167 | $per_page = $this->get_per_page(); |
@@ -57,7 +57,7 @@ |
||
57 | 57 | continue; |
58 | 58 | } |
59 | 59 | |
60 | - $this->restrictions[] = $restriction; |
|
60 | + $this->restrictions[ ] = $restriction; |
|
61 | 61 | } |
62 | 62 | } |
63 | 63 |
@@ -109,7 +109,7 @@ |
||
109 | 109 | continue; |
110 | 110 | } |
111 | 111 | |
112 | - $descriptions[] = sprintf( $string, $entity->get_title() ); |
|
112 | + $descriptions[ ] = sprintf( $string, $entity->get_title() ); |
|
113 | 113 | } |
114 | 114 | |
115 | 115 | return $descriptions; |
@@ -222,7 +222,8 @@ |
||
222 | 222 | |
223 | 223 | $search_term = ''; |
224 | 224 | |
225 | - if ( isset( $_POST['wordpoints_points_logs_search'] ) ) { // WPCS: CSRF OK |
|
225 | + if ( isset( $_POST['wordpoints_points_logs_search'] ) ) { |
|
226 | +// WPCS: CSRF OK |
|
226 | 227 | $search_term = trim( |
227 | 228 | sanitize_text_field( |
228 | 229 | wp_unslash( $_POST['wordpoints_points_logs_search'] ) // WPCS: CSRF OK |
@@ -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; |
@@ -102,7 +102,7 @@ |
||
102 | 102 | ); |
103 | 103 | |
104 | 104 | self::$queries[ $slug ] = array_merge( $defaults, $data ); |
105 | - self::$queries[ $slug ]['args'] = $args; |
|
105 | + self::$queries[ $slug ][ 'args' ] = $args; |
|
106 | 106 | |
107 | 107 | return true; |
108 | 108 | } |