Changeset 27515 for trunk/src/wp-includes/script-loader.php
- Timestamp:
- 03/12/2014 04:11:38 PM (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/script-loader.php
r27499 r27515 582 582 583 583 // Register a stylesheet for the selected admin color scheme. 584 $colors_url = false; 585 if ( ! empty( $GLOBALS['_wp_admin_css_colors'] ) ) { 586 $color = get_user_option( 'admin_color' ); 587 if ( ! $color || ! isset( $GLOBALS['_wp_admin_css_colors'][ $color ] ) ) { 588 $color = 'fresh'; 589 } 590 $colors_url = $GLOBALS['_wp_admin_css_colors'][ $color ]->url; 591 } 592 $styles->add( 'colors', $colors_url, array( 'wp-admin', 'buttons', 'open-sans', 'dashicons' ) ); 584 $styles->add( 'colors', true, array( 'wp-admin', 'buttons', 'open-sans', 'dashicons' ) ); 593 585 594 586 $suffix = SCRIPT_DEBUG ? '' : '.min'; … … 690 682 691 683 /** 684 * Administration Screen CSS for changing the styles. 685 * 686 * If installing the 'wp-admin/' directory will be replaced with './'. 687 * 688 * The $_wp_admin_css_colors global manages the Administration Screens CSS 689 * stylesheet that is loaded. The option that is set is 'admin_color' and is the 690 * color and key for the array. The value for the color key is an object with 691 * a 'url' parameter that has the URL path to the CSS file. 692 * 693 * The query from $src parameter will be appended to the URL that is given from 694 * the $_wp_admin_css_colors array value URL. 695 * 696 * @since 2.6.0 697 * @uses $_wp_admin_css_colors 698 * 699 * @param string $src Source URL. 700 * @param string $handle Either 'colors' or 'colors-rtl'. 701 * @return string URL path to CSS stylesheet for Administration Screens. 702 */ 703 function wp_style_loader_src( $src, $handle ) { 704 global $_wp_admin_css_colors; 705 706 if ( defined('WP_INSTALLING') ) 707 return preg_replace( '#^wp-admin/#', './', $src ); 708 709 if ( 'colors' == $handle ) { 710 $color = get_user_option('admin_color'); 711 712 if ( empty($color) || !isset($_wp_admin_css_colors[$color]) ) 713 $color = 'fresh'; 714 715 $color = $_wp_admin_css_colors[$color]; 716 $parsed = parse_url( $src ); 717 $url = $color->url; 718 719 if ( ! $url ) { 720 return false; 721 } 722 723 if ( isset($parsed['query']) && $parsed['query'] ) { 724 wp_parse_str( $parsed['query'], $qv ); 725 $url = add_query_arg( $qv, $url ); 726 } 727 728 return $url; 729 } 730 731 return $src; 732 } 733 734 /** 692 735 * Prints the script queue in the HTML head on admin pages. 693 736 * … … 935 978 936 979 add_action( 'wp_default_styles', 'wp_default_styles' ); 980 add_filter( 'style_loader_src', 'wp_style_loader_src', 10, 2 );
Note: See TracChangeset
for help on using the changeset viewer.