@@ -190,7 +190,7 @@ |
||
190 | 190 | * |
191 | 191 | * @param string $event_slug The slug of the event this reaction is for. |
192 | 192 | * |
193 | - * @return int|false The reaction ID, or false if not created. |
|
193 | + * @return integer The reaction ID, or false if not created. |
|
194 | 194 | */ |
195 | 195 | abstract protected function _create_reaction( $event_slug ); |
196 | 196 | } |
@@ -144,7 +144,7 @@ discard block |
||
144 | 144 | |
145 | 145 | if ( $is_new ) { |
146 | 146 | |
147 | - $id = $this->_create_reaction( $settings['event'] ); |
|
147 | + $id = $this->_create_reaction( $settings[ 'event' ] ); |
|
148 | 148 | |
149 | 149 | if ( ! $id ) { |
150 | 150 | return false; |
@@ -153,14 +153,14 @@ discard block |
||
153 | 153 | |
154 | 154 | $reaction = $this->get_reaction( $id ); |
155 | 155 | |
156 | - $reaction->update_event_slug( $settings['event'] ); |
|
156 | + $reaction->update_event_slug( $settings[ 'event' ] ); |
|
157 | 157 | |
158 | - unset( $settings['event'] ); |
|
158 | + unset( $settings[ 'event' ] ); |
|
159 | 159 | |
160 | - $reaction->update_meta( 'reactor', $settings['reactor'] ); |
|
160 | + $reaction->update_meta( 'reactor', $settings[ 'reactor' ] ); |
|
161 | 161 | |
162 | 162 | /** @var WordPoints_Hook_ReactorI $reactor */ |
163 | - $reactor = wordpoints_hooks()->get_sub_app( 'reactors' )->get( $settings['reactor'] ); |
|
163 | + $reactor = wordpoints_hooks()->get_sub_app( 'reactors' )->get( $settings[ 'reactor' ] ); |
|
164 | 164 | $reactor->update_settings( $reaction, $settings ); |
165 | 165 | |
166 | 166 | /** @var WordPoints_Hook_ExtensionI $extension */ |
@@ -103,7 +103,7 @@ |
||
103 | 103 | * |
104 | 104 | * @param int|string $number The hook number or ID to get the points for. |
105 | 105 | * |
106 | - * @return int|false The number of points for this instance, or false. |
|
106 | + * @return integer The number of points for this instance, or false. |
|
107 | 107 | */ |
108 | 108 | public function get_points( $number = null ) { |
109 | 109 |
@@ -115,8 +115,8 @@ discard block |
||
115 | 115 | |
116 | 116 | $instances = $this->get_instances(); |
117 | 117 | |
118 | - if ( isset( $instances[ $number ]['points'] ) ) { |
|
119 | - return $instances[ $number ]['points']; |
|
118 | + if ( isset( $instances[ $number ][ 'points' ] ) ) { |
|
119 | + return $instances[ $number ][ 'points' ]; |
|
120 | 120 | } |
121 | 121 | |
122 | 122 | return false; |
@@ -151,9 +151,9 @@ discard block |
||
151 | 151 | |
152 | 152 | $new_instance = array_merge( array( 'points' => 0 ), $old_instance, $new_instance ); |
153 | 153 | |
154 | - if ( false === wordpoints_posint( $new_instance['points'] ) ) { |
|
155 | - if ( isset( $this->defaults['points'] ) ) { |
|
156 | - $new_instance['points'] = $this->defaults['points']; |
|
154 | + if ( false === wordpoints_posint( $new_instance[ 'points' ] ) ) { |
|
155 | + if ( isset( $this->defaults[ 'points' ] ) ) { |
|
156 | + $new_instance[ 'points' ] = $this->defaults[ 'points' ]; |
|
157 | 157 | } else { |
158 | 158 | return false; |
159 | 159 | } |
@@ -180,20 +180,20 @@ discard block |
||
180 | 180 | */ |
181 | 181 | protected function form( $instance ) { |
182 | 182 | |
183 | - if ( ! isset( $instance['points'] ) ) { |
|
183 | + if ( ! isset( $instance[ 'points' ] ) ) { |
|
184 | 184 | |
185 | - if ( isset( $this->defaults['points'] ) ) { |
|
186 | - $instance['points'] = $this->defaults['points']; |
|
185 | + if ( isset( $this->defaults[ 'points' ] ) ) { |
|
186 | + $instance[ 'points' ] = $this->defaults[ 'points' ]; |
|
187 | 187 | } else { |
188 | - $instance['points'] = 0; |
|
188 | + $instance[ 'points' ] = 0; |
|
189 | 189 | } |
190 | 190 | } |
191 | 191 | |
192 | 192 | ?> |
193 | 193 | |
194 | 194 | <p> |
195 | - <label for="<?php $this->the_field_id( 'points' ); ?>"><?php echo esc_html( $this->options['points_label'] ); ?></label> |
|
196 | - <input class="widefat" name="<?php $this->the_field_name( 'points' ); ?>" id="<?php $this->the_field_id( 'points' ); ?>" type="number" min="0" value="<?php echo wordpoints_posint( $instance['points'] ); ?>" /> |
|
195 | + <label for="<?php $this->the_field_id( 'points' ); ?>"><?php echo esc_html( $this->options[ 'points_label' ] ); ?></label> |
|
196 | + <input class="widefat" name="<?php $this->the_field_name( 'points' ); ?>" id="<?php $this->the_field_id( 'points' ); ?>" type="number" min="0" value="<?php echo wordpoints_posint( $instance[ 'points' ] ); ?>" /> |
|
197 | 197 | </p> |
198 | 198 | |
199 | 199 | <?php |
@@ -212,7 +212,7 @@ discard block |
||
212 | 212 | */ |
213 | 213 | protected function generate_description( $instance = array() ) { |
214 | 214 | |
215 | - return $this->options['description']; |
|
215 | + return $this->options[ 'description' ]; |
|
216 | 216 | } |
217 | 217 | |
218 | 218 | // |
@@ -442,7 +442,7 @@ discard block |
||
442 | 442 | break; |
443 | 443 | } |
444 | 444 | |
445 | - unset( $instances['__i__'] ); |
|
445 | + unset( $instances[ '__i__' ] ); |
|
446 | 446 | |
447 | 447 | return $instances; |
448 | 448 | } |
@@ -673,8 +673,8 @@ discard block |
||
673 | 673 | |
674 | 674 | $instances = $this->get_instances(); |
675 | 675 | |
676 | - if ( 'generated' !== $type && ! empty( $instances[ $this->number ]['_description'] ) ) { |
|
677 | - return $instances[ $this->number ]['_description']; |
|
676 | + if ( 'generated' !== $type && ! empty( $instances[ $this->number ][ '_description' ] ) ) { |
|
677 | + return $instances[ $this->number ][ '_description' ]; |
|
678 | 678 | } |
679 | 679 | |
680 | 680 | $instance = ( isset( $instances[ $this->number ] ) ) ? $instances[ $this->number ] : array(); |
@@ -775,7 +775,7 @@ discard block |
||
775 | 775 | , $options |
776 | 776 | ); |
777 | 777 | |
778 | - $this->options['_classname'] = $this->option_name; |
|
778 | + $this->options[ '_classname' ] = $this->option_name; |
|
779 | 779 | } |
780 | 780 | |
781 | 781 | // |
@@ -792,7 +792,7 @@ discard block |
||
792 | 792 | final private function save_instances( $instances ) { |
793 | 793 | |
794 | 794 | // This needs to start at 1. |
795 | - unset( $instances[0] ); |
|
795 | + unset( $instances[ 0 ] ); |
|
796 | 796 | |
797 | 797 | if ( WordPoints_Points_Hooks::get_network_mode() ) { |
798 | 798 | update_site_option( $this->option_name, $instances ); |
@@ -421,7 +421,7 @@ |
||
421 | 421 | * @since 2.0.0 |
422 | 422 | * |
423 | 423 | * @param string $key The log meta key to match on. |
424 | - * @param mixed $value The log meta value to match on. |
|
424 | + * @param integer $value The log meta value to match on. |
|
425 | 425 | * @param string $new_key The key for the new meta value to add. |
426 | 426 | * @param mixed $new_value The new meta value to add. If falsey, new meta isn't added. |
427 | 427 | */ |
@@ -99,14 +99,14 @@ discard block |
||
99 | 99 | |
100 | 100 | $instance = array_merge( $this->defaults, $instance ); |
101 | 101 | |
102 | - if ( $post_type === $instance['post_type'] ) { |
|
103 | - return ! empty( $instance['auto_reverse'] ); |
|
104 | - } elseif ( 'ALL' === $instance['post_type'] ) { |
|
102 | + if ( $post_type === $instance[ 'post_type' ] ) { |
|
103 | + return ! empty( $instance[ 'auto_reverse' ] ); |
|
104 | + } elseif ( 'ALL' === $instance[ 'post_type' ] ) { |
|
105 | 105 | $all_posts_instance = $instance; |
106 | 106 | } |
107 | 107 | } |
108 | 108 | |
109 | - return ! empty( $all_posts_instance['auto_reverse'] ); |
|
109 | + return ! empty( $all_posts_instance[ 'auto_reverse' ] ); |
|
110 | 110 | } |
111 | 111 | |
112 | 112 | /** |
@@ -186,8 +186,8 @@ discard block |
||
186 | 186 | |
187 | 187 | $post = false; |
188 | 188 | |
189 | - if ( '' === $reverse && isset( $meta['post_id'] ) ) { |
|
190 | - $post = get_post( $meta['post_id'] ); |
|
189 | + if ( '' === $reverse && isset( $meta[ 'post_id' ] ) ) { |
|
190 | + $post = get_post( $meta[ 'post_id' ] ); |
|
191 | 191 | } |
192 | 192 | |
193 | 193 | if ( $post ) { |
@@ -202,22 +202,22 @@ discard block |
||
202 | 202 | |
203 | 203 | if ( |
204 | 204 | $this->get_option( 'log_text_post_type' . $reverse ) |
205 | - && isset( $meta['post_type'] ) |
|
206 | - && post_type_exists( $meta['post_type'] ) |
|
205 | + && isset( $meta[ 'post_type' ] ) |
|
206 | + && post_type_exists( $meta[ 'post_type' ] ) |
|
207 | 207 | ) { |
208 | 208 | |
209 | 209 | // We do know the type of post though, so include that in the log. |
210 | 210 | $text = sprintf( |
211 | 211 | $this->get_option( 'log_text_post_type' . $reverse ) |
212 | - , get_post_type_object( $meta['post_type'] )->labels->singular_name |
|
212 | + , get_post_type_object( $meta[ 'post_type' ] )->labels->singular_name |
|
213 | 213 | ); |
214 | 214 | |
215 | - } elseif ( isset( $meta['post_title'] ) ) { |
|
215 | + } elseif ( isset( $meta[ 'post_title' ] ) ) { |
|
216 | 216 | |
217 | 217 | // If the title is saved as metadata, then we can use it. |
218 | 218 | $text = sprintf( |
219 | 219 | $this->get_option( 'log_text_post_title' . $reverse ) |
220 | - , $meta['post_title'] |
|
220 | + , $meta[ 'post_title' ] |
|
221 | 221 | ); |
222 | 222 | } |
223 | 223 | } |
@@ -246,7 +246,7 @@ discard block |
||
246 | 246 | |
247 | 247 | $args = array(); |
248 | 248 | |
249 | - $args[] = '<a href="' . esc_url( $url ) . '">' |
|
249 | + $args[ ] = '<a href="' . esc_url( $url ) . '">' |
|
250 | 250 | . ( $post_title ? $post_title : _x( '(no title)', 'post title', 'wordpoints' ) ) |
251 | 251 | . '</a>'; |
252 | 252 | |
@@ -255,7 +255,7 @@ discard block |
||
255 | 255 | $post_type = get_post_field( 'post_type', $post_id ); |
256 | 256 | |
257 | 257 | if ( $text && $post_type && post_type_exists( $post_type ) ) { |
258 | - $args[] = get_post_type_object( $post_type )->labels->singular_name; |
|
258 | + $args[ ] = get_post_type_object( $post_type )->labels->singular_name; |
|
259 | 259 | } else { |
260 | 260 | $text = $this->get_option( 'log_text_post_title' . $reverse ); |
261 | 261 | } |
@@ -274,8 +274,8 @@ discard block |
||
274 | 274 | */ |
275 | 275 | protected function generate_description( $instance = array() ) { |
276 | 276 | |
277 | - if ( ! empty( $instance['post_type'] ) && 'ALL' !== $instance['post_type'] ) { |
|
278 | - $post_type = get_post_type_object( $instance['post_type'] ); |
|
277 | + if ( ! empty( $instance[ 'post_type' ] ) && 'ALL' !== $instance[ 'post_type' ] ) { |
|
278 | + $post_type = get_post_type_object( $instance[ 'post_type' ] ); |
|
279 | 279 | |
280 | 280 | if ( $post_type ) { |
281 | 281 | return sprintf( $this->get_option( 'post_type_description' ), $post_type->labels->singular_name ); |
@@ -306,7 +306,7 @@ discard block |
||
306 | 306 | |
307 | 307 | wordpoints_list_post_types( |
308 | 308 | array( |
309 | - 'selected' => $instance['post_type'], |
|
309 | + 'selected' => $instance[ 'post_type' ], |
|
310 | 310 | 'id' => $this->get_field_id( 'post_type' ), |
311 | 311 | 'name' => $this->get_field_name( 'post_type' ), |
312 | 312 | 'class' => 'widefat wordpoints-append-to-hook-title', |
@@ -329,7 +329,7 @@ discard block |
||
329 | 329 | ?> |
330 | 330 | |
331 | 331 | <p> |
332 | - <input class="widefat" name="<?php $this->the_field_name( 'auto_reverse' ); ?>" id="<?php $this->the_field_id( 'auto_reverse' ); ?>" type="checkbox" value="1" <?php checked( '1', $instance['auto_reverse'] ); ?> /> |
|
332 | + <input class="widefat" name="<?php $this->the_field_name( 'auto_reverse' ); ?>" id="<?php $this->the_field_id( 'auto_reverse' ); ?>" type="checkbox" value="1" <?php checked( '1', $instance[ 'auto_reverse' ] ); ?> /> |
|
333 | 333 | <label for="<?php $this->the_field_id( 'auto_reverse' ); ?>"><?php echo esc_html( $disable_label ); ?></label> |
334 | 334 | </p> |
335 | 335 |
@@ -294,7 +294,7 @@ discard block |
||
294 | 294 | * 'default', which will return a list of the most recent points logs, with |
295 | 295 | * users excluded according to the general settings. |
296 | 296 | * |
297 | - * @return WordPoints_Points_Logs_Query|false Logs query instance, or false. |
|
297 | + * @return WordPoints_Points_Logs_Query Logs query instance, or false. |
|
298 | 298 | */ |
299 | 299 | function wordpoints_get_points_logs_query( $points_type, $query_slug = 'default' ) { |
300 | 300 | |
@@ -466,6 +466,11 @@ discard block |
||
466 | 466 | * @since 1.9.0 |
467 | 467 | * |
468 | 468 | * @WordPress\action wordpoints_points_log-comment_disapprove |
469 | + * @param string $text |
|
470 | + * @param integer $points |
|
471 | + * @param string $points_type |
|
472 | + * @param integer $user_id |
|
473 | + * @param string $log_type |
|
469 | 474 | */ |
470 | 475 | function wordpoints_points_logs_comment_disapprove( $text, $points, $points_type, $user_id, $log_type, $meta ) { |
471 | 476 | |
@@ -492,6 +497,11 @@ discard block |
||
492 | 497 | * @since 1.9.0 |
493 | 498 | * |
494 | 499 | * @WordPress\action wordpoints_points_log-post_delete |
500 | + * @param string $text |
|
501 | + * @param integer $points |
|
502 | + * @param string $points_type |
|
503 | + * @param integer $user_id |
|
504 | + * @param string $log_type |
|
495 | 505 | */ |
496 | 506 | function wordpoints_points_logs_post_delete( $text, $points, $points_type, $user_id, $log_type, $meta ) { |
497 | 507 |
@@ -89,7 +89,7 @@ discard block |
||
89 | 89 | |
90 | 90 | // The current user needs to be set dynamically, since it can change at times. |
91 | 91 | if ( 'current_user' === $query_slug ) { |
92 | - $args['user_id'] = get_current_user_id(); |
|
92 | + $args[ 'user_id' ] = get_current_user_id(); |
|
93 | 93 | } |
94 | 94 | |
95 | 95 | /** |
@@ -137,12 +137,12 @@ discard block |
||
137 | 137 | |
138 | 138 | $query_data = WordPoints_Points_Log_Queries::get_query_data( $query_slug ); |
139 | 139 | |
140 | - if ( $query_data['cache_queries'] ) { |
|
140 | + if ( $query_data[ 'cache_queries' ] ) { |
|
141 | 141 | |
142 | 142 | $query->prime_cache( |
143 | - $query_data['cache_key'] |
|
143 | + $query_data[ 'cache_key' ] |
|
144 | 144 | , null |
145 | - , $query_data['network_wide'] |
|
145 | + , $query_data[ 'network_wide' ] |
|
146 | 146 | ); |
147 | 147 | } |
148 | 148 | |
@@ -196,7 +196,7 @@ discard block |
||
196 | 196 | |
197 | 197 | $args = array_merge( $defaults, $args ); |
198 | 198 | |
199 | - if ( ! $args['datatable'] ) { |
|
199 | + if ( ! $args[ 'datatable' ] ) { |
|
200 | 200 | |
201 | 201 | _deprecated_argument( |
202 | 202 | __FUNCTION__ |
@@ -204,13 +204,13 @@ discard block |
||
204 | 204 | , '$args["datatable"] is deprecated and should no longer be used. Use $args["paginate"] instead.' |
205 | 205 | ); |
206 | 206 | |
207 | - $args['paginate'] = false; |
|
207 | + $args[ 'paginate' ] = false; |
|
208 | 208 | } |
209 | 209 | |
210 | 210 | $view = wordpoints_component( 'points' ) |
211 | 211 | ->get_sub_app( 'logs' ) |
212 | 212 | ->get_sub_app( 'views' ) |
213 | - ->get( $args['view'], array( $logs_query, $args ) ); |
|
213 | + ->get( $args[ 'view' ], array( $logs_query, $args ) ); |
|
214 | 214 | |
215 | 215 | if ( ! $view instanceof WordPoints_Points_Logs_View ) { |
216 | 216 | return; |
@@ -284,10 +284,10 @@ discard block |
||
284 | 284 | */ |
285 | 285 | function wordpoints_points_logs_profile_edit( $text, $points, $points_type, $user_id, $log_type, $meta ) { |
286 | 286 | |
287 | - $user_name = sanitize_user_field( 'display_name', get_userdata( $meta['user_id'] )->display_name, $meta['user_id'], 'display' ); |
|
287 | + $user_name = sanitize_user_field( 'display_name', get_userdata( $meta[ 'user_id' ] )->display_name, $meta[ 'user_id' ], 'display' ); |
|
288 | 288 | |
289 | 289 | // translators: 1. User name; 2. Reason given. |
290 | - return sprintf( _x( 'Points adjusted by %1$s. Reason: %2$s', 'points log description', 'wordpoints' ), $user_name, esc_html( $meta['reason'] ) ); |
|
290 | + return sprintf( _x( 'Points adjusted by %1$s. Reason: %2$s', 'points log description', 'wordpoints' ), $user_name, esc_html( $meta[ 'reason' ] ) ); |
|
291 | 291 | } |
292 | 292 | |
293 | 293 | /** |
@@ -299,7 +299,7 @@ discard block |
||
299 | 299 | */ |
300 | 300 | function wordpoints_points_logs_comment_disapprove( $text, $points, $points_type, $user_id, $log_type, $meta ) { |
301 | 301 | |
302 | - switch ( $meta['status'] ) { |
|
302 | + switch ( $meta[ 'status' ] ) { |
|
303 | 303 | |
304 | 304 | case 'spam': |
305 | 305 | $text = _x( 'Comment marked as spam.', 'points log description', 'wordpoints' ); |
@@ -325,9 +325,9 @@ discard block |
||
325 | 325 | */ |
326 | 326 | function wordpoints_points_logs_post_delete( $text, $points, $points_type, $user_id, $log_type, $meta ) { |
327 | 327 | |
328 | - if ( isset( $meta['post_type'] ) ) { |
|
328 | + if ( isset( $meta[ 'post_type' ] ) ) { |
|
329 | 329 | |
330 | - $post_type = get_post_type_object( $meta['post_type'] ); |
|
330 | + $post_type = get_post_type_object( $meta[ 'post_type' ] ); |
|
331 | 331 | |
332 | 332 | if ( ! is_null( $post_type ) ) { |
333 | 333 | |
@@ -389,18 +389,18 @@ discard block |
||
389 | 389 | '%user_id%', |
390 | 390 | ); |
391 | 391 | |
392 | - if ( empty( $args['points_type'] ) ) { |
|
392 | + if ( empty( $args[ 'points_type' ] ) ) { |
|
393 | 393 | $points_types = array_keys( wordpoints_get_points_types() ); |
394 | 394 | } else { |
395 | - $points_types = (array) $args['points_type']; |
|
395 | + $points_types = (array) $args[ 'points_type' ]; |
|
396 | 396 | } |
397 | 397 | |
398 | 398 | foreach ( $points_types as $points_type ) { |
399 | 399 | foreach ( WordPoints_Points_Log_Queries::get_queries() as $query ) { |
400 | 400 | |
401 | - if ( ! empty( $query['cache_key'] ) ) { |
|
401 | + if ( ! empty( $query[ 'cache_key' ] ) ) { |
|
402 | 402 | |
403 | - if ( $query['network_wide'] ) { |
|
403 | + if ( $query[ 'network_wide' ] ) { |
|
404 | 404 | $group = 'wordpoints_network_points_logs_query'; |
405 | 405 | } else { |
406 | 406 | $group = 'wordpoints_points_logs_query'; |
@@ -408,11 +408,11 @@ discard block |
||
408 | 408 | |
409 | 409 | $replace = array( |
410 | 410 | $points_type, |
411 | - $args['user_id'], |
|
411 | + $args[ 'user_id' ], |
|
412 | 412 | ); |
413 | 413 | |
414 | 414 | wp_cache_delete( |
415 | - str_replace( $find, $replace, $query['cache_key'] ) |
|
415 | + str_replace( $find, $replace, $query[ 'cache_key' ] ) |
|
416 | 416 | , $group |
417 | 417 | ); |
418 | 418 | } |
@@ -363,7 +363,7 @@ |
||
363 | 363 | * |
364 | 364 | * @param string $type The slug for a points type. |
365 | 365 | * |
366 | - * @return int|false The minimum for this type of points. False if $type is bad. |
|
366 | + * @return integer The minimum for this type of points. False if $type is bad. |
|
367 | 367 | */ |
368 | 368 | function wordpoints_get_points_minimum( $type ) { |
369 | 369 |
@@ -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 | |
@@ -1035,13 +1035,13 @@ discard block |
||
1035 | 1035 | , array( '%d' ) |
1036 | 1036 | ); |
1037 | 1037 | |
1038 | - if ( ! isset( $flushed['points_types'][ $log->points_type ], $flushed['user_ids'][ $log->user_id ] ) ) { |
|
1038 | + if ( ! isset( $flushed[ 'points_types' ][ $log->points_type ], $flushed[ 'user_ids' ][ $log->user_id ] ) ) { |
|
1039 | 1039 | wordpoints_flush_points_logs_caches( |
1040 | 1040 | array( 'user_id' => $log->user_id, 'points_type' => $log->points_type ) |
1041 | 1041 | ); |
1042 | 1042 | |
1043 | - $flushed['points_types'][ $log->points_type ] = true; |
|
1044 | - $flushed['user_ids'][ $log->user_id ] = true; |
|
1043 | + $flushed[ 'points_types' ][ $log->points_type ] = true; |
|
1044 | + $flushed[ 'user_ids' ][ $log->user_id ] = true; |
|
1045 | 1045 | } |
1046 | 1046 | } |
1047 | 1047 | |
@@ -1075,9 +1075,9 @@ discard block |
||
1075 | 1075 | $cache = array( 'is_max' => false, 'top_users' => array() ); |
1076 | 1076 | } |
1077 | 1077 | |
1078 | - $cached_users = count( $cache['top_users'] ); |
|
1078 | + $cached_users = count( $cache[ 'top_users' ] ); |
|
1079 | 1079 | |
1080 | - if ( $num_users > $cached_users && ! $cache['is_max'] ) { |
|
1080 | + if ( $num_users > $cached_users && ! $cache[ 'is_max' ] ) { |
|
1081 | 1081 | |
1082 | 1082 | global $wpdb; |
1083 | 1083 | |
@@ -1126,19 +1126,19 @@ discard block |
||
1126 | 1126 | return array(); |
1127 | 1127 | } |
1128 | 1128 | |
1129 | - $cache['top_users'] = array_merge( $cache['top_users'], $top_users ); |
|
1129 | + $cache[ 'top_users' ] = array_merge( $cache[ 'top_users' ], $top_users ); |
|
1130 | 1130 | |
1131 | - if ( count( $cache['top_users'] ) < $num_users ) { |
|
1132 | - $cache['is_max'] = true; |
|
1131 | + if ( count( $cache[ 'top_users' ] ) < $num_users ) { |
|
1132 | + $cache[ 'is_max' ] = true; |
|
1133 | 1133 | } |
1134 | 1134 | |
1135 | - $cache['top_users'] = array_map( 'intval', $cache['top_users'] ); |
|
1135 | + $cache[ 'top_users' ] = array_map( 'intval', $cache[ 'top_users' ] ); |
|
1136 | 1136 | |
1137 | 1137 | wp_cache_set( $points_type, $cache, 'wordpoints_points_top_users' ); |
1138 | 1138 | |
1139 | 1139 | } // End if ( not cached ). |
1140 | 1140 | |
1141 | - return array_slice( $cache['top_users'], 0, $num_users ); |
|
1141 | + return array_slice( $cache[ 'top_users' ], 0, $num_users ); |
|
1142 | 1142 | } |
1143 | 1143 | |
1144 | 1144 | /** |
@@ -1170,7 +1170,7 @@ discard block |
||
1170 | 1170 | $points_type_name = wordpoints_get_points_type_setting( $points_type, 'name' ); |
1171 | 1171 | |
1172 | 1172 | if ( ! empty( $points_type_name ) ) { |
1173 | - $column_headers['points'] = $points_type_name; |
|
1173 | + $column_headers[ 'points' ] = $points_type_name; |
|
1174 | 1174 | } |
1175 | 1175 | |
1176 | 1176 | /** |
@@ -1195,11 +1195,11 @@ discard block |
||
1195 | 1195 | <thead> |
1196 | 1196 | <tr> |
1197 | 1197 | <th scope="col"> |
1198 | - <span aria-hidden="true"><?php echo esc_html( $column_headers['#'] ); ?></span> |
|
1199 | - <span class="screen-reader-text"><?php echo esc_html( $column_headers['position'] ); ?></span> |
|
1198 | + <span aria-hidden="true"><?php echo esc_html( $column_headers[ '#' ] ); ?></span> |
|
1199 | + <span class="screen-reader-text"><?php echo esc_html( $column_headers[ 'position' ] ); ?></span> |
|
1200 | 1200 | </th> |
1201 | - <th scope="col"><?php echo esc_html( $column_headers['user'] ); ?></th> |
|
1202 | - <th scope="col"><?php echo esc_html( $column_headers['points'] ); ?></th> |
|
1201 | + <th scope="col"><?php echo esc_html( $column_headers[ 'user' ] ); ?></th> |
|
1202 | + <th scope="col"><?php echo esc_html( $column_headers[ 'points' ] ); ?></th> |
|
1203 | 1203 | </tr> |
1204 | 1204 | </thead> |
1205 | 1205 | <tbody> |
@@ -1267,11 +1267,11 @@ discard block |
||
1267 | 1267 | <tfoot> |
1268 | 1268 | <tr> |
1269 | 1269 | <th scope="col"> |
1270 | - <span aria-hidden="true"><?php echo esc_html( $column_headers['#'] ); ?></span> |
|
1271 | - <span class="screen-reader-text"><?php echo esc_html( $column_headers['position'] ); ?></span> |
|
1270 | + <span aria-hidden="true"><?php echo esc_html( $column_headers[ '#' ] ); ?></span> |
|
1271 | + <span class="screen-reader-text"><?php echo esc_html( $column_headers[ 'position' ] ); ?></span> |
|
1272 | 1272 | </th> |
1273 | - <th scope="col"><?php echo esc_html( $column_headers['user'] ); ?></th> |
|
1274 | - <th scope="col"><?php echo esc_html( $column_headers['points'] ); ?></th> |
|
1273 | + <th scope="col"><?php echo esc_html( $column_headers[ 'user' ] ); ?></th> |
|
1274 | + <th scope="col"><?php echo esc_html( $column_headers[ 'points' ] ); ?></th> |
|
1275 | 1275 | </tr> |
1276 | 1276 | </tfoot> |
1277 | 1277 | </table> |
@@ -1310,7 +1310,7 @@ discard block |
||
1310 | 1310 | $cache = wp_cache_get( $slug, 'wordpoints_points_top_users' ); |
1311 | 1311 | |
1312 | 1312 | // If there aren't fewer users than the cache holds, we don't need to clear it. |
1313 | - if ( ! is_array( $cache ) || ! $cache['is_max'] ) { |
|
1313 | + if ( ! is_array( $cache ) || ! $cache[ 'is_max' ] ) { |
|
1314 | 1314 | continue; |
1315 | 1315 | } |
1316 | 1316 | |
@@ -1335,7 +1335,7 @@ discard block |
||
1335 | 1335 | $cache = wp_cache_get( $slug, 'wordpoints_points_top_users' ); |
1336 | 1336 | |
1337 | 1337 | // If this user isn't in the cache, we don't need to clear it. |
1338 | - if ( ! is_array( $cache ) || ! in_array( (int) $user_id, array_map( 'intval', $cache['top_users'] ), true ) ) { |
|
1338 | + if ( ! is_array( $cache ) || ! in_array( (int) $user_id, array_map( 'intval', $cache[ 'top_users' ] ), true ) ) { |
|
1339 | 1339 | continue; |
1340 | 1340 | } |
1341 | 1341 |
@@ -173,7 +173,7 @@ discard block |
||
173 | 173 | * |
174 | 174 | * @param mixed $maybe_int The value to convert to an integer. |
175 | 175 | * |
176 | - * @return int|false False if $maybe_int couldn't reliably be converted to an integer. |
|
176 | + * @return integer False if $maybe_int couldn't reliably be converted to an integer. |
|
177 | 177 | */ |
178 | 178 | function wordpoints_int( &$maybe_int ) { |
179 | 179 | |
@@ -969,7 +969,7 @@ discard block |
||
969 | 969 | * @since 1.0.1 |
970 | 970 | * @since 1.8.0 The $message now supports WP_Error objects. |
971 | 971 | * |
972 | - * @param string|WP_Error $message The error message. |
|
972 | + * @param string $message The error message. |
|
973 | 973 | * |
974 | 974 | * @return string The error message. |
975 | 975 | */ |
@@ -88,7 +88,8 @@ discard block |
||
88 | 88 | */ |
89 | 89 | function wordpoints_maintenance_shutdown_print_rand_str() { |
90 | 90 | |
91 | - if ( ! isset( $_GET['wordpoints_module_check'] ) ) { // WPCS: CSRF OK. |
|
91 | + if ( ! isset( $_GET['wordpoints_module_check'] ) ) { |
|
92 | +// WPCS: CSRF OK. |
|
92 | 93 | return; |
93 | 94 | } |
94 | 95 | |
@@ -98,7 +99,8 @@ discard block |
||
98 | 99 | $nonce = get_option( 'wordpoints_module_check_nonce' ); |
99 | 100 | } |
100 | 101 | |
101 | - if ( ! $nonce || ! hash_equals( $nonce, sanitize_key( $_GET['wordpoints_module_check'] ) ) ) { // WPCS: CSRF OK. |
|
102 | + if ( ! $nonce || ! hash_equals( $nonce, sanitize_key( $_GET['wordpoints_module_check'] ) ) ) { |
|
103 | +// WPCS: CSRF OK. |
|
102 | 104 | return; |
103 | 105 | } |
104 | 106 | |
@@ -128,7 +130,8 @@ discard block |
||
128 | 130 | */ |
129 | 131 | function wordpoints_maintenance_filter_modules( $modules ) { |
130 | 132 | |
131 | - if ( ! isset( $_GET['check_module'], $_GET['wordpoints_module_check'] ) ) { // WPCS: CSRF OK. |
|
133 | + if ( ! isset( $_GET['check_module'], $_GET['wordpoints_module_check'] ) ) { |
|
134 | +// WPCS: CSRF OK. |
|
132 | 135 | return $modules; |
133 | 136 | } |
134 | 137 | |
@@ -138,7 +141,8 @@ discard block |
||
138 | 141 | $nonce = get_option( 'wordpoints_module_check_nonce' ); |
139 | 142 | } |
140 | 143 | |
141 | - if ( ! $nonce || ! hash_equals( $nonce, sanitize_key( $_GET['wordpoints_module_check'] ) ) ) { // WPCS: CSRF OK. |
|
144 | + if ( ! $nonce || ! hash_equals( $nonce, sanitize_key( $_GET['wordpoints_module_check'] ) ) ) { |
|
145 | +// WPCS: CSRF OK. |
|
142 | 146 | return $modules; |
143 | 147 | } |
144 | 148 |
@@ -91,13 +91,13 @@ discard block |
||
91 | 91 | |
92 | 92 | // Normally this should never happen, because the plugins_loaded action won't |
93 | 93 | // run until the next request after WordPoints is activated and installs itself. |
94 | - if ( empty( $wordpoints_data['version'] ) ) { |
|
94 | + if ( empty( $wordpoints_data[ 'version' ] ) ) { |
|
95 | 95 | return; |
96 | 96 | } |
97 | 97 | |
98 | 98 | // The major version is determined by the first number, so we can just cast to |
99 | 99 | // an integer. IF the major versions are equal, we don't need to do anything. |
100 | - if ( (int) WORDPOINTS_VERSION === (int) $wordpoints_data['version'] ) { |
|
100 | + if ( (int) WORDPOINTS_VERSION === (int) $wordpoints_data[ 'version' ] ) { |
|
101 | 101 | return; |
102 | 102 | } |
103 | 103 | |
@@ -115,7 +115,7 @@ discard block |
||
115 | 115 | */ |
116 | 116 | function wordpoints_maintenance_shutdown_print_rand_str() { |
117 | 117 | |
118 | - if ( ! isset( $_GET['wordpoints_module_check'] ) ) { // WPCS: CSRF OK. |
|
118 | + if ( ! isset( $_GET[ 'wordpoints_module_check' ] ) ) { // WPCS: CSRF OK. |
|
119 | 119 | return; |
120 | 120 | } |
121 | 121 | |
@@ -125,7 +125,7 @@ discard block |
||
125 | 125 | $nonce = get_option( 'wordpoints_module_check_nonce' ); |
126 | 126 | } |
127 | 127 | |
128 | - if ( ! $nonce || ! hash_equals( $nonce, sanitize_key( $_GET['wordpoints_module_check'] ) ) ) { // WPCS: CSRF OK. |
|
128 | + if ( ! $nonce || ! hash_equals( $nonce, sanitize_key( $_GET[ 'wordpoints_module_check' ] ) ) ) { // WPCS: CSRF OK. |
|
129 | 129 | return; |
130 | 130 | } |
131 | 131 | |
@@ -155,7 +155,7 @@ discard block |
||
155 | 155 | */ |
156 | 156 | function wordpoints_maintenance_filter_modules( $modules ) { |
157 | 157 | |
158 | - if ( ! isset( $_GET['check_module'], $_GET['wordpoints_module_check'] ) ) { // WPCS: CSRF OK. |
|
158 | + if ( ! isset( $_GET[ 'check_module' ], $_GET[ 'wordpoints_module_check' ] ) ) { // WPCS: CSRF OK. |
|
159 | 159 | return $modules; |
160 | 160 | } |
161 | 161 | |
@@ -165,13 +165,13 @@ discard block |
||
165 | 165 | $nonce = get_option( 'wordpoints_module_check_nonce' ); |
166 | 166 | } |
167 | 167 | |
168 | - if ( ! $nonce || ! hash_equals( $nonce, sanitize_key( $_GET['wordpoints_module_check'] ) ) ) { // WPCS: CSRF OK. |
|
168 | + if ( ! $nonce || ! hash_equals( $nonce, sanitize_key( $_GET[ 'wordpoints_module_check' ] ) ) ) { // WPCS: CSRF OK. |
|
169 | 169 | return $modules; |
170 | 170 | } |
171 | 171 | |
172 | 172 | $modules = explode( |
173 | 173 | ',' |
174 | - , sanitize_text_field( wp_unslash( $_GET['check_module'] ) ) // WPCS: CSRF OK. |
|
174 | + , sanitize_text_field( wp_unslash( $_GET[ 'check_module' ] ) ) // WPCS: CSRF OK. |
|
175 | 175 | ); |
176 | 176 | |
177 | 177 | if ( 'pre_site_option_wordpoints_sitewide_active_modules' === current_filter() ) { |
@@ -353,7 +353,7 @@ discard block |
||
353 | 353 | return false; |
354 | 354 | } |
355 | 355 | |
356 | - $values[] = $request[ $value ]; |
|
356 | + $values[ ] = $request[ $value ]; |
|
357 | 357 | } |
358 | 358 | |
359 | 359 | $action_format = vsprintf( $action_format, $values ); |
@@ -395,10 +395,10 @@ discard block |
||
395 | 395 | |
396 | 396 | $error_data = $error->error_data; |
397 | 397 | |
398 | - if ( isset( $error_data[ $code ]['title'] ) ) { |
|
398 | + if ( isset( $error_data[ $code ][ 'title' ] ) ) { |
|
399 | 399 | |
400 | - $error_data[ $code ]['title'] = wp_kses( |
|
401 | - $error->error_data[ $code ]['title'] |
|
400 | + $error_data[ $code ][ 'title' ] = wp_kses( |
|
401 | + $error->error_data[ $code ][ 'title' ] |
|
402 | 402 | , 'wordpoints_sanitize_wp_error_title' |
403 | 403 | ); |
404 | 404 | |
@@ -799,16 +799,16 @@ discard block |
||
799 | 799 | |
800 | 800 | $options = array_merge( $defaults, $options ); |
801 | 801 | |
802 | - echo '<select class="' . esc_attr( $options['class'] ) . '" name="' . esc_attr( $options['name'] ) . '" id="' . esc_attr( $options['id'] ) . '">'; |
|
803 | - echo '<option value="ALL"' . selected( $options['selected'], 'ALL', false ) . '>' . esc_html_x( 'Any', 'post type', 'wordpoints' ) . '</option>'; |
|
802 | + echo '<select class="' . esc_attr( $options[ 'class' ] ) . '" name="' . esc_attr( $options[ 'name' ] ) . '" id="' . esc_attr( $options[ 'id' ] ) . '">'; |
|
803 | + echo '<option value="ALL"' . selected( $options[ 'selected' ], 'ALL', false ) . '>' . esc_html_x( 'Any', 'post type', 'wordpoints' ) . '</option>'; |
|
804 | 804 | |
805 | 805 | foreach ( get_post_types( $args, 'objects' ) as $post_type ) { |
806 | 806 | |
807 | - if ( isset( $options['filter'] ) && ! call_user_func( $options['filter'], $post_type ) ) { |
|
807 | + if ( isset( $options[ 'filter' ] ) && ! call_user_func( $options[ 'filter' ], $post_type ) ) { |
|
808 | 808 | continue; |
809 | 809 | } |
810 | 810 | |
811 | - echo '<option value="' . esc_attr( $post_type->name ) . '"' . selected( $options['selected'], $post_type->name, false ) . '>' . esc_html( $post_type->label ) . '</option>'; |
|
811 | + echo '<option value="' . esc_attr( $post_type->name ) . '"' . selected( $options[ 'selected' ], $post_type->name, false ) . '>' . esc_html( $post_type->label ) . '</option>'; |
|
812 | 812 | } |
813 | 813 | |
814 | 814 | echo '</select>'; |
@@ -1006,18 +1006,18 @@ discard block |
||
1006 | 1006 | , esc_html( "{$cap} is deprecated, use {$deprecated[ $cap ]} instead." ) |
1007 | 1007 | ); |
1008 | 1008 | |
1009 | - $caps[] = $deprecated[ $cap ]; |
|
1009 | + $caps[ ] = $deprecated[ $cap ]; |
|
1010 | 1010 | } |
1011 | 1011 | |
1012 | 1012 | switch ( $cap ) { |
1013 | 1013 | case 'install_wordpoints_extensions': |
1014 | 1014 | case 'update_wordpoints_extensions': |
1015 | 1015 | if ( defined( 'DISALLOW_FILE_MODS' ) && DISALLOW_FILE_MODS ) { |
1016 | - $caps[] = 'do_not_allow'; |
|
1016 | + $caps[ ] = 'do_not_allow'; |
|
1017 | 1017 | } elseif ( is_multisite() && ! is_super_admin( $user_id ) ) { |
1018 | - $caps[] = 'do_not_allow'; |
|
1018 | + $caps[ ] = 'do_not_allow'; |
|
1019 | 1019 | } else { |
1020 | - $caps[] = $cap; |
|
1020 | + $caps[ ] = $cap; |
|
1021 | 1021 | } |
1022 | 1022 | break; |
1023 | 1023 | } |
@@ -1194,15 +1194,15 @@ discard block |
||
1194 | 1194 | case 0: |
1195 | 1195 | return new $class_name(); |
1196 | 1196 | case 1: |
1197 | - return new $class_name( $args[0] ); |
|
1197 | + return new $class_name( $args[ 0 ] ); |
|
1198 | 1198 | case 2: |
1199 | - return new $class_name( $args[0], $args[1] ); |
|
1199 | + return new $class_name( $args[ 0 ], $args[ 1 ] ); |
|
1200 | 1200 | case 3: |
1201 | - return new $class_name( $args[0], $args[1], $args[2] ); |
|
1201 | + return new $class_name( $args[ 0 ], $args[ 1 ], $args[ 2 ] ); |
|
1202 | 1202 | case 4: |
1203 | - return new $class_name( $args[0], $args[1], $args[2], $args[3] ); |
|
1203 | + return new $class_name( $args[ 0 ], $args[ 1 ], $args[ 2 ], $args[ 3 ] ); |
|
1204 | 1204 | case 5: |
1205 | - return new $class_name( $args[0], $args[1], $args[2], $args[3], $args[4] ); |
|
1205 | + return new $class_name( $args[ 0 ], $args[ 1 ], $args[ 2 ], $args[ 3 ], $args[ 4 ] ); |
|
1206 | 1206 | default: |
1207 | 1207 | return false; |
1208 | 1208 | } |
@@ -92,6 +92,7 @@ discard block |
||
92 | 92 | * |
93 | 93 | * @param string $parent_slug The group slug. |
94 | 94 | * @param string $slug The slug of the class to deregister. |
95 | + * @return void |
|
95 | 96 | */ |
96 | 97 | public function deregister( $parent_slug, $slug ); |
97 | 98 | |
@@ -101,6 +102,7 @@ discard block |
||
101 | 102 | * @since 2.1.0 |
102 | 103 | * |
103 | 104 | * @param string $parent_slug The group slug. |
105 | + * @return void |
|
104 | 106 | */ |
105 | 107 | public function deregister_children( $parent_slug ); |
106 | 108 |
@@ -76,6 +76,7 @@ discard block |
||
76 | 76 | * @param string $slug The slug of the class to deregister. |
77 | 77 | * @param string[] $parent_slugs The slug(s) of the class's parent(s) in the |
78 | 78 | * hierarchy. |
79 | + * @return void |
|
79 | 80 | */ |
80 | 81 | public function deregister( $slug, array $parent_slugs = array() ); |
81 | 82 | |
@@ -85,6 +86,7 @@ discard block |
||
85 | 86 | * @since 2.2.0 |
86 | 87 | * |
87 | 88 | * @param string[] $parent_slugs The hierarchy of the parent. |
89 | + * @return void |
|
88 | 90 | */ |
89 | 91 | public function deregister_children( array $parent_slugs = array() ); |
90 | 92 |
@@ -71,6 +71,7 @@ |
||
71 | 71 | * @since 2.1.0 |
72 | 72 | * |
73 | 73 | * @param string $slug The slug of the class to deregister. |
74 | + * @return void |
|
74 | 75 | */ |
75 | 76 | public function deregister( $slug ); |
76 | 77 |