Revert [27203], restore JIT color scheme stylesheets. Restores [27111].

fixes #27175. see #20729.

Built from https://develop.svn.wordpress.org/trunk@27515


git-svn-id: http://core.svn.wordpress.org/trunk@27358 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Andrew Nacin 2014-03-12 16:12:15 +00:00
parent 8343fabff6
commit 20948e27e8
3 changed files with 57 additions and 18 deletions

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

@ -3411,15 +3411,6 @@ function rich_edit_exists() {
return $wp_rich_edit_exists;
}
/**
* Callback formerly fired on the style_loader_src hook. No longer needed.
*
* @since 2.6.0
* @deprecated 3.9.0
*/
function wp_style_loader_src() {}
/**
* Old callback for tag link tooltips.
*

View File

@ -581,15 +581,7 @@ function wp_default_styles( &$styles ) {
}
// Register a stylesheet for the selected admin color scheme.
$colors_url = false;
if ( ! empty( $GLOBALS['_wp_admin_css_colors'] ) ) {
$color = get_user_option( 'admin_color' );
if ( ! $color || ! isset( $GLOBALS['_wp_admin_css_colors'][ $color ] ) ) {
$color = 'fresh';
}
$colors_url = $GLOBALS['_wp_admin_css_colors'][ $color ]->url;
}
$styles->add( 'colors', $colors_url, array( 'wp-admin', 'buttons', 'open-sans', 'dashicons' ) );
$styles->add( 'colors', true, array( 'wp-admin', 'buttons', 'open-sans', 'dashicons' ) );
$suffix = SCRIPT_DEBUG ? '' : '.min';
@ -688,6 +680,57 @@ function wp_just_in_time_script_localization() {
}
/**
* Administration Screen CSS for changing the styles.
*
* If installing the 'wp-admin/' directory will be replaced with './'.
*
* The $_wp_admin_css_colors global manages the Administration Screens CSS
* stylesheet that is loaded. The option that is set is 'admin_color' and is the
* color and key for the array. The value for the color key is an object with
* a 'url' parameter that has the URL path to the CSS file.
*
* The query from $src parameter will be appended to the URL that is given from
* the $_wp_admin_css_colors array value URL.
*
* @since 2.6.0
* @uses $_wp_admin_css_colors
*
* @param string $src Source URL.
* @param string $handle Either 'colors' or 'colors-rtl'.
* @return string URL path to CSS stylesheet for Administration Screens.
*/
function wp_style_loader_src( $src, $handle ) {
global $_wp_admin_css_colors;
if ( defined('WP_INSTALLING') )
return preg_replace( '#^wp-admin/#', './', $src );
if ( 'colors' == $handle ) {
$color = get_user_option('admin_color');
if ( empty($color) || !isset($_wp_admin_css_colors[$color]) )
$color = 'fresh';
$color = $_wp_admin_css_colors[$color];
$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 );
}
return $url;
}
return $src;
}
/**
* Prints the script queue in the HTML head on admin pages.
*
@ -934,3 +977,4 @@ add_filter( 'wp_print_scripts', 'wp_just_in_time_script_localization' );
add_filter( 'print_scripts_array', 'wp_prototype_before_jquery' );
add_action( 'wp_default_styles', 'wp_default_styles' );
add_filter( 'style_loader_src', 'wp_style_loader_src', 10, 2 );