Fix the conditional enqueueing/printing of colors stylesheets, without breaking dependencies.

fixes #18380.
see #20729 which should properly fix this.


git-svn-id: https://develop.svn.wordpress.org/trunk@27111 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Andrew Nacin 2014-02-06 22:15:25 +00:00
parent 4d7d68b565
commit 1304fb3463
5 changed files with 16 additions and 3 deletions

View File

@ -95,7 +95,11 @@
// Set color scheme
if ( user_id === current_user_id ) {
// Load the colors stylesheet
// Load the colors stylesheet.
// The default color scheme won't have one, so we'll need to create an element.
if ( 0 === $stylesheet.length ) {
$stylesheet = $( '<link rel="stylesheet" />' ).appendTo( 'head' );
}
$stylesheet.attr( 'href', $this.children( '.css_url' ).val() );
// repaint icons

View File

@ -62,6 +62,10 @@ class WP_Styles extends WP_Dependencies {
$media = 'all';
$href = $this->_css_href( $obj->src, $ver, $handle );
if ( empty( $href ) ) {
// Turns out there is nothing to print.
return true;
}
$rel = isset($obj->extra['alt']) && $obj->extra['alt'] ? 'alternate stylesheet' : 'stylesheet';
$title = isset($obj->extra['title']) ? "title='" . esc_attr( $obj->extra['title'] ) . "'" : '';

View File

@ -2103,7 +2103,7 @@ function register_admin_color_schemes() {
$suffix .= defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ? '' : '.min';
wp_admin_css_color( 'fresh', _x( 'Default', 'admin color scheme' ),
admin_url( "css/colors$suffix.css" ),
false,
array( '#222', '#333', '#0074a2', '#2ea2cc' ),
array( 'base' => '#999', 'focus' => '#2ea2cc', 'current' => '#fff' )
);

View File

@ -587,6 +587,7 @@ function wp_default_styles( &$styles ) {
$styles->add( 'dashicons', "/wp-includes/css/dashicons$suffix.css" );
// Register "meta" stylesheet for admin colors. All colors-* style sheets should have the same version string.
$styles->add( 'colors', true, array( 'wp-admin', 'buttons', 'open-sans', 'dashicons' ) );
// do not refer to this directly, the right one is queued by the above "meta" colors handle
@ -695,6 +696,10 @@ function wp_style_loader_src( $src, $handle ) {
$parsed = parse_url( $src );
$url = $color->url;
if ( ! $url ) {
return false;
}
if ( isset($parsed['query']) && $parsed['query'] ) {
wp_parse_str( $parsed['query'], $qv );
$url = add_query_arg( $qv, $url );

View File

@ -4,7 +4,7 @@
*
* @global string $wp_version
*/
$wp_version = '3.9-alpha-src';
$wp_version = '3.9-alpha-27111-src';
/**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.