X-Git-Url: https://scripts.mit.edu/gitweb/autoinstalls/wordpress.git/blobdiff_plain/4feeb71a9d812a9ae371c28a3d8b442a4394ded7..607b7e02d77e7326161e8ec15639052d2040f745:/wp-signup.php diff --git a/wp-signup.php b/wp-signup.php index bd46d02c..99bd2afb 100644 --- a/wp-signup.php +++ b/wp-signup.php @@ -91,11 +91,15 @@ do_action( 'before_signup_form' ); * * @since MU * - * @param string $blogname The new site name - * @param string $blog_title The new site title - * @param array $errors + * @param string $blogname The new site name. + * @param string $blog_title The new site title. + * @param WP_Error|string $errors A WP_Error object containing existing errors. Defaults to empty string. */ function show_blog_form( $blogname = '', $blog_title = '', $errors = '' ) { + if ( ! is_wp_error( $errors ) ) { + $errors = new WP_Error(); + } + $current_site = get_current_site(); // Blog name if ( !is_subdomain_install() ) @@ -112,12 +116,15 @@ function show_blog_form( $blogname = '', $blog_title = '', $errors = '' ) { else echo '.' . ( $site_domain = preg_replace( '|^www\.|', '', $current_site->domain ) ) . '
'; - if ( !is_user_logged_in() ) { - if ( !is_subdomain_install() ) + if ( ! is_user_logged_in() ) { + if ( ! is_subdomain_install() ) { $site = $current_site->domain . $current_site->path . __( 'sitename' ); - else + } else { $site = __( 'domain' ) . '.' . $site_domain . $current_site->path; - echo '

(' . sprintf( __('Your address will be %s.'), $site ) . ') ' . __( 'Must be at least 4 characters, letters and numbers only. It cannot be changed, so choose carefully!' ) . '

'; + } + + /* translators: %s: site address */ + echo '

(' . sprintf( __( 'Your address will be %s.' ), $site ) . ') ' . __( 'Must be at least 4 characters, letters and numbers only. It cannot be changed, so choose carefully!' ) . '

'; } // Blog Title @@ -183,7 +190,7 @@ function show_blog_form( $blogname = '', $blog_title = '', $errors = '' ) { * * @since 3.0.0 * - * @param array $errors An array possibly containing 'blogname' or 'blog_title' errors. + * @param WP_Error $errors A WP_Error object possibly containing 'blogname' or 'blog_title' errors. */ do_action( 'signup_blogform', $errors ); } @@ -208,17 +215,21 @@ function validate_blog_form() { * * @since MU * - * @param string $user_name The entered username - * @param string $user_email The entered email address - * @param array $errors + * @param string $user_name The entered username. + * @param string $user_email The entered email address. + * @param WP_Error|string $errors A WP_Error object containing existing errors. Defaults to empty string. */ function show_user_form($user_name = '', $user_email = '', $errors = '') { + if ( ! is_wp_error( $errors ) ) { + $errors = new WP_Error(); + } + // User name echo ''; if ( $errmsg = $errors->get_error_message('user_name') ) { echo '

'.$errmsg.'

'; } - echo '
'; + echo '
'; _e( '(Must be at least 4 characters, letters and numbers only.)' ); ?> @@ -236,7 +247,7 @@ function show_user_form($user_name = '', $user_email = '', $errors = '') { * * @since 3.0.0 * - * @param array $errors An array possibly containing 'user_name' or 'user_email' errors. + * @param WP_Error $errors A WP_Error object containing containing 'user_name' or 'user_email' errors. */ do_action( 'signup_extra_fields', $errors ); } @@ -257,9 +268,9 @@ function validate_user_form() { * * @since MU * - * @param string $blogname The new site name - * @param string $blog_title The new site title. - * @param array $errors + * @param string $blogname The new site name + * @param string $blog_title The new site title. + * @param WP_Error|string $errors A WP_Error object containing existing errors. Defaults to empty string. */ function signup_another_blog( $blogname = '', $blog_title = '', $errors = '' ) { $current_user = wp_get_current_user(); @@ -275,16 +286,16 @@ function signup_another_blog( $blogname = '', $blog_title = '', $errors = '' ) { ); /** - * Filter the default site sign-up variables. + * Filters the default site sign-up variables. * * @since 3.0.0 * * @param array $signup_defaults { * An array of default site sign-up variables. * - * @type string $blogname The site blogname. - * @type string $blog_title The site title. - * @type array $errors An array possibly containing 'blogname' or 'blog_title' errors. + * @type string $blogname The site blogname. + * @type string $blog_title The site title. + * @type WP_Error $errors A WP_Error object possibly containing 'blogname' or 'blog_title' errors. * } */ $filtered_results = apply_filters( 'signup_another_blog_init', $signup_defaults ); @@ -386,17 +397,19 @@ function validate_another_blog_signup() { } /** - * Filter the new site meta variables. + * Filters the new site meta variables. + * + * Use the {@see 'add_signup_meta'} filter instead. * * @since MU - * @deprecated 3.0.0 Use the 'add_signup_meta' filter instead. + * @deprecated 3.0.0 Use the {@see 'add_signup_meta'} filter instead. * * @param array $blog_meta_defaults An array of default blog meta variables. */ $meta_defaults = apply_filters( 'signup_create_blog_meta', $blog_meta_defaults ); /** - * Filter the new default site meta variables. + * Filters the new default site meta variables. * * @since 3.0.0 * @@ -430,7 +443,7 @@ function validate_another_blog_signup() { * @param string $blog_title The site title. * @param string $user_name The username. * @param string $user_email The user's email address. - * @param array $meta Any additional meta from the 'add_signup_meta' filter in validate_blog_signup(). + * @param array $meta Any additional meta from the {@see 'add_signup_meta'} filter in validate_blog_signup(). * @param int $blog_id The site ID. */ function confirm_another_blog_signup( $domain, $path, $blog_title, $user_name, $user_email = '', $meta = array(), $blog_id = 0 ) { @@ -451,9 +464,13 @@ function confirm_another_blog_signup( $domain, $path, $blog_title, $user_name, $ ); ?> -

+

%2$s is your new site. Log in as “%4$s” using your existing password.' ), esc_url( $home_url ), untrailingslashit( $domain . $path ), @@ -475,9 +492,9 @@ function confirm_another_blog_signup( $domain, $path, $blog_title, $user_name, $ * * @since MU * - * @param string $user_name The username - * @param string $user_email The user's email - * @param array $errors + * @param string $user_name The username. + * @param string $user_email The user's email. + * @param WP_Error|string $errors A WP_Error object containing existing errors. Defaults to empty string. */ function signup_user( $user_name = '', $user_email = '', $errors = '' ) { global $active_signup; @@ -494,16 +511,16 @@ function signup_user( $user_name = '', $user_email = '', $errors = '' ) { ); /** - * Filter the default user variables used on the user sign-up form. + * Filters the default user variables used on the user sign-up form. * * @since 3.0.0 * * @param array $signup_user_defaults { * An array of default user variables. * - * @type string $user_name The user username. - * @type string $user_email The user email address. - * @type array $errors An array of possible errors relevant to the sign-up user. + * @type string $user_name The user username. + * @type string $user_email The user email address. + * @type WP_Error $errors A WP_Error object with possible errors relevant to the sign-up user. * } */ $filtered_results = apply_filters( 'signup_user_init', $signup_user_defaults ); @@ -513,7 +530,10 @@ function signup_user( $user_name = '', $user_email = '', $errors = '' ) { ?> -

site_name ) ?>

+

site_name ); + ?>

@@ -739,7 +759,10 @@ function confirm_blog_signup( $domain, $path, $blog_title, $user_name = '', $use

' . sprintf( __( 'Greetings Site Administrator! You are currently allowing “%s” registrations. To change or disable registration go to your Options page.' ), $i18n_signup[$active_signup], esc_url( network_admin_url( 'settings.php' ) ) ) . ''; +} $newblogname = isset($_GET['new']) ? strtolower(preg_replace('/^-|-$|[^-a-zA-Z0-9]/', '', $_GET['new'])) : null; @@ -808,7 +834,8 @@ if ( $active_signup == 'none' ) { _e( 'Registration has been disabled.' ); } elseif ( $active_signup == 'blog' && !is_user_logged_in() ) { $login_url = wp_login_url( network_site_url( 'wp-signup.php' ) ); - echo sprintf( __( 'You must first log in, and then you can create a new site.' ), $login_url ); + /* translators: %s: login URL */ + printf( __( 'You must first log in, and then you can create a new site.' ), $login_url ); } else { $stage = isset( $_POST['stage'] ) ? $_POST['stage'] : 'default'; switch ( $stage ) {