From 5c228ae86994a394ee21057e38df3fce52ede6d3 Mon Sep 17 00:00:00 2001 From: nacin Date: Thu, 28 Jun 2012 20:18:38 +0000 Subject: [PATCH] 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 --- wp-includes/class.wp-scripts.php | 2 +- wp-includes/class.wp-styles.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/wp-includes/class.wp-scripts.php b/wp-includes/class.wp-scripts.php index 0ac2af4d97..f75929b4ab 100644 --- a/wp-includes/class.wp-scripts.php +++ b/wp-includes/class.wp-scripts.php @@ -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; } diff --git a/wp-includes/class.wp-styles.php b/wp-includes/class.wp-styles.php index 48e8f7ef1d..fdfe5afe32 100644 --- a/wp-includes/class.wp-styles.php +++ b/wp-includes/class.wp-styles.php @@ -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; }