<!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>[12865] trunk/wp-admin/network.php: Whitespace cleanup and inline docs.</title>
</head>
<body>

<div id="msg">
<dl>
<dt>Revision</dt> <dd><a href="http://trac.wordpress.org/changeset/12865">12865</a></dd>
<dt>Author</dt> <dd>ryan</dd>
<dt>Date</dt> <dd>2010-01-27 13:48:37 +0000 (Wed, 27 Jan 2010)</dd>
</dl>

<h3>Log Message</h3>
<pre>Whitespace cleanup and inline docs. Props nacin. see <a href="http://trac.wordpress.org/ticket/12027">#12027</a></pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkwpadminnetworkphp">trunk/wp-admin/network.php</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkwpadminnetworkphp"></a>
<div class="modfile"><h4>Modified: trunk/wp-admin/network.php (12864 => 12865)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-admin/network.php        2010-01-27 02:59:26 UTC (rev 12864)
+++ trunk/wp-admin/network.php        2010-01-27 13:48:37 UTC (rev 12865)
</span><span class="lines">@@ -2,30 +2,28 @@
</span><span class="cx"> /**
</span><span class="cx">  * Network settings administration panel.
</span><span class="cx">  *
</span><del>- * @since 3.0
</del><ins>+ * A multi-step process allowing the user to enable a network of WordPress sites.
</ins><span class="cx">  *
</span><ins>+ * @since 3.0.0
+ *
</ins><span class="cx">  * @package WordPress
</span><span class="cx">  * @subpackage Administration
</span><span class="cx">  */
</span><span class="cx"> 
</span><span class="cx"> /** WordPress Administration Bootstrap */
</span><del>-require_once('./admin.php');
</del><ins>+require_once( './admin.php' );
</ins><span class="cx"> 
</span><span class="cx"> if ( ! is_super_admin() )
</span><del>-        wp_die(__('You do not have sufficient permissions to manage options for this blog.'));
</del><ins>+        wp_die( __( 'You do not have sufficient permissions to manage options for this blog.' ) );
</ins><span class="cx"> 
</span><del>-$title = __('Network Settings');
</del><ins>+$title = __( 'Network Settings' );
</ins><span class="cx"> $parent_file = 'tools.php';
</span><span class="cx"> 
</span><del>-add_contextual_help($current_screen, __('&lt;a href=&quot;http://codex.wordpress.org/Settings_Network_SubPanel&quot; target=&quot;_blank&quot;&gt;Network Settings&lt;/a&gt;'));
</del><ins>+add_contextual_help( $current_screen, __( '&lt;a href=&quot;http://codex.wordpress.org/Settings_Network_SubPanel&quot; target=&quot;_blank&quot;&gt;Network Settings&lt;/a&gt;') );
</ins><span class="cx"> 
</span><del>-include('./admin-header.php');
-/*
-This option panel does not save data to the options table.
-It contains a multi-step process allowing the user to enable a network of WordPress sites.
-*/
</del><ins>+include( './admin-header.php' );
</ins><span class="cx"> 
</span><del>-$dirs = array( substr( ABSPATH, 0, -1), ABSPATH . &quot;wp-content&quot; );
</del><ins>+$dirs = array( substr( ABSPATH, 0, -1 ), ABSPATH . 'wp-content' );
</ins><span class="cx"> ?&gt;
</span><span class="cx"> &lt;div class=&quot;wrap&quot;&gt;
</span><span class="cx"> &lt;?php screen_icon(); ?&gt;
</span><span class="lines">@@ -33,91 +31,107 @@
</span><span class="cx"> 
</span><span class="cx"> &lt;form method=&quot;post&quot; action=&quot;network.php&quot;&gt;
</span><span class="cx"> &lt;?php
</span><ins>+/**
+ * Prints summary of server statistics in preparation for setting up a network.
+ *
+ * @since 3.0.0
+ */
</ins><span class="cx"> function filestats( $err ) {
</span><span class="cx"> ?&gt;
</span><del>-        &lt;h2&gt;&lt;?php esc_html_e('Server Summary'); ?&gt;&lt;/h2&gt;
-        &lt;p&gt;&lt;?php _e('If you post a message to the WordPress support forum at &lt;a target=&quot;_blank&quot; href=&quot;http://wordpress.org/support/&quot;&gt;http://wordpress.org/support/&lt;/a&gt; then copy and paste the following information into your message:'); ?&gt;&lt;/p&gt;
</del><ins>+        &lt;h2&gt;&lt;?php esc_html_e( 'Server Summary' ); ?&gt;&lt;/h2&gt;
+        &lt;p&gt;&lt;?php _e( 'If you post a message to the WordPress support forum at &lt;a target=&quot;_blank&quot; href=&quot;http://wordpress.org/support/&quot;&gt;http://wordpress.org/support/&lt;/a&gt; then copy and paste the following information into your message:' ); ?&gt;&lt;/p&gt;
</ins><span class="cx">         &lt;blockquote style=&quot;background: #eee; border: 1px solid #333; padding: 5px;&quot;&gt;
</span><del>-        &lt;br /&gt;&lt;strong&gt;&lt;?php echo __('ERROR:') . &quot; $err&quot;; ?&gt;&lt;/strong&gt;&lt;br /&gt;
</del><ins>+        &lt;br /&gt;&lt;strong&gt;&lt;?php printf( __( 'ERROR: %s' ), $err ); ?&gt;&lt;/strong&gt;&lt;br /&gt;
</ins><span class="cx"> &lt;?php
</span><span class="cx">         clearstatcache();
</span><del>-        $files = array( &quot;htaccess.dist&quot;, &quot;.htaccess&quot; );
</del><ins>+        $files = array( 'htaccess.dist', '.htaccess' );
</ins><span class="cx"> 
</span><span class="cx">         $indent = '&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;';
</span><span class="cx">         foreach ( (array) $files as $val ) {
</span><span class="cx">                 $stats = @stat( $val );
</span><del>-                if( $stats ) {
</del><ins>+                if ( $stats ) {
</ins><span class="cx"> ?&gt;
</span><span class="cx">                         &lt;h2&gt;&lt;?php echo esc_html( $val ); ?&gt;&lt;/h2&gt;
</span><del>-                        &lt;?php echo $indent . sprintf( __('uid/gid: %1$s/%2$s'), $stats[ 'uid' ], $stats[ 'gid' ] ); ?&gt;&lt;br /&gt;
-                        &lt;?php echo $indent . sprintf( __('size: %s'), $stats['size'] ); ?&gt;&lt;br/&gt;
-                        &lt;?php echo $indent . sprintf( __('perms: %s'), substr( sprintf('%o', fileperms( $val ) ), -4 ) ); ?&gt;&lt;br/&gt;
-                        &lt;?php echo $indent . sprintf( __('readable: %s'), is_readable( $val ) ? __('yes') : __('no') ); ?&gt;&lt;br/&gt;
-                        &lt;?php echo $indent . sprintf( __('writeable: %s'), is_writeable( $val ) ? __('yes') : __('no') ); ?&gt;&lt;br/&gt;
</del><ins>+                        &lt;?php echo $indent . sprintf( __( 'uid/gid: %1$s/%2$s' ), $stats['uid'], $stats['gid'] ); ?&gt;&lt;br /&gt;
+                        &lt;?php echo $indent . sprintf( __( 'size: %s' ), $stats['size'] ); ?&gt;&lt;br/&gt;
+                        &lt;?php echo $indent . sprintf( __( 'perms: %s' ), substr( sprintf( '%o', fileperms( $val ) ), -4 ) ); ?&gt;&lt;br/&gt;
+                        &lt;?php echo $indent . sprintf( __( 'readable: %s' ), is_readable( $val ) ? __( 'yes' ) : __( 'no' ) ); ?&gt;&lt;br/&gt;
+                        &lt;?php echo $indent . sprintf( __( 'writeable: %s' ), is_writeable( $val ) ? __( 'yes' ) : __( 'no' ) ); ?&gt;&lt;br/&gt;
</ins><span class="cx"> &lt;?php
</span><del>-                } elseif( ! file_exists( $val ) ) {
</del><ins>+                } elseif ( ! file_exists( $val ) ) {
</ins><span class="cx"> ?&gt;
</span><span class="cx">                         &lt;h2&gt;&lt;?php echo esc_html( $val ); ?&gt;&lt;/h2&gt;
</span><del>-                        &lt;?php echo $indent . sprintf( __('FILE NOT FOUND: %s'), $val ); ?&gt;&lt;br/&gt;
</del><ins>+                        &lt;?php echo $indent . sprintf( __( 'FILE NOT FOUND: %s' ), $val ); ?&gt;&lt;br/&gt;
</ins><span class="cx"> &lt;?php
</span><span class="cx">                 }
</span><span class="cx">         }
</span><span class="cx">         echo &quot;&lt;/blockquote&gt;&quot;;
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+/**
+ * Prints .htaccess component of step 2 for network settings.
+ *
+ * @since 3.0.0
+ */
</ins><span class="cx"> function step2_htaccess() {
</span><span class="cx">         global $base;
</span><span class="cx"> 
</span><span class="cx">         // remove ending slash from $base and $url
</span><span class="cx">         $htaccess = '';
</span><del>-        if( substr($base, -1 ) == '/') {
-                $base = substr($base, 0, -1);
-        }
</del><ins>+        if ( substr( $base, -1 ) == '/' )
+                $base = substr( $base, 0, -1 );
+
</ins><span class="cx">         $htaccess_sample = ABSPATH . 'wp-admin/includes/htaccess.ms';
</span><del>-        if ( !file_exists( $htaccess_sample ) )
-                wp_die( sprintf( __('Sorry, I need a %s to work from. Please re-upload this file to your WordPress installation.'), $htaccess_sample ) );
</del><ins>+        if ( ! file_exists( $htaccess_sample ) )
+                wp_die( sprintf( __( 'Sorry, I need a %s to work from. Please re-upload this file to your WordPress installation.' ), $htaccess_sample ) );
</ins><span class="cx"> 
</span><span class="cx">         $htaccess_file = file( $htaccess_sample );
</span><span class="cx">         $fp = @fopen( $htaccess_sample, &quot;r&quot; );
</span><del>-        if( $fp ) {
-                while( !feof( $fp ) ) {
</del><ins>+        if ( $fp ) {
+                while ( ! feof( $fp ) ) {
</ins><span class="cx">                         $htaccess .= fgets( $fp, 4096 );
</span><span class="cx">                 }
</span><span class="cx">                 fclose( $fp );
</span><span class="cx">                 $htaccess_file = str_replace( &quot;BASE&quot;, $base, $htaccess );
</span><span class="cx">         } else {
</span><del>-                wp_die( sprintf( __('Sorry, I need to be able to read %s. Please check the permissions on this file.'), $htaccess_sample ) );
</del><ins>+                wp_die( sprintf( __( 'Sorry, I need to be able to read %s. Please check the permissions on this file.' ), $htaccess_sample ) );
</ins><span class="cx">         }
</span><span class="cx"> 
</span><span class="cx">         //@todo: check for super-cache in use
</span><span class="cx"> ?&gt;
</span><del>-                        &lt;li&gt;&lt;p&gt;&lt;?php _e('Replace the contents of your &lt;code&gt;.htaccess&lt;/code&gt; with the following:'); ?&gt;&lt;/p&gt;
</del><ins>+                        &lt;li&gt;&lt;p&gt;&lt;?php _e( 'Replace the contents of your &lt;code&gt;.htaccess&lt;/code&gt; with the following:' ); ?&gt;&lt;/p&gt;
</ins><span class="cx">                                 &lt;textarea name=&quot;htaccess&quot; cols=&quot;120&quot; rows=&quot;20&quot;&gt;
</span><del>-&lt;?php echo $htaccess_file; ?&gt;
</del><ins>+&lt;?php echo wp_htmledit_pre( $htaccess_file ); ?&gt;
</ins><span class="cx">                                 &lt;/textarea&gt;
</span><span class="cx">                         &lt;/li&gt;
</span><span class="cx"> &lt;?php
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+/**
+ * Prints part of step 1 for network settings and checks for mod_rewrite.
+ *
+ * @since 3.0.0
+ * @return bool Whether mod_rewrite is enabled.
+ */
</ins><span class="cx"> function step1() {
</span><span class="cx">         $rewrite_enabled = false;
</span><span class="cx">         ?&gt;
</span><del>-        &lt;h2&gt;&lt;?php esc_html_e('Installing Network of WordPress Sites'); ?&gt;&lt;/h2&gt;
-        &lt;p&gt;&lt;?php _e('I will help you enable the features for creating a network of sites by asking you a few questions so that you can create configuration files and make a directory to store all your uploaded files.'); ?&gt;&lt;/p&gt;
</del><ins>+        &lt;h2&gt;&lt;?php esc_html_e( 'Installing Network of WordPress Sites' ); ?&gt;&lt;/h2&gt;
+        &lt;p&gt;&lt;?php _e( 'I will help you enable the features for creating a network of sites by asking you a few questions so that you can create configuration files and make a directory to store all your uploaded files.' ); ?&gt;&lt;/p&gt;
</ins><span class="cx"> 
</span><del>-        &lt;h2&gt;&lt;?php esc_html_e('What do I need?'); ?&gt;&lt;/h2&gt;
</del><ins>+        &lt;h2&gt;&lt;?php esc_html_e( 'What do I need?' ); ?&gt;&lt;/h2&gt;
</ins><span class="cx">         &lt;ul&gt;
</span><span class="cx">                 &lt;li&gt;&lt;?php _e( 'Access to your server to change directory permissions. This can be done through ssh or ftp for example.' ); ?&gt;&lt;/li&gt;
</span><span class="cx">                 &lt;li&gt;&lt;?php _e( 'A valid email where your password and administrative emails will be sent.' ); ?&gt;&lt;/li&gt;
</span><del>-                &lt;li&gt;&lt;?php _e( &quot;Wildcard dns records if you're going to use the virtual host (sub-domain) functionality. Check the &lt;a href='http://trac.mu.wordpress.org/browser/trunk/README.txt'&gt;README&lt;/a&gt; for further details.&quot;); ?&gt;&lt;/li&gt;
</del><ins>+                &lt;li&gt;&lt;?php _e( &quot;Wildcard dns records if you're going to use the virtual host (sub-domain) functionality. Check the &lt;a href='http://trac.mu.wordpress.org/browser/trunk/README.txt'&gt;README&lt;/a&gt; for further details.&quot; ); ?&gt;&lt;/li&gt;
</ins><span class="cx">         &lt;/ul&gt;
</span><span class="cx">         &lt;?php
</span><del>-        $mod_rewrite_msg = &quot;\n&lt;p&gt;&quot; . __( &quot;If the &lt;code&gt;mod_rewrite&lt;/code&gt; module is disabled ask your administrator to enable that module, or look at the &lt;a href='http://httpd.apache.org/docs/mod/mod_rewrite.html'&gt;Apache documentation&lt;/a&gt; or &lt;a href='http://www.google.com/search?q=apache+mod_rewrite'&gt;elsewhere&lt;/a&gt; for help setting it up.&quot; ) . '&lt;/p&gt;';
</del><ins>+        $mod_rewrite_msg = &quot;\n&lt;p&gt;&quot; . __( 'If the &lt;code&gt;mod_rewrite&lt;/code&gt; module is disabled ask your administrator to enable that module, or look at the &lt;a href=&quot;http://httpd.apache.org/docs/mod/mod_rewrite.html&quot;&gt;Apache documentation&lt;/a&gt; or &lt;a href=&quot;http://www.google.com/search?q=apache+mod_rewrite&quot;&gt;elsewhere&lt;/a&gt; for help setting it up.' ) . '&lt;/p&gt;';
</ins><span class="cx"> 
</span><span class="cx">         if ( function_exists( 'apache_get_modules' ) ) {
</span><span class="cx">                 $modules = apache_get_modules();
</span><span class="cx">                 if ( ! in_array( 'mod_rewrite', $modules ) )
</span><del>-                        echo '&lt;p&gt;' . __('&lt;strong&gt;Warning!&lt;/strong&gt; It looks like mod_rewrite is not installed.') . '&lt;/p&gt;' . $mod_rewrite_msg;
</del><ins>+                        echo '&lt;p&gt;' . __( '&lt;strong&gt;Warning!&lt;/strong&gt; It looks like mod_rewrite is not installed.' ) . '&lt;/p&gt;' . $mod_rewrite_msg;
</ins><span class="cx">                 else
</span><span class="cx">                         $rewrite_enabled = true;
</span><span class="cx">         } else {
</span><span class="lines">@@ -126,11 +140,17 @@
</span><span class="cx">         return $rewrite_enabled;
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+/**
+ * Prints most of step 1 for network settings.
+ *
+ * @since 3.0.0
+ * @param bool $rewrite_enabled Whether mod_rewrite is enabled. Default false.
+ */
</ins><span class="cx"> function printstep1form( $rewrite_enabled = false ) {
</span><del>-        $weblog_title = sprintf( __('%s Sites'), ucfirst( get_option( 'blogname' ) ) );
</del><ins>+        $weblog_title = sprintf( __( '%s Sites' ), ucfirst( get_option( 'blogname' ) ) );
</ins><span class="cx">         $email = get_option( 'admin_email' );
</span><span class="cx">         $hostname = get_clean_basedomain();
</span><del>-        if( substr( $hostname, 0, 4 ) == 'www.' )
</del><ins>+        if ( substr( $hostname, 0, 4 ) == 'www.' )
</ins><span class="cx">                 $nowww = substr( $hostname, 4 );
</span><span class="cx"> 
</span><span class="cx">         wp_nonce_field( 'install-network-1' );
</span><span class="lines">@@ -138,12 +158,12 @@
</span><span class="cx">                 &lt;input type='hidden' name='action' value='step2' /&gt;
</span><span class="cx">                 &lt;h2&gt;&lt;?php esc_html_e( 'Site Addresses' ); ?&gt;&lt;/h2&gt;
</span><span class="cx">                 &lt;p&gt;&lt;?php _e( 'Please choose whether you would like sites in your WordPress install to use sub-domains or sub-directories. You cannot change this later.' ); ?&gt;&lt;/p&gt;
</span><del>-                &lt;?php if ( !$rewrite_enabled ) { ?&gt;
-                &lt;p&gt;&lt;?php _e( '&lt;strong&gt;Note&lt;/strong&gt; It looks like &lt;code&gt;mod_rewrite&lt;/code&gt; is not installed.'); ?&gt;&lt;/p&gt;
</del><ins>+                &lt;?php if ( ! $rewrite_enabled ) { ?&gt;
+                &lt;p&gt;&lt;?php _e( '&lt;strong&gt;Note&lt;/strong&gt; It looks like &lt;code&gt;mod_rewrite&lt;/code&gt; is not installed.' ); ?&gt;&lt;/p&gt;
</ins><span class="cx">                 &lt;?php } ?&gt;
</span><span class="cx">                 &lt;p class=&quot;blog-address&quot;&gt;
</span><del>-                        &lt;label&gt;&lt;input type='radio' name='vhost' value='yes'&lt;?php if( $rewrite_enabled ) echo ' checked=&quot;checked&quot;'; ?&gt; /&gt; &lt;?php _e( 'Sub-domains (like &lt;code&gt;blog1.example.com&lt;/code&gt;)' ); ?&gt;&lt;/label&gt;&lt;br /&gt;
-                        &lt;label&gt;&lt;input type='radio' name='vhost' value='no'&lt;?php if( !$rewrite_enabled ) echo ' checked=&quot;checked&quot;'; ?&gt; /&gt; &lt;?php _e( 'Sub-directories (like &lt;code&gt;example.com/blog1&lt;/code&gt;) '); ?&gt;&lt;/label&gt;
</del><ins>+                        &lt;label&gt;&lt;input type='radio' name='vhost' value='yes'&lt;?php if ( $rewrite_enabled ) echo ' checked=&quot;checked&quot;'; ?&gt; /&gt; &lt;?php _e( 'Sub-domains (like &lt;code&gt;blog1.example.com&lt;/code&gt;)' ); ?&gt;&lt;/label&gt;&lt;br /&gt;
+                        &lt;label&gt;&lt;input type='radio' name='vhost' value='no'&lt;?php if ( ! $rewrite_enabled ) echo ' checked=&quot;checked&quot;'; ?&gt; /&gt; &lt;?php _e( 'Sub-directories (like &lt;code&gt;example.com/blog1&lt;/code&gt;)' ); ?&gt;&lt;/label&gt;
</ins><span class="cx">                 &lt;/p&gt;
</span><span class="cx"> 
</span><span class="cx">                 &lt;h2&gt;&lt;?php esc_html_e( 'Server Address' ); ?&gt;&lt;/h2&gt;
</span><span class="lines">@@ -182,6 +202,11 @@
</span><span class="cx">         &lt;?php
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+/**
+ * Prints step 2 for network settings.
+ *
+ * @since 3.0.0
+ */
</ins><span class="cx"> function step2() {
</span><span class="cx"> ?&gt;
</span><span class="cx">                 &lt;h2&gt;&lt;?php esc_html_e( 'Enabling WordPress Sites' ); ?&gt;&lt;/h2&gt;
</span><span class="lines">@@ -194,14 +219,19 @@
</span><span class="cx"> &lt;?php
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+/**
+ * Prints configuration file component of step 2 for network settings.
+ *
+ * @since 3.0.0
+ */
</ins><span class="cx"> function step2_config() {
</span><span class="cx">         global $base, $wpdb, $vhost;
</span><span class="cx"> 
</span><del>-        $vhost   = stripslashes($_POST['vhost' ]);
</del><ins>+        $vhost   = stripslashes( $_POST['vhost' ] );
</ins><span class="cx">         $prefix  = $wpdb-&gt;base_prefix;
</span><span class="cx"> 
</span><span class="cx">         $config_sample = ABSPATH . 'wp-admin/includes/wp-config.ms';
</span><del>-        if ( !file_exists( $config_sample ) )
</del><ins>+        if ( ! file_exists( $config_sample ) )
</ins><span class="cx">                 wp_die( sprintf( __( 'Sorry, I need a &lt;code&gt;%s&lt;/code&gt; to work from. Please re-upload this file to your WordPress installation.' ), $config_sample ) );
</span><span class="cx"> 
</span><span class="cx">         $wp_config_file = file( $config_sample );
</span><span class="lines">@@ -209,35 +239,35 @@
</span><span class="cx">                         &lt;li&gt;&lt;p&gt;&lt;?php _e( 'Replace the contents of your &lt;code&gt;wp-config.php&lt;/code&gt; with the following:' ); ?&gt;&lt;/p&gt;
</span><span class="cx">                                 &lt;textarea name=&quot;wp-config&quot; cols=&quot;120&quot; rows=&quot;20&quot;&gt;
</span><span class="cx"> &lt;?php
</span><del>-        foreach ($wp_config_file as $line) {
-                switch ( trim( substr($line,0,16) ) ) {
</del><ins>+        foreach ( $wp_config_file as $line ) {
+                switch ( trim( substr( $line, 0, 16 ) ) ) {
</ins><span class="cx">                         case &quot;define('DB_NAME'&quot;:
</span><del>-                                $output = str_replace(&quot;wordpress&quot;, DB_NAME, $line);
</del><ins>+                                $output = str_replace( &quot;wordpress&quot;, DB_NAME, $line );
</ins><span class="cx">                                 break;
</span><span class="cx">                         case &quot;define('DB_USER'&quot;:
</span><del>-                                $output = str_replace(&quot;username&quot;, DB_USER, $line);
</del><ins>+                                $output = str_replace( &quot;username&quot;, DB_USER, $line );
</ins><span class="cx">                                 break;
</span><span class="cx">                         case &quot;define('DB_PASSW&quot;:
</span><del>-                                $output = str_replace(&quot;password&quot;, DB_PASSWORD, $line);
</del><ins>+                                $output = str_replace( &quot;password&quot;, DB_PASSWORD, $line );
</ins><span class="cx">                                 break;
</span><span class="cx">                         case &quot;define('DB_HOST'&quot;:
</span><del>-                                $output = str_replace(&quot;localhost&quot;, DB_HOST, $line);
</del><ins>+                                $output = str_replace( &quot;localhost&quot;, DB_HOST, $line );
</ins><span class="cx">                                 break;
</span><span class="cx">                         case &quot;define('VHOST',&quot;:
</span><del>-                                $output = str_replace(&quot;VHOSTSETTING&quot;, $vhost, $line);
</del><ins>+                                $output = str_replace( &quot;VHOSTSETTING&quot;, $vhost, $line );
</ins><span class="cx">                                 break;
</span><span class="cx">                         case '$table_prefix  =':
</span><del>-                                $output = str_replace('wp_', $prefix, $line);
</del><ins>+                                $output = str_replace( 'wp_', $prefix, $line );
</ins><span class="cx">                                 break;
</span><span class="cx">                         case '$base = \'BASE\';':
</span><del>-                                $output = str_replace('BASE', $base, $line);
</del><ins>+                                $output = str_replace( 'BASE', $base, $line );
</ins><span class="cx">                                 break;
</span><span class="cx">                         case &quot;define('DOMAIN_C&quot;:
</span><span class="cx">                                 $domain = get_clean_basedomain();
</span><del>-                                $output = str_replace(&quot;current_site_domain&quot;, $domain, $line);
</del><ins>+                                $output = str_replace( &quot;current_site_domain&quot;, $domain, $line );
</ins><span class="cx">                                 break;
</span><span class="cx">                         case &quot;define('PATH_CUR&quot;:
</span><del>-                                $output = str_replace(&quot;current_site_path&quot;, $base, $line);
</del><ins>+                                $output = str_replace( &quot;current_site_path&quot;, $base, $line );
</ins><span class="cx">                                 break;
</span><span class="cx">                         case &quot;define('AUTH_KEY&quot;:
</span><span class="cx">                         case &quot;define('AUTH_SAL&quot;:
</span><span class="lines">@@ -249,7 +279,7 @@
</span><span class="cx">                                         $hash = constant( $constant );
</span><span class="cx">                                 else
</span><span class="cx">                                         $hash = md5( mt_rand() ) . md5( mt_rand() );
</span><del>-                                $output = str_replace('put your unique phrase here', $hash, $line);
</del><ins>+                                $output = str_replace( 'put your unique phrase here', $hash, $line );
</ins><span class="cx">                                 break;
</span><span class="cx">                         default:
</span><span class="cx">                                 $output = $line;
</span><span class="lines">@@ -263,39 +293,45 @@
</span><span class="cx"> &lt;?php
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+/**
+ * Gets base domain of network.
+ *
+ * @since 3.0.0
+ */
</ins><span class="cx"> function get_clean_basedomain() {
</span><span class="cx">         global $wpdb;
</span><del>-        $domain = preg_replace( '|https?://|', '', get_option( 'siteurl') );
-        if( strpos( $domain, '/' ) )
</del><ins>+        $domain = preg_replace( '|https?://|', '', get_option( 'siteurl' ) );
+        if ( strpos( $domain, '/' ) )
</ins><span class="cx">                 $domain = substr( $domain, 0, strpos( $domain, '/' ) );
</span><span class="cx">         return $domain;
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-$action = isset($_POST[ 'action' ]) ? $_POST[ 'action' ] : null;
-switch($action) {
-        case &quot;step2&quot;:
</del><ins>+$action = isset( $_POST[ 'action' ] ) ? $_POST[ 'action' ] : null;
+
+switch( $action ) {
+        case 'step2':
</ins><span class="cx">                 check_admin_referer( 'install-network-1' );
</span><span class="cx"> 
</span><span class="cx">                 // Install!
</span><del>-                $base = stripslashes( dirname( dirname($_SERVER[&quot;SCRIPT_NAME&quot;]) ) );
-                if( $base != &quot;/&quot;)
-                        $base .= &quot;/&quot;;
</del><ins>+                $base = stripslashes( dirname( dirname( $_SERVER['SCRIPT_NAME'] ) ) );
+                if ( $base != '/' )
+                        $base .= '/';
</ins><span class="cx"> 
</span><span class="cx">                 require_once( ABSPATH . 'wp-admin/includes/upgrade.php' );
</span><span class="cx">                 // create network tables
</span><span class="cx">                 $domain = get_clean_basedomain();
</span><span class="cx">                 install_network();
</span><del>-                populate_network( 1, $domain, sanitize_email( $_POST[ 'email' ] ), $_POST[ 'weblog_title' ], $base, $_POST[ 'vhost' ] );
</del><ins>+                populate_network( 1, $domain, sanitize_email( $_POST['email'] ), $_POST['weblog_title'], $base, $_POST['vhost'] );
</ins><span class="cx">                 // create wp-config.php / htaccess
</span><span class="cx">                 step2();
</span><span class="cx">         break;
</span><span class="cx">         default:
</span><span class="cx">                 //@todo: give an informative screen instead
</span><span class="cx">                 if ( is_multisite() ) {
</span><del>-                        _e('Network already enabled');
</del><ins>+                        _e( 'Network already enabled.' );
</ins><span class="cx">                 } else {
</span><span class="cx">                         $rewrite_enabled = step1();
</span><del>-                        printstep1form($rewrite_enabled);
</del><ins>+                        printstep1form( $rewrite_enabled );
</ins><span class="cx">                 }
</span><span class="cx">         break;
</span><span class="cx"> }
</span><span class="lines">@@ -303,4 +339,4 @@
</span><span class="cx"> &lt;/form&gt;
</span><span class="cx"> &lt;/div&gt;
</span><span class="cx"> 
</span><del>-&lt;?php include('./admin-footer.php'); ?&gt;
</del><ins>+&lt;?php include( './admin-footer.php' ); ?&gt;
</ins></span></pre>
</div>
</div>

</body>
</html>