@@ -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 */ |
@@ -1073,6 +1073,7 @@ |
||
1073 | 1073 | * |
1074 | 1074 | * @since 2.1.4 |
1075 | 1075 | * |
1076 | + * @param string[] $post_types |
|
1076 | 1077 | * @return array The slugs of the events. |
1077 | 1078 | */ |
1078 | 1079 | protected function _2_1_4_get_reversal_log_types( $post_types ) { |
@@ -150,12 +150,12 @@ discard block |
||
150 | 150 | if ( 1 === version_compare( '1.5.0', $this->updating_from ) ) { |
151 | 151 | |
152 | 152 | if ( ! $this->network_wide ) { |
153 | - unset( $this->updates['1_5_0'] ); |
|
153 | + unset( $this->updates[ '1_5_0' ] ); |
|
154 | 154 | } |
155 | 155 | } |
156 | 156 | |
157 | 157 | if ( $this->network_wide ) { |
158 | - unset( $this->updates['1_8_0'] ); |
|
158 | + unset( $this->updates[ '1_8_0' ] ); |
|
159 | 159 | } |
160 | 160 | |
161 | 161 | if ( 1 === version_compare( '1.9.0', $this->updating_from ) ) { |
@@ -495,8 +495,8 @@ discard block |
||
495 | 495 | continue; |
496 | 496 | } |
497 | 497 | |
498 | - if ( ! isset( $settings['post_type'] ) ) { |
|
499 | - $settings['post_type'] = 'ALL'; |
|
498 | + if ( ! isset( $settings[ 'post_type' ] ) ) { |
|
499 | + $settings[ 'post_type' ] = 'ALL'; |
|
500 | 500 | } |
501 | 501 | |
502 | 502 | // If the trash points are set, create a post delete points hook instead. |
@@ -505,7 +505,7 @@ discard block |
||
505 | 505 | $new_hook->update_callback( |
506 | 506 | array( |
507 | 507 | 'points' => $settings[ $split_key ], |
508 | - 'post_type' => $settings['post_type'], |
|
508 | + 'post_type' => $settings[ 'post_type' ], |
|
509 | 509 | ) |
510 | 510 | , $new_hook->next_hook_id_number() |
511 | 511 | ); |
@@ -514,13 +514,13 @@ discard block |
||
514 | 514 | $points_type = $hook->points_type( $network_ . $number ); |
515 | 515 | |
516 | 516 | // Add this instance to the points-types-hooks list. |
517 | - $points_types_hooks[ $points_type ][] = $new_hook->get_id( $number ); |
|
517 | + $points_types_hooks[ $points_type ][ ] = $new_hook->get_id( $number ); |
|
518 | 518 | } |
519 | 519 | |
520 | 520 | // If the publish points are set, update the settings of the hook. |
521 | 521 | if ( isset( $settings[ $key ] ) && wordpoints_posint( $settings[ $key ] ) ) { |
522 | 522 | |
523 | - $settings['points'] = $settings[ $key ]; |
|
523 | + $settings[ 'points' ] = $settings[ $key ]; |
|
524 | 524 | |
525 | 525 | $hook->update_callback( $settings, $number ); |
526 | 526 | |
@@ -554,9 +554,9 @@ discard block |
||
554 | 554 | public function _1_4_0_clean_hook_settings( $instance, $new_instance, $old_instance, $hook ) { |
555 | 555 | |
556 | 556 | if ( $hook instanceof WordPoints_Post_Points_Hook ) { |
557 | - unset( $instance['trash'], $instance['publish'] ); |
|
557 | + unset( $instance[ 'trash' ], $instance[ 'publish' ] ); |
|
558 | 558 | } elseif ( $hook instanceof WordPoints_Comment_Points_Hook ) { |
559 | - unset( $instance['approve'], $instance['disapprove'] ); |
|
559 | + unset( $instance[ 'approve' ], $instance[ 'disapprove' ] ); |
|
560 | 560 | } |
561 | 561 | |
562 | 562 | return $instance; |
@@ -729,9 +729,9 @@ discard block |
||
729 | 729 | |
730 | 730 | $hook_instances_indexed |
731 | 731 | [ $hook->points_type( $network_ . $number ) ] |
732 | - [ $instance['post_type'] ] |
|
733 | - [ $instance['points'] ] |
|
734 | - [] = $number; |
|
732 | + [ $instance[ 'post_type' ] ] |
|
733 | + [ $instance[ 'points' ] ] |
|
734 | + [ ] = $number; |
|
735 | 735 | } |
736 | 736 | |
737 | 737 | foreach ( $hook_reverse_instances as $number => $instance ) { |
@@ -742,12 +742,12 @@ discard block |
||
742 | 742 | |
743 | 743 | // We use empty() instead of isset() because array_pop() below may leave |
744 | 744 | // us with an empty array as the value. |
745 | - if ( empty( $hook_instances_indexed[ $points_type ][ $instance['post_type'] ][ $instance['points'] ] ) ) { |
|
745 | + if ( empty( $hook_instances_indexed[ $points_type ][ $instance[ 'post_type' ] ][ $instance[ 'points' ] ] ) ) { |
|
746 | 746 | continue; |
747 | 747 | } |
748 | 748 | |
749 | 749 | $comment_instance_number = array_pop( |
750 | - $hook_instances_indexed[ $points_type ][ $instance['post_type'] ][ $instance['points'] ] |
|
750 | + $hook_instances_indexed[ $points_type ][ $instance[ 'post_type' ] ][ $instance[ 'points' ] ] |
|
751 | 751 | ); |
752 | 752 | |
753 | 753 | // We need to unset this instance from the list of hook instances. It |
@@ -768,7 +768,7 @@ discard block |
||
768 | 768 | if ( ! empty( $hook_instances ) ) { |
769 | 769 | |
770 | 770 | foreach ( $hook_instances as $number => $instance ) { |
771 | - $instance['auto_reverse'] = 0; |
|
771 | + $instance[ 'auto_reverse' ] = 0; |
|
772 | 772 | $hook->update_callback( $instance, $number ); |
773 | 773 | } |
774 | 774 | |
@@ -826,7 +826,7 @@ discard block |
||
826 | 826 | ); |
827 | 827 | |
828 | 828 | if ( $network_wide ) { |
829 | - $query_args['blog_id'] = false; |
|
829 | + $query_args[ 'blog_id' ] = false; |
|
830 | 830 | } |
831 | 831 | |
832 | 832 | $query = new WordPoints_Points_Logs_Query( $query_args ); |
@@ -983,9 +983,9 @@ discard block |
||
983 | 983 | continue; |
984 | 984 | } |
985 | 985 | |
986 | - $logs_to_delete[] = $post_publish_reverse_log_id; |
|
987 | - $logs_to_delete[] = $post_update_reverse_log_id; |
|
988 | - $logs_to_delete[] = $post_update_log_id; |
|
986 | + $logs_to_delete[ ] = $post_publish_reverse_log_id; |
|
987 | + $logs_to_delete[ ] = $post_update_reverse_log_id; |
|
988 | + $logs_to_delete[ ] = $post_update_log_id; |
|
989 | 989 | |
990 | 990 | // Give the user their points back, as they were removed in error. |
991 | 991 | $this->_2_1_4_revert_log( $post_publish_reverse_log ); |
@@ -1025,7 +1025,7 @@ discard block |
||
1025 | 1025 | if ( count( $logs ) > 1 ) { |
1026 | 1026 | |
1027 | 1027 | // The first one is the original, so keep it. |
1028 | - unset( $logs[0] ); |
|
1028 | + unset( $logs[ 0 ] ); |
|
1029 | 1029 | |
1030 | 1030 | array_map( array( $this, '_2_1_4_revert_log' ), $logs ); |
1031 | 1031 | |
@@ -1166,7 +1166,7 @@ discard block |
||
1166 | 1166 | ); |
1167 | 1167 | |
1168 | 1168 | if ( $hit_id ) { |
1169 | - $hits_to_delete[] = $hit_id; |
|
1169 | + $hits_to_delete[ ] = $hit_id; |
|
1170 | 1170 | } |
1171 | 1171 | |
1172 | 1172 | wordpoints_points_log_delete_all_metadata( $log_id ); |
@@ -1201,7 +1201,7 @@ discard block |
||
1201 | 1201 | |
1202 | 1202 | foreach ( $hit_ids as $hit_id ) { |
1203 | 1203 | |
1204 | - $hit_ids[] = get_metadata( |
|
1204 | + $hit_ids[ ] = get_metadata( |
|
1205 | 1205 | 'wordpoints_hook_hit' |
1206 | 1206 | , $hit_id |
1207 | 1207 | , 'hook_hit_id' |
@@ -1286,8 +1286,8 @@ discard block |
||
1286 | 1286 | isset( $reversal_logs[ $log->id ] ) |
1287 | 1287 | && strtotime( $reversal_logs[ $log->id ]->date ) - strtotime( $log->date ) < 2 |
1288 | 1288 | ) { |
1289 | - $logs_to_delete[] = $log->id; |
|
1290 | - $logs_to_delete[] = $reversal_logs[ $log->id ]->id; |
|
1289 | + $logs_to_delete[ ] = $log->id; |
|
1290 | + $logs_to_delete[ ] = $reversal_logs[ $log->id ]->id; |
|
1291 | 1291 | } |
1292 | 1292 | } |
1293 | 1293 | |
@@ -1345,7 +1345,7 @@ discard block |
||
1345 | 1345 | $legacy_log_types = array(); |
1346 | 1346 | |
1347 | 1347 | foreach ( $post_types as $post_type ) { |
1348 | - $legacy_log_types[] = "points_legacy_post_publish\\{$post_type}"; |
|
1348 | + $legacy_log_types[ ] = "points_legacy_post_publish\\{$post_type}"; |
|
1349 | 1349 | } |
1350 | 1350 | |
1351 | 1351 | $query = new WordPoints_Points_Logs_Query( |
@@ -1368,7 +1368,7 @@ discard block |
||
1368 | 1368 | , true |
1369 | 1369 | ); |
1370 | 1370 | |
1371 | - $legacy_logs[ $post_id ][] = $legacy_log; |
|
1371 | + $legacy_logs[ $post_id ][ ] = $legacy_log; |
|
1372 | 1372 | } |
1373 | 1373 | |
1374 | 1374 | return $legacy_logs; |
@@ -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 | |
@@ -1094,13 +1094,13 @@ discard block |
||
1094 | 1094 | , array( '%d' ) |
1095 | 1095 | ); |
1096 | 1096 | |
1097 | - if ( ! isset( $flushed['points_types'][ $log->points_type ], $flushed['user_ids'][ $log->user_id ] ) ) { |
|
1097 | + if ( ! isset( $flushed[ 'points_types' ][ $log->points_type ], $flushed[ 'user_ids' ][ $log->user_id ] ) ) { |
|
1098 | 1098 | wordpoints_flush_points_logs_caches( |
1099 | 1099 | array( 'user_id' => $log->user_id, 'points_type' => $log->points_type ) |
1100 | 1100 | ); |
1101 | 1101 | |
1102 | - $flushed['points_types'][ $log->points_type ] = true; |
|
1103 | - $flushed['user_ids'][ $log->user_id ] = true; |
|
1102 | + $flushed[ 'points_types' ][ $log->points_type ] = true; |
|
1103 | + $flushed[ 'user_ids' ][ $log->user_id ] = true; |
|
1104 | 1104 | } |
1105 | 1105 | } |
1106 | 1106 | |
@@ -1134,9 +1134,9 @@ discard block |
||
1134 | 1134 | $cache = array( 'is_max' => false, 'top_users' => array() ); |
1135 | 1135 | } |
1136 | 1136 | |
1137 | - $cached_users = count( $cache['top_users'] ); |
|
1137 | + $cached_users = count( $cache[ 'top_users' ] ); |
|
1138 | 1138 | |
1139 | - if ( $num_users > $cached_users && ! $cache['is_max'] ) { |
|
1139 | + if ( $num_users > $cached_users && ! $cache[ 'is_max' ] ) { |
|
1140 | 1140 | |
1141 | 1141 | global $wpdb; |
1142 | 1142 | |
@@ -1185,19 +1185,19 @@ discard block |
||
1185 | 1185 | return array(); |
1186 | 1186 | } |
1187 | 1187 | |
1188 | - $cache['top_users'] = array_merge( $cache['top_users'], $top_users ); |
|
1188 | + $cache[ 'top_users' ] = array_merge( $cache[ 'top_users' ], $top_users ); |
|
1189 | 1189 | |
1190 | - if ( count( $cache['top_users'] ) < $num_users ) { |
|
1191 | - $cache['is_max'] = true; |
|
1190 | + if ( count( $cache[ 'top_users' ] ) < $num_users ) { |
|
1191 | + $cache[ 'is_max' ] = true; |
|
1192 | 1192 | } |
1193 | 1193 | |
1194 | - $cache['top_users'] = array_map( 'intval', $cache['top_users'] ); |
|
1194 | + $cache[ 'top_users' ] = array_map( 'intval', $cache[ 'top_users' ] ); |
|
1195 | 1195 | |
1196 | 1196 | wp_cache_set( $points_type, $cache, 'wordpoints_points_top_users' ); |
1197 | 1197 | |
1198 | 1198 | } // End if ( not cached ). |
1199 | 1199 | |
1200 | - return array_slice( $cache['top_users'], 0, $num_users ); |
|
1200 | + return array_slice( $cache[ 'top_users' ], 0, $num_users ); |
|
1201 | 1201 | } |
1202 | 1202 | |
1203 | 1203 | /** |
@@ -1229,7 +1229,7 @@ discard block |
||
1229 | 1229 | $points_type_name = wordpoints_get_points_type_setting( $points_type, 'name' ); |
1230 | 1230 | |
1231 | 1231 | if ( ! empty( $points_type_name ) ) { |
1232 | - $column_headers['points'] = $points_type_name; |
|
1232 | + $column_headers[ 'points' ] = $points_type_name; |
|
1233 | 1233 | } |
1234 | 1234 | |
1235 | 1235 | /** |
@@ -1254,11 +1254,11 @@ discard block |
||
1254 | 1254 | <thead> |
1255 | 1255 | <tr> |
1256 | 1256 | <th scope="col"> |
1257 | - <span aria-hidden="true"><?php echo esc_html( $column_headers['#'] ); ?></span> |
|
1258 | - <span class="screen-reader-text"><?php echo esc_html( $column_headers['position'] ); ?></span> |
|
1257 | + <span aria-hidden="true"><?php echo esc_html( $column_headers[ '#' ] ); ?></span> |
|
1258 | + <span class="screen-reader-text"><?php echo esc_html( $column_headers[ 'position' ] ); ?></span> |
|
1259 | 1259 | </th> |
1260 | - <th scope="col"><?php echo esc_html( $column_headers['user'] ); ?></th> |
|
1261 | - <th scope="col"><?php echo esc_html( $column_headers['points'] ); ?></th> |
|
1260 | + <th scope="col"><?php echo esc_html( $column_headers[ 'user' ] ); ?></th> |
|
1261 | + <th scope="col"><?php echo esc_html( $column_headers[ 'points' ] ); ?></th> |
|
1262 | 1262 | </tr> |
1263 | 1263 | </thead> |
1264 | 1264 | <tbody> |
@@ -1317,11 +1317,11 @@ discard block |
||
1317 | 1317 | <tfoot> |
1318 | 1318 | <tr> |
1319 | 1319 | <th scope="col"> |
1320 | - <span aria-hidden="true"><?php echo esc_html( $column_headers['#'] ); ?></span> |
|
1321 | - <span class="screen-reader-text"><?php echo esc_html( $column_headers['position'] ); ?></span> |
|
1320 | + <span aria-hidden="true"><?php echo esc_html( $column_headers[ '#' ] ); ?></span> |
|
1321 | + <span class="screen-reader-text"><?php echo esc_html( $column_headers[ 'position' ] ); ?></span> |
|
1322 | 1322 | </th> |
1323 | - <th scope="col"><?php echo esc_html( $column_headers['user'] ); ?></th> |
|
1324 | - <th scope="col"><?php echo esc_html( $column_headers['points'] ); ?></th> |
|
1323 | + <th scope="col"><?php echo esc_html( $column_headers[ 'user' ] ); ?></th> |
|
1324 | + <th scope="col"><?php echo esc_html( $column_headers[ 'points' ] ); ?></th> |
|
1325 | 1325 | </tr> |
1326 | 1326 | </tfoot> |
1327 | 1327 | </table> |
@@ -1360,7 +1360,7 @@ discard block |
||
1360 | 1360 | $cache = wp_cache_get( $slug, 'wordpoints_points_top_users' ); |
1361 | 1361 | |
1362 | 1362 | // If there aren't fewer users than the cache holds, we don't need to clear it. |
1363 | - if ( ! is_array( $cache ) || ! $cache['is_max'] ) { |
|
1363 | + if ( ! is_array( $cache ) || ! $cache[ 'is_max' ] ) { |
|
1364 | 1364 | continue; |
1365 | 1365 | } |
1366 | 1366 | |
@@ -1385,7 +1385,7 @@ discard block |
||
1385 | 1385 | $cache = wp_cache_get( $slug, 'wordpoints_points_top_users' ); |
1386 | 1386 | |
1387 | 1387 | // If this user isn't in the cache, we don't need to clear it. |
1388 | - if ( ! is_array( $cache ) || ! in_array( (int) $user_id, array_map( 'intval', $cache['top_users'] ), true ) ) { |
|
1388 | + if ( ! is_array( $cache ) || ! in_array( (int) $user_id, array_map( 'intval', $cache[ 'top_users' ] ), true ) ) { |
|
1389 | 1389 | continue; |
1390 | 1390 | } |
1391 | 1391 |
@@ -402,7 +402,7 @@ |
||
402 | 402 | * |
403 | 403 | * @param int $rank_id The ID of the rank to get the position of. |
404 | 404 | * |
405 | - * @return int|false The rank's position, or false. |
|
405 | + * @return integer The rank's position, or false. |
|
406 | 406 | */ |
407 | 407 | public function get_rank_position( $rank_id ) { |
408 | 408 |
@@ -440,7 +440,7 @@ |
||
440 | 440 | |
441 | 441 | } elseif ( $count < $position ) { |
442 | 442 | |
443 | - $ranks[] = $rank_id; |
|
443 | + $ranks[ ] = $rank_id; |
|
444 | 444 | |
445 | 445 | } else { |
446 | 446 |
@@ -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 | */ |
@@ -64,13 +64,13 @@ discard block |
||
64 | 64 | |
65 | 65 | // Normally this should never happen, because the plugins_loaded action won't |
66 | 66 | // run until the next request after WordPoints is activated and installs itself. |
67 | - if ( empty( $wordpoints_data['version'] ) ) { |
|
67 | + if ( empty( $wordpoints_data[ 'version' ] ) ) { |
|
68 | 68 | return; |
69 | 69 | } |
70 | 70 | |
71 | 71 | // The major version is determined by the first number, so we can just cast to |
72 | 72 | // an integer. IF the major versions are equal, we don't need to do anything. |
73 | - if ( (int) WORDPOINTS_VERSION === (int) $wordpoints_data['version'] ) { |
|
73 | + if ( (int) WORDPOINTS_VERSION === (int) $wordpoints_data[ 'version' ] ) { |
|
74 | 74 | return; |
75 | 75 | } |
76 | 76 | |
@@ -88,7 +88,7 @@ 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' ] ) ) { // WPCS: CSRF OK. |
|
92 | 92 | return; |
93 | 93 | } |
94 | 94 | |
@@ -98,7 +98,7 @@ discard block |
||
98 | 98 | $nonce = get_option( 'wordpoints_module_check_nonce' ); |
99 | 99 | } |
100 | 100 | |
101 | - if ( ! $nonce || ! hash_equals( $nonce, sanitize_key( $_GET['wordpoints_module_check'] ) ) ) { // WPCS: CSRF OK. |
|
101 | + if ( ! $nonce || ! hash_equals( $nonce, sanitize_key( $_GET[ 'wordpoints_module_check' ] ) ) ) { // WPCS: CSRF OK. |
|
102 | 102 | return; |
103 | 103 | } |
104 | 104 | |
@@ -128,7 +128,7 @@ discard block |
||
128 | 128 | */ |
129 | 129 | function wordpoints_maintenance_filter_modules( $modules ) { |
130 | 130 | |
131 | - if ( ! isset( $_GET['check_module'], $_GET['wordpoints_module_check'] ) ) { // WPCS: CSRF OK. |
|
131 | + if ( ! isset( $_GET[ 'check_module' ], $_GET[ 'wordpoints_module_check' ] ) ) { // WPCS: CSRF OK. |
|
132 | 132 | return $modules; |
133 | 133 | } |
134 | 134 | |
@@ -138,13 +138,13 @@ discard block |
||
138 | 138 | $nonce = get_option( 'wordpoints_module_check_nonce' ); |
139 | 139 | } |
140 | 140 | |
141 | - if ( ! $nonce || ! hash_equals( $nonce, sanitize_key( $_GET['wordpoints_module_check'] ) ) ) { // WPCS: CSRF OK. |
|
141 | + if ( ! $nonce || ! hash_equals( $nonce, sanitize_key( $_GET[ 'wordpoints_module_check' ] ) ) ) { // WPCS: CSRF OK. |
|
142 | 142 | return $modules; |
143 | 143 | } |
144 | 144 | |
145 | 145 | $modules = explode( |
146 | 146 | ',' |
147 | - , sanitize_text_field( wp_unslash( $_GET['check_module'] ) ) // WPCS: CSRF OK. |
|
147 | + , sanitize_text_field( wp_unslash( $_GET[ 'check_module' ] ) ) // WPCS: CSRF OK. |
|
148 | 148 | ); |
149 | 149 | |
150 | 150 | if ( 'pre_site_option_wordpoints_sitewide_active_modules' === current_filter() ) { |
@@ -304,7 +304,7 @@ discard block |
||
304 | 304 | return false; |
305 | 305 | } |
306 | 306 | |
307 | - $values[] = $request[ $value ]; |
|
307 | + $values[ ] = $request[ $value ]; |
|
308 | 308 | } |
309 | 309 | |
310 | 310 | $action_format = vsprintf( $action_format, $values ); |
@@ -346,10 +346,10 @@ discard block |
||
346 | 346 | |
347 | 347 | $error_data = $error->error_data; |
348 | 348 | |
349 | - if ( isset( $error_data[ $code ]['title'] ) ) { |
|
349 | + if ( isset( $error_data[ $code ][ 'title' ] ) ) { |
|
350 | 350 | |
351 | - $error_data[ $code ]['title'] = wp_kses( |
|
352 | - $error->error_data[ $code ]['title'] |
|
351 | + $error_data[ $code ][ 'title' ] = wp_kses( |
|
352 | + $error->error_data[ $code ][ 'title' ] |
|
353 | 353 | , 'wordpoints_sanitize_wp_error_title' |
354 | 354 | ); |
355 | 355 | |
@@ -750,16 +750,16 @@ discard block |
||
750 | 750 | |
751 | 751 | $options = array_merge( $defaults, $options ); |
752 | 752 | |
753 | - echo '<select class="' . esc_attr( $options['class'] ) . '" name="' . esc_attr( $options['name'] ) . '" id="' . esc_attr( $options['id'] ) . '">'; |
|
754 | - echo '<option value="ALL"' . selected( $options['selected'], 'ALL', false ) . '>' . esc_html_x( 'Any', 'post type', 'wordpoints' ) . '</option>'; |
|
753 | + echo '<select class="' . esc_attr( $options[ 'class' ] ) . '" name="' . esc_attr( $options[ 'name' ] ) . '" id="' . esc_attr( $options[ 'id' ] ) . '">'; |
|
754 | + echo '<option value="ALL"' . selected( $options[ 'selected' ], 'ALL', false ) . '>' . esc_html_x( 'Any', 'post type', 'wordpoints' ) . '</option>'; |
|
755 | 755 | |
756 | 756 | foreach ( get_post_types( $args, 'objects' ) as $post_type ) { |
757 | 757 | |
758 | - if ( isset( $options['filter'] ) && ! call_user_func( $options['filter'], $post_type ) ) { |
|
758 | + if ( isset( $options[ 'filter' ] ) && ! call_user_func( $options[ 'filter' ], $post_type ) ) { |
|
759 | 759 | continue; |
760 | 760 | } |
761 | 761 | |
762 | - echo '<option value="' . esc_attr( $post_type->name ) . '"' . selected( $options['selected'], $post_type->name, false ) . '>' . esc_html( $post_type->label ) . '</option>'; |
|
762 | + echo '<option value="' . esc_attr( $post_type->name ) . '"' . selected( $options[ 'selected' ], $post_type->name, false ) . '>' . esc_html( $post_type->label ) . '</option>'; |
|
763 | 763 | } |
764 | 764 | |
765 | 765 | echo '</select>'; |
@@ -936,11 +936,11 @@ discard block |
||
936 | 936 | switch ( $cap ) { |
937 | 937 | case 'install_wordpoints_modules': |
938 | 938 | if ( defined( 'DISALLOW_FILE_MODS' ) && DISALLOW_FILE_MODS ) { |
939 | - $caps[] = 'do_not_allow'; |
|
939 | + $caps[ ] = 'do_not_allow'; |
|
940 | 940 | } elseif ( is_multisite() && ! is_super_admin( $user_id ) ) { |
941 | - $caps[] = 'do_not_allow'; |
|
941 | + $caps[ ] = 'do_not_allow'; |
|
942 | 942 | } else { |
943 | - $caps[] = $cap; |
|
943 | + $caps[ ] = $cap; |
|
944 | 944 | } |
945 | 945 | break; |
946 | 946 | } |
@@ -1116,13 +1116,13 @@ discard block |
||
1116 | 1116 | case 0: |
1117 | 1117 | return new $class_name(); |
1118 | 1118 | case 1: |
1119 | - return new $class_name( $args[0] ); |
|
1119 | + return new $class_name( $args[ 0 ] ); |
|
1120 | 1120 | case 2: |
1121 | - return new $class_name( $args[0], $args[1] ); |
|
1121 | + return new $class_name( $args[ 0 ], $args[ 1 ] ); |
|
1122 | 1122 | case 3: |
1123 | - return new $class_name( $args[0], $args[1], $args[2] ); |
|
1123 | + return new $class_name( $args[ 0 ], $args[ 1 ], $args[ 2 ] ); |
|
1124 | 1124 | case 4: |
1125 | - return new $class_name( $args[0], $args[1], $args[2], $args[3] ); |
|
1125 | + return new $class_name( $args[ 0 ], $args[ 1 ], $args[ 2 ], $args[ 3 ] ); |
|
1126 | 1126 | default: |
1127 | 1127 | return false; |
1128 | 1128 | } |
@@ -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 |
@@ -246,9 +246,9 @@ |
||
246 | 246 | } |
247 | 247 | |
248 | 248 | $screen_options = '<p><a id="access-on" href="' . esc_url( wp_nonce_url( $url, 'wordpoints_points_hooks_accessiblity', 'wordpoints-accessiblity-nonce' ) ) . '&accessibility-mode=on">' |
249 | - . esc_html__( 'Enable accessibility mode', 'wordpoints' ) |
|
250 | - . '</a><a id="access-off" href="' . esc_url( wp_nonce_url( $url, 'wordpoints_points_hooks_accessiblity', 'wordpoints-accessiblity-nonce' ) ) . '&accessibility-mode=off">' |
|
251 | - . esc_html__( 'Disable accessibility mode', 'wordpoints' ) . "</a></p>\n"; |
|
249 | + . esc_html__( 'Enable accessibility mode', 'wordpoints' ) |
|
250 | + . '</a><a id="access-off" href="' . esc_url( wp_nonce_url( $url, 'wordpoints_points_hooks_accessiblity', 'wordpoints-accessiblity-nonce' ) ) . '&accessibility-mode=off">' |
|
251 | + . esc_html__( 'Disable accessibility mode', 'wordpoints' ) . "</a></p>\n"; |
|
252 | 252 | break; |
253 | 253 | } |
254 | 254 |
@@ -143,7 +143,7 @@ discard block |
||
143 | 143 | */ |
144 | 144 | function wordpoints_points_admin_screen_hooks() { |
145 | 145 | |
146 | - if ( isset( $_GET['edithook'] ) || isset( $_POST['savehook'] ) || isset( $_POST['removehook'] ) ) { // WPCS: CSRF OK. |
|
146 | + if ( isset( $_GET[ 'edithook' ] ) || isset( $_POST[ 'savehook' ] ) || isset( $_POST[ 'removehook' ] ) ) { // WPCS: CSRF OK. |
|
147 | 147 | |
148 | 148 | // - We're doing this without AJAX (JS). |
149 | 149 | |
@@ -206,7 +206,7 @@ discard block |
||
206 | 206 | */ |
207 | 207 | function wordpoints_no_js_points_hooks_save() { |
208 | 208 | |
209 | - if ( ! isset( $_POST['savehook'] ) && ! isset( $_POST['removehook'] ) ) { // WPCS: CSRF OK. |
|
209 | + if ( ! isset( $_POST[ 'savehook' ] ) && ! isset( $_POST[ 'removehook' ] ) ) { // WPCS: CSRF OK. |
|
210 | 210 | return; |
211 | 211 | } |
212 | 212 | |
@@ -284,7 +284,7 @@ discard block |
||
284 | 284 | */ |
285 | 285 | function wordpoints_points_hook_description_form( $has_form, $instance, $hook ) { |
286 | 286 | |
287 | - $description = ( isset( $instance['_description'] ) ) ? $instance['_description'] : ''; |
|
287 | + $description = ( isset( $instance[ '_description' ] ) ) ? $instance[ '_description' ] : ''; |
|
288 | 288 | |
289 | 289 | ?> |
290 | 290 | |
@@ -350,7 +350,7 @@ discard block |
||
350 | 350 | ?> |
351 | 351 | |
352 | 352 | <tr> |
353 | - <th scope="row"><?php echo esc_html( $type['name'] ); ?></th> |
|
353 | + <th scope="row"><?php echo esc_html( $type[ 'name' ] ); ?></th> |
|
354 | 354 | <td> |
355 | 355 | <input type="hidden" name="<?php echo esc_attr( "wordpoints_points_old-{$slug}" ); ?>" value="<?php echo esc_attr( $points ); ?>" /> |
356 | 356 | <input type="number" name="<?php echo esc_attr( "wordpoints_points-{$slug}" ); ?>" value="<?php echo esc_attr( $points ); ?>" autocomplete="off" /> |
@@ -389,7 +389,7 @@ discard block |
||
389 | 389 | <tbody> |
390 | 390 | <?php foreach ( wordpoints_get_points_types() as $slug => $type ) : ?> |
391 | 391 | <tr> |
392 | - <th scope="row" style="text-align: left;"><?php echo esc_html( $type['name'] ); ?></th> |
|
392 | + <th scope="row" style="text-align: left;"><?php echo esc_html( $type[ 'name' ] ); ?></th> |
|
393 | 393 | <td style="text-align: right;"><?php wordpoints_display_points( $user->ID, $slug, 'profile_page' ); ?></td> |
394 | 394 | </tr> |
395 | 395 | <?php endforeach; ?> |
@@ -419,7 +419,7 @@ discard block |
||
419 | 419 | } |
420 | 420 | |
421 | 421 | if ( |
422 | - ! isset( $_POST['wordpoints_points_set_nonce'], $_POST['wordpoints_set_reason'] ) |
|
422 | + ! isset( $_POST[ 'wordpoints_points_set_nonce' ], $_POST[ 'wordpoints_set_reason' ] ) |
|
423 | 423 | || ! wordpoints_verify_nonce( 'wordpoints_points_set_nonce', 'wordpoints_points_set_profile', null, 'post' ) |
424 | 424 | ) { |
425 | 425 | return; |
@@ -444,7 +444,7 @@ discard block |
||
444 | 444 | , 'profile_edit' |
445 | 445 | , array( |
446 | 446 | 'user_id' => get_current_user_id(), |
447 | - 'reason' => sanitize_text_field( wp_unslash( $_POST['wordpoints_set_reason'] ) ), |
|
447 | + 'reason' => sanitize_text_field( wp_unslash( $_POST[ 'wordpoints_set_reason' ] ) ), |
|
448 | 448 | ) |
449 | 449 | ); |
450 | 450 | } |
@@ -500,11 +500,11 @@ discard block |
||
500 | 500 | function wordpoints_points_admin_settings_save() { |
501 | 501 | |
502 | 502 | if ( |
503 | - isset( $_POST['default_points_type'] ) |
|
503 | + isset( $_POST[ 'default_points_type' ] ) |
|
504 | 504 | && wordpoints_verify_nonce( 'wordpoints_default_points_type_nonce', 'wordpoints_default_points_type', null, 'post' ) |
505 | 505 | ) { |
506 | 506 | |
507 | - $points_type = sanitize_key( $_POST['default_points_type'] ); |
|
507 | + $points_type = sanitize_key( $_POST[ 'default_points_type' ] ); |
|
508 | 508 | |
509 | 509 | if ( '-1' === $points_type ) { |
510 | 510 | |
@@ -527,7 +527,7 @@ discard block |
||
527 | 527 | function wordpoints_points_admin_notices() { |
528 | 528 | |
529 | 529 | if ( |
530 | - ( ! isset( $_GET['page'] ) || 'wordpoints_points_types' !== $_GET['page'] ) // WPCS: CSRF OK. |
|
530 | + ( ! isset( $_GET[ 'page' ] ) || 'wordpoints_points_types' !== $_GET[ 'page' ] ) // WPCS: CSRF OK. |
|
531 | 531 | && current_user_can( 'manage_wordpoints_points_types' ) |
532 | 532 | && ! wordpoints_get_points_types() |
533 | 533 | ) { |
@@ -143,7 +143,8 @@ discard block |
||
143 | 143 | */ |
144 | 144 | function wordpoints_points_admin_screen_hooks() { |
145 | 145 | |
146 | - if ( isset( $_GET['edithook'] ) || isset( $_POST['savehook'] ) || isset( $_POST['removehook'] ) ) { // WPCS: CSRF OK. |
|
146 | + if ( isset( $_GET['edithook'] ) || isset( $_POST['savehook'] ) || isset( $_POST['removehook'] ) ) { |
|
147 | +// WPCS: CSRF OK. |
|
147 | 148 | |
148 | 149 | // - We're doing this without AJAX (JS). |
149 | 150 | |
@@ -206,7 +207,8 @@ discard block |
||
206 | 207 | */ |
207 | 208 | function wordpoints_no_js_points_hooks_save() { |
208 | 209 | |
209 | - if ( ! isset( $_POST['savehook'] ) && ! isset( $_POST['removehook'] ) ) { // WPCS: CSRF OK. |
|
210 | + if ( ! isset( $_POST['savehook'] ) && ! isset( $_POST['removehook'] ) ) { |
|
211 | +// WPCS: CSRF OK. |
|
210 | 212 | return; |
211 | 213 | } |
212 | 214 | |
@@ -290,9 +292,12 @@ discard block |
||
290 | 292 | |
291 | 293 | <?php if ( $has_form ) : ?> |
292 | 294 | <hr /> |
293 | - <?php else : ?> |
|
295 | + <?php else { |
|
296 | + : ?> |
|
294 | 297 | <br /> |
295 | - <?php endif; ?> |
|
298 | + <?php endif; |
|
299 | +} |
|
300 | +?> |
|
296 | 301 | |
297 | 302 | <div class="hook-instance-description"> |
298 | 303 | <label for="<?php $hook->the_field_id( '_description' ); ?>"><?php echo esc_html_x( 'Description (optional):', 'points hook', 'wordpoints' ); ?></label> |