@@ -57,13 +57,14 @@ protected function get_counts( $taxonomies ) {
5757 return [];
5858 }
5959
60- $ query = $ wpdb ->prepare (
60+ $ query = $ wpdb ->prepare (
6161 "SELECT `taxonomy`, COUNT(*) AS `count`
6262 FROM $ wpdb ->term_taxonomy
63- WHERE `taxonomy` IN ( " . implode ( ', ' , array_fill ( 0 , count ( $ taxonomies ), '%s ' ) ) . " )
64- GROUP BY `taxonomy` " ,
63+ WHERE `taxonomy` IN ( " . implode ( ', ' , array_fill ( 0 , count ( $ taxonomies ), '%s ' ) ) . ' )
64+ GROUP BY `taxonomy` ' ,
6565 $ taxonomies
6666 );
67+ // phpcs:ignore WordPress.DB.PreparedSQL.NotPrepared -- $query is already prepared above.
6768 $ counts = $ wpdb ->get_results ( $ query );
6869
6970 // Make sure there's a count for every item.
@@ -155,11 +156,14 @@ public function list_( $args, $assoc_args ) {
155156 $ counts = $ this ->get_counts ( wp_list_pluck ( $ taxonomies , 'name ' ) );
156157 }
157158
158- $ taxonomies = array_map ( function ( $ taxonomy ) use ( $ counts ) {
159- $ taxonomy ->object_type = implode ( ', ' , $ taxonomy ->object_type );
160- $ taxonomy ->count = isset ( $ counts [ $ taxonomy ->name ] ) ? $ counts [ $ taxonomy ->name ] : 0 ;
161- return $ taxonomy ;
162- }, $ taxonomies );
159+ $ taxonomies = array_map (
160+ function ( $ taxonomy ) use ( $ counts ) {
161+ $ taxonomy ->object_type = implode ( ', ' , $ taxonomy ->object_type );
162+ $ taxonomy ->count = isset ( $ counts [ $ taxonomy ->name ] ) ? $ counts [ $ taxonomy ->name ] : 0 ;
163+ return $ taxonomy ;
164+ },
165+ $ taxonomies
166+ );
163167
164168 $ formatter ->display_items ( $ taxonomies );
165169 }
@@ -231,10 +235,13 @@ public function get( $args, $assoc_args ) {
231235 }
232236
233237 if ( empty ( $ assoc_args ['fields ' ] ) ) {
234- $ default_fields = array_merge ( $ this ->fields , array (
235- 'labels ' ,
236- 'cap '
237- ) );
238+ $ default_fields = array_merge (
239+ $ this ->fields ,
240+ array (
241+ 'labels ' ,
242+ 'cap ' ,
243+ )
244+ );
238245
239246 $ assoc_args ['fields ' ] = $ default_fields ;
240247 }
0 commit comments