Make WordPress Core

Changeset 8301


Ignore:
Timestamp:
07/09/2008 05:24:36 PM (18 years ago)
Author:
ryan
Message:

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

Location:
trunk/wp-includes
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-includes/class.wp-scripts.php

    r7976 r8301  
    5151
    5252                $src = $this->registered[$handle]->src;
    53                 if ( !preg_match('|^https?://|', $src) ) {
     53                if ( !preg_match('|^https?://|', $src) && !preg_match('|^' . preg_quote(WP_CONTENT_URL) . '|', $src) ) {
    5454                        $src = $this->base_url . $src;
    5555                }
  • trunk/wp-includes/class.wp-styles.php

    r7976 r8301  
    6060
    6161        function _css_href( $src, $ver, $handle ) {
    62                 if ( !preg_match('|^https?://|', $src) ) {
     62                if ( !preg_match('|^https?://|', $src) && !preg_match('|^' . preg_quote(WP_CONTENT_URL) . '|', $src) ) {
    6363                        $src = $this->base_url . $src;
    6464                }
  • trunk/wp-includes/link-template.php

    r8197 r8301  
    801801
    802802function admin_url($path = '') {
    803         global $_wp_admin_url;
    804 
    805803        $url = site_url('wp-admin/', 'admin');
    806804
    … …  
    812810
    813811function includes_url($path = '') {
    814         global $_wp_includes_url;
    815 
    816812        $url = site_url() . '/' . WPINC . '/';
    817813
    … …  
    822818}
    823819
     820function content_url($path = '') {
     821        $scheme = ( is_ssl() ? 'https' : 'http' );
     822        $url = WP_CONTENT_URL;
     823        if ( 0 === strpos($url, 'http') ) {
     824                if ( is_ssl() )
     825                        $url = str_replace( 'http://', "{$scheme}://", $url );
     826        }
     827
     828        if ( !empty($path) && is_string($path) && strpos($path, '..') === false )
     829                $url .= '/' . ltrim($path, '/');
     830
     831        return $url;
     832}
     833
    824834?>
  • trunk/wp-includes/theme.php

    r8252 r8301  
    338338
    339339function get_theme_root_uri() {
    340         return apply_filters('theme_root_uri', WP_CONTENT_URL . "/themes", get_option('siteurl'));
     340        return apply_filters('theme_root_uri', content_url('themes'), get_option('siteurl'));
    341341}
    342342
Note: See TracChangeset for help on using the changeset viewer.