mirror of
https://github.com/WordPress/WordPress.git
synced 2024-12-23 09:37:42 +01:00
Script Loader: Improve code style and readability in _wp_normalize_relative_css_links()
.
Props: westonruter. See: 58069. Built from https://develop.svn.wordpress.org/trunk@55669 git-svn-id: http://core.svn.wordpress.org/trunk@55181 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
b116fcdb27
commit
b1a6d31cfe
@ -2944,25 +2944,24 @@ function _wp_normalize_relative_css_links( $css, $stylesheet_url ) {
|
|||||||
static function ( $matches ) use ( $stylesheet_url ) {
|
static function ( $matches ) use ( $stylesheet_url ) {
|
||||||
list( , $prefix, $url ) = $matches;
|
list( , $prefix, $url ) = $matches;
|
||||||
|
|
||||||
if ( ! (
|
// Short-circuit if the URL does not require normalization.
|
||||||
str_starts_with( $url, 'http:' )
|
if (
|
||||||
||
|
str_starts_with( $url, 'http:' ) ||
|
||||||
str_starts_with( $url, 'https:' )
|
str_starts_with( $url, 'https:' ) ||
|
||||||
||
|
str_starts_with( $url, '//' ) ||
|
||||||
str_starts_with( $url, '//' )
|
str_starts_with( $url, '#' ) ||
|
||||||
||
|
|
||||||
str_starts_with( $url, '#' )
|
|
||||||
||
|
|
||||||
str_starts_with( $url, 'data:' )
|
str_starts_with( $url, 'data:' )
|
||||||
) ) {
|
) {
|
||||||
// Build the absolute URL.
|
return $matches[0];
|
||||||
$absolute_url = dirname( $stylesheet_url ) . '/' . $url;
|
|
||||||
$absolute_url = str_replace( '/./', '/', $absolute_url );
|
|
||||||
|
|
||||||
// Convert to URL related to the site root.
|
|
||||||
$url = wp_make_link_relative( $absolute_url );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Build the absolute URL.
|
||||||
|
$absolute_url = dirname( $stylesheet_url ) . '/' . $url;
|
||||||
|
$absolute_url = str_replace( '/./', '/', $absolute_url );
|
||||||
|
|
||||||
|
// Convert to URL related to the site root.
|
||||||
|
$url = wp_make_link_relative( $absolute_url );
|
||||||
|
|
||||||
return $prefix . $url;
|
return $prefix . $url;
|
||||||
},
|
},
|
||||||
$css
|
$css
|
||||||
|
@ -16,7 +16,7 @@
|
|||||||
*
|
*
|
||||||
* @global string $wp_version
|
* @global string $wp_version
|
||||||
*/
|
*/
|
||||||
$wp_version = '6.3-alpha-55667';
|
$wp_version = '6.3-alpha-55669';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
||||||
|
Loading…
Reference in New Issue
Block a user