Make WordPress Core


Ignore:
Timestamp:
08/17/2018 01:50:26 AM (6 years 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-admin/user-new.php

    r42761 r43571  
    8080                        'update'  => 'addnoconfirmation',
    8181                        'user_id' => $user_id,
    82                     ), 'user-new.php'
     82                    ),
     83                    'user-new.php'
    8384                );
    8485            } else {
     
    8889            $newuser_key = wp_generate_password( 20, false );
    8990            add_option(
    90                 'new_user_' . $newuser_key, array(
     91                'new_user_' . $newuser_key,
     92                array(
    9193                    'user_id' => $user_id,
    9294                    'email'   => $user_details->user_email,
     
    177179            }
    178180            wpmu_signup_user(
    179                 $new_user_login, $new_user_email, array(
     181                $new_user_login,
     182                $new_user_email,
     183                array(
    180184                    'add_to_blog' => get_current_blog_id(),
    181185                    'new_role'    => $_REQUEST['role'],
     
    194198                            'update'  => 'addnoconfirmation',
    195199                            'user_id' => $new_user['user_id'],
    196                         ), 'user-new.php'
     200                        ),
     201                        'user-new.php'
    197202                    );
    198203                }
     
    344349        </ul>
    345350    </div>
    346 <?php
     351    <?php
    347352endif;
    348353
     
    379384        $type  = 'text';
    380385    }
    381 ?>
     386    ?>
    382387<form method="post" name="adduser" id="adduser" class="validate" novalidate="novalidate"
    383 <?php
     388    <?php
    384389    /**
    385390     * Fires inside the adduser form tag.
     
    388393     */
    389394    do_action( 'user_new_form_tag' );
    390 ?>
     395    ?>
    391396>
    392397<input name="action" type="hidden" value="adduser" />
    393 <?php wp_nonce_field( 'add-user', '_wpnonce_add-user' ); ?>
     398    <?php wp_nonce_field( 'add-user', '_wpnonce_add-user' ); ?>
    394399
    395400<table class="form-table">
     
    405410        </td>
    406411    </tr>
    407 <?php if ( current_user_can( 'manage_network_users' ) ) { ?>
     412    <?php if ( current_user_can( 'manage_network_users' ) ) { ?>
    408413    <tr>
    409414        <th scope="row"><?php _e( 'Skip Confirmation Email' ); ?></th>
     
    415420<?php } ?>
    416421</table>
    417 <?php
    418 /**
    419  * Fires at the end of the new user form.
    420  *
    421  * Passes a contextual string to make both types of new user forms
    422  * uniquely targetable. Contexts are 'add-existing-user' (Multisite),
    423  * and 'add-new-user' (single site and network admin).
    424  *
    425  * @since 3.7.0
    426  *
    427  * @param string $type A contextual string specifying which type of new user form the hook follows.
    428  */
    429 do_action( 'user_new_form', 'add-existing-user' );
    430 ?>
    431 <?php submit_button( __( 'Add Existing User' ), 'primary', 'adduser', true, array( 'id' => 'addusersub' ) ); ?>
     422    <?php
     423    /**
     424    * Fires at the end of the new user form.
     425    *
     426    * Passes a contextual string to make both types of new user forms
     427    * uniquely targetable. Contexts are 'add-existing-user' (Multisite),
     428    * and 'add-new-user' (single site and network admin).
     429    *
     430    * @since 3.7.0
     431    *
     432    * @param string $type A contextual string specifying which type of new user form the hook follows.
     433    */
     434    do_action( 'user_new_form', 'add-existing-user' );
     435    ?>
     436    <?php submit_button( __( 'Add Existing User' ), 'primary', 'adduser', true, array( 'id' => 'addusersub' ) ); ?>
    432437</form>
    433 <?php
     438    <?php
    434439} // is_multisite()
    435440
     
    438443        echo '<h2 id="create-new-user">' . __( 'Add New User' ) . '</h2>';
    439444    }
    440 ?>
     445    ?>
    441446<p><?php _e( 'Create a brand new user and add them to this site.' ); ?></p>
    442447<form method="post" name="createuser" id="createuser" class="validate" novalidate="novalidate"
    443 <?php
     448    <?php
    444449    /** This action is documented in wp-admin/user-new.php */
    445450    do_action( 'user_new_form_tag' );
    446 ?>
     451    ?>
    447452>
    448453<input name="action" type="hidden" value="createuser" />
    449 <?php wp_nonce_field( 'create-user', '_wpnonce_create-user' ); ?>
    450 <?php
    451 // Load up the passed data, else set to a default.
    452 $creating = isset( $_POST['createuser'] );
    453 
    454 $new_user_login             = $creating && isset( $_POST['user_login'] ) ? wp_unslash( $_POST['user_login'] ) : '';
    455 $new_user_firstname         = $creating && isset( $_POST['first_name'] ) ? wp_unslash( $_POST['first_name'] ) : '';
    456 $new_user_lastname          = $creating && isset( $_POST['last_name'] ) ? wp_unslash( $_POST['last_name'] ) : '';
    457 $new_user_email             = $creating && isset( $_POST['email'] ) ? wp_unslash( $_POST['email'] ) : '';
    458 $new_user_uri               = $creating && isset( $_POST['url'] ) ? wp_unslash( $_POST['url'] ) : '';
    459 $new_user_role              = $creating && isset( $_POST['role'] ) ? wp_unslash( $_POST['role'] ) : '';
    460 $new_user_send_notification = $creating && ! isset( $_POST['send_user_notification'] ) ? false : true;
    461 $new_user_ignore_pass       = $creating && isset( $_POST['noconfirmation'] ) ? wp_unslash( $_POST['noconfirmation'] ) : '';
    462 
    463 ?>
     454    <?php wp_nonce_field( 'create-user', '_wpnonce_create-user' ); ?>
     455    <?php
     456    // Load up the passed data, else set to a default.
     457    $creating = isset( $_POST['createuser'] );
     458
     459    $new_user_login             = $creating && isset( $_POST['user_login'] ) ? wp_unslash( $_POST['user_login'] ) : '';
     460    $new_user_firstname         = $creating && isset( $_POST['first_name'] ) ? wp_unslash( $_POST['first_name'] ) : '';
     461    $new_user_lastname          = $creating && isset( $_POST['last_name'] ) ? wp_unslash( $_POST['last_name'] ) : '';
     462    $new_user_email             = $creating && isset( $_POST['email'] ) ? wp_unslash( $_POST['email'] ) : '';
     463    $new_user_uri               = $creating && isset( $_POST['url'] ) ? wp_unslash( $_POST['url'] ) : '';
     464    $new_user_role              = $creating && isset( $_POST['role'] ) ? wp_unslash( $_POST['role'] ) : '';
     465    $new_user_send_notification = $creating && ! isset( $_POST['send_user_notification'] ) ? false : true;
     466    $new_user_ignore_pass       = $creating && isset( $_POST['noconfirmation'] ) ? wp_unslash( $_POST['noconfirmation'] ) : '';
     467
     468    ?>
    464469<table class="form-table">
    465470    <tr class="form-field form-required">
     
    471476        <td><input name="email" type="email" id="email" value="<?php echo esc_attr( $new_user_email ); ?>" /></td>
    472477    </tr>
    473 <?php if ( ! is_multisite() ) { ?>
     478    <?php if ( ! is_multisite() ) { ?>
    474479    <tr class="form-field">
    475480        <th scope="row"><label for="first_name"><?php _e( 'First Name' ); ?> </label></th>
     
    556561</table>
    557562
    558 <?php
    559 /** This action is documented in wp-admin/user-new.php */
    560 do_action( 'user_new_form', 'add-new-user' );
    561 ?>
    562 
    563 <?php submit_button( __( 'Add New User' ), 'primary', 'createuser', true, array( 'id' => 'createusersub' ) ); ?>
     563    <?php
     564    /** This action is documented in wp-admin/user-new.php */
     565    do_action( 'user_new_form', 'add-new-user' );
     566    ?>
     567
     568    <?php submit_button( __( 'Add New User' ), 'primary', 'createuser', true, array( 'id' => 'createusersub' ) ); ?>
    564569
    565570</form>
Note: See TracChangeset for help on using the changeset viewer.