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
This commit is contained in:
desrosj 2019-01-16 16:51:52 +00:00
parent 2e7e09d869
commit 601d13a657
2 changed files with 38 additions and 21 deletions

View File

@ -13,7 +13,7 @@
* *
* @global string $wp_version * @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. * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.

View File

@ -103,14 +103,15 @@ function show_blog_form( $blogname = '', $blog_title = '', $errors = '' ) {
} }
$current_network = get_network(); $current_network = get_network();
// Blog name // Blog name.
if ( ! is_subdomain_install() ) { if ( ! is_subdomain_install() ) {
echo '<label for="blogname">' . __( 'Site Name:' ) . '</label>'; echo '<label for="blogname">' . __( 'Site Name:' ) . '</label>';
} else { } else {
echo '<label for="blogname">' . __( 'Site Domain:' ) . '</label>'; echo '<label for="blogname">' . __( 'Site Domain:' ) . '</label>';
} }
if ( $errmsg = $errors->get_error_message( 'blogname' ) ) { $errmsg = $errors->get_error_message( 'blogname' );
if ( $errmsg ) {
?> ?>
<p class="error"><?php echo $errmsg; ?></p> <p class="error"><?php echo $errmsg; ?></p>
<?php <?php
@ -119,7 +120,8 @@ function show_blog_form( $blogname = '', $blog_title = '', $errors = '' ) {
if ( ! is_subdomain_install() ) { if ( ! is_subdomain_install() ) {
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 />'; 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 />';
} else { } else {
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 />'; $site_domain = preg_replace( '|^www\.|', '', $current_network->domain );
echo '<input name="blogname" type="text" id="blogname" value="' . esc_attr( $blogname ) . '" maxlength="60" /><span class="suffix_address">.' . esc_html( $site_domain ) . '</span><br />';
} }
if ( ! is_user_logged_in() ) { if ( ! is_user_logged_in() ) {
@ -136,7 +138,10 @@ function show_blog_form( $blogname = '', $blog_title = '', $errors = '' ) {
// Blog Title // Blog Title
?> ?>
<label for="blog_title"><?php _e( 'Site Title:' ); ?></label> <label for="blog_title"><?php _e( 'Site Title:' ); ?></label>
<?php if ( $errmsg = $errors->get_error_message( 'blog_title' ) ) { ?> <?php
$errmsg = $errors->get_error_message( 'blog_title' );
if ( $errmsg ) {
?>
<p class="error"><?php echo $errmsg; ?></p> <p class="error"><?php echo $errmsg; ?></p>
<?php <?php
} }
@ -178,7 +183,8 @@ function show_blog_form( $blogname = '', $blog_title = '', $errors = '' ) {
<?php <?php
endif; // Languages. endif; // Languages.
$blog_public_on_checked = $blog_public_off_checked = ''; $blog_public_on_checked = '';
$blog_public_off_checked = '';
if ( isset( $_POST['blog_public'] ) && '0' == $_POST['blog_public'] ) { if ( isset( $_POST['blog_public'] ) && '0' == $_POST['blog_public'] ) {
$blog_public_off_checked = 'checked="checked"'; $blog_public_off_checked = 'checked="checked"';
} else { } else {
@ -245,7 +251,8 @@ function show_user_form( $user_name = '', $user_email = '', $errors = '' ) {
// User name // User name
echo '<label for="user_name">' . __( 'Username:' ) . '</label>'; echo '<label for="user_name">' . __( 'Username:' ) . '</label>';
if ( $errmsg = $errors->get_error_message( 'user_name' ) ) { $errmsg = $errors->get_error_message( 'user_name' );
if ( $errmsg ) {
echo '<p class="error">' . $errmsg . '</p>'; echo '<p class="error">' . $errmsg . '</p>';
} }
echo '<input name="user_name" type="text" id="user_name" value="' . esc_attr( $user_name ) . '" autocapitalize="none" autocorrect="off" maxlength="60" /><br />'; echo '<input name="user_name" type="text" id="user_name" value="' . esc_attr( $user_name ) . '" autocapitalize="none" autocorrect="off" maxlength="60" /><br />';
@ -253,12 +260,16 @@ function show_user_form( $user_name = '', $user_email = '', $errors = '' ) {
?> ?>
<label for="user_email"><?php _e( 'Email&nbsp;Address:' ); ?></label> <label for="user_email"><?php _e( 'Email&nbsp;Address:' ); ?></label>
<?php if ( $errmsg = $errors->get_error_message( 'user_email' ) ) { ?> <?php
$errmsg = $errors->get_error_message( 'user_email' );
if ( $errmsg ) {
?>
<p class="error"><?php echo $errmsg; ?></p> <p class="error"><?php echo $errmsg; ?></p>
<?php } ?> <?php } ?>
<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.)' ); ?> <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.)' ); ?>
<?php <?php
if ( $errmsg = $errors->get_error_message( 'generic' ) ) { $errmsg = $errors->get_error_message( 'generic' );
if ( $errmsg ) {
echo '<p class="error">' . $errmsg . '</p>'; echo '<p class="error">' . $errmsg . '</p>';
} }
/** /**
@ -332,8 +343,11 @@ function signup_another_blog( $blogname = '', $blog_title = '', $errors = '' ) {
?> ?>
<p> <p>
<?php <?php
/* translators: %s: Current user's display name. */ printf(
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 ); /* translators: %s: Current user's display name. */
__( '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> </p>
@ -587,9 +601,9 @@ function signup_user( $user_name = '', $user_email = '', $errors = '' ) {
<?php show_user_form( $user_name, $user_email, $errors ); ?> <?php show_user_form( $user_name, $user_email, $errors ); ?>
<p> <p>
<?php if ( $active_signup == 'blog' ) { ?> <?php if ( 'blog' === $active_signup ) { ?>
<input id="signupblog" type="hidden" name="signup_for" value="blog" /> <input id="signupblog" type="hidden" name="signup_for" value="blog" />
<?php } elseif ( $active_signup == 'user' ) { ?> <?php } elseif ( 'user' === $active_signup ) { ?>
<input id="signupblog" type="hidden" name="signup_for" value="user" /> <input id="signupblog" type="hidden" name="signup_for" value="user" />
<?php } else { ?> <?php } else { ?>
<input id="signupblog" type="radio" name="signup_for" value="blog" <?php checked( $signup_for, 'blog' ); ?> /> <input id="signupblog" type="radio" name="signup_for" value="blog" <?php checked( $signup_for, 'blog' ); ?> />
@ -912,9 +926,9 @@ if ( current_user_can( 'manage_network' ) ) {
$newblogname = isset( $_GET['new'] ) ? strtolower( preg_replace( '/^-|-$|[^-a-zA-Z0-9]/', '', $_GET['new'] ) ) : null; $newblogname = isset( $_GET['new'] ) ? strtolower( preg_replace( '/^-|-$|[^-a-zA-Z0-9]/', '', $_GET['new'] ) ) : null;
$current_user = wp_get_current_user(); $current_user = wp_get_current_user();
if ( $active_signup == 'none' ) { if ( 'none' === $active_signup ) {
_e( 'Registration has been disabled.' ); _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' ) ); $login_url = wp_login_url( network_site_url( 'wp-signup.php' ) );
/* translators: %s: login URL */ /* translators: %s: login URL */
printf( __( 'You must first <a href="%s">log in</a>, and then you can create a new site.' ), $login_url ); printf( __( 'You must first <a href="%s">log in</a>, 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'; $stage = isset( $_POST['stage'] ) ? $_POST['stage'] : 'default';
switch ( $stage ) { switch ( $stage ) {
case 'validate-user-signup': 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(); validate_user_signup();
} else { } else {
_e( 'User registration has been disabled.' ); _e( 'User registration has been disabled.' );
} }
break; break;
case 'validate-blog-signup': case 'validate-blog-signup':
if ( $active_signup == 'all' || $active_signup == 'blog' ) { if ( 'all' === $active_signup || 'blog' === $active_signup ) {
validate_blog_signup(); validate_blog_signup();
} else { } else {
_e( 'Site registration has been disabled.' ); _e( 'Site registration has been disabled.' );
@ -947,11 +964,11 @@ if ( $active_signup == 'none' ) {
* @since 3.0.0 * @since 3.0.0
*/ */
do_action( 'preprocess_signup_form' ); 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 ); 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 ); 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.' ); _e( 'Sorry, new registrations are not allowed at this time.' );
} else { } else {
_e( 'You are logged in already. No need to register again!' ); _e( 'You are logged in already. No need to register again!' );
@ -960,7 +977,7 @@ if ( $active_signup == 'none' ) {
if ( $newblogname ) { if ( $newblogname ) {
$newblog = get_blogaddress_by_name( $newblogname ); $newblog = get_blogaddress_by_name( $newblogname );
if ( $active_signup == 'blog' || $active_signup == 'all' ) { if ( 'blog' === $active_signup || 'all' === $active_signup ) {
printf( printf(
/* translators: %s: site address */ /* translators: %s: site address */
'<p><em>' . __( 'The site you were looking for, %s, does not exist, but you can create it now!' ) . '</em></p>', '<p><em>' . __( 'The site you were looking for, %s, does not exist, but you can create it now!' ) . '</em></p>',