WordPress.org

Make WordPress Core

Changeset 21166


Ignore:
Timestamp:
06/28/2012 08:18:38 PM (8 years ago)
Author:
nacin
Message:

Allow protocol-relative URLs when registering/enqueueing scripts and styles.

props mimecine, TobiasBg, georgestephanis.
props kurtpayne for the test coverage.
fixes #16560.

Location:
trunk/wp-includes
Files:
2 edited

Legend:

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

    r21132 r21166  
    111111
    112112        $this->print_extra_script( $handle );
    113         if ( !preg_match('|^https?://|', $src) && ! ( $this->content_url && 0 === strpos($src, $this->content_url) ) ) {
     113        if ( !preg_match('|^(https?:)?//|', $src) && ! ( $this->content_url && 0 === strpos($src, $this->content_url) ) ) {
    114114            $src = $this->base_url . $src;
    115115        }
  • trunk/wp-includes/class.wp-styles.php

    r19712 r21166  
    136136
    137137    function _css_href( $src, $ver, $handle ) {
    138         if ( !is_bool($src) && !preg_match('|^https?://|', $src) && ! ( $this->content_url && 0 === strpos($src, $this->content_url) ) ) {
     138        if ( !is_bool($src) && !preg_match('|^(https?:)?//|', $src) && ! ( $this->content_url && 0 === strpos($src, $this->content_url) ) ) {
    139139            $src = $this->base_url . $src;
    140140        }
Note: See TracChangeset for help on using the changeset viewer.