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: http://core.svn.wordpress.org/trunk@21166 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
nacin 2012-06-28 20:18:38 +00:00
parent cefb69254d
commit 5c228ae869
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;
}