Make WordPress Core

Ticket #43405: 43405.2.diff

File 43405.2.diff, 8.1 KB (added by netweb, 7 years ago)
  • src/wp-signup.php

     
    110110                echo '<label for="blogname">' . __( 'Site Domain:' ) . '</label>';
    111111        }
    112112
    113         if ( $errmsg = $errors->get_error_message( 'blogname' ) ) {
    114         ?>
     113        $errmsg = $errors->get_error_message( 'blogname' );
     114        if ( $errmsg ) {
     115                ?>
    115116                <p class="error"><?php echo $errmsg; ?></p>
    116         <?php
     117                <?php
    117118        }
    118119
    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' ) ) { ?>
    140                 <p class="error"><?php echo $errmsg; ?></p>
    141141        <?php
    142 }
     142        $errmsg = $errors->get_error_message( 'blog_title' );
     143        if ( $errmsg ) {
     144                ?>
     145                <p class="error"><?php echo $errmsg; ?></p>
     146                <?php
     147        }
    143148        echo '<input name="blog_title" type="text" id="blog_title" value="' . esc_attr( $blog_title ) . '" />';
    144149        ?>
    145150
     
    175180                        );
    176181                        ?>
    177182                </p>
    178         <?php
     183                <?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        /**
     
    323334        $blog_title = $filtered_results['blog_title'];
    324335        $errors     = $filtered_results['errors'];
    325336
     337        /* translators: %s: site name */
    326338        echo '<h2>' . sprintf( __( 'Get <em>another</em> %s site in seconds' ), get_network()->site_name ) . '</h2>';
    327339
    328340        if ( $errors->has_errors() ) {
    329341                echo '<p>' . __( 'There was a problem, please correct the form below and try again.' ) . '</p>';
    330342        }
    331343        ?>
    332         <p><?php 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 ); ?></p>
     344        <p>
     345                <?php
     346                printf(
     347                        /* translators: %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                );
     351                ?>
     352        </p>
    333353
    334354        <?php
    335355        $blogs = get_blogs_of_user( $current_user->ID );
    336356        if ( ! empty( $blogs ) ) {
    337         ?>
     357                ?>
    338358
    339359                        <p><?php _e( 'Sites you are already a member of:' ); ?></p>
    340360                        <ul>
     
    581601                <?php show_user_form( $user_name, $user_email, $errors ); ?>
    582602
    583603                <p>
    584                 <?php if ( $active_signup == 'blog' ) { ?>
     604                <?php if ( 'blog' === $active_signup ) { ?>
    585605                        <input id="signupblog" type="hidden" name="signup_for" value="blog" />
    586                 <?php } elseif ( $active_signup == 'user' ) { ?>
     606                <?php } elseif ( 'user' === $active_signup ) { ?>
    587607                        <input id="signupblog" type="hidden" name="signup_for" value="user" />
    588608                <?php } else { ?>
    589609                        <input id="signupblog" type="radio" name="signup_for" value="blog" <?php checked( $signup_for, 'blog' ); ?> />
     
    906926$newblogname = isset( $_GET['new'] ) ? strtolower( preg_replace( '/^-|-$|[^-a-zA-Z0-9]/', '', $_GET['new'] ) ) : null;
    907927
    908928$current_user = wp_get_current_user();
    909 if ( $active_signup == 'none' ) {
     929if ( 'none' === $active_signup ) {
    910930        _e( 'Registration has been disabled.' );
    911 } elseif ( $active_signup == 'blog' && ! is_user_logged_in() ) {
     931} elseif ( 'blog' === $active_signup && ! is_user_logged_in() ) {
    912932        $login_url = wp_login_url( network_site_url( 'wp-signup.php' ) );
    913933        /* translators: %s: login URL */
    914934        printf( __( 'You must first <a href="%s">log in</a>, and then you can create a new site.' ), $login_url );
     
    916936        $stage = isset( $_POST['stage'] ) ? $_POST['stage'] : 'default';
    917937        switch ( $stage ) {
    918938                case 'validate-user-signup':
    919                         if ( $active_signup == 'all' || $_POST['signup_for'] == 'blog' && $active_signup == 'blog' || $_POST['signup_for'] == 'user' && $active_signup == 'user' ) {
     939                        if ( 'all' === $active_signup || 'blog' === $_POST['signup_for'] && 'blog' === $active_signup ||
     940                                'user' === $_POST['signup_for'] && 'user' === $active_signup ) {
    920941                                validate_user_signup();
    921942                        } else {
    922943                                _e( 'User registration has been disabled.' );
    923944                        }
    924945                        break;
    925946                case 'validate-blog-signup':
    926                         if ( $active_signup == 'all' || $active_signup == 'blog' ) {
     947                        if ( 'all' === $active_signup || 'blog' === $active_signup ) {
    927948                                validate_blog_signup();
    928949                        } else {
    929950                                _e( 'Site registration has been disabled.' );
     
    941962                         * @since 3.0.0
    942963                         */
    943964                        do_action( 'preprocess_signup_form' );
    944                         if ( is_user_logged_in() && ( $active_signup == 'all' || $active_signup == 'blog' ) ) {
     965                        if ( is_user_logged_in() && ( 'all' === $active_signup || 'blog' === $active_signup ) ) {
    945966                                signup_another_blog( $newblogname );
    946                         } elseif ( ! is_user_logged_in() && ( $active_signup == 'all' || $active_signup == 'user' ) ) {
     967                        } elseif ( ! is_user_logged_in() && ( 'all' === $active_signup || 'user' === $active_signup ) ) {
    947968                                signup_user( $newblogname, $user_email );
    948                         } elseif ( ! is_user_logged_in() && ( $active_signup == 'blog' ) ) {
     969                        } elseif ( ! is_user_logged_in() && ( 'blog' === $active_signup ) ) {
    949970                                _e( 'Sorry, new registrations are not allowed at this time.' );
    950971                        } else {
    951972                                _e( 'You are logged in already. No need to register again!' );
     
    954975                        if ( $newblogname ) {
    955976                                $newblog = get_blogaddress_by_name( $newblogname );
    956977
    957                                 if ( $active_signup == 'blog' || $active_signup == 'all' ) {
    958                                         /* translators: %s: site address */
     978                                if ( 'blog' === $active_signup || 'all' === $active_signup ) {
    959979                                        printf(
     980                                                /* translators: %s: site address */
    960981                                                '<p><em>' . __( 'The site you were looking for, %s, does not exist, but you can create it now!' ) . '</em></p>',
    961982                                                '<strong>' . $newblog . '</strong>'
    962983                                        );
    963                                 } else {                  /* translators: %s: site address */
     984                                } else {
    964985                                        printf(
     986                                                /* translators: %s: site address*/
    965987                                                '<p><em>' . __( 'The site you were looking for, %s, does not exist.' ) . '</em></p>',
    966988                                                '<strong>' . $newblog . '</strong>'
    967989                                        );