wp_guess_url() and install styling fixes from sambauers. fixes #7129 see #4732

git-svn-id: http://svn.automattic.com/wordpress/trunk@8182 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
ryan 2008-06-24 17:36:21 +00:00
parent c64c4fbd63
commit ce2ed91698
4 changed files with 19 additions and 11 deletions

View File

@ -154,8 +154,7 @@ CREATE TABLE $wpdb->usermeta (
function populate_options() {
global $wpdb, $wp_db_version;
$schema = ( isset($_SERVER['HTTPS']) && strtolower($_SERVER['HTTPS']) == 'on' ) ? 'https://' : 'http://';
$guessurl = preg_replace('|/wp-admin/.*|i', '', $schema . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI']);
$guessurl = wp_guess_url();
do_action('populate_options');

View File

@ -21,12 +21,7 @@ function wp_install($blog_title, $user_name, $user_email, $public, $remote) {
update_option('enable_app',$remote);
update_option('enable_xmlrpc',$remote);
$schema = ( isset($_SERVER['HTTPS']) && strtolower($_SERVER['HTTPS']) == 'on' ) ? 'https://' : 'http://';
if ( defined('WP_SITEURL') && '' != WP_SITEURL )
$guessurl = WP_SITEURL;
else
$guessurl = preg_replace('|/wp-admin/.*|i', '', $schema . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI']);
$guessurl = wp_guess_url();
update_option('siteurl', $guessurl);

View File

@ -2126,4 +2126,14 @@ function force_ssl_admin($force = '') {
return $forced;
}
function wp_guess_url() {
if ( defined('WP_SITEURL') && '' != WP_SITEURL ) {
$url = WP_SITEURL;
} else {
$schema = ( isset($_SERVER['HTTPS']) && strtolower($_SERVER['HTTPS']) == 'on' ) ? 'https://' : 'http://';
$url = preg_replace('|/wp-admin/.*|i', '', $schema . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI']);
}
return $url;
}
?>

View File

@ -7,7 +7,9 @@ require( ABSPATH . WPINC . '/class.wp-styles.php' );
require( ABSPATH . WPINC . '/functions.wp-styles.php' );
function wp_default_scripts( &$scripts ) {
$scripts->base_url = site_url();
if (!$guessurl = site_url())
$guessurl = wp_guess_url();
$scripts->base_url = $guessurl;
$scripts->default_version = get_bloginfo( 'version' );
$scripts->add( 'common', '/wp-admin/js/common.js', array('jquery'), '20080318' );
@ -203,7 +205,9 @@ function wp_default_scripts( &$scripts ) {
}
function wp_default_styles( &$styles ) {
$styles->base_url = site_url();
if (!$guessurl = site_url())
$guessurl = wp_guess_url();
$styles->base_url = $guessurl;
$styles->default_version = get_bloginfo( 'version' );
$styles->text_direction = 'rtl' == get_bloginfo( 'text_direction' ) ? 'rtl' : 'ltr';