WordPress.org

Make WordPress Core


Ignore:
Timestamp:
08/17/2018 01:50:26 AM (13 months ago)
Author:
pento
Message:

Coding Standards: Upgrade WPCS to 1.0.0

WPCS 1.0.0 includes a bunch of new auto-fixers, which drops the number of coding standards issues across WordPress significantly. Prior to running the auto-fixers, there were 15,312 issues detected. With this commit, we now drop to 4,769 issues.

This change includes three notable additions:

  • Multiline function calls must now put each parameter on a new line.
  • Auto-formatting files is now part of the grunt precommit script.
  • Auto-fixable coding standards issues will now cause Travis failures.

Fixes #44600.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/user.php

    r43568 r43571  
    910910            INNER JOIN {$wpdb->users} ON user_id = ID
    911911            WHERE meta_key = '{$blog_prefix}capabilities'
    912         ", ARRAY_N
     912        ",
     913            ARRAY_N
    913914        );
    914915
     
    26072608        WHERE meta_key = '{$prefix}capabilities'
    26082609        AND meta_value NOT REGEXP %s
    2609     ", $regex
     2610    ",
     2611            $regex
    26102612        )
    26112613    );
     
    27082710        if ( ! is_email( $_POST['email'] ) ) {
    27092711            $errors->add(
    2710                 'user_email', __( '<strong>ERROR</strong>: The email address isn&#8217;t correct.' ), array(
     2712                'user_email',
     2713                __( '<strong>ERROR</strong>: The email address isn&#8217;t correct.' ),
     2714                array(
    27112715                    'form-field' => 'email',
    27122716                )
     
    27182722        if ( $wpdb->get_var( $wpdb->prepare( "SELECT user_email FROM {$wpdb->users} WHERE user_email=%s", $_POST['email'] ) ) ) {
    27192723            $errors->add(
    2720                 'user_email', __( '<strong>ERROR</strong>: The email address is already used.' ), array(
     2724                'user_email',
     2725                __( '<strong>ERROR</strong>: The email address is already used.' ),
     2726                array(
    27212727                    'form-field' => 'email',
    27222728                )
     
    29412947
    29422948    update_post_meta( $request_id, '_wp_user_request_confirmed_timestamp', time() );
    2943     wp_update_post( array(
    2944         'ID'          => $request_id,
    2945         'post_status' => 'request-confirmed',
    2946     ) );
     2949    wp_update_post(
     2950        array(
     2951            'ID'          => $request_id,
     2952            'post_status' => 'request-confirmed',
     2953        )
     2954    );
    29472955}
    29482956
     
    31273135    );
    31283136
    3129     $subject  = sprintf(
     3137    $subject = sprintf(
    31303138        /* translators: %s: Site name. */
    31313139        __( '[%s] Erasure Request Fulfilled' ),
     
    32363244    $request = wp_get_user_request_data( $request_id );
    32373245
    3238     $message = '<p class="success">' . __( 'Action has been confirmed.' ) . '</p>';
     3246    $message  = '<p class="success">' . __( 'Action has been confirmed.' ) . '</p>';
    32393247    $message .= '<p>' . __( 'The site administrator has been notified and will fulfill your request as soon as possible.' ) . '</p>';
    32403248
    32413249    if ( $request && in_array( $request->action_name, _wp_privacy_action_request_types(), true ) ) {
    32423250        if ( 'export_personal_data' === $request->action_name ) {
    3243             $message = '<p class="success">' . __( 'Thanks for confirming your export request.' ) . '</p>';
     3251            $message  = '<p class="success">' . __( 'Thanks for confirming your export request.' ) . '</p>';
    32443252            $message .= '<p>' . __( 'The site administrator has been notified. You will receive a link to download your export via email when they fulfill your request.' ) . '</p>';
    32453253        } elseif ( 'remove_personal_data' === $request->action_name ) {
    3246             $message = '<p class="success">' . __( 'Thanks for confirming your erasure request.' ) . '</p>';
     3254            $message  = '<p class="success">' . __( 'Thanks for confirming your erasure request.' ) . '</p>';
    32473255            $message .= '<p>' . __( 'The site administrator has been notified. You will receive an email confirmation when they erase your data.' ) . '</p>';
    32483256        }
     
    32913299
    32923300    // Check for duplicates.
    3293     $requests_query = new WP_Query( array(
    3294         'post_type'     => 'user_request',
    3295         'post_name__in' => array( $action_name ),  // Action name stored in post_name column.
    3296         'title'         => $email_address, // Email address stored in post_title column.
    3297         'post_status'   => 'any',
    3298         'fields'        => 'ids',
    3299     ) );
     3301    $requests_query = new WP_Query(
     3302        array(
     3303            'post_type'     => 'user_request',
     3304            'post_name__in' => array( $action_name ),  // Action name stored in post_name column.
     3305            'title'         => $email_address, // Email address stored in post_title column.
     3306            'post_status'   => 'any',
     3307            'fields'        => 'ids',
     3308        )
     3309    );
    33003310
    33013311    if ( $requests_query->found_posts ) {
     
    33033313    }
    33043314
    3305     $request_id = wp_insert_post( array(
    3306         'post_author'   => $user_id,
    3307         'post_name'     => $action_name,
    3308         'post_title'    => $email_address,
    3309         'post_content'  => wp_json_encode( $request_data ),
    3310         'post_status'   => 'request-pending',
    3311         'post_type'     => 'user_request',
    3312         'post_date'     => current_time( 'mysql', false ),
    3313         'post_date_gmt' => current_time( 'mysql', true ),
    3314     ), true );
     3315    $request_id = wp_insert_post(
     3316        array(
     3317            'post_author'   => $user_id,
     3318            'post_name'     => $action_name,
     3319            'post_title'    => $email_address,
     3320            'post_content'  => wp_json_encode( $request_data ),
     3321            'post_status'   => 'request-pending',
     3322            'post_type'     => 'user_request',
     3323            'post_date'     => current_time( 'mysql', false ),
     3324            'post_date_gmt' => current_time( 'mysql', true ),
     3325        ),
     3326        true
     3327    );
    33153328
    33163329    return $request_id;
     
    33813394        'email'       => $request->email,
    33823395        'description' => wp_user_request_action_description( $request->action_name ),
    3383         'confirm_url' => add_query_arg( array(
    3384             'action'      => 'confirmaction',
    3385             'request_id'  => $request_id,
    3386             'confirm_key' => wp_generate_user_request_key( $request_id ),
    3387         ), wp_login_url() ),
     3396        'confirm_url' => add_query_arg(
     3397            array(
     3398                'action'      => 'confirmaction',
     3399                'request_id'  => $request_id,
     3400                'confirm_key' => wp_generate_user_request_key( $request_id ),
     3401            ),
     3402            wp_login_url()
     3403        ),
    33883404        'sitename'    => wp_specialchars_decode( get_option( 'blogname' ), ENT_QUOTES ),
    33893405        'siteurl'     => home_url(),
     
    34973513    }
    34983514
    3499     wp_update_post( array(
    3500         'ID'                => $request_id,
    3501         'post_status'       => 'request-pending',
    3502         'post_password'     => $wp_hasher->HashPassword( $key ),
    3503         'post_modified'     => current_time( 'mysql', false ),
    3504         'post_modified_gmt' => current_time( 'mysql', true ),
    3505     ) );
     3515    wp_update_post(
     3516        array(
     3517            'ID'                => $request_id,
     3518            'post_status'       => 'request-pending',
     3519            'post_password'     => $wp_hasher->HashPassword( $key ),
     3520            'post_modified'     => current_time( 'mysql', false ),
     3521            'post_modified_gmt' => current_time( 'mysql', true ),
     3522        )
     3523    );
    35063524
    35073525    return $key;
Note: See TracChangeset for help on using the changeset viewer.