Make WordPress Core

Ticket #43405: 43405.4.diff

File 43405.4.diff, 7.3 KB (added by desrosj, 6 years ago)
  • src/wp-signup.php

     
    103103        }
    104104
    105105        $current_network = get_network();
    106         // Blog name
     106        // Blog name.
    107107        if ( ! is_subdomain_install() ) {
    108108                echo '<label for="blogname">' . __( 'Site Name:' ) . '</label>';
    109109        } else {
     
    110110                echo '<label for="blogname">' . __( 'Site Domain:' ) . '</label>';
    111111        }
    112112
    113         if ( $errmsg = $errors->get_error_message( 'blogname' ) ) {
     113        $errmsg = $errors->get_error_message( 'blogname' );
     114        if ( $errmsg ) {
    114115                ?>
    115116                <p class="error"><?php echo $errmsg; ?></p>
    116117                <?php
     
    119120        if ( ! is_subdomain_install() ) {
    120121                echo '<span class="prefix_address">' . $current_network->domain . $current_network->path . '</span><input name="blogname" type="text" id="blogname" value="' . esc_attr( $blogname ) . '" maxlength="60" /><br />';
    121122        } else {
    122                 echo '<input name="blogname" type="text" id="blogname" value="' . esc_attr( $blogname ) . '" maxlength="60" /><span class="suffix_address">.' . ( $site_domain = preg_replace( '|^www\.|', '', $current_network->domain ) ) . '</span><br />';
     123                $site_domain = preg_replace( '|^www\.|', '', $current_network->domain );
     124                echo '<input name="blogname" type="text" id="blogname" value="' . esc_attr( $blogname ) . '" maxlength="60" /><span class="suffix_address">.' . esc_html( $site_domain ) . '</span><br />';
    123125        }
    124126
    125127        if ( ! is_user_logged_in() ) {
     
    136138        // Blog Title
    137139        ?>
    138140        <label for="blog_title"><?php _e( 'Site Title:' ); ?></label>
    139         <?php if ( $errmsg = $errors->get_error_message( 'blog_title' ) ) { ?>
     141        <?php
     142        $errmsg = $errors->get_error_message( 'blog_title' );
     143        if ( $errmsg ) {
     144                ?>
    140145                <p class="error"><?php echo $errmsg; ?></p>
    141146                <?php
    142147        }
     
    178183                <?php
    179184                endif; // Languages.
    180185
    181                 $blog_public_on_checked = $blog_public_off_checked = '';
     186                $blog_public_on_checked  = '';
     187                $blog_public_off_checked = '';
    182188        if ( isset( $_POST['blog_public'] ) && '0' == $_POST['blog_public'] ) {
    183189                $blog_public_off_checked = 'checked="checked"';
    184190        } else {
     
    245251
    246252        // User name
    247253        echo '<label for="user_name">' . __( 'Username:' ) . '</label>';
    248         if ( $errmsg = $errors->get_error_message( 'user_name' ) ) {
     254        $errmsg = $errors->get_error_message( 'user_name' );
     255        if ( $errmsg ) {
    249256                echo '<p class="error">' . $errmsg . '</p>';
    250257        }
    251258        echo '<input name="user_name" type="text" id="user_name" value="' . esc_attr( $user_name ) . '" autocapitalize="none" autocorrect="off" maxlength="60" /><br />';
     
    253260        ?>
    254261
    255262        <label for="user_email"><?php _e( 'Email&nbsp;Address:' ); ?></label>
    256         <?php if ( $errmsg = $errors->get_error_message( 'user_email' ) ) { ?>
     263        <?php
     264        $errmsg = $errors->get_error_message( 'user_email' );
     265        if ( $errmsg ) {
     266                ?>
    257267                <p class="error"><?php echo $errmsg; ?></p>
    258268        <?php } ?>
    259269        <input name="user_email" type="email" id="user_email" value="<?php echo esc_attr( $user_email ); ?>" maxlength="200" /><br /><?php _e( 'We send your registration email to this address. (Double-check your email address before continuing.)' ); ?>
    260270        <?php
    261         if ( $errmsg = $errors->get_error_message( 'generic' ) ) {
     271        $errmsg = $errors->get_error_message( 'generic' );
     272        if ( $errmsg ) {
    262273                echo '<p class="error">' . $errmsg . '</p>';
    263274        }
    264275        /**
     
    332343        ?>
    333344        <p>
    334345                <?php
    335                 /* translators: %s: Current user's display name. */
    336                 printf( __( 'Welcome back, %s. By filling out the form below, you can <strong>add another site to your account</strong>. There is no limit to the number of sites you can have, so create to your heart&#8217;s content, but write responsibly!' ), $current_user->display_name );
     346                printf(
     347                        /* translators: %s: Current user's display name. */
     348                        __( 'Welcome back, %s. By filling out the form below, you can <strong>add another site to your account</strong>. There is no limit to the number of sites you can have, so create to your heart&#8217;s content, but write responsibly!' ),
     349                        $current_user->display_name
     350                );
    337351                ?>
    338352        </p>
    339353
     
    587601                <?php show_user_form( $user_name, $user_email, $errors ); ?>
    588602
    589603                <p>
    590                 <?php if ( $active_signup == 'blog' ) { ?>
     604                <?php if ( 'blog' === $active_signup ) { ?>
    591605                        <input id="signupblog" type="hidden" name="signup_for" value="blog" />
    592                 <?php } elseif ( $active_signup == 'user' ) { ?>
     606                <?php } elseif ( 'user' === $active_signup ) { ?>
    593607                        <input id="signupblog" type="hidden" name="signup_for" value="user" />
    594608                <?php } else { ?>
    595609                        <input id="signupblog" type="radio" name="signup_for" value="blog" <?php checked( $signup_for, 'blog' ); ?> />
     
    912926$newblogname = isset( $_GET['new'] ) ? strtolower( preg_replace( '/^-|-$|[^-a-zA-Z0-9]/', '', $_GET['new'] ) ) : null;
    913927
    914928$current_user = wp_get_current_user();
    915 if ( $active_signup == 'none' ) {
     929if ( 'none' === $active_signup ) {
    916930        _e( 'Registration has been disabled.' );
    917 } elseif ( $active_signup == 'blog' && ! is_user_logged_in() ) {
     931} elseif ( 'blog' === $active_signup && ! is_user_logged_in() ) {
    918932        $login_url = wp_login_url( network_site_url( 'wp-signup.php' ) );
    919933        /* translators: %s: login URL */
    920934        printf( __( 'You must first <a href="%s">log in</a>, and then you can create a new site.' ), $login_url );
     
    922936        $stage = isset( $_POST['stage'] ) ? $_POST['stage'] : 'default';
    923937        switch ( $stage ) {
    924938                case 'validate-user-signup':
    925                         if ( $active_signup == 'all' || $_POST['signup_for'] == 'blog' && $active_signup == 'blog' || $_POST['signup_for'] == 'user' && $active_signup == 'user' ) {
     939                        if ( 'all' === $active_signup
     940                                || ( 'blog' === $_POST['signup_for'] && 'blog' === $active_signup )
     941                                || ( 'user' === $_POST['signup_for'] && 'user' === $active_signup )
     942                        ) {
    926943                                validate_user_signup();
    927944                        } else {
    928945                                _e( 'User registration has been disabled.' );
     
    929946                        }
    930947                        break;
    931948                case 'validate-blog-signup':
    932                         if ( $active_signup == 'all' || $active_signup == 'blog' ) {
     949                        if ( 'all' === $active_signup || 'blog' === $active_signup ) {
    933950                                validate_blog_signup();
    934951                        } else {
    935952                                _e( 'Site registration has been disabled.' );
     
    947964                         * @since 3.0.0
    948965                         */
    949966                        do_action( 'preprocess_signup_form' );
    950                         if ( is_user_logged_in() && ( $active_signup == 'all' || $active_signup == 'blog' ) ) {
     967                        if ( is_user_logged_in() && ( 'all' === $active_signup || 'blog' === $active_signup ) ) {
    951968                                signup_another_blog( $newblogname );
    952                         } elseif ( ! is_user_logged_in() && ( $active_signup == 'all' || $active_signup == 'user' ) ) {
     969                        } elseif ( ! is_user_logged_in() && ( 'all' === $active_signup || 'user' === $active_signup ) ) {
    953970                                signup_user( $newblogname, $user_email );
    954                         } elseif ( ! is_user_logged_in() && ( $active_signup == 'blog' ) ) {
     971                        } elseif ( ! is_user_logged_in() && ( 'blog' === $active_signup ) ) {
    955972                                _e( 'Sorry, new registrations are not allowed at this time.' );
    956973                        } else {
    957974                                _e( 'You are logged in already. No need to register again!' );
     
    960977                        if ( $newblogname ) {
    961978                                $newblog = get_blogaddress_by_name( $newblogname );
    962979
    963                                 if ( $active_signup == 'blog' || $active_signup == 'all' ) {
     980                                if ( 'blog' === $active_signup || 'all' === $active_signup ) {
    964981                                        printf(
    965982                                                /* translators: %s: site address */
    966983                                                '<p><em>' . __( 'The site you were looking for, %s, does not exist, but you can create it now!' ) . '</em></p>',