Make WordPress Core

Changeset 13124


Ignore:
Timestamp:
02/13/2010 08:40:42 PM (15 years ago)
Author:
nacin
Message:

install.php whitespace cleanup, inline docs, function @sinces, fixes #11491

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-admin/install.php

    r12577 r13124  
    1010 * We are installing WordPress.
    1111 *
    12  * @since unknown
     12 * @since 1.5.1
    1313 * @var bool
    1414 */
    15 define('WP_INSTALLING', true);
     15define( 'WP_INSTALLING', true );
    1616
    1717/** Load WordPress Bootstrap */
    18 require_once(dirname(dirname(__FILE__)) . '/wp-load.php');
     18require_once( dirname( dirname( __FILE__ ) ) . '/wp-load.php' );
    1919
    2020/** Load WordPress Administration Upgrade API */
    21 require_once(dirname(__FILE__) . '/includes/upgrade.php');
     21require_once( dirname( __FILE__ ) . '/includes/upgrade.php' );
    2222
    23 if (isset($_GET['step']))
    24     $step = $_GET['step'];
    25 else
    26     $step = 0;
     23$step = isset( $_GET['step'] ) ? $_GET['step'] : 0;
    2724
    2825/**
    2926 * Display install header.
    3027 *
    31  * @since unknown
     28 * @since 2.5.0
    3229 * @package WordPress
    3330 * @subpackage Installer
    3431 */
    3532function display_header() {
    36 header( 'Content-Type: text/html; charset=utf-8' );
     33    header( 'Content-Type: text/html; charset=utf-8' );
    3734?>
    3835<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
     
    4037<head>
    4138    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    42     <title><?php _e('WordPress &rsaquo; Installation'); ?></title>
     39    <title><?php _e( 'WordPress &rsaquo; Installation' ); ?></title>
    4340    <?php wp_admin_css( 'install', true ); ?>
    4441</head>
     
    4744
    4845<?php
    49 }//end function display_header();
     46} // end display_header()
    5047
     48/**
     49 * Display installer setup form.
     50 *
     51 * @since 2.8.0
     52 * @package WordPress
     53 * @subpackage Installer
     54 */
    5155function display_setup_form( $error = null ) {
    5256    // Ensure that Blogs appear in search engines by default
    5357    $blog_public = 1;
    54     if ( isset($_POST) && !empty($_POST) ) {
    55         $blog_public = isset($_POST['blog_public']);
    56     }
     58    if ( isset( $_POST ) && ! empty( $_POST ) )
     59        $blog_public = isset( $_POST['blog_public'] );
    5760
    5861    if ( ! is_null( $error ) ) {
    5962?>
    60 <p><?php printf( __('<strong>ERROR</strong>: %s'), $error); ?></p>
     63<p><?php printf( __( '<strong>ERROR</strong>: %s' ), $error ); ?></p>
    6164<?php } ?>
    6265<form id="setup" method="post" action="install.php?step=2">
    6366    <table class="form-table">
    6467        <tr>
    65             <th scope="row"><label for="weblog_title"><?php _e('Blog Title'); ?></label></th>
    66             <td><input name="weblog_title" type="text" id="weblog_title" size="25" value="<?php echo ( isset($_POST['weblog_title']) ? esc_attr($_POST['weblog_title']) : '' ); ?>" /></td>
     68            <th scope="row"><label for="weblog_title"><?php _e( 'Blog Title' ); ?></label></th>
     69            <td><input name="weblog_title" type="text" id="weblog_title" size="25" value="<?php echo ( isset( $_POST['weblog_title'] ) ? esc_attr( $_POST['weblog_title'] ) : '' ); ?>" /></td>
    6770        </tr>
    6871        <tr>
    69             <th scope="row"><label for="admin_email"><?php _e('Your E-mail'); ?></label></th>
    70             <td><input name="admin_email" type="text" id="admin_email" size="25" value="<?php echo ( isset($_POST['admin_email']) ? esc_attr($_POST['admin_email']) : '' ); ?>" /><br />
    71             <?php _e('Double-check your email address before continuing.'); ?></td>
     72            <th scope="row"><label for="admin_email"><?php _e( 'Your E-mail' ); ?></label></th>
     73            <td><input name="admin_email" type="text" id="admin_email" size="25" value="<?php echo ( isset( $_POST['admin_email'] ) ? esc_attr( $_POST['admin_email'] ) : '' ); ?>" /><br />
     74            <?php _e( 'Double-check your email address before continuing.' ); ?></td>
    7275        </tr>
    7376        <tr>
    74             <td colspan="2"><label><input type="checkbox" name="blog_public" value="1" <?php checked($blog_public); ?> /> <?php _e('Allow my blog to appear in search engines like Google and Technorati.'); ?></label></td>
     77            <td colspan="2"><label><input type="checkbox" name="blog_public" value="1" <?php checked( $blog_public ); ?> /> <?php _e( 'Allow my blog to appear in search engines like Google and Technorati.' ); ?></label></td>
    7578        </tr>
    7679    </table>
    77     <p class="step"><input type="submit" name="Submit" value="<?php esc_attr_e('Install WordPress'); ?>" class="button" /></p>
     80    <p class="step"><input type="submit" name="Submit" value="<?php esc_attr_e( 'Install WordPress' ); ?>" class="button" /></p>
    7881</form>
    7982<?php
    80 }
     83} // end display_setup_form()
    8184
    8285// Let's check to make sure WP isn't already installed.
    83 if ( is_blog_installed() ) {display_header(); die('<h1>'.__('Already Installed').'</h1><p>'.__('You appear to have already installed WordPress. To reinstall please clear your old database tables first.').'</p></body></html>');}
     86if ( is_blog_installed() ) {
     87    display_header();
     88    die( '<h1>' . __( 'Already Installed' ) . '</h1><p>' . __( 'You appear to have already installed WordPress. To reinstall please clear your old database tables first.' ) . '</p></body></html>' );
     89}
    8490
    8591$php_version    = phpversion();
     
    101107
    102108switch($step) {
    103     case 0:
    104     case 1: // in case people are directly linking to this
     109    case 0: // Step 1
     110    case 1: // Step 1, direct link.
    105111      display_header();
    106112?>
    107 <h1><?php _e('Welcome'); ?></h1>
    108 <p><?php printf(__('Welcome to the famous five minute WordPress installation process! You may want to browse the <a href="%s">ReadMe documentation</a> at your leisure.  Otherwise, just fill in the information below and you&#8217;ll be on your way to using the most extendable and powerful personal publishing platform in the world.'), '../readme.html'); ?></p>
    109 <!--<h2 class="step"><a href="install.php?step=1"><?php _e('First Step'); ?></a></h2>-->
     113<h1><?php _e( 'Welcome' ); ?></h1>
     114<p><?php printf( __( 'Welcome to the famous five minute WordPress installation process! You may want to browse the <a href="%s">ReadMe documentation</a> at your leisure. Otherwise, just fill in the information below and you&#8217;ll be on your way to using the most extendable and powerful personal publishing platform in the world.' ), '../readme.html' ); ?></p>
    110115
    111 <h1><?php _e('Information needed'); ?></h1>
    112 <p><?php _e('Please provide the following information.  Don&#8217;t worry, you can always change these settings later.'); ?></p>
    113 
    114 
     116<h1><?php _e( 'Information needed' ); ?></h1>
     117<p><?php _e( 'Please provide the following information. Don&#8217;t worry, you can always change these settings later.' ); ?></p>
    115118
    116119<?php
     
    118121        break;
    119122    case 2:
    120         if ( !empty($wpdb->error) )
    121             wp_die($wpdb->error->get_error_message());
     123        if ( ! empty( $wpdb->error ) )
     124            wp_die( $wpdb->error->get_error_message() );
    122125
    123126        display_header();
    124127        // Fill in the data we gathered
    125         $weblog_title = isset($_POST['weblog_title']) ? stripslashes($_POST['weblog_title']) : '';
    126         $admin_email = isset($_POST['admin_email']) ? stripslashes($_POST['admin_email']) : '';
    127         $public = isset($_POST['blog_public']) ? (int) $_POST['blog_public'] : 0;
     128        $weblog_title = isset( $_POST['weblog_title'] ) ? stripslashes( $_POST['weblog_title'] ) : '';
     129        $admin_email  = isset( $_POST['admin_email']  ) ? stripslashes( $_POST['admin_email'] ) : '';
     130        $public       = isset( $_POST['blog_public']  ) ? (int) $_POST['blog_public'] : 0;
    128131        // check e-mail address
    129132        $error = false;
    130         if (empty($admin_email)) {
     133        if ( empty( $admin_email ) ) {
    131134            // TODO: poka-yoke
    132             display_setup_form( __('you must provide an e-mail address.') );
     135            display_setup_form( __( 'you must provide an e-mail address.' ) );
    133136            $error = true;
    134         } else if (!is_email($admin_email)) {
     137        } elseif ( ! is_email( $admin_email ) ) {
    135138            // TODO: poka-yoke
    136             display_setup_form( __('that isn&#8217;t a valid e-mail address.  E-mail addresses look like: <code>username@example.com</code>') );
     139            display_setup_form( __( 'that isn&#8217;t a valid e-mail address.  E-mail addresses look like: <code>username@example.com</code>' ) );
    137140            $error = true;
    138141        }
     
    140143        if ( $error === false ) {
    141144            $wpdb->show_errors();
    142             $result = wp_install($weblog_title, 'admin', $admin_email, $public);
    143             extract($result, EXTR_SKIP);
     145            $result = wp_install( $weblog_title, 'admin', $admin_email, $public );
     146            extract( $result, EXTR_SKIP );
    144147?>
    145148
    146 <h1><?php _e('Success!'); ?></h1>
     149<h1><?php _e( 'Success!' ); ?></h1>
    147150
    148 <p><?php printf(__('WordPress has been installed. Were you expecting more steps? Sorry to disappoint.'), ''); ?></p>
     151<p><?php _e( 'WordPress has been installed. Were you expecting more steps? Sorry to disappoint.' ); ?></p>
    149152
    150153<table class="form-table">
    151154    <tr>
    152         <th><?php _e('Username'); ?></th>
     155        <th><?php _e( 'Username' ); ?></th>
    153156        <td><code>admin</code></td>
    154157    </tr>
    155158    <tr>
    156         <th><?php _e('Password'); ?></th>
    157         <td><?php if ( !empty( $password ) ) {
    158                         echo '<code>'. $password .'</code><br />';
    159                     }
    160                     echo '<p>'. $password_message .'</p>'; ?></td>
     159        <th><?php _e( 'Password' ); ?></th>
     160        <td><?php
     161        if ( ! empty( $password ) )
     162            echo "<code>$password</code><br />";
     163        echo "<p>$password_message</p>"; ?>
     164        </td>
    161165    </tr>
    162166</table>
    163167
    164 <p class="step"><a href="../wp-login.php" class="button"><?php _e('Log In'); ?></a></p>
     168<p class="step"><a href="../wp-login.php" class="button"><?php _e( 'Log In' ); ?></a></p>
    165169
    166170<?php
Note: See TracChangeset for help on using the changeset viewer.