From 53ebaef3502b28900234a7c6726e29c69d0032db Mon Sep 17 00:00:00 2001 From: Kelly Dwan Date: Fri, 25 Oct 2019 16:58:23 -0400 Subject: [PATCH] Clean up some PHPCS errors --- plugins/wporg-5ftf/includes/xprofile.php | 7 ++++--- themes/wporg-5ftf/functions.php | 2 +- themes/wporg-5ftf/single-5ftf_pledge.php | 14 +++++++------- 3 files changed, 12 insertions(+), 11 deletions(-) diff --git a/plugins/wporg-5ftf/includes/xprofile.php b/plugins/wporg-5ftf/includes/xprofile.php index 449e494..8e22e27 100644 --- a/plugins/wporg-5ftf/includes/xprofile.php +++ b/plugins/wporg-5ftf/includes/xprofile.php @@ -38,7 +38,7 @@ function get_xprofile_contribution_data( array $user_ids ) { implode( ', ', array_map( 'absint', $field_ids ) ) ); - return $wpdb->get_results( $sql, ARRAY_A ); + return $wpdb->get_results( $sql, ARRAY_A ); // phpcs:ignore WordPress.DB.PreparedSQL -- prepare called above. } /** @@ -50,7 +50,8 @@ function get_xprofile_contribution_data( array $user_ids ) { */ function get_aggregate_contributor_data_for_pledge( $pledge_id ) { $contributors = Contributor\get_contributor_user_objects( - Contributor\get_pledge_contributors( $pledge_id, 'pending' ) // TODO set to 'publish' when finished testing + // TODO set to 'publish' when finished testing. + Contributor\get_pledge_contributors( $pledge_id, 'pending' ) ); $user_ids = wp_list_pluck( $contributors, 'ID' ); @@ -63,7 +64,7 @@ function get_aggregate_contributor_data_for_pledge( $pledge_id ) { ); $aggregate_data = array_reduce( $data, function( $carry, $item ) { - switch( $item['field_id'] ) { + switch ( $item['field_id'] ) { case 29: // Hours. $carry['hours'] += absint( $item['value'] ); break; diff --git a/themes/wporg-5ftf/functions.php b/themes/wporg-5ftf/functions.php index d2eaef0..5dfbc50 100644 --- a/themes/wporg-5ftf/functions.php +++ b/themes/wporg-5ftf/functions.php @@ -217,7 +217,7 @@ add_filter( 'script_loader_src', __NAMESPACE__ . '\loader_src', 10, 2 ); * @return array */ function get_badge_classes( $team ) { - switch( strtolower( $team ) ) { + switch ( strtolower( $team ) ) { case 'accessibility': $classes = array( 'badge-accessibility', 'dashicons-universal-access' ); break; diff --git a/themes/wporg-5ftf/single-5ftf_pledge.php b/themes/wporg-5ftf/single-5ftf_pledge.php index ab1d709..c4f9520 100644 --- a/themes/wporg-5ftf/single-5ftf_pledge.php +++ b/themes/wporg-5ftf/single-5ftf_pledge.php @@ -46,23 +46,23 @@ get_header(); ?>

%3$s hours per week.', 'wporg' ) ), + echo wp_kses_post( sprintf( + __( '%1$s sponsors %2$s for a total of %3$s hours per week.', 'wporg' ), get_the_title(), sprintf( _n( '%d contributor', '%d contributors', $contribution_data['contributors'], 'wporg' ), number_format_i18n( absint( $contribution_data['contributors'] ) ) ), number_format_i18n( absint( $contribution_data['hours'] ) ) - ); + ) ); ?>