| 1 | Index: wp-admin/options-general.php |
|---|
| 2 | =================================================================== |
|---|
| 3 | --- wp-admin/options-general.php (revision 12541) |
|---|
| 4 | +++ wp-admin/options-general.php (working copy) |
|---|
| 5 | @@ -71,10 +71,6 @@ |
|---|
| 6 | <span class="description"><?php _e('In a few words, explain what this blog is about.') ?></span></td> |
|---|
| 7 | </tr> |
|---|
| 8 | <tr valign="top"> |
|---|
| 9 | -<th scope="row"><label for="siteurl"><?php _e('WordPress address (URL)') ?></label></th> |
|---|
| 10 | -<td><input name="siteurl" type="text" id="siteurl" value="<?php form_option('siteurl'); ?>" class="regular-text code<?php if ( defined( 'WP_SITEURL' ) ) : ?> disabled" disabled="disabled"<?php else: ?>"<?php endif; ?> /></td> |
|---|
| 11 | -</tr> |
|---|
| 12 | -<tr valign="top"> |
|---|
| 13 | <th scope="row"><label for="home"><?php _e('Blog address (URL)') ?></label></th> |
|---|
| 14 | <td><input name="home" type="text" id="home" value="<?php form_option('home'); ?>" class="regular-text code<?php if ( defined( 'WP_HOME' ) ) : ?> disabled" disabled="disabled"<?php else: ?>"<?php endif; ?> /> |
|---|
| 15 | <span class="description"><?php _e('Enter the address here if you want your blog homepage <a href="http://codex.wordpress.org/Giving_WordPress_Its_Own_Directory">to be different from the directory</a> you installed WordPress.'); ?></span></td> |
|---|
| 16 | Index: wp-admin/options.php |
|---|
| 17 | =================================================================== |
|---|
| 18 | --- wp-admin/options.php (revision 12541) |
|---|
| 19 | +++ wp-admin/options.php (working copy) |
|---|
| 20 | @@ -30,7 +30,6 @@ |
|---|
| 21 | 'reading' => array( 'posts_per_page', 'posts_per_rss', 'rss_use_excerpt', 'blog_charset', 'show_on_front', 'page_on_front', 'page_for_posts' ), |
|---|
| 22 | 'writing' => array( 'default_post_edit_rows', 'use_smilies', 'ping_sites', 'mailserver_url', 'mailserver_port', 'mailserver_login', 'mailserver_pass', 'default_category', 'default_email_category', 'use_balanceTags', 'default_link_category', 'enable_app', 'enable_xmlrpc' ), |
|---|
| 23 | 'options' => array( '' ) ); |
|---|
| 24 | -if ( !defined( 'WP_SITEURL' ) ) $whitelist_options['general'][] = 'siteurl'; |
|---|
| 25 | if ( !defined( 'WP_HOME' ) ) $whitelist_options['general'][] = 'home'; |
|---|
| 26 | |
|---|
| 27 | $whitelist_options = apply_filters( 'whitelist_options', $whitelist_options ); |
|---|
| 28 | @@ -71,6 +70,18 @@ |
|---|
| 29 | $_POST['gmt_offset'] = preg_replace('/UTC\+?/', '', $_POST['gmt_offset']); |
|---|
| 30 | $_POST['timezone_string'] = ''; |
|---|
| 31 | } |
|---|
| 32 | + |
|---|
| 33 | + // Make 'www' preference consistent |
|---|
| 34 | + $home = $_POST['home']; |
|---|
| 35 | + $siteurl = get_option('siteurl'); |
|---|
| 36 | + |
|---|
| 37 | + $siteurl_www = ( FALSE !== strpos($siteurl, '://www.') ); |
|---|
| 38 | + $home_www = ( FALSE !== strpos($home, '://www.') ); |
|---|
| 39 | + |
|---|
| 40 | + if ( $home_www && !$siteurl_www ) |
|---|
| 41 | + update_option('siteurl', str_replace('://', '://www.', $siteurl)); |
|---|
| 42 | + elseif ( !$home_www && $siteurl_www ) |
|---|
| 43 | + update_option('siteurl', str_replace('://www.', '://', $siteurl)); |
|---|
| 44 | } |
|---|
| 45 | |
|---|
| 46 | if ( $options ) { |
|---|