WordPress.org

Make WordPress Core

Ticket #16560: external-protocol-regex.diff

File external-protocol-regex.diff, 1.1 KB (added by mimecine, 9 years ago)

Diff to change the regex for checking if a link is using a protocol.

  • wp-includes/class.wp-styles.php

     
    102102        }
    103103
    104104        function _css_href( $src, $ver, $handle ) {
    105                 if ( !is_bool($src) && !preg_match('|^https?://|', $src) && ! ( $this->content_url && 0 === strpos($src, $this->content_url) ) ) {
     105                if ( !is_bool($src) && !preg_match('|^(\w+:)?//|', $src) && ! ( $this->content_url && 0 === strpos($src, $this->content_url) ) ) {
    106106                        $src = $this->base_url . $src;
    107107                }
    108108
  • wp-includes/class.wp-scripts.php

     
    114114                }
    115115
    116116                $this->print_scripts_l10n( $handle );
    117                 if ( !preg_match('|^https?://|', $src) && ! ( $this->content_url && 0 === strpos($src, $this->content_url) ) ) {
     117                if ( !preg_match('|^(\w+:)?//|', $src) && ! ( $this->content_url && 0 === strpos($src, $this->content_url) ) ) {
    118118                        $src = $this->base_url . $src;
    119119                }
    120120