<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" /><style type="text/css"><!--
#msg dl { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; }
#msg dl a { font-weight: bold}
#msg dl a:link { color:#fc3; }
#msg dl a:active { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fc0 solid; padding: 6px; }
#msg ul, pre { overflow: auto; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<title>[13124] trunk/wp-admin/install.php: install.php whitespace cleanup,
inline docs, function @sinces, fixes #11491</title>
</head>
<body>
<div id="msg">
<dl>
<dt>Revision</dt> <dd><a href="http://trac.wordpress.org/changeset/13124">13124</a></dd>
<dt>Author</dt> <dd>nacin</dd>
<dt>Date</dt> <dd>2010-02-13 20:40:42 +0000 (Sat, 13 Feb 2010)</dd>
</dl>
<h3>Log Message</h3>
<pre>install.php whitespace cleanup, inline docs, function @sinces, fixes <a href="http://trac.wordpress.org/ticket/11491">#11491</a></pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkwpadmininstallphp">trunk/wp-admin/install.php</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkwpadmininstallphp"></a>
<div class="modfile"><h4>Modified: trunk/wp-admin/install.php (13123 => 13124)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-admin/install.php        2010-02-13 20:17:15 UTC (rev 13123)
+++ trunk/wp-admin/install.php        2010-02-13 20:40:42 UTC (rev 13124)
</span><span class="lines">@@ -9,78 +9,84 @@
</span><span class="cx"> /**
</span><span class="cx"> * We are installing WordPress.
</span><span class="cx"> *
</span><del>- * @since unknown
</del><ins>+ * @since 1.5.1
</ins><span class="cx"> * @var bool
</span><span class="cx"> */
</span><del>-define('WP_INSTALLING', true);
</del><ins>+define( 'WP_INSTALLING', true );
</ins><span class="cx">
</span><span class="cx"> /** Load WordPress Bootstrap */
</span><del>-require_once(dirname(dirname(__FILE__)) . '/wp-load.php');
</del><ins>+require_once( dirname( dirname( __FILE__ ) ) . '/wp-load.php' );
</ins><span class="cx">
</span><span class="cx"> /** Load WordPress Administration Upgrade API */
</span><del>-require_once(dirname(__FILE__) . '/includes/upgrade.php');
</del><ins>+require_once( dirname( __FILE__ ) . '/includes/upgrade.php' );
</ins><span class="cx">
</span><del>-if (isset($_GET['step']))
-        $step = $_GET['step'];
-else
-        $step = 0;
</del><ins>+$step = isset( $_GET['step'] ) ? $_GET['step'] : 0;
</ins><span class="cx">
</span><span class="cx"> /**
</span><span class="cx"> * Display install header.
</span><span class="cx"> *
</span><del>- * @since unknown
</del><ins>+ * @since 2.5.0
</ins><span class="cx"> * @package WordPress
</span><span class="cx"> * @subpackage Installer
</span><span class="cx"> */
</span><span class="cx"> function display_header() {
</span><del>-header( 'Content-Type: text/html; charset=utf-8' );
</del><ins>+        header( 'Content-Type: text/html; charset=utf-8' );
</ins><span class="cx"> ?>
</span><span class="cx"> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
</span><span class="cx"> <html xmlns="http://www.w3.org/1999/xhtml" <?php language_attributes(); ?>>
</span><span class="cx"> <head>
</span><span class="cx">         <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
</span><del>-        <title><?php _e('WordPress &rsaquo; Installation'); ?></title>
</del><ins>+        <title><?php _e( 'WordPress &rsaquo; Installation' ); ?></title>
</ins><span class="cx">         <?php wp_admin_css( 'install', true ); ?>
</span><span class="cx"> </head>
</span><span class="cx"> <body>
</span><span class="cx"> <h1 id="logo"><img alt="WordPress" src="images/wordpress-logo.png" /></h1>
</span><span class="cx">
</span><span class="cx"> <?php
</span><del>-}//end function display_header();
</del><ins>+} // end display_header()
</ins><span class="cx">
</span><ins>+/**
+ * Display installer setup form.
+ *
+ * @since 2.8.0
+ * @package WordPress
+ * @subpackage Installer
+ */
</ins><span class="cx"> function display_setup_form( $error = null ) {
</span><span class="cx">         // Ensure that Blogs appear in search engines by default
</span><span class="cx">         $blog_public = 1;
</span><del>-        if ( isset($_POST) && !empty($_POST) ) {
-                $blog_public = isset($_POST['blog_public']);
-        }
</del><ins>+        if ( isset( $_POST ) && ! empty( $_POST ) )
+                $blog_public = isset( $_POST['blog_public'] );
</ins><span class="cx">
</span><span class="cx">         if ( ! is_null( $error ) ) {
</span><span class="cx"> ?>
</span><del>-<p><?php printf( __('<strong>ERROR</strong>: %s'), $error); ?></p>
</del><ins>+<p><?php printf( __( '<strong>ERROR</strong>: %s' ), $error ); ?></p>
</ins><span class="cx"> <?php } ?>
</span><span class="cx"> <form id="setup" method="post" action="install.php?step=2">
</span><span class="cx">         <table class="form-table">
</span><span class="cx">                 <tr>
</span><del>-                        <th scope="row"><label for="weblog_title"><?php _e('Blog Title'); ?></label></th>
-                        <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>
</del><ins>+                        <th scope="row"><label for="weblog_title"><?php _e( 'Blog Title' ); ?></label></th>
+                        <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>
</ins><span class="cx">                 </tr>
</span><span class="cx">                 <tr>
</span><del>-                        <th scope="row"><label for="admin_email"><?php _e('Your E-mail'); ?></label></th>
-                        <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 />
-                        <?php _e('Double-check your email address before continuing.'); ?></td>
</del><ins>+                        <th scope="row"><label for="admin_email"><?php _e( 'Your E-mail' ); ?></label></th>
+                        <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 />
+                        <?php _e( 'Double-check your email address before continuing.' ); ?></td>
</ins><span class="cx">                 </tr>
</span><span class="cx">                 <tr>
</span><del>-                        <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>
</del><ins>+                        <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>
</ins><span class="cx">                 </tr>
</span><span class="cx">         </table>
</span><del>-        <p class="step"><input type="submit" name="Submit" value="<?php esc_attr_e('Install WordPress'); ?>" class="button" /></p>
</del><ins>+        <p class="step"><input type="submit" name="Submit" value="<?php esc_attr_e( 'Install WordPress' ); ?>" class="button" /></p>
</ins><span class="cx"> </form>
</span><span class="cx"> <?php
</span><del>-}
</del><ins>+} // end display_setup_form()
</ins><span class="cx">
</span><span class="cx"> // Let's check to make sure WP isn't already installed.
</span><del>-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>');}
</del><ins>+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>' );
+}
</ins><span class="cx">
</span><span class="cx"> $php_version = phpversion();
</span><span class="cx"> $mysql_version = $wpdb->db_version();
</span><span class="lines">@@ -100,68 +106,66 @@
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> switch($step) {
</span><del>-        case 0:
-        case 1: // in case people are directly linking to this
</del><ins>+        case 0: // Step 1
+        case 1: // Step 1, direct link.
</ins><span class="cx">          display_header();
</span><span class="cx"> ?>
</span><del>-<h1><?php _e('Welcome'); ?></h1>
-<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>
-<!--<h2 class="step"><a href="install.php?step=1"><?php _e('First Step'); ?></a></h2>-->
</del><ins>+<h1><?php _e( 'Welcome' ); ?></h1>
+<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>
</ins><span class="cx">
</span><del>-<h1><?php _e('Information needed'); ?></h1>
-<p><?php _e('Please provide the following information. Don&#8217;t worry, you can always change these settings later.'); ?></p>
</del><ins>+<h1><?php _e( 'Information needed' ); ?></h1>
+<p><?php _e( 'Please provide the following information. Don&#8217;t worry, you can always change these settings later.' ); ?></p>
</ins><span class="cx">
</span><del>-
-
</del><span class="cx"> <?php
</span><span class="cx">                 display_setup_form();
</span><span class="cx">                 break;
</span><span class="cx">         case 2:
</span><del>-                if ( !empty($wpdb->error) )
-                        wp_die($wpdb->error->get_error_message());
</del><ins>+                if ( ! empty( $wpdb->error ) )
+                        wp_die( $wpdb->error->get_error_message() );
</ins><span class="cx">
</span><span class="cx">                 display_header();
</span><span class="cx">                 // Fill in the data we gathered
</span><del>-                $weblog_title = isset($_POST['weblog_title']) ? stripslashes($_POST['weblog_title']) : '';
-                $admin_email = isset($_POST['admin_email']) ? stripslashes($_POST['admin_email']) : '';
-                $public = isset($_POST['blog_public']) ? (int) $_POST['blog_public'] : 0;
</del><ins>+                $weblog_title = isset( $_POST['weblog_title'] ) ? stripslashes( $_POST['weblog_title'] ) : '';
+                $admin_email = isset( $_POST['admin_email'] ) ? stripslashes( $_POST['admin_email'] ) : '';
+                $public = isset( $_POST['blog_public'] ) ? (int) $_POST['blog_public'] : 0;
</ins><span class="cx">                 // check e-mail address
</span><span class="cx">                 $error = false;
</span><del>-                if (empty($admin_email)) {
</del><ins>+                if ( empty( $admin_email ) ) {
</ins><span class="cx">                         // TODO: poka-yoke
</span><del>-                        display_setup_form( __('you must provide an e-mail address.') );
</del><ins>+                        display_setup_form( __( 'you must provide an e-mail address.' ) );
</ins><span class="cx">                         $error = true;
</span><del>-                } else if (!is_email($admin_email)) {
</del><ins>+                } elseif ( ! is_email( $admin_email ) ) {
</ins><span class="cx">                         // TODO: poka-yoke
</span><del>-                        display_setup_form( __('that isn&#8217;t a valid e-mail address. E-mail addresses look like: <code>username@example.com</code>') );
</del><ins>+                        display_setup_form( __( 'that isn&#8217;t a valid e-mail address. E-mail addresses look like: <code>username@example.com</code>' ) );
</ins><span class="cx">                         $error = true;
</span><span class="cx">                 }
</span><span class="cx">
</span><span class="cx">                 if ( $error === false ) {
</span><span class="cx">                         $wpdb->show_errors();
</span><del>-                        $result = wp_install($weblog_title, 'admin', $admin_email, $public);
-                        extract($result, EXTR_SKIP);
</del><ins>+                        $result = wp_install( $weblog_title, 'admin', $admin_email, $public );
+                        extract( $result, EXTR_SKIP );
</ins><span class="cx"> ?>
</span><span class="cx">
</span><del>-<h1><?php _e('Success!'); ?></h1>
</del><ins>+<h1><?php _e( 'Success!' ); ?></h1>
</ins><span class="cx">
</span><del>-<p><?php printf(__('WordPress has been installed. Were you expecting more steps? Sorry to disappoint.'), ''); ?></p>
</del><ins>+<p><?php _e( 'WordPress has been installed. Were you expecting more steps? Sorry to disappoint.' ); ?></p>
</ins><span class="cx">
</span><span class="cx"> <table class="form-table">
</span><span class="cx">         <tr>
</span><del>-                <th><?php _e('Username'); ?></th>
</del><ins>+                <th><?php _e( 'Username' ); ?></th>
</ins><span class="cx">                 <td><code>admin</code></td>
</span><span class="cx">         </tr>
</span><span class="cx">         <tr>
</span><del>-                <th><?php _e('Password'); ?></th>
-                <td><?php if ( !empty( $password ) ) {
-                                                echo '<code>'. $password .'</code><br />';
-                                        }
-                                        echo '<p>'. $password_message .'</p>'; ?></td>
</del><ins>+                <th><?php _e( 'Password' ); ?></th>
+                <td><?php
+                if ( ! empty( $password ) )
+                        echo "<code>$password</code><br />";
+                echo "<p>$password_message</p>"; ?>
+                </td>
</ins><span class="cx">         </tr>
</span><span class="cx"> </table>
</span><span class="cx">
</span><del>-<p class="step"><a href="../wp-login.php" class="button"><?php _e('Log In'); ?></a></p>
</del><ins>+<p class="step"><a href="../wp-login.php" class="button"><?php _e( 'Log In' ); ?></a></p>
</ins><span class="cx">
</span><span class="cx"> <?php
</span><span class="cx">                 }
</span></span></pre>
</div>
</div>
</body>
</html>