diff --git src/wp-signup.php src/wp-signup.php
index cecaf989e5..377ccf67d7 100644
|
|
function show_blog_form( $blogname = '', $blog_title = '', $errors = '' ) { |
108 | 108 | echo '<label for="blogname">' . __( 'Site Domain:' ) . '</label>'; |
109 | 109 | } |
110 | 110 | |
111 | | if ( $errmsg = $errors->get_error_message( 'blogname' ) ) { |
| 111 | $errmsg = $errors->get_error_message( 'blogname' ); |
| 112 | if ( $errmsg ) { |
112 | 113 | ?> |
113 | 114 | <p class="error"><?php echo $errmsg; ?></p> |
114 | 115 | <?php |
… |
… |
function show_blog_form( $blogname = '', $blog_title = '', $errors = '' ) { |
117 | 118 | if ( ! is_subdomain_install() ) { |
118 | 119 | 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 />'; |
119 | 120 | } else { |
120 | | 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 />'; |
| 121 | $site_domain = preg_replace( '|^www\.|', '', $current_network->domain ); |
| 122 | echo '<input name="blogname" type="text" id="blogname" value="' . esc_attr( $blogname ) . '" maxlength="60" /><span class="suffix_address">.' . ( $site_domain ) . '</span><br />'; |
121 | 123 | } |
122 | 124 | |
123 | 125 | if ( ! is_user_logged_in() ) { |
… |
… |
function show_blog_form( $blogname = '', $blog_title = '', $errors = '' ) { |
134 | 136 | // Blog Title |
135 | 137 | ?> |
136 | 138 | <label for="blog_title"><?php _e( 'Site Title:' ); ?></label> |
137 | | <?php if ( $errmsg = $errors->get_error_message( 'blog_title' ) ) { ?> |
138 | | <p class="error"><?php echo $errmsg; ?></p> |
139 | 139 | <?php |
140 | | } |
| 140 | $errmsg = $errors->get_error_message( 'blog_title' ); |
| 141 | if ( $errmsg ) { |
| 142 | ?> |
| 143 | <p class="error"><?php echo $errmsg; ?></p> |
| 144 | <?php |
| 145 | } |
141 | 146 | echo '<input name="blog_title" type="text" id="blog_title" value="' . esc_attr( $blog_title ) . '" />'; |
142 | 147 | ?> |
143 | 148 | |
… |
… |
function show_blog_form( $blogname = '', $blog_title = '', $errors = '' ) { |
176 | 181 | <?php |
177 | 182 | endif; // Languages. |
178 | 183 | |
179 | | $blog_public_on_checked = $blog_public_off_checked = ''; |
| 184 | $blog_public_on_checked = ''; |
| 185 | $blog_public_off_checked = ''; |
180 | 186 | if ( isset( $_POST['blog_public'] ) && '0' == $_POST['blog_public'] ) { |
181 | 187 | $blog_public_off_checked = 'checked="checked"'; |
182 | 188 | } else { |
… |
… |
function show_user_form( $user_name = '', $user_email = '', $errors = '' ) { |
243 | 249 | |
244 | 250 | // User name |
245 | 251 | echo '<label for="user_name">' . __( 'Username:' ) . '</label>'; |
246 | | if ( $errmsg = $errors->get_error_message( 'user_name' ) ) { |
| 252 | $errmsg = $errors->get_error_message( 'user_name' ); |
| 253 | if ( $errmsg ) { |
247 | 254 | echo '<p class="error">' . $errmsg . '</p>'; |
248 | 255 | } |
249 | 256 | 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 = '' ) { |
251 | 258 | ?> |
252 | 259 | |
253 | 260 | <label for="user_email"><?php _e( 'Email Address:' ); ?></label> |
254 | | <?php if ( $errmsg = $errors->get_error_message( 'user_email' ) ) { ?> |
| 261 | <?php |
| 262 | $errmsg = $errors->get_error_message( 'user_email' ); |
| 263 | if ( $errmsg ) { |
| 264 | ?> |
255 | 265 | <p class="error"><?php echo $errmsg; ?></p> |
256 | 266 | <?php } ?> |
257 | 267 | <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.)' ); ?> |
258 | 268 | <?php |
259 | | if ( $errmsg = $errors->get_error_message( 'generic' ) ) { |
| 269 | $errmsg = $errors->get_error_message( 'generic' ); |
| 270 | if ( $errmsg ) { |
260 | 271 | echo '<p class="error">' . $errmsg . '</p>'; |
261 | 272 | } |
262 | 273 | /** |
… |
… |
function signup_another_blog( $blogname = '', $blog_title = '', $errors = '' ) { |
321 | 332 | $blog_title = $filtered_results['blog_title']; |
322 | 333 | $errors = $filtered_results['errors']; |
323 | 334 | |
| 335 | /* translators: %s: site name */ |
324 | 336 | echo '<h2>' . sprintf( __( 'Get <em>another</em> %s site in seconds' ), get_network()->site_name ) . '</h2>'; |
325 | 337 | |
326 | 338 | if ( $errors->get_error_code() ) { |
327 | 339 | echo '<p>' . __( 'There was a problem, please correct the form below and try again.' ) . '</p>'; |
328 | 340 | } |
329 | 341 | ?> |
330 | | <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> |
| 342 | <p> |
| 343 | <?php |
| 344 | printf( |
| 345 | /* translators: %s: display name */ |
| 346 | __( '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!' ), |
| 347 | $current_user->display_name |
| 348 | ); |
| 349 | ?> |
| 350 | </p> |
331 | 351 | |
332 | 352 | <?php |
333 | 353 | $blogs = get_blogs_of_user( $current_user->ID ); |
… |
… |
function validate_another_blog_signup() { |
383 | 403 | $result = validate_blog_form(); |
384 | 404 | |
385 | 405 | // Extracted values set/overwrite globals. |
| 406 | // phpcs:disable WordPress.Variables.GlobalVariables.OverrideProhibited |
386 | 407 | $domain = $result['domain']; |
387 | 408 | $path = $result['path']; |
388 | 409 | $blogname = $result['blogname']; |
389 | 410 | $blog_title = $result['blog_title']; |
390 | 411 | $errors = $result['errors']; |
| 412 | // phpcs:enable WordPress.Variables.GlobalVariables.OverrideProhibited |
391 | 413 | |
392 | 414 | if ( $errors->get_error_code() ) { |
393 | 415 | signup_another_blog( $blogname, $blog_title, $errors ); |
… |
… |
function signup_user( $user_name = '', $user_email = '', $errors = '' ) { |
573 | 595 | <?php show_user_form( $user_name, $user_email, $errors ); ?> |
574 | 596 | |
575 | 597 | <p> |
576 | | <?php if ( $active_signup == 'blog' ) { ?> |
| 598 | <?php if ( 'blog' === $active_signup ) { ?> |
577 | 599 | <input id="signupblog" type="hidden" name="signup_for" value="blog" /> |
578 | | <?php } elseif ( $active_signup == 'user' ) { ?> |
| 600 | <?php } elseif ( 'user' === $active_signup ) { ?> |
579 | 601 | <input id="signupblog" type="hidden" name="signup_for" value="user" /> |
580 | 602 | <?php } else { ?> |
581 | 603 | <input id="signupblog" type="radio" name="signup_for" value="blog" <?php checked( $signup_for, 'blog' ); ?> /> |
… |
… |
if ( current_user_can( 'manage_network' ) ) { |
898 | 920 | $newblogname = isset( $_GET['new'] ) ? strtolower( preg_replace( '/^-|-$|[^-a-zA-Z0-9]/', '', $_GET['new'] ) ) : null; |
899 | 921 | |
900 | 922 | $current_user = wp_get_current_user(); |
901 | | if ( $active_signup == 'none' ) { |
| 923 | if ( 'none' === $active_signup ) { |
902 | 924 | _e( 'Registration has been disabled.' ); |
903 | | } elseif ( $active_signup == 'blog' && ! is_user_logged_in() ) { |
| 925 | } elseif ( 'blog' === $active_signup && ! is_user_logged_in() ) { |
904 | 926 | $login_url = wp_login_url( network_site_url( 'wp-signup.php' ) ); |
905 | 927 | /* translators: %s: login URL */ |
906 | 928 | printf( __( 'You must first <a href="%s">log in</a>, and then you can create a new site.' ), $login_url ); |
… |
… |
if ( $active_signup == 'none' ) { |
908 | 930 | $stage = isset( $_POST['stage'] ) ? $_POST['stage'] : 'default'; |
909 | 931 | switch ( $stage ) { |
910 | 932 | case 'validate-user-signup': |
911 | | if ( $active_signup == 'all' || $_POST['signup_for'] == 'blog' && $active_signup == 'blog' || $_POST['signup_for'] == 'user' && $active_signup == 'user' ) { |
| 933 | if ( 'all' === $active_signup || 'blog' === $_POST['signup_for'] && 'blog' === $active_signup || 'user' === $_POST['signup_for'] && 'user' === $active_signup ) { |
912 | 934 | validate_user_signup(); |
913 | 935 | } else { |
914 | 936 | _e( 'User registration has been disabled.' ); |
915 | 937 | } |
916 | 938 | break; |
917 | 939 | case 'validate-blog-signup': |
918 | | if ( $active_signup == 'all' || $active_signup == 'blog' ) { |
| 940 | if ( 'all' === $active_signup || 'blog' === $active_signup ) { |
919 | 941 | validate_blog_signup(); |
920 | 942 | } else { |
921 | 943 | _e( 'Site registration has been disabled.' ); |
… |
… |
if ( $active_signup == 'none' ) { |
933 | 955 | * @since 3.0.0 |
934 | 956 | */ |
935 | 957 | do_action( 'preprocess_signup_form' ); |
936 | | if ( is_user_logged_in() && ( $active_signup == 'all' || $active_signup == 'blog' ) ) { |
| 958 | if ( is_user_logged_in() && ( 'all' === $active_signup || 'blog' === $active_signup ) ) { |
937 | 959 | signup_another_blog( $newblogname ); |
938 | | } elseif ( ! is_user_logged_in() && ( $active_signup == 'all' || $active_signup == 'user' ) ) { |
| 960 | } elseif ( ! is_user_logged_in() && ( 'all' === $active_signup || 'user' === $active_signup ) ) { |
939 | 961 | signup_user( $newblogname, $user_email ); |
940 | | } elseif ( ! is_user_logged_in() && ( $active_signup == 'blog' ) ) { |
| 962 | } elseif ( ! is_user_logged_in() && ( 'blog' === $active_signup ) ) { |
941 | 963 | _e( 'Sorry, new registrations are not allowed at this time.' ); |
942 | 964 | } else { |
943 | 965 | _e( 'You are logged in already. No need to register again!' ); |
… |
… |
if ( $active_signup == 'none' ) { |
946 | 968 | if ( $newblogname ) { |
947 | 969 | $newblog = get_blogaddress_by_name( $newblogname ); |
948 | 970 | |
949 | | if ( $active_signup == 'blog' || $active_signup == 'all' ) { |
950 | | /* translators: %s: site address */ |
| 971 | if ( 'blog' === $active_signup || 'all' === $active_signup ) { |
951 | 972 | printf( |
| 973 | /* translators: %s: site address */ |
952 | 974 | '<p><em>' . __( 'The site you were looking for, %s, does not exist, but you can create it now!' ) . '</em></p>', |
953 | 975 | '<strong>' . $newblog . '</strong>' |
954 | 976 | ); |
955 | | } else { /* translators: %s: site address */ |
| 977 | } else { |
956 | 978 | printf( |
| 979 | /* translators: %s: site address*/ |
957 | 980 | '<p><em>' . __( 'The site you were looking for, %s, does not exist.' ) . '</em></p>', |
958 | 981 | '<strong>' . $newblog . '</strong>' |
959 | 982 | ); |