Script/Style Dependencies: Make sure that inline styles for handles without a source are printed.
This prevents breaking plugins which are adding inline styles to the `wp-admin` handle after [36341]. Props dd32, ocean90. Fixes #35229. Built from https://develop.svn.wordpress.org/trunk@36550 git-svn-id: http://core.svn.wordpress.org/trunk@36517 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
0d89816985
commit
bc5d22266d
|
@ -98,21 +98,6 @@ class WP_Dependencies {
|
||||||
|
|
||||||
foreach ( $this->to_do as $key => $handle ) {
|
foreach ( $this->to_do as $key => $handle ) {
|
||||||
if ( !in_array($handle, $this->done, true) && isset($this->registered[$handle]) ) {
|
if ( !in_array($handle, $this->done, true) && isset($this->registered[$handle]) ) {
|
||||||
|
|
||||||
/*
|
|
||||||
* A single item may alias a set of items, by having dependencies,
|
|
||||||
* but no source. Queuing the item queues the dependencies.
|
|
||||||
*
|
|
||||||
* Example: The extending class WP_Scripts is used to register 'scriptaculous' as a set of registered handles:
|
|
||||||
* <code>add( 'scriptaculous', false, array( 'scriptaculous-dragdrop', 'scriptaculous-slider', 'scriptaculous-controls' ) );</code>
|
|
||||||
*
|
|
||||||
* The src property is false.
|
|
||||||
*/
|
|
||||||
if ( ! $this->registered[$handle]->src ) {
|
|
||||||
$this->done[] = $handle;
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Attempt to process the item. If successful,
|
* Attempt to process the item. If successful,
|
||||||
* add the handle to the done array.
|
* add the handle to the done array.
|
||||||
|
|
|
@ -177,6 +177,11 @@ class WP_Scripts extends WP_Dependencies {
|
||||||
echo $cond_after;
|
echo $cond_after;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// A single item may alias a set of items, by having dependencies, but no source.
|
||||||
|
if ( ! $obj->src ) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
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;
|
$src = $this->base_url . $src;
|
||||||
}
|
}
|
||||||
|
|
|
@ -72,11 +72,20 @@ class WP_Styles extends WP_Dependencies {
|
||||||
else
|
else
|
||||||
$media = 'all';
|
$media = 'all';
|
||||||
|
|
||||||
$href = $this->_css_href( $obj->src, $ver, $handle );
|
// A single item may alias a set of items, by having dependencies, but no source.
|
||||||
if ( empty( $href ) ) {
|
if ( ! $obj->src ) {
|
||||||
// Turns out there is nothing to print.
|
if ( $inline_style = $this->print_inline_style( $handle, false ) ) {
|
||||||
|
$inline_style = sprintf( "<style id='%s-inline-css' type='text/css'>\n%s\n</style>\n", esc_attr( $handle ), $inline_style );
|
||||||
|
if ( $this->do_concat ) {
|
||||||
|
$this->print_html .= $inline_style;
|
||||||
|
} else {
|
||||||
|
echo $inline_style;
|
||||||
|
}
|
||||||
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$href = $this->_css_href( $obj->src, $ver, $handle );
|
||||||
$rel = isset($obj->extra['alt']) && $obj->extra['alt'] ? 'alternate stylesheet' : 'stylesheet';
|
$rel = isset($obj->extra['alt']) && $obj->extra['alt'] ? 'alternate stylesheet' : 'stylesheet';
|
||||||
$title = isset($obj->extra['title']) ? "title='" . esc_attr( $obj->extra['title'] ) . "'" : '';
|
$title = isset($obj->extra['title']) ? "title='" . esc_attr( $obj->extra['title'] ) . "'" : '';
|
||||||
|
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
*
|
*
|
||||||
* @global string $wp_version
|
* @global string $wp_version
|
||||||
*/
|
*/
|
||||||
$wp_version = '4.5-alpha-36549';
|
$wp_version = '4.5-alpha-36550';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 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