Ticket #43405: 43405.2.diff
File 43405.2.diff, 8.1 KB (added by , 7 years ago) |
---|
-
src/wp-signup.php
110 110 echo '<label for="blogname">' . __( 'Site Domain:' ) . '</label>'; 111 111 } 112 112 113 if ( $errmsg = $errors->get_error_message( 'blogname' ) ) { 114 ?> 113 $errmsg = $errors->get_error_message( 'blogname' ); 114 if ( $errmsg ) { 115 ?> 115 116 <p class="error"><?php echo $errmsg; ?></p> 116 <?php117 <?php 117 118 } 118 119 119 120 if ( ! is_subdomain_install() ) { 120 121 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 />'; 121 122 } 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 />'; 123 125 } 124 126 125 127 if ( ! is_user_logged_in() ) { … … 136 138 // Blog Title 137 139 ?> 138 140 <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>141 141 <?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 } 143 148 echo '<input name="blog_title" type="text" id="blog_title" value="' . esc_attr( $blog_title ) . '" />'; 144 149 ?> 145 150 … … 175 180 ); 176 181 ?> 177 182 </p> 178 <?php183 <?php 179 184 endif; // Languages. 180 185 181 $blog_public_on_checked = $blog_public_off_checked = ''; 186 $blog_public_on_checked = ''; 187 $blog_public_off_checked = ''; 182 188 if ( isset( $_POST['blog_public'] ) && '0' == $_POST['blog_public'] ) { 183 189 $blog_public_off_checked = 'checked="checked"'; 184 190 } else { … … 245 251 246 252 // User name 247 253 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 ) { 249 256 echo '<p class="error">' . $errmsg . '</p>'; 250 257 } 251 258 echo '<input name="user_name" type="text" id="user_name" value="' . esc_attr( $user_name ) . '" autocapitalize="none" autocorrect="off" maxlength="60" /><br />'; … … 253 260 ?> 254 261 255 262 <label for="user_email"><?php _e( 'Email 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 ?> 257 267 <p class="error"><?php echo $errmsg; ?></p> 258 268 <?php } ?> 259 269 <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.)' ); ?> 260 270 <?php 261 if ( $errmsg = $errors->get_error_message( 'generic' ) ) { 271 $errmsg = $errors->get_error_message( 'generic' ); 272 if ( $errmsg ) { 262 273 echo '<p class="error">' . $errmsg . '</p>'; 263 274 } 264 275 /** … … 323 334 $blog_title = $filtered_results['blog_title']; 324 335 $errors = $filtered_results['errors']; 325 336 337 /* translators: %s: site name */ 326 338 echo '<h2>' . sprintf( __( 'Get <em>another</em> %s site in seconds' ), get_network()->site_name ) . '</h2>'; 327 339 328 340 if ( $errors->has_errors() ) { 329 341 echo '<p>' . __( 'There was a problem, please correct the form below and try again.' ) . '</p>'; 330 342 } 331 343 ?> 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’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’s content, but write responsibly!' ), 349 $current_user->display_name 350 ); 351 ?> 352 </p> 333 353 334 354 <?php 335 355 $blogs = get_blogs_of_user( $current_user->ID ); 336 356 if ( ! empty( $blogs ) ) { 337 ?>357 ?> 338 358 339 359 <p><?php _e( 'Sites you are already a member of:' ); ?></p> 340 360 <ul> … … 581 601 <?php show_user_form( $user_name, $user_email, $errors ); ?> 582 602 583 603 <p> 584 <?php if ( $active_signup == 'blog') { ?>604 <?php if ( 'blog' === $active_signup ) { ?> 585 605 <input id="signupblog" type="hidden" name="signup_for" value="blog" /> 586 <?php } elseif ( $active_signup == 'user') { ?>606 <?php } elseif ( 'user' === $active_signup ) { ?> 587 607 <input id="signupblog" type="hidden" name="signup_for" value="user" /> 588 608 <?php } else { ?> 589 609 <input id="signupblog" type="radio" name="signup_for" value="blog" <?php checked( $signup_for, 'blog' ); ?> /> … … 906 926 $newblogname = isset( $_GET['new'] ) ? strtolower( preg_replace( '/^-|-$|[^-a-zA-Z0-9]/', '', $_GET['new'] ) ) : null; 907 927 908 928 $current_user = wp_get_current_user(); 909 if ( $active_signup == 'none') {929 if ( 'none' === $active_signup ) { 910 930 _e( 'Registration has been disabled.' ); 911 } elseif ( $active_signup == 'blog'&& ! is_user_logged_in() ) {931 } elseif ( 'blog' === $active_signup && ! is_user_logged_in() ) { 912 932 $login_url = wp_login_url( network_site_url( 'wp-signup.php' ) ); 913 933 /* translators: %s: login URL */ 914 934 printf( __( 'You must first <a href="%s">log in</a>, and then you can create a new site.' ), $login_url ); … … 916 936 $stage = isset( $_POST['stage'] ) ? $_POST['stage'] : 'default'; 917 937 switch ( $stage ) { 918 938 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 ) { 920 941 validate_user_signup(); 921 942 } else { 922 943 _e( 'User registration has been disabled.' ); 923 944 } 924 945 break; 925 946 case 'validate-blog-signup': 926 if ( $active_signup == 'all' || $active_signup == 'blog') {947 if ( 'all' === $active_signup || 'blog' === $active_signup ) { 927 948 validate_blog_signup(); 928 949 } else { 929 950 _e( 'Site registration has been disabled.' ); … … 941 962 * @since 3.0.0 942 963 */ 943 964 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 ) ) { 945 966 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 ) ) { 947 968 signup_user( $newblogname, $user_email ); 948 } elseif ( ! is_user_logged_in() && ( $active_signup == 'blog') ) {969 } elseif ( ! is_user_logged_in() && ( 'blog' === $active_signup ) ) { 949 970 _e( 'Sorry, new registrations are not allowed at this time.' ); 950 971 } else { 951 972 _e( 'You are logged in already. No need to register again!' ); … … 954 975 if ( $newblogname ) { 955 976 $newblog = get_blogaddress_by_name( $newblogname ); 956 977 957 if ( $active_signup == 'blog' || $active_signup == 'all' ) { 958 /* translators: %s: site address */ 978 if ( 'blog' === $active_signup || 'all' === $active_signup ) { 959 979 printf( 980 /* translators: %s: site address */ 960 981 '<p><em>' . __( 'The site you were looking for, %s, does not exist, but you can create it now!' ) . '</em></p>', 961 982 '<strong>' . $newblog . '</strong>' 962 983 ); 963 } else { /* translators: %s: site address */984 } else { 964 985 printf( 986 /* translators: %s: site address*/ 965 987 '<p><em>' . __( 'The site you were looking for, %s, does not exist.' ) . '</em></p>', 966 988 '<strong>' . $newblog . '</strong>' 967 989 );