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

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



git-svn-id: https://develop.svn.wordpress.org/trunk@21166 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Andrew Nacin 2012-06-28 20:18:38 +00:00
parent 900829b986
commit a0f7d641b7
2 changed files with 2 additions and 2 deletions

View File

@ -110,7 +110,7 @@ class WP_Scripts extends WP_Dependencies {
}
$this->print_extra_script( $handle );
if ( !preg_match('|^https?://|', $src) && ! ( $this->content_url && 0 === strpos($src, $this->content_url) ) ) {
if ( !preg_match('|^(https?:)?//|', $src) && ! ( $this->content_url && 0 === strpos($src, $this->content_url) ) ) {
$src = $this->base_url . $src;
}

View File

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