diff --git a/src/wp-signup.php b/src/wp-signup.php
index 3a424743bf..acd382f84c 100644
a
|
b
|
function show_blog_form( $blogname = '', $blog_title = '', $errors = '' ) { |
110 | 110 | echo '<label for="blogname">' . __( 'Site Domain:' ) . '</label>'; |
111 | 111 | } |
112 | 112 | |
113 | | if ( $errmsg = $errors->get_error_message( 'blogname' ) ) { |
| 113 | $errmsg = $errors->get_error_message( 'blogname' ); |
| 114 | if ( $errmsg ) { |
114 | 115 | ?> |
115 | 116 | <p class="error"><?php echo $errmsg; ?></p> |
116 | 117 | <?php |
… |
… |
function show_blog_form( $blogname = '', $blog_title = '', $errors = '' ) { |
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() ) { |
… |
… |
function show_blog_form( $blogname = '', $blog_title = '', $errors = '' ) { |
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 | |
… |
… |
function show_blog_form( $blogname = '', $blog_title = '', $errors = '' ) { |
178 | 183 | <?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 { |
… |
… |
function show_user_form( $user_name = '', $user_email = '', $errors = '' ) { |
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 />'; |
… |
… |
function show_user_form( $user_name = '', $user_email = '', $errors = '' ) { |
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 | /** |
… |
… |
function signup_another_blog( $blogname = '', $blog_title = '', $errors = '' ) { |
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 ); |
… |
… |
function validate_another_blog_signup() { |
391 | 411 | $result = validate_blog_form(); |
392 | 412 | |
393 | 413 | // Extracted values set/overwrite globals. |
| 414 | // phpcs:disable WordPress.Variables.GlobalVariables.OverrideProhibited |
394 | 415 | $domain = $result['domain']; |
395 | 416 | $path = $result['path']; |
396 | 417 | $blogname = $result['blogname']; |
397 | 418 | $blog_title = $result['blog_title']; |
398 | 419 | $errors = $result['errors']; |
| 420 | // phpcs:enable WordPress.Variables.GlobalVariables.OverrideProhibited |
399 | 421 | |
400 | 422 | if ( $errors->has_errors() ) { |
401 | 423 | signup_another_blog( $blogname, $blog_title, $errors ); |
… |
… |
function signup_user( $user_name = '', $user_email = '', $errors = '' ) { |
581 | 603 | <?php show_user_form( $user_name, $user_email, $errors ); ?> |
582 | 604 | |
583 | 605 | <p> |
584 | | <?php if ( $active_signup == 'blog' ) { ?> |
| 606 | <?php if ( 'blog' === $active_signup ) { ?> |
585 | 607 | <input id="signupblog" type="hidden" name="signup_for" value="blog" /> |
586 | | <?php } elseif ( $active_signup == 'user' ) { ?> |
| 608 | <?php } elseif ( 'user' === $active_signup ) { ?> |
587 | 609 | <input id="signupblog" type="hidden" name="signup_for" value="user" /> |
588 | 610 | <?php } else { ?> |
589 | 611 | <input id="signupblog" type="radio" name="signup_for" value="blog" <?php checked( $signup_for, 'blog' ); ?> /> |
… |
… |
if ( current_user_can( 'manage_network' ) ) { |
906 | 928 | $newblogname = isset( $_GET['new'] ) ? strtolower( preg_replace( '/^-|-$|[^-a-zA-Z0-9]/', '', $_GET['new'] ) ) : null; |
907 | 929 | |
908 | 930 | $current_user = wp_get_current_user(); |
909 | | if ( $active_signup == 'none' ) { |
| 931 | if ( 'none' === $active_signup ) { |
910 | 932 | _e( 'Registration has been disabled.' ); |
911 | | } elseif ( $active_signup == 'blog' && ! is_user_logged_in() ) { |
| 933 | } elseif ( 'blog' === $active_signup && ! is_user_logged_in() ) { |
912 | 934 | $login_url = wp_login_url( network_site_url( 'wp-signup.php' ) ); |
913 | 935 | /* translators: %s: login URL */ |
914 | 936 | printf( __( 'You must first <a href="%s">log in</a>, and then you can create a new site.' ), $login_url ); |
… |
… |
if ( $active_signup == 'none' ) { |
916 | 938 | $stage = isset( $_POST['stage'] ) ? $_POST['stage'] : 'default'; |
917 | 939 | switch ( $stage ) { |
918 | 940 | case 'validate-user-signup': |
919 | | if ( $active_signup == 'all' || $_POST['signup_for'] == 'blog' && $active_signup == 'blog' || $_POST['signup_for'] == 'user' && $active_signup == 'user' ) { |
| 941 | if ( 'all' === $active_signup || 'blog' === $_POST['signup_for'] && 'blog' === $active_signup || |
| 942 | 'user' === $_POST['signup_for'] && 'user' === $active_signup ) { |
920 | 943 | validate_user_signup(); |
921 | 944 | } else { |
922 | 945 | _e( 'User registration has been disabled.' ); |
923 | 946 | } |
924 | 947 | break; |
925 | 948 | case 'validate-blog-signup': |
926 | | if ( $active_signup == 'all' || $active_signup == 'blog' ) { |
| 949 | if ( 'all' === $active_signup || 'blog' === $active_signup ) { |
927 | 950 | validate_blog_signup(); |
928 | 951 | } else { |
929 | 952 | _e( 'Site registration has been disabled.' ); |
… |
… |
if ( $active_signup == 'none' ) { |
941 | 964 | * @since 3.0.0 |
942 | 965 | */ |
943 | 966 | do_action( 'preprocess_signup_form' ); |
944 | | if ( is_user_logged_in() && ( $active_signup == 'all' || $active_signup == 'blog' ) ) { |
| 967 | if ( is_user_logged_in() && ( 'all' === $active_signup || 'blog' === $active_signup ) ) { |
945 | 968 | signup_another_blog( $newblogname ); |
946 | | } elseif ( ! is_user_logged_in() && ( $active_signup == 'all' || $active_signup == 'user' ) ) { |
| 969 | } elseif ( ! is_user_logged_in() && ( 'all' === $active_signup || 'user' === $active_signup ) ) { |
947 | 970 | signup_user( $newblogname, $user_email ); |
948 | | } elseif ( ! is_user_logged_in() && ( $active_signup == 'blog' ) ) { |
| 971 | } elseif ( ! is_user_logged_in() && ( 'blog' === $active_signup ) ) { |
949 | 972 | _e( 'Sorry, new registrations are not allowed at this time.' ); |
950 | 973 | } else { |
951 | 974 | _e( 'You are logged in already. No need to register again!' ); |
… |
… |
if ( $active_signup == 'none' ) { |
954 | 977 | if ( $newblogname ) { |
955 | 978 | $newblog = get_blogaddress_by_name( $newblogname ); |
956 | 979 | |
957 | | if ( $active_signup == 'blog' || $active_signup == 'all' ) { |
958 | | /* translators: %s: site address */ |
| 980 | if ( 'blog' === $active_signup || 'all' === $active_signup ) { |
959 | 981 | printf( |
| 982 | /* translators: %s: site address */ |
960 | 983 | '<p><em>' . __( 'The site you were looking for, %s, does not exist, but you can create it now!' ) . '</em></p>', |
961 | 984 | '<strong>' . $newblog . '</strong>' |
962 | 985 | ); |
963 | | } else { /* translators: %s: site address */ |
| 986 | } else { |
964 | 987 | printf( |
| 988 | /* translators: %s: site address*/ |
965 | 989 | '<p><em>' . __( 'The site you were looking for, %s, does not exist.' ) . '</em></p>', |
966 | 990 | '<strong>' . $newblog . '</strong>' |
967 | 991 | ); |