Clean up some PHPCS errors

This commit is contained in:
Kelly Dwan 2019-10-25 16:58:23 -04:00
parent de5feec329
commit 53ebaef350
No known key found for this signature in database
GPG key ID: 8BA5575F3D11575D
3 changed files with 12 additions and 11 deletions

View file

@ -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;

View file

@ -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;

View file

@ -46,23 +46,23 @@ get_header(); ?>
<p>
<?php
printf(
wp_kses_post( __( '%1$s sponsors %2$s for a total of <strong>%3$s</strong> hours per week.', 'wporg' ) ),
echo wp_kses_post( sprintf(
__( '%1$s sponsors %2$s for a total of <strong>%3$s</strong> hours per week.', 'wporg' ),
get_the_title(),
sprintf(
_n( '<strong>%d</strong> contributor', '<strong>%d</strong> contributors', $contribution_data['contributors'], 'wporg' ),
number_format_i18n( absint( $contribution_data['contributors'] ) )
),
number_format_i18n( absint( $contribution_data['hours'] ) )
);
) );
?>
</p>
<p>
<?php
printf(
wp_kses_post( __( 'Contributors from %s work on the following teams:', 'wporg' ) ),
echo wp_kses_post( sprintf(
__( 'Contributors from %s work on the following teams:', 'wporg' ),
get_the_title()
);
) );
?>
</p>
<ul class="team-grid">
@ -89,7 +89,7 @@ get_header(); ?>
'<a href="%1$s">%2$s</a>',
sprintf(
'https://profiles.wordpress.org/%s/',
sanitize_key( $contributor->user_login )
sanitize_key( $contributor->user_login ) // phpcs:ignore WordPress.Security.EscapeOutput -- sanitize_key will catch any security issues.
),
esc_html( $contributor->display_name )
);