WordPress.org

Make WordPress Core


Ignore:
Timestamp:
01/21/2010 05:20:23 PM (10 years ago)
Author:
wpmuguru
Message:

allow www installs to enable multisite, see #11945

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-admin/options-network.php

    r12780 r12787  
    130130    $weblog_title = ucfirst( get_option( 'blogname' ) ) . ' Sites';
    131131    $email = get_option( 'admin_email' );
    132     $hostname = $_SERVER[ 'HTTP_HOST' ];
    133     if( substr( $_SERVER[ 'HTTP_HOST' ], 0, 4 ) == 'www.' )
    134         $hostname = str_replace( "www.", "", $_SERVER[ 'HTTP_HOST' ] );
     132    $hostname = get_clean_basedomain();
     133    if( substr( $hostname, 0, 4 ) == 'www.' )
     134        $nowww = substr( $hostname, 4 );
    135135
    136136    wp_nonce_field( 'install-network-1' );
     
    148148
    149149        <h2>Server Address</h2>
     150        <?php if ( isset( $nowww ) ) { ?>
     151        <h3>We recommend you change your siteurl to <code><?php echo $nowww; ?></code> before enabling the network feature. It will still be possible to visit your site using the "www" prefix with an address like <code><?php echo $hostname; ?></code> but any links will not have the "www" prefix. </h3>
     152        <?php } ?>
    150153        <table class="form-table"> 
    151154            <tr>
     
    264267    global $wpdb;
    265268    $domain = preg_replace( '|https?://|', '', get_option( 'siteurl') );
    266     //@todo: address no www in multisite code
    267     if( substr( $domain, 0, 4 ) == 'www.' )
    268         $domain = substr( $domain, 4 );
    269269    if( strpos( $domain, '/' ) )
    270270        $domain = substr( $domain, 0, strpos( $domain, '/' ) );
    271271    return $domain;
    272 }
    273 
    274 function nowww() {
    275     $nowww = str_replace( 'www.', '', $_POST[ 'basedomain' ] );
    276     ?>
    277     <h2>No-www</h2>
    278     <p>WordPress strips the string "www" from the URLs of sites using this software. It is still possible to visit your site using the "www" prefix with an address like <em><?php echo $_POST[ 'basedomain' ] ?></em> but any links will not have the "www" prefix. They will instead point at <?php echo $nowww ?>.</p>
    279     <p>The preferred method of hosting sites is without the "www" prefix as it's more compact and simple.</p>
    280     <p>You can still use "<?php echo $_POST[ 'basedomain' ] ?>" and URLs like "www.blog1.<?php echo $nowww; ?>" to address your site and blogs after installation but internal links will use the <?php echo $nowww ?> format.</p>
    281 
    282     <p><a href="http://no-www.org/">www. is depreciated</a> has a lot more information on why 'www.' isn't needed any more.</p>
    283     <p>
    284     <?php wp_nonce_field( 'install-network-1' ); ?>
    285         <input type='hidden' name='vhost' value='<?php echo $_POST[ 'vhost' ]; ?>' />
    286         <input type='hidden' name='weblog_title' value='<?php echo $_POST[ 'weblog_title' ]; ?>' />
    287         <input type='hidden' name='email' value='<?php echo $_POST[ 'email' ]; ?>' />
    288         <input type='hidden' name='action' value='step2' />
    289         <input type='hidden' name='basedomain' value='<?echo $nowww ?>' />
    290         <input class="button" type='submit' value='Continue' />
    291     </p>
    292     <?php
    293272}
    294273
     
    297276    case "step2":
    298277        check_admin_referer( 'install-network-1' );
    299         if( substr( $_POST[ 'basedomain' ], 0, 4 ) == 'www.' ) {
    300             nowww();
    301             continue;
    302         }
    303278       
    304279        // Install!
Note: See TracChangeset for help on using the changeset viewer.