From 601d13a6571bf6f535b32c32ce7f2ead99913902 Mon Sep 17 00:00:00 2001 From: desrosj Date: Wed, 16 Jan 2019 16:51:52 +0000 Subject: [PATCH] Coding Standards: Manually fix coding standards violations in `wp-signup.php`. Props GaryJ, jrf, netweb, desrosj. Fixes #43405. Built from https://develop.svn.wordpress.org/trunk@44626 git-svn-id: http://core.svn.wordpress.org/trunk@44457 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-includes/version.php | 2 +- wp-signup.php | 57 ++++++++++++++++++++++++++--------------- 2 files changed, 38 insertions(+), 21 deletions(-) diff --git a/wp-includes/version.php b/wp-includes/version.php index 1c2a84bb67..098883f6db 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -13,7 +13,7 @@ * * @global string $wp_version */ -$wp_version = '5.1-beta1-44625'; +$wp_version = '5.1-beta1-44626'; /** * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema. diff --git a/wp-signup.php b/wp-signup.php index 285eeac3f3..362b6bacae 100644 --- a/wp-signup.php +++ b/wp-signup.php @@ -103,14 +103,15 @@ function show_blog_form( $blogname = '', $blog_title = '', $errors = '' ) { } $current_network = get_network(); - // Blog name + // Blog name. if ( ! is_subdomain_install() ) { echo ''; } else { echo ''; } - if ( $errmsg = $errors->get_error_message( 'blogname' ) ) { + $errmsg = $errors->get_error_message( 'blogname' ); + if ( $errmsg ) { ?>

' . $current_network->domain . $current_network->path . '
'; } else { - echo '.' . ( $site_domain = preg_replace( '|^www\.|', '', $current_network->domain ) ) . '
'; + $site_domain = preg_replace( '|^www\.|', '', $current_network->domain ); + echo '.' . esc_html( $site_domain ) . '
'; } if ( ! is_user_logged_in() ) { @@ -136,7 +138,10 @@ function show_blog_form( $blogname = '', $blog_title = '', $errors = '' ) { // Blog Title ?> - get_error_message( 'blog_title' ) ) { ?> + get_error_message( 'blog_title' ); + if ( $errmsg ) { + ?>

' . __( 'Username:' ) . ''; - if ( $errmsg = $errors->get_error_message( 'user_name' ) ) { + $errmsg = $errors->get_error_message( 'user_name' ); + if ( $errmsg ) { echo '

' . $errmsg . '

'; } echo '
'; @@ -253,12 +260,16 @@ function show_user_form( $user_name = '', $user_email = '', $errors = '' ) { ?> - get_error_message( 'user_email' ) ) { ?> + get_error_message( 'user_email' ); + if ( $errmsg ) { + ?>


get_error_message( 'generic' ) ) { + $errmsg = $errors->get_error_message( 'generic' ); + if ( $errmsg ) { echo '

' . $errmsg . '

'; } /** @@ -332,8 +343,11 @@ function signup_another_blog( $blogname = '', $blog_title = '', $errors = '' ) { ?>

add another site to your account. There is no limit to the number of sites you can have, so create to your heart’s content, but write responsibly!' ), $current_user->display_name ); + printf( + /* translators: %s: Current user's display name. */ + __( 'Welcome back, %s. By filling out the form below, you can add another site to your account. There is no limit to the number of sites you can have, so create to your heart’s content, but write responsibly!' ), + $current_user->display_name + ); ?>

@@ -587,9 +601,9 @@ function signup_user( $user_name = '', $user_email = '', $errors = '' ) {

- + - + /> @@ -912,9 +926,9 @@ if ( current_user_can( 'manage_network' ) ) { $newblogname = isset( $_GET['new'] ) ? strtolower( preg_replace( '/^-|-$|[^-a-zA-Z0-9]/', '', $_GET['new'] ) ) : null; $current_user = wp_get_current_user(); -if ( $active_signup == 'none' ) { +if ( 'none' === $active_signup ) { _e( 'Registration has been disabled.' ); -} elseif ( $active_signup == 'blog' && ! is_user_logged_in() ) { +} elseif ( 'blog' === $active_signup && ! is_user_logged_in() ) { $login_url = wp_login_url( network_site_url( 'wp-signup.php' ) ); /* translators: %s: login URL */ printf( __( 'You must first log in, and then you can create a new site.' ), $login_url ); @@ -922,14 +936,17 @@ if ( $active_signup == 'none' ) { $stage = isset( $_POST['stage'] ) ? $_POST['stage'] : 'default'; switch ( $stage ) { case 'validate-user-signup': - if ( $active_signup == 'all' || $_POST['signup_for'] == 'blog' && $active_signup == 'blog' || $_POST['signup_for'] == 'user' && $active_signup == 'user' ) { + if ( 'all' === $active_signup + || ( 'blog' === $_POST['signup_for'] && 'blog' === $active_signup ) + || ( 'user' === $_POST['signup_for'] && 'user' === $active_signup ) + ) { validate_user_signup(); } else { _e( 'User registration has been disabled.' ); } break; case 'validate-blog-signup': - if ( $active_signup == 'all' || $active_signup == 'blog' ) { + if ( 'all' === $active_signup || 'blog' === $active_signup ) { validate_blog_signup(); } else { _e( 'Site registration has been disabled.' ); @@ -947,11 +964,11 @@ if ( $active_signup == 'none' ) { * @since 3.0.0 */ do_action( 'preprocess_signup_form' ); - if ( is_user_logged_in() && ( $active_signup == 'all' || $active_signup == 'blog' ) ) { + if ( is_user_logged_in() && ( 'all' === $active_signup || 'blog' === $active_signup ) ) { signup_another_blog( $newblogname ); - } elseif ( ! is_user_logged_in() && ( $active_signup == 'all' || $active_signup == 'user' ) ) { + } elseif ( ! is_user_logged_in() && ( 'all' === $active_signup || 'user' === $active_signup ) ) { signup_user( $newblogname, $user_email ); - } elseif ( ! is_user_logged_in() && ( $active_signup == 'blog' ) ) { + } elseif ( ! is_user_logged_in() && ( 'blog' === $active_signup ) ) { _e( 'Sorry, new registrations are not allowed at this time.' ); } else { _e( 'You are logged in already. No need to register again!' ); @@ -960,7 +977,7 @@ if ( $active_signup == 'none' ) { if ( $newblogname ) { $newblog = get_blogaddress_by_name( $newblogname ); - if ( $active_signup == 'blog' || $active_signup == 'all' ) { + if ( 'blog' === $active_signup || 'all' === $active_signup ) { printf( /* translators: %s: site address */ '

' . __( 'The site you were looking for, %s, does not exist, but you can create it now!' ) . '

',