@@ -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. |
@@ -37,8 +37,8 @@ |
||
37 | 37 | protected function generate() { |
38 | 38 | |
39 | 39 | return wordpoints_get_formatted_user_rank( |
40 | - $this->atts['user_id'] |
|
41 | - , $this->atts['rank_group'] |
|
40 | + $this->atts[ 'user_id' ] |
|
41 | + , $this->atts[ 'rank_group' ] |
|
42 | 42 | , 'user_rank_shortcode' |
43 | 43 | ); |
44 | 44 | } |
@@ -179,7 +179,7 @@ discard block |
||
179 | 179 | |
180 | 180 | foreach ( $modules as $module ) { |
181 | 181 | if ( ! $this->check_module( $module ) ) { |
182 | - $incompatible_modules[] = $module; |
|
182 | + $incompatible_modules[ ] = $module; |
|
183 | 183 | $this->checked_modules[ $module ] = false; |
184 | 184 | } |
185 | 185 | } |
@@ -211,7 +211,7 @@ discard block |
||
211 | 211 | unset( $modules[ $index ] ); |
212 | 212 | |
213 | 213 | if ( ! $this->checked_modules[ $module ] ) { |
214 | - $incompatible[] = $module; |
|
214 | + $incompatible[ ] = $module; |
|
215 | 215 | } |
216 | 216 | } |
217 | 217 |
@@ -171,15 +171,15 @@ discard block |
||
171 | 171 | |
172 | 172 | foreach ( $installables as $slug => $installable ) { |
173 | 173 | |
174 | - if ( isset( $network_wide_data ) && $installable['network_wide'] ) { |
|
175 | - $data =& $network_wide_data; |
|
174 | + if ( isset( $network_wide_data ) && $installable[ 'network_wide' ] ) { |
|
175 | + $data = & $network_wide_data; |
|
176 | 176 | } else { |
177 | - $data =& $wordpoints_data; |
|
177 | + $data = & $wordpoints_data; |
|
178 | 178 | } |
179 | 179 | |
180 | 180 | if ( 'wordpoints' === $slug ) { |
181 | 181 | |
182 | - if ( ! isset( $data['version'] ) ) { |
|
182 | + if ( ! isset( $data[ 'version' ] ) ) { |
|
183 | 183 | // WordPoints should always be installed at this point. If it |
184 | 184 | // isn't, the install script didn't run for some reason. See |
185 | 185 | // https://github.com/WordPoints/wordpoints/issues/349 |
@@ -187,19 +187,19 @@ discard block |
||
187 | 187 | continue; |
188 | 188 | } |
189 | 189 | |
190 | - $db_version = $data['version']; |
|
190 | + $db_version = $data[ 'version' ]; |
|
191 | 191 | |
192 | 192 | } else { |
193 | 193 | |
194 | 194 | // This installable hasn't been installed yet, so we don't update. |
195 | - if ( ! isset( $data[ "{$type}s" ][ $slug ]['version'] ) ) { |
|
195 | + if ( ! isset( $data[ "{$type}s" ][ $slug ][ 'version' ] ) ) { |
|
196 | 196 | continue; |
197 | 197 | } |
198 | 198 | |
199 | - $db_version = $data[ "{$type}s" ][ $slug ]['version']; |
|
199 | + $db_version = $data[ "{$type}s" ][ $slug ][ 'version' ]; |
|
200 | 200 | } |
201 | 201 | |
202 | - $code_version = $installable['version']; |
|
202 | + $code_version = $installable[ 'version' ]; |
|
203 | 203 | |
204 | 204 | // If the DB version isn't less than the code version, we don't need to upgrade. |
205 | 205 | if ( version_compare( $db_version, $code_version ) !== -1 ) { |
@@ -215,9 +215,9 @@ discard block |
||
215 | 215 | $installer->update( $db_version, $code_version ); |
216 | 216 | |
217 | 217 | if ( 'wordpoints' === $slug ) { |
218 | - $data['version'] = $code_version; |
|
218 | + $data[ 'version' ] = $code_version; |
|
219 | 219 | } else { |
220 | - $data[ "{$type}s" ][ $slug ]['version'] = $code_version; |
|
220 | + $data[ "{$type}s" ][ $slug ][ 'version' ] = $code_version; |
|
221 | 221 | } |
222 | 222 | |
223 | 223 | $updated = true; |
@@ -301,7 +301,7 @@ discard block |
||
301 | 301 | |
302 | 302 | foreach ( $skipped as $slug => $version ) { |
303 | 303 | |
304 | - if ( empty( self::$registered[ $type ][ $slug ]['network_wide'] ) ) { |
|
304 | + if ( empty( self::$registered[ $type ][ $slug ][ 'network_wide' ] ) ) { |
|
305 | 305 | continue; |
306 | 306 | } |
307 | 307 | |
@@ -309,7 +309,7 @@ discard block |
||
309 | 309 | // of the slug, but this is such an edge case to start with that I |
310 | 310 | // decided not to. Also of note: the version is only used in the |
311 | 311 | // update message. |
312 | - $messages[] = esc_html( |
|
312 | + $messages[ ] = esc_html( |
|
313 | 313 | sprintf( |
314 | 314 | $message_template |
315 | 315 | , $slug |
@@ -375,18 +375,18 @@ discard block |
||
375 | 375 | |
376 | 376 | if ( ! isset( self::$installers[ $type ][ $slug ] ) ) { |
377 | 377 | |
378 | - if ( ! file_exists( self::$registered[ $type ][ $slug ]['un_installer'] ) ) { |
|
378 | + if ( ! file_exists( self::$registered[ $type ][ $slug ][ 'un_installer' ] ) ) { |
|
379 | 379 | return false; |
380 | 380 | } |
381 | 381 | |
382 | 382 | self::$installers[ $type ][ $slug ] = require( |
383 | - self::$registered[ $type ][ $slug ]['un_installer'] |
|
383 | + self::$registered[ $type ][ $slug ][ 'un_installer' ] |
|
384 | 384 | ); |
385 | 385 | } |
386 | 386 | |
387 | 387 | return new self::$installers[ $type ][ $slug ]( |
388 | 388 | $slug |
389 | - , self::$registered[ $type ][ $slug ]['version'] |
|
389 | + , self::$registered[ $type ][ $slug ][ 'version' ] |
|
390 | 390 | ); |
391 | 391 | } |
392 | 392 |
@@ -237,12 +237,12 @@ discard block |
||
237 | 237 | if ( isset( $args[ $arg ] ) ) { |
238 | 238 | |
239 | 239 | _deprecated_argument( |
240 | - esc_html( "{$data['class']}::__construct" ) |
|
241 | - , esc_html( $data['version'] ) |
|
242 | - , esc_html( "{$arg} is deprecated, use {$data['replacement']} instead" ) |
|
240 | + esc_html( "{$data[ 'class' ]}::__construct" ) |
|
241 | + , esc_html( $data[ 'version' ] ) |
|
242 | + , esc_html( "{$arg} is deprecated, use {$data[ 'replacement' ]} instead" ) |
|
243 | 243 | ); |
244 | 244 | |
245 | - $args[ $data['replacement'] ] = $args[ $arg ]; |
|
245 | + $args[ $data[ 'replacement' ] ] = $args[ $arg ]; |
|
246 | 246 | |
247 | 247 | unset( $args[ $arg ] ); |
248 | 248 | } |
@@ -265,12 +265,12 @@ discard block |
||
265 | 265 | if ( isset( $this->deprecated_args[ $arg ] ) ) { |
266 | 266 | |
267 | 267 | _deprecated_argument( |
268 | - esc_html( "{$this->deprecated_args[ $arg ]['class']}::get_arg" ) |
|
269 | - , esc_html( $this->deprecated_args[ $arg ]['version'] ) |
|
270 | - , esc_html( "{$arg} is deprecated, use {$this->deprecated_args[ $arg ]['replacement']} instead" ) |
|
268 | + esc_html( "{$this->deprecated_args[ $arg ][ 'class' ]}::get_arg" ) |
|
269 | + , esc_html( $this->deprecated_args[ $arg ][ 'version' ] ) |
|
270 | + , esc_html( "{$arg} is deprecated, use {$this->deprecated_args[ $arg ][ 'replacement' ]} instead" ) |
|
271 | 271 | ); |
272 | 272 | |
273 | - $arg = $this->deprecated_args[ $arg ]['replacement']; |
|
273 | + $arg = $this->deprecated_args[ $arg ][ 'replacement' ]; |
|
274 | 274 | } |
275 | 275 | |
276 | 276 | if ( isset( $this->args[ $arg ] ) ) { |
@@ -298,12 +298,12 @@ discard block |
||
298 | 298 | if ( isset( $args[ $arg ] ) ) { |
299 | 299 | |
300 | 300 | _deprecated_argument( |
301 | - esc_html( "{$data['class']}::set_args" ) |
|
302 | - , esc_html( $data['version'] ) |
|
303 | - , esc_html( "{$arg} is deprecated, use {$data['replacement']} instead" ) |
|
301 | + esc_html( "{$data[ 'class' ]}::set_args" ) |
|
302 | + , esc_html( $data[ 'version' ] ) |
|
303 | + , esc_html( "{$arg} is deprecated, use {$data[ 'replacement' ]} instead" ) |
|
304 | 304 | ); |
305 | 305 | |
306 | - $args[ $data['replacement'] ] = $args[ $arg ]; |
|
306 | + $args[ $data[ 'replacement' ] ] = $args[ $arg ]; |
|
307 | 307 | |
308 | 308 | unset( $args[ $arg ] ); |
309 | 309 | } |
@@ -456,9 +456,9 @@ discard block |
||
456 | 456 | $all_fields = array_keys( $this->columns ); |
457 | 457 | $fields = array(); |
458 | 458 | |
459 | - if ( ! empty( $this->args['fields'] ) ) { |
|
459 | + if ( ! empty( $this->args[ 'fields' ] ) ) { |
|
460 | 460 | |
461 | - $fields = (array) $this->args['fields']; |
|
461 | + $fields = (array) $this->args[ 'fields' ]; |
|
462 | 462 | $diff = array_diff( $fields, $all_fields ); |
463 | 463 | $fields = array_intersect( $all_fields, $fields ); |
464 | 464 | |
@@ -560,11 +560,11 @@ discard block |
||
560 | 560 | $validators = array(); |
561 | 561 | |
562 | 562 | // Default validators for integer columns. |
563 | - if ( '%d' === $data['format'] ) { |
|
564 | - if ( ! empty( $data['unsigned'] ) ) { |
|
565 | - $validators[] = array( $this, 'validate_unsigned_column' ); |
|
563 | + if ( '%d' === $data[ 'format' ] ) { |
|
564 | + if ( ! empty( $data[ 'unsigned' ] ) ) { |
|
565 | + $validators[ ] = array( $this, 'validate_unsigned_column' ); |
|
566 | 566 | } else { |
567 | - $validators[] = 'wordpoints_int'; |
|
567 | + $validators[ ] = 'wordpoints_int'; |
|
568 | 568 | } |
569 | 569 | } |
570 | 570 | |
@@ -604,8 +604,8 @@ discard block |
||
604 | 604 | global $wpdb; |
605 | 605 | |
606 | 606 | if ( |
607 | - isset( $data['values'] ) |
|
608 | - && ! in_array( $this->args[ $column ], $data['values'], true ) |
|
607 | + isset( $data[ 'values' ] ) |
|
608 | + && ! in_array( $this->args[ $column ], $data[ 'values' ], true ) |
|
609 | 609 | ) { |
610 | 610 | return; |
611 | 611 | } |
@@ -623,8 +623,8 @@ discard block |
||
623 | 623 | |
624 | 624 | $column = wordpoints_escape_mysql_identifier( $column ); |
625 | 625 | |
626 | - $this->wheres[] = $wpdb->prepare( // WPCS: unprepared SQL OK. |
|
627 | - "{$column} {$compare} {$data['format']}" |
|
626 | + $this->wheres[ ] = $wpdb->prepare( // WPCS: unprepared SQL OK. |
|
627 | + "{$column} {$compare} {$data[ 'format' ]}" |
|
628 | 628 | , $value |
629 | 629 | ); |
630 | 630 | } |
@@ -645,7 +645,7 @@ discard block |
||
645 | 645 | |
646 | 646 | // MySQL doesn't support LIKE and NOT LIKE for int columns. |
647 | 647 | // See https://stackoverflow.com/q/8422455/1924128 |
648 | - if ( '%s' === $data['format'] ) { |
|
648 | + if ( '%s' === $data[ 'format' ] ) { |
|
649 | 649 | $comparisons = array_merge( $comparisons, array( 'LIKE', 'NOT LIKE' ) ); |
650 | 650 | } |
651 | 651 | |
@@ -680,8 +680,8 @@ discard block |
||
680 | 680 | |
681 | 681 | $values = $this->args[ $key ]; |
682 | 682 | |
683 | - if ( isset( $data['values'] ) ) { |
|
684 | - $values = array_intersect( $values, $data['values'] ); |
|
683 | + if ( isset( $data[ 'values' ] ) ) { |
|
684 | + $values = array_intersect( $values, $data[ 'values' ] ); |
|
685 | 685 | } else { |
686 | 686 | $values = $this->validate_values( |
687 | 687 | $values |
@@ -693,7 +693,7 @@ discard block |
||
693 | 693 | return; |
694 | 694 | } |
695 | 695 | |
696 | - $in = wordpoints_prepare__in( $values, $data['format'] ); |
|
696 | + $in = wordpoints_prepare__in( $values, $data[ 'format' ] ); |
|
697 | 697 | |
698 | 698 | if ( false === $in ) { |
699 | 699 | return; |
@@ -701,7 +701,7 @@ discard block |
||
701 | 701 | |
702 | 702 | $column = wordpoints_escape_mysql_identifier( $column ); |
703 | 703 | |
704 | - $this->wheres[] = "{$column} {$type} ({$in})"; |
|
704 | + $this->wheres[ ] = "{$column} {$type} ({$in})"; |
|
705 | 705 | } |
706 | 706 | |
707 | 707 | /** |
@@ -715,7 +715,7 @@ discard block |
||
715 | 715 | |
716 | 716 | foreach ( $this->columns as $column => $data ) { |
717 | 717 | |
718 | - if ( ! empty( $data['is_date'] ) ) { |
|
718 | + if ( ! empty( $data[ 'is_date' ] ) ) { |
|
719 | 719 | $this->prepare_date_where( $column ); |
720 | 720 | } else { |
721 | 721 | $this->prepare_column_where( $column, $data ); |
@@ -738,7 +738,7 @@ discard block |
||
738 | 738 | |
739 | 739 | // MySQL doesn't allow for the offset without a limit, so if no limit is set |
740 | 740 | // we can ignore the start arg. See https://stackoverflow.com/a/271650/1924128 |
741 | - if ( ! isset( $this->args['limit'] ) ) { |
|
741 | + if ( ! isset( $this->args[ 'limit' ] ) ) { |
|
742 | 742 | return; |
743 | 743 | } |
744 | 744 | |
@@ -763,8 +763,8 @@ discard block |
||
763 | 763 | } |
764 | 764 | } |
765 | 765 | |
766 | - if ( $this->args['limit'] > 0 && $this->args['start'] >= 0 ) { |
|
767 | - $this->limit = "LIMIT {$this->args['start']}, {$this->args['limit']}"; |
|
766 | + if ( $this->args[ 'limit' ] > 0 && $this->args[ 'start' ] >= 0 ) { |
|
767 | + $this->limit = "LIMIT {$this->args[ 'start' ]}, {$this->args[ 'limit' ]}"; |
|
768 | 768 | } |
769 | 769 | } |
770 | 770 | |
@@ -775,12 +775,12 @@ discard block |
||
775 | 775 | */ |
776 | 776 | protected function prepare_order_by() { |
777 | 777 | |
778 | - if ( empty( $this->args['order_by'] ) ) { |
|
778 | + if ( empty( $this->args[ 'order_by' ] ) ) { |
|
779 | 779 | return; |
780 | 780 | } |
781 | 781 | |
782 | - $order = $this->args['order']; |
|
783 | - $order_by = $this->args['order_by']; |
|
782 | + $order = $this->args[ 'order' ]; |
|
783 | + $order_by = $this->args[ 'order_by' ]; |
|
784 | 784 | |
785 | 785 | if ( ! in_array( $order, array( 'DESC', 'ASC' ), true ) ) { |
786 | 786 | |
@@ -796,9 +796,9 @@ discard block |
||
796 | 796 | $wpdb->{"{$this->meta_type}meta"} |
797 | 797 | ); |
798 | 798 | |
799 | - if ( isset( $this->args['meta_type'] ) ) { |
|
799 | + if ( isset( $this->args[ 'meta_type' ] ) ) { |
|
800 | 800 | |
801 | - $meta_type = $this->meta_query->get_cast_for_type( $this->args['meta_type'] ); |
|
801 | + $meta_type = $this->meta_query->get_cast_for_type( $this->args[ 'meta_type' ] ); |
|
802 | 802 | $order_by = "CAST({$meta_table_name}.meta_value AS {$meta_type})"; |
803 | 803 | |
804 | 804 | } else { |
@@ -841,7 +841,7 @@ discard block |
||
841 | 841 | $date_query = $date_query->get_sql(); |
842 | 842 | |
843 | 843 | if ( ! empty( $date_query ) ) { |
844 | - $this->wheres[] = ltrim( $date_query, ' AND' ); |
|
844 | + $this->wheres[ ] = ltrim( $date_query, ' AND' ); |
|
845 | 845 | } |
846 | 846 | |
847 | 847 | remove_filter( 'date_query_valid_columns', array( $this, 'date_query_valid_columns_filter' ) ); |
@@ -883,11 +883,11 @@ discard block |
||
883 | 883 | , $this |
884 | 884 | ); |
885 | 885 | |
886 | - if ( ! empty( $meta_query['where'] ) ) { |
|
887 | - $this->wheres[] = ltrim( $meta_query['where'], ' AND' ); |
|
886 | + if ( ! empty( $meta_query[ 'where' ] ) ) { |
|
887 | + $this->wheres[ ] = ltrim( $meta_query[ 'where' ], ' AND' ); |
|
888 | 888 | } |
889 | 889 | |
890 | - $this->meta_join = $meta_query['join'] . "\n"; |
|
890 | + $this->meta_join = $meta_query[ 'join' ] . "\n"; |
|
891 | 891 | } |
892 | 892 | } |
893 | 893 |
@@ -474,7 +474,7 @@ discard block |
||
474 | 474 | |
475 | 475 | $fields = implode( ', ', array_map( 'wordpoints_escape_mysql_identifier', $fields ) ); |
476 | 476 | |
477 | - $this->select = "SELECT {$fields}"; |
|
477 | + $this->select = "select {$fields}"; |
|
478 | 478 | } |
479 | 479 | |
480 | 480 | /** |
@@ -764,7 +764,7 @@ discard block |
||
764 | 764 | } |
765 | 765 | |
766 | 766 | if ( $this->args['limit'] > 0 && $this->args['start'] >= 0 ) { |
767 | - $this->limit = "LIMIT {$this->args['start']}, {$this->args['limit']}"; |
|
767 | + $this->limit = "limit {$this->args['start']}, {$this->args['limit']}"; |
|
768 | 768 | } |
769 | 769 | } |
770 | 770 |
@@ -77,8 +77,8 @@ discard block |
||
77 | 77 | unset( $this->entities[ $slug ] ); |
78 | 78 | |
79 | 79 | if ( |
80 | - isset( $this->hierarchy[0] ) |
|
81 | - && $this->hierarchy[0]->get_slug() === $slug |
|
80 | + isset( $this->hierarchy[ 0 ] ) |
|
81 | + && $this->hierarchy[ 0 ]->get_slug() === $slug |
|
82 | 82 | ) { |
83 | 83 | $this->current = null; |
84 | 84 | $this->hierarchy = array(); |
@@ -112,7 +112,7 @@ discard block |
||
112 | 112 | } |
113 | 113 | |
114 | 114 | if ( $this->current ) { |
115 | - $this->hierarchy[] = $this->current; |
|
115 | + $this->hierarchy[ ] = $this->current; |
|
116 | 116 | } |
117 | 117 | |
118 | 118 | $this->current = $child; |
@@ -141,10 +141,10 @@ |
||
141 | 141 | |
142 | 142 | $parsed_slug = $this->parse_slug( $child_slug ); |
143 | 143 | |
144 | - if ( $parsed_slug['is_array'] ) { |
|
145 | - $child = new WordPoints_Entity_Array( $parsed_slug['slug'] ); |
|
144 | + if ( $parsed_slug[ 'is_array' ] ) { |
|
145 | + $child = new WordPoints_Entity_Array( $parsed_slug[ 'slug' ] ); |
|
146 | 146 | } else { |
147 | - $child = wordpoints_entities()->get( $parsed_slug['slug'] ); |
|
147 | + $child = wordpoints_entities()->get( $parsed_slug[ 'slug' ] ); |
|
148 | 148 | } |
149 | 149 | |
150 | 150 | if ( isset( $this->the_value ) ) { |