Make WordPress Core


Ignore:
Timestamp:
11/30/2017 11:09:33 PM (7 years ago)
Author:
pento
Message:

Code is Poetry.
WordPress' code just... wasn't.
This is now dealt with.

Props jrf, pento, netweb, GaryJ, jdgrimes, westonruter, Greg Sherwood from PHPCS, and everyone who's ever contributed to WPCS and PHPCS.
Fixes #41057.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-signup.php

    r42217 r42343  
    22
    33/** Sets up the WordPress Environment. */
    4 require( dirname(__FILE__) . '/wp-load.php' );
     4require( dirname( __FILE__ ) . '/wp-load.php' );
    55
    66add_action( 'wp_head', 'wp_no_robots' );
     
    88require( dirname( __FILE__ ) . '/wp-blog-header.php' );
    99
    10 if ( is_array( get_site_option( 'illegal_names' )) && isset( $_GET[ 'new' ] ) && in_array( $_GET[ 'new' ], get_site_option( 'illegal_names' ) ) ) {
     10if ( is_array( get_site_option( 'illegal_names' ) ) && isset( $_GET['new'] ) && in_array( $_GET['new'], get_site_option( 'illegal_names' ) ) ) {
    1111    wp_redirect( network_home_url() );
    1212    die();
     
    2828add_action( 'wp_head', 'do_signup_header' );
    2929
    30 if ( !is_multisite() ) {
     30if ( ! is_multisite() ) {
    3131    wp_redirect( wp_registration_url() );
    3232    die();
    3333}
    3434
    35 if ( !is_main_site() ) {
     35if ( ! is_main_site() ) {
    3636    wp_redirect( network_site_url( 'wp-signup.php' ) );
    3737    die();
     
    103103    $current_network = get_network();
    104104    // Blog name
    105     if ( !is_subdomain_install() )
    106         echo '<label for="blogname">' . __('Site Name:') . '</label>';
    107     else
    108         echo '<label for="blogname">' . __('Site Domain:') . '</label>';
    109 
    110     if ( $errmsg = $errors->get_error_message('blogname') ) { ?>
    111         <p class="error"><?php echo $errmsg ?></p>
    112     <?php }
    113 
    114     if ( !is_subdomain_install() )
    115         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 />';
    116     else
    117         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 />';
     105    if ( ! is_subdomain_install() ) {
     106        echo '<label for="blogname">' . __( 'Site Name:' ) . '</label>';
     107    } else {
     108        echo '<label for="blogname">' . __( 'Site Domain:' ) . '</label>';
     109    }
     110
     111    if ( $errmsg = $errors->get_error_message( 'blogname' ) ) {
     112    ?>
     113        <p class="error"><?php echo $errmsg; ?></p>
     114    <?php
     115    }
     116
     117    if ( ! is_subdomain_install() ) {
     118        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    } 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    }
    118122
    119123    if ( ! is_user_logged_in() ) {
     
    130134    // Blog Title
    131135    ?>
    132     <label for="blog_title"><?php _e('Site Title:') ?></label>
    133     <?php if ( $errmsg = $errors->get_error_message('blog_title') ) { ?>
    134         <p class="error"><?php echo $errmsg ?></p>
    135     <?php }
    136     echo '<input name="blog_title" type="text" id="blog_title" value="'.esc_attr($blog_title).'" />';
     136    <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    <?php
     140}
     141    echo '<input name="blog_title" type="text" id="blog_title" value="' . esc_attr( $blog_title ) . '" />';
    137142    ?>
    138143
     
    158163            }
    159164
    160             wp_dropdown_languages( array(
    161                 'name'                        => 'WPLANG',
    162                 'id'                          => 'site-language',
    163                 'selected'                    => $lang,
    164                 'languages'                   => $languages,
    165                 'show_available_translations' => false,
    166             ) );
     165            wp_dropdown_languages(
     166                array(
     167                    'name'                        => 'WPLANG',
     168                    'id'                          => 'site-language',
     169                    'selected'                    => $lang,
     170                    'languages'                   => $languages,
     171                    'show_available_translations' => false,
     172                )
     173            );
    167174            ?>
    168175        </p>
     
    171178
    172179        $blog_public_on_checked = $blog_public_off_checked = '';
    173         if ( isset( $_POST['blog_public'] ) && '0' == $_POST['blog_public'] ) {
    174             $blog_public_off_checked = 'checked="checked"';
    175         } else {
    176             $blog_public_on_checked = 'checked="checked"';
    177         }
     180    if ( isset( $_POST['blog_public'] ) && '0' == $_POST['blog_public'] ) {
     181        $blog_public_off_checked = 'checked="checked"';
     182    } else {
     183        $blog_public_on_checked = 'checked="checked"';
     184    }
    178185    ?>
    179186
    180187    <div id="privacy">
    181         <p class="privacy-intro">
    182             <label for="blog_public_on"><?php _e('Privacy:') ?></label>
    183             <?php _e( 'Allow search engines to index this site.' ); ?>
    184             <br style="clear:both" />
    185             <label class="checkbox" for="blog_public_on">
    186                 <input type="radio" id="blog_public_on" name="blog_public" value="1" <?php echo $blog_public_on_checked; ?> />
    187                 <strong><?php _e( 'Yes' ); ?></strong>
    188             </label>
    189             <label class="checkbox" for="blog_public_off">
    190                 <input type="radio" id="blog_public_off" name="blog_public" value="0" <?php echo $blog_public_off_checked; ?> />
    191                 <strong><?php _e( 'No' ); ?></strong>
    192             </label>
    193         </p>
     188        <p class="privacy-intro">
     189            <label for="blog_public_on"><?php _e( 'Privacy:' ); ?></label>
     190            <?php _e( 'Allow search engines to index this site.' ); ?>
     191            <br style="clear:both" />
     192            <label class="checkbox" for="blog_public_on">
     193                <input type="radio" id="blog_public_on" name="blog_public" value="1" <?php echo $blog_public_on_checked; ?> />
     194                <strong><?php _e( 'Yes' ); ?></strong>
     195            </label>
     196            <label class="checkbox" for="blog_public_off">
     197                <input type="radio" id="blog_public_off" name="blog_public" value="0" <?php echo $blog_public_off_checked; ?> />
     198                <strong><?php _e( 'No' ); ?></strong>
     199            </label>
     200        </p>
    194201    </div>
    195202
     
    214221function validate_blog_form() {
    215222    $user = '';
    216     if ( is_user_logged_in() )
     223    if ( is_user_logged_in() ) {
    217224        $user = wp_get_current_user();
    218 
    219     return wpmu_validate_blog_signup($_POST['blogname'], $_POST['blog_title'], $user);
     225    }
     226
     227    return wpmu_validate_blog_signup( $_POST['blogname'], $_POST['blog_title'], $user );
    220228}
    221229
     
    229237 * @param WP_Error|string $errors     A WP_Error object containing existing errors. Defaults to empty string.
    230238 */
    231 function show_user_form($user_name = '', $user_email = '', $errors = '') {
     239function show_user_form( $user_name = '', $user_email = '', $errors = '' ) {
    232240    if ( ! is_wp_error( $errors ) ) {
    233241        $errors = new WP_Error();
     
    235243
    236244    // User name
    237     echo '<label for="user_name">' . __('Username:') . '</label>';
    238     if ( $errmsg = $errors->get_error_message('user_name') ) {
    239         echo '<p class="error">'.$errmsg.'</p>';
    240     }
    241     echo '<input name="user_name" type="text" id="user_name" value="'. esc_attr( $user_name ) .'" autocapitalize="none" autocorrect="off" maxlength="60" /><br />';
     245    echo '<label for="user_name">' . __( 'Username:' ) . '</label>';
     246    if ( $errmsg = $errors->get_error_message( 'user_name' ) ) {
     247        echo '<p class="error">' . $errmsg . '</p>';
     248    }
     249    echo '<input name="user_name" type="text" id="user_name" value="' . esc_attr( $user_name ) . '" autocapitalize="none" autocorrect="off" maxlength="60" /><br />';
    242250    _e( '(Must be at least 4 characters, letters and numbers only.)' );
    243251    ?>
    244252
    245     <label for="user_email"><?php _e( 'Email&nbsp;Address:' ) ?></label>
    246     <?php if ( $errmsg = $errors->get_error_message('user_email') ) { ?>
    247         <p class="error"><?php echo $errmsg ?></p>
     253    <label for="user_email"><?php _e( 'Email&nbsp;Address:' ); ?></label>
     254    <?php if ( $errmsg = $errors->get_error_message( 'user_email' ) ) { ?>
     255        <p class="error"><?php echo $errmsg; ?></p>
    248256    <?php } ?>
    249     <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.)') ?>
    250     <?php
    251     if ( $errmsg = $errors->get_error_message('generic') ) {
     257    <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    <?php
     259    if ( $errmsg = $errors->get_error_message( 'generic' ) ) {
    252260        echo '<p class="error">' . $errmsg . '</p>';
    253261    }
     
    270278 */
    271279function validate_user_form() {
    272     return wpmu_validate_user_signup($_POST['user_name'], $_POST['user_email']);
     280    return wpmu_validate_user_signup( $_POST['user_name'], $_POST['user_email'] );
    273281}
    274282
     
    285293    $current_user = wp_get_current_user();
    286294
    287     if ( ! is_wp_error($errors) ) {
     295    if ( ! is_wp_error( $errors ) ) {
    288296        $errors = new WP_Error();
    289297    }
     
    292300        'blogname'   => $blogname,
    293301        'blog_title' => $blog_title,
    294         'errors'     => $errors
     302        'errors'     => $errors,
    295303    );
    296304
     
    310318    $filtered_results = apply_filters( 'signup_another_blog_init', $signup_defaults );
    311319
    312     $blogname = $filtered_results['blogname'];
     320    $blogname   = $filtered_results['blogname'];
    313321    $blog_title = $filtered_results['blog_title'];
    314     $errors = $filtered_results['errors'];
     322    $errors     = $filtered_results['errors'];
    315323
    316324    echo '<h2>' . sprintf( __( 'Get <em>another</em> %s site in seconds' ), get_network()->site_name ) . '</h2>';
     
    320328    }
    321329    ?>
    322     <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&#8217;s content, but write responsibly!' ), $current_user->display_name ) ?></p>
    323 
    324     <?php
    325     $blogs = get_blogs_of_user($current_user->ID);
    326     if ( !empty($blogs) ) { ?>
    327 
    328             <p><?php _e( 'Sites you are already a member of:' ) ?></p>
     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&#8217;s content, but write responsibly!' ), $current_user->display_name ); ?></p>
     331
     332    <?php
     333    $blogs = get_blogs_of_user( $current_user->ID );
     334    if ( ! empty( $blogs ) ) {
     335    ?>
     336
     337            <p><?php _e( 'Sites you are already a member of:' ); ?></p>
    329338            <ul>
    330                 <?php foreach ( $blogs as $blog ) {
     339                <?php
     340                foreach ( $blogs as $blog ) {
    331341                    $home_url = get_home_url( $blog->userblog_id );
    332342                    echo '<li><a href="' . esc_url( $home_url ) . '">' . $home_url . '</a></li>';
    333                 } ?>
     343                }
     344                ?>
    334345            </ul>
    335346    <?php } ?>
    336347
    337     <p><?php _e( 'If you&#8217;re not going to use a great site domain, leave it for a new user. Now have at it!' ) ?></p>
     348    <p><?php _e( 'If you&#8217;re not going to use a great site domain, leave it for a new user. Now have at it!' ); ?></p>
    338349    <form id="setupform" method="post" action="wp-signup.php">
    339350        <input type="hidden" name="stage" value="gimmeanotherblog" />
     
    349360        do_action( 'signup_hidden_fields', 'create-another-site' );
    350361        ?>
    351         <?php show_blog_form($blogname, $blog_title, $errors); ?>
    352         <p class="submit"><input type="submit" name="submit" class="submit" value="<?php esc_attr_e( 'Create Site' ) ?>" /></p>
     362        <?php show_blog_form( $blogname, $blog_title, $errors ); ?>
     363        <p class="submit"><input type="submit" name="submit" class="submit" value="<?php esc_attr_e( 'Create Site' ); ?>" /></p>
    353364    </form>
    354365    <?php
     
    373384
    374385    // Extracted values set/overwrite globals.
    375     $domain = $result['domain'];
    376     $path = $result['path'];
    377     $blogname = $result['blogname'];
     386    $domain     = $result['domain'];
     387    $path       = $result['path'];
     388    $blogname   = $result['blogname'];
    378389    $blog_title = $result['blog_title'];
    379     $errors = $result['errors'];
     390    $errors     = $result['errors'];
    380391
    381392    if ( $errors->get_error_code() ) {
    382         signup_another_blog($blogname, $blog_title, $errors);
     393        signup_another_blog( $blogname, $blog_title, $errors );
    383394        return false;
    384395    }
     
    388399    $blog_meta_defaults = array(
    389400        'lang_id' => 1,
    390         'public'  => $public
     401        'public'  => $public,
    391402    );
    392403
     
    403414            }
    404415        }
    405 
    406416    }
    407417
     
    468478    }
    469479
    470     $site = sprintf( '<a href="%1$s">%2$s</a>',
     480    $site = sprintf(
     481        '<a href="%1$s">%2$s</a>',
    471482        esc_url( $home_url ),
    472483        $blog_title
     
    474485
    475486    ?>
    476     <h2><?php
     487    <h2>
     488    <?php
    477489        /* translators: %s: site name */
    478490        printf( __( 'The site %s is yours.' ), $site );
    479     ?></h2>
     491    ?>
     492    </h2>
    480493    <p>
    481         <?php printf(
     494        <?php
     495        printf(
    482496            /* translators: 1: link to new site, 2: login URL, 3: username */
    483497            __( '%1$s is your new site. <a href="%2$s">Log in</a> as &#8220;%3$s&#8221; using your existing password.' ),
     
    489503            esc_url( $login_url ),
    490504            $user_name
    491         ); ?>
     505        );
     506        ?>
    492507    </p>
    493508    <?php
     
    512527    global $active_signup;
    513528
    514     if ( !is_wp_error($errors) )
     529    if ( ! is_wp_error( $errors ) ) {
    515530        $errors = new WP_Error();
    516 
    517     $signup_for = isset( $_POST[ 'signup_for' ] ) ? esc_html( $_POST[ 'signup_for' ] ) : 'blog';
     531    }
     532
     533    $signup_for = isset( $_POST['signup_for'] ) ? esc_html( $_POST['signup_for'] ) : 'blog';
    518534
    519535    $signup_user_defaults = array(
     
    537553     */
    538554    $filtered_results = apply_filters( 'signup_user_init', $signup_user_defaults );
    539     $user_name = $filtered_results['user_name'];
    540     $user_email = $filtered_results['user_email'];
    541     $errors = $filtered_results['errors'];
    542 
    543     ?>
    544 
    545     <h2><?php
     555    $user_name        = $filtered_results['user_name'];
     556    $user_email       = $filtered_results['user_email'];
     557    $errors           = $filtered_results['errors'];
     558
     559    ?>
     560
     561    <h2>
     562    <?php
    546563        /* translators: %s: name of the network */
    547564        printf( __( 'Get your own %s account in seconds' ), get_network()->site_name );
    548     ?></h2>
     565    ?>
     566    </h2>
    549567    <form id="setupform" method="post" action="wp-signup.php" novalidate="novalidate">
    550568        <input type="hidden" name="stage" value="validate-user-signup" />
     
    553571        do_action( 'signup_hidden_fields', 'validate-user' );
    554572        ?>
    555         <?php show_user_form($user_name, $user_email, $errors); ?>
     573        <?php show_user_form( $user_name, $user_email, $errors ); ?>
    556574
    557575        <p>
     
    562580        <?php } else { ?>
    563581            <input id="signupblog" type="radio" name="signup_for" value="blog" <?php checked( $signup_for, 'blog' ); ?> />
    564             <label class="checkbox" for="signupblog"><?php _e('Gimme a site!') ?></label>
     582            <label class="checkbox" for="signupblog"><?php _e( 'Gimme a site!' ); ?></label>
    565583            <br />
    566584            <input id="signupuser" type="radio" name="signup_for" value="user" <?php checked( $signup_for, 'user' ); ?> />
    567             <label class="checkbox" for="signupuser"><?php _e('Just a username, please.') ?></label>
     585            <label class="checkbox" for="signupuser"><?php _e( 'Just a username, please.' ); ?></label>
    568586        <?php } ?>
    569587        </p>
    570588
    571         <p class="submit"><input type="submit" name="submit" class="submit" value="<?php esc_attr_e('Next') ?>" /></p>
     589        <p class="submit"><input type="submit" name="submit" class="submit" value="<?php esc_attr_e( 'Next' ); ?>" /></p>
    572590    </form>
    573591    <?php
     
    582600 */
    583601function validate_user_signup() {
    584     $result = validate_user_form();
    585     $user_name = $result['user_name'];
     602    $result     = validate_user_form();
     603    $user_name  = $result['user_name'];
    586604    $user_email = $result['user_email'];
    587     $errors = $result['errors'];
     605    $errors     = $result['errors'];
    588606
    589607    if ( $errors->get_error_code() ) {
    590         signup_user($user_name, $user_email, $errors);
     608        signup_user( $user_name, $user_email, $errors );
    591609        return false;
    592610    }
    593611
    594612    if ( 'blog' == $_POST['signup_for'] ) {
    595         signup_blog($user_name, $user_email);
     613        signup_blog( $user_name, $user_email );
    596614        return false;
    597615    }
     
    600618    wpmu_signup_user( $user_name, $user_email, apply_filters( 'add_signup_meta', array() ) );
    601619
    602     confirm_user_signup($user_name, $user_email);
     620    confirm_user_signup( $user_name, $user_email );
    603621    return true;
    604622}
     
    612630 * @param string $user_email The user's email address
    613631 */
    614 function confirm_user_signup($user_name, $user_email) {
    615     ?>
    616     <h2><?php /* translators: %s: username */
    617     printf( __( '%s is your new username' ), $user_name) ?></h2>
    618     <p><?php _e( 'But, before you can start using your new username, <strong>you must activate it</strong>.' ) ?></p>
    619     <p><?php /* translators: %s: email address */
    620     printf( __( 'Check your inbox at %s and click the link given.' ), '<strong>' . $user_email . '</strong>' ); ?></p>
     632function confirm_user_signup( $user_name, $user_email ) {
     633    ?>
     634    <h2>
     635    <?php
     636    /* translators: %s: username */
     637    printf( __( '%s is your new username' ), $user_name )
     638    ?>
     639    </h2>
     640    <p><?php _e( 'But, before you can start using your new username, <strong>you must activate it</strong>.' ); ?></p>
     641    <p>
     642    <?php
     643    /* translators: %s: email address */
     644    printf( __( 'Check your inbox at %s and click the link given.' ), '<strong>' . $user_email . '</strong>' );
     645    ?>
     646    </p>
    621647    <p><?php _e( 'If you do not activate your username within two days, you will have to sign up again.' ); ?></p>
    622648    <?php
     
    636662 * @param WP_Error|string $errors     A WP_Error object containing existing errors. Defaults to empty string.
    637663 */
    638 function signup_blog($user_name = '', $user_email = '', $blogname = '', $blog_title = '', $errors = '') {
    639     if ( !is_wp_error($errors) )
     664function signup_blog( $user_name = '', $user_email = '', $blogname = '', $blog_title = '', $errors = '' ) {
     665    if ( ! is_wp_error( $errors ) ) {
    640666        $errors = new WP_Error();
     667    }
    641668
    642669    $signup_blog_defaults = array(
     
    645672        'blogname'   => $blogname,
    646673        'blog_title' => $blog_title,
    647         'errors'     => $errors
     674        'errors'     => $errors,
    648675    );
    649676
     
    665692    $filtered_results = apply_filters( 'signup_blog_init', $signup_blog_defaults );
    666693
    667     $user_name = $filtered_results['user_name'];
     694    $user_name  = $filtered_results['user_name'];
    668695    $user_email = $filtered_results['user_email'];
    669     $blogname = $filtered_results['blogname'];
     696    $blogname   = $filtered_results['blogname'];
    670697    $blog_title = $filtered_results['blog_title'];
    671     $errors = $filtered_results['errors'];
    672 
    673     if ( empty($blogname) )
     698    $errors     = $filtered_results['errors'];
     699
     700    if ( empty( $blogname ) ) {
    674701        $blogname = $user_name;
     702    }
    675703    ?>
    676704    <form id="setupform" method="post" action="wp-signup.php">
    677705        <input type="hidden" name="stage" value="validate-blog-signup" />
    678         <input type="hidden" name="user_name" value="<?php echo esc_attr($user_name) ?>" />
    679         <input type="hidden" name="user_email" value="<?php echo esc_attr($user_email) ?>" />
     706        <input type="hidden" name="user_name" value="<?php echo esc_attr( $user_name ); ?>" />
     707        <input type="hidden" name="user_email" value="<?php echo esc_attr( $user_email ); ?>" />
    680708        <?php
    681709        /** This action is documented in wp-signup.php */
    682710        do_action( 'signup_hidden_fields', 'validate-site' );
    683711        ?>
    684         <?php show_blog_form($blogname, $blog_title, $errors); ?>
    685         <p class="submit"><input type="submit" name="submit" class="submit" value="<?php esc_attr_e('Signup') ?>" /></p>
     712        <?php show_blog_form( $blogname, $blog_title, $errors ); ?>
     713        <p class="submit"><input type="submit" name="submit" class="submit" value="<?php esc_attr_e( 'Signup' ); ?>" /></p>
    686714    </form>
    687715    <?php
     
    698726    // Re-validate user info.
    699727    $user_result = wpmu_validate_user_signup( $_POST['user_name'], $_POST['user_email'] );
    700     $user_name = $user_result['user_name'];
    701     $user_email = $user_result['user_email'];
     728    $user_name   = $user_result['user_name'];
     729    $user_email  = $user_result['user_email'];
    702730    $user_errors = $user_result['errors'];
    703731
     
    707735    }
    708736
    709     $result = wpmu_validate_blog_signup( $_POST['blogname'], $_POST['blog_title'] );
    710     $domain = $result['domain'];
    711     $path = $result['path'];
    712     $blogname = $result['blogname'];
     737    $result     = wpmu_validate_blog_signup( $_POST['blogname'], $_POST['blog_title'] );
     738    $domain     = $result['domain'];
     739    $path       = $result['path'];
     740    $blogname   = $result['blogname'];
    713741    $blog_title = $result['blog_title'];
    714     $errors = $result['errors'];
     742    $errors     = $result['errors'];
    715743
    716744    if ( $errors->get_error_code() ) {
    717         signup_blog($user_name, $user_email, $blogname, $blog_title, $errors);
     745        signup_blog( $user_name, $user_email, $blogname, $blog_title, $errors );
    718746        return false;
    719747    }
    720748
    721     $public = (int) $_POST['blog_public'];
    722     $signup_meta = array ('lang_id' => 1, 'public' => $public);
     749    $public      = (int) $_POST['blog_public'];
     750    $signup_meta = array(
     751        'lang_id' => 1,
     752        'public'  => $public,
     753    );
    723754
    724755    // Handle the language setting for the new site.
     
    734765            }
    735766        }
    736 
    737767    }
    738768
     
    740770    $meta = apply_filters( 'add_signup_meta', $signup_meta );
    741771
    742     wpmu_signup_blog($domain, $path, $blog_title, $user_name, $user_email, $meta);
    743     confirm_blog_signup($domain, $path, $blog_title, $user_name, $user_email, $meta);
     772    wpmu_signup_blog( $domain, $path, $blog_title, $user_name, $user_email, $meta );
     773    confirm_blog_signup( $domain, $path, $blog_title, $user_name, $user_email, $meta );
    744774    return true;
    745775}
     
    759789function confirm_blog_signup( $domain, $path, $blog_title, $user_name = '', $user_email = '', $meta = array() ) {
    760790    ?>
    761     <h2><?php /* translators: %s: site address */
    762     printf( __( 'Congratulations! Your new site, %s, is almost ready.' ), "<a href='http://{$domain}{$path}'>{$blog_title}</a>" ) ?></h2>
    763 
    764     <p><?php _e( 'But, before you can start using your site, <strong>you must activate it</strong>.' ) ?></p>
    765     <p><?php /* translators: %s: email address */
    766     printf( __( 'Check your inbox at %s and click the link given.' ), '<strong>' . $user_email . '</strong>' ); ?></p>
     791    <h2>
     792    <?php
     793    /* translators: %s: site address */
     794    printf( __( 'Congratulations! Your new site, %s, is almost ready.' ), "<a href='http://{$domain}{$path}'>{$blog_title}</a>" )
     795    ?>
     796    </h2>
     797
     798    <p><?php _e( 'But, before you can start using your site, <strong>you must activate it</strong>.' ); ?></p>
     799    <p>
     800    <?php
     801    /* translators: %s: email address */
     802    printf( __( 'Check your inbox at %s and click the link given.' ), '<strong>' . $user_email . '</strong>' );
     803    ?>
     804    </p>
    767805    <p><?php _e( 'If you do not activate your site within two days, you will have to sign up again.' ); ?></p>
    768806    <h2><?php _e( 'Still waiting for your email?' ); ?></h2>
    769807    <p>
    770         <?php _e( 'If you haven&#8217;t received your email yet, there are a number of things you can do:' ) ?>
     808        <?php _e( 'If you haven&#8217;t received your email yet, there are a number of things you can do:' ); ?>
    771809        <ul id="noemail-tips">
    772             <li><p><strong><?php _e( 'Wait a little longer. Sometimes delivery of email can be delayed by processes outside of our control.' ) ?></strong></p></li>
    773             <li><p><?php _e( 'Check the junk or spam folder of your email client. Sometime emails wind up there by mistake.' ) ?></p></li>
    774             <li><?php
     810            <li><p><strong><?php _e( 'Wait a little longer. Sometimes delivery of email can be delayed by processes outside of our control.' ); ?></strong></p></li>
     811            <li><p><?php _e( 'Check the junk or spam folder of your email client. Sometime emails wind up there by mistake.' ); ?></p></li>
     812            <li>
     813            <?php
    775814                /* translators: %s: email address */
    776815                printf( __( 'Have you entered your email correctly? You have entered %s, if it&#8217;s incorrect, you will not receive your email.' ), $user_email );
    777             ?></li>
     816            ?>
     817            </li>
    778818        </ul>
    779819    </p>
     
    856896}
    857897
    858 $newblogname = isset($_GET['new']) ? strtolower(preg_replace('/^-|-$|[^-a-zA-Z0-9]/', '', $_GET['new'])) : null;
     898$newblogname = isset( $_GET['new'] ) ? strtolower( preg_replace( '/^-|-$|[^-a-zA-Z0-9]/', '', $_GET['new'] ) ) : null;
    859899
    860900$current_user = wp_get_current_user();
    861901if ( $active_signup == 'none' ) {
    862902    _e( 'Registration has been disabled.' );
    863 } elseif ( $active_signup == 'blog' && !is_user_logged_in() ) {
     903} elseif ( $active_signup == 'blog' && ! is_user_logged_in() ) {
    864904    $login_url = wp_login_url( network_site_url( 'wp-signup.php' ) );
    865905    /* translators: %s: login URL */
    866906    printf( __( 'You must first <a href="%s">log in</a>, and then you can create a new site.' ), $login_url );
    867907} else {
    868     $stage = isset( $_POST['stage'] ) ?  $_POST['stage'] : 'default';
     908    $stage = isset( $_POST['stage'] ) ? $_POST['stage'] : 'default';
    869909    switch ( $stage ) {
    870         case 'validate-user-signup' :
    871             if ( $active_signup == 'all' || $_POST[ 'signup_for' ] == 'blog' && $active_signup == 'blog' || $_POST[ 'signup_for' ] == 'user' && $active_signup == 'user' )
     910        case 'validate-user-signup':
     911            if ( $active_signup == 'all' || $_POST['signup_for'] == 'blog' && $active_signup == 'blog' || $_POST['signup_for'] == 'user' && $active_signup == 'user' ) {
    872912                validate_user_signup();
    873             else
     913            } else {
    874914                _e( 'User registration has been disabled.' );
    875         break;
     915            }
     916            break;
    876917        case 'validate-blog-signup':
    877             if ( $active_signup == 'all' || $active_signup == 'blog' )
     918            if ( $active_signup == 'all' || $active_signup == 'blog' ) {
    878919                validate_blog_signup();
    879             else
     920            } else {
    880921                _e( 'Site registration has been disabled.' );
     922            }
    881923            break;
    882924        case 'gimmeanotherblog':
     
    884926            break;
    885927        case 'default':
    886         default :
    887             $user_email = isset( $_POST[ 'user_email' ] ) ? $_POST[ 'user_email' ] : '';
     928        default:
     929            $user_email = isset( $_POST['user_email'] ) ? $_POST['user_email'] : '';
    888930            /**
    889931             * Fires when the site sign-up form is sent.
     
    892934             */
    893935            do_action( 'preprocess_signup_form' );
    894             if ( is_user_logged_in() && ( $active_signup == 'all' || $active_signup == 'blog' ) )
    895                 signup_another_blog($newblogname);
    896             elseif ( ! is_user_logged_in() && ( $active_signup == 'all' || $active_signup == 'user' ) )
     936            if ( is_user_logged_in() && ( $active_signup == 'all' || $active_signup == 'blog' ) ) {
     937                signup_another_blog( $newblogname );
     938            } elseif ( ! is_user_logged_in() && ( $active_signup == 'all' || $active_signup == 'user' ) ) {
    897939                signup_user( $newblogname, $user_email );
    898             elseif ( ! is_user_logged_in() && ( $active_signup == 'blog' ) )
     940            } elseif ( ! is_user_logged_in() && ( $active_signup == 'blog' ) ) {
    899941                _e( 'Sorry, new registrations are not allowed at this time.' );
    900             else
     942            } else {
    901943                _e( 'You are logged in already. No need to register again!' );
     944            }
    902945
    903946            if ( $newblogname ) {
    904947                $newblog = get_blogaddress_by_name( $newblogname );
    905948
    906                 if ( $active_signup == 'blog' || $active_signup == 'all' )
     949                if ( $active_signup == 'blog' || $active_signup == 'all' ) {
    907950                    /* translators: %s: site address */
    908                     printf( '<p><em>' . __( 'The site you were looking for, %s, does not exist, but you can create it now!' ) . '</em></p>',
     951                    printf(
     952                        '<p><em>' . __( 'The site you were looking for, %s, does not exist, but you can create it now!' ) . '</em></p>',
    909953                        '<strong>' . $newblog . '</strong>'
    910954                    );
    911                 else
    912                     /* translators: %s: site address */
    913                     printf( '<p><em>' . __( 'The site you were looking for, %s, does not exist.' ) . '</em></p>',
     955                } else {                  /* translators: %s: site address */
     956                    printf(
     957                        '<p><em>' . __( 'The site you were looking for, %s, does not exist.' ) . '</em></p>',
    914958                        '<strong>' . $newblog . '</strong>'
    915959                    );
     960                }
    916961            }
    917962            break;
     
    927972 * @since 3.0.0
    928973 */
    929 do_action( 'after_signup_form' ); ?>
    930 
    931 <?php get_footer( 'wp-signup' );
     974do_action( 'after_signup_form' );
     975?>
     976
     977<?php
     978get_footer( 'wp-signup' );
Note: See TracChangeset for help on using the changeset viewer.