Introduce content_url(). Don't prepend base url to content url in script loader. see #6938 #7001

git-svn-id: https://develop.svn.wordpress.org/trunk@8301 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Ryan Boren 2008-07-09 17:24:36 +00:00
parent 22635c32c2
commit 0fba0a6d4a
4 changed files with 17 additions and 7 deletions

View File

@ -50,7 +50,7 @@ class WP_Scripts extends WP_Dependencies {
$ver .= '&' . $this->args[$handle];
$src = $this->registered[$handle]->src;
if ( !preg_match('|^https?://|', $src) ) {
if ( !preg_match('|^https?://|', $src) && !preg_match('|^' . preg_quote(WP_CONTENT_URL) . '|', $src) ) {
$src = $this->base_url . $src;
}

View File

@ -59,7 +59,7 @@ class WP_Styles extends WP_Dependencies {
}
function _css_href( $src, $ver, $handle ) {
if ( !preg_match('|^https?://|', $src) ) {
if ( !preg_match('|^https?://|', $src) && !preg_match('|^' . preg_quote(WP_CONTENT_URL) . '|', $src) ) {
$src = $this->base_url . $src;
}

View File

@ -800,8 +800,6 @@ function site_url($path = '', $scheme = null) {
}
function admin_url($path = '') {
global $_wp_admin_url;
$url = site_url('wp-admin/', 'admin');
if ( !empty($path) && is_string($path) && strpos($path, '..') === false )
@ -811,8 +809,6 @@ function admin_url($path = '') {
}
function includes_url($path = '') {
global $_wp_includes_url;
$url = site_url() . '/' . WPINC . '/';
if ( !empty($path) && is_string($path) && strpos($path, '..') === false )
@ -821,4 +817,18 @@ function includes_url($path = '') {
return $url;
}
function content_url($path = '') {
$scheme = ( is_ssl() ? 'https' : 'http' );
$url = WP_CONTENT_URL;
if ( 0 === strpos($url, 'http') ) {
if ( is_ssl() )
$url = str_replace( 'http://', "{$scheme}://", $url );
}
if ( !empty($path) && is_string($path) && strpos($path, '..') === false )
$url .= '/' . ltrim($path, '/');
return $url;
}
?>

View File

@ -337,7 +337,7 @@ function get_theme_root() {
}
function get_theme_root_uri() {
return apply_filters('theme_root_uri', WP_CONTENT_URL . "/themes", get_option('siteurl'));
return apply_filters('theme_root_uri', content_url('themes'), get_option('siteurl'));
}
function get_query_template($type) {