wp_admin_css() improvements. Props mdawaffe. see #7011

git-svn-id: http://svn.automattic.com/wordpress/trunk@7979 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
ryan 2008-05-22 00:06:41 +00:00
parent 3846bff484
commit 68a874a4dd
16 changed files with 35 additions and 48 deletions

View File

@ -126,9 +126,12 @@ function wp_iframe($content_func /* ... */) {
<meta http-equiv="Content-Type" content="<?php bloginfo('html_type'); ?>; charset=<?php echo get_option('blog_charset'); ?>" />
<title><?php bloginfo('name') ?> &rsaquo; <?php _e('Uploads'); ?> &#8212; <?php _e('WordPress'); ?></title>
<?php
wp_admin_css( 'css/global' );
wp_admin_css( 'global' );
wp_admin_css();
wp_admin_css( 'css/colors' );
wp_admin_css( 'colors' );
if ( 0 === strpos( $content_func, 'media' ) )
wp_admin_css( 'media' );
?>
<script type="text/javascript">
//<![CDATA[
@ -137,6 +140,7 @@ function addLoadEvent(func) {if ( typeof wpOnload!='function'){wpOnload=func;}el
</script>
<?php
do_action('admin_print_scripts');
do_action('admin_print_styles');
do_action('admin_head');
if ( is_string($content_func) )
do_action( "admin_head_{$content_func}" );
@ -182,10 +186,6 @@ add_action( 'admin_print_scripts-post.php', 'add_thickbox' );
add_action( 'admin_print_scripts-page-new.php', 'add_thickbox' );
add_action( 'admin_print_scripts-page.php', 'add_thickbox' );
function media_admin_css() {
wp_admin_css('css/media');
}
add_action('media_upload_media', 'media_upload_handler');
function media_upload_form_handler() {
@ -1205,12 +1205,9 @@ add_action('media_upload_image', 'media_upload_image');
add_action('media_upload_audio', 'media_upload_audio');
add_action('media_upload_video', 'media_upload_video');
add_action('media_upload_file', 'media_upload_file');
add_action('admin_head_media_upload_type_form', 'media_admin_css');
add_filter('media_upload_gallery', 'media_upload_gallery');
add_action('admin_head_media_upload_gallery_form', 'media_admin_css');
add_filter('media_upload_library', 'media_upload_library');
add_action('admin_head_media_upload_library_form', 'media_admin_css');
?>

View File

@ -285,11 +285,3 @@ function wp_widget_control_ob_filter( $string ) {
$string = str_replace( '&nbsp;', ' ', $string );
return trim( wp_specialchars( strip_tags( $string ) ) );
}
function widget_css() {
wp_admin_css( 'css/widgets' );
}
add_action( 'admin_head', 'widget_css' );
?>

View File

@ -26,12 +26,8 @@ jQuery(function($) {
}
add_action( 'admin_head', 'index_js' );
function index_css() {
wp_admin_css( 'css/dashboard' );
}
add_action( 'admin_head', 'index_css' );
wp_enqueue_script( 'jquery' );
wp_admin_css( 'dashboard' );
$title = __('Dashboard');
$parent_file = 'index.php';

View File

@ -16,7 +16,7 @@ header( 'Content-Type: text/html; charset=utf-8' );
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title><?php _e('WordPress &rsaquo; Installation'); ?></title>
<?php wp_admin_css( 'css/install' ); ?>
<?php wp_admin_css( 'install', true ); ?>
</head>
<body>
<h1 id="logo"><img alt="WordPress" src="images/wordpress-logo.png" /></h1>

View File

@ -60,7 +60,8 @@ case 'edit' :
add_filter('attachment_fields_to_edit', 'media_single_attachment_fields_to_edit', 10, 2);
wp_enqueue_script( 'wp-ajax-response' );
add_action('admin_head', 'media_admin_css');
wp_admin_css( 'media' );
require( 'admin-header.php' );

View File

@ -6,10 +6,7 @@ $parent_file = 'plugins.php';
wp_reset_vars(array('action', 'redirect', 'profile', 'error', 'warning', 'a', 'file'));
add_action( 'admin_head', 'theme_editor_css' );
function theme_editor_css(){
wp_admin_css( 'css/theme-editor' );
}
wp_admin_css( 'theme-editor' );
$plugins = get_plugins();
$plugin_files = array_keys($plugins);

View File

@ -195,11 +195,13 @@ if ( empty($_GET['tab']) ) {
<?php
wp_enqueue_script('jquery-ui-tabs');
add_thickbox();
wp_admin_css('press-this');
wp_admin_css( 'colors' );
wp_enqueue_script('post');
do_action('admin_print_scripts');
do_action('admin_print_styles');
do_action('admin_head');
wp_admin_css('css/press-this');
wp_admin_css( 'css/colors' );
?>
<script type="text/javascript">

View File

@ -14,8 +14,9 @@ if ('b' == $_GET['a']) {
<meta http-equiv="Content-Type" content="<?php bloginfo('html_type'); ?>; charset=UTF-8" />
<title><?php _e('WordPress &#8250; Posted'); ?></title>
<?php
wp_admin_css( 'css/global' );
wp_admin_css();
wp_admin_css( 'global', true );
wp_admin_css( 'wp-admin', true );
wp_admin_css( 'colors', true );
?>
</head>
<body>
@ -32,8 +33,9 @@ wp_admin_css();
<meta http-equiv="Content-Type" content="<?php bloginfo('html_type'); ?>; charset=<?php bloginfo('blog_charset'); ?>" />
<title><?php _e('WordPress &#8250; Sidebar'); ?></title>
<?php
wp_admin_css( 'css/global' );
wp_admin_css();
wp_admin_css( 'global', true );
wp_admin_css( 'wp-admin', true );
wp_admin_css( 'colors', true );
?>
<style type="text/css" media="screen">
form {

View File

@ -6,10 +6,7 @@ $parent_file = 'themes.php';
wp_reset_vars(array('action', 'redirect', 'profile', 'error', 'warning', 'a', 'file', 'theme'));
add_action( 'admin_head', 'theme_editor_css' );
function theme_editor_css(){
wp_admin_css( 'css/theme-editor' );
}
wp_admin_css( 'theme-editor' );
$themes = get_themes();

View File

@ -3,7 +3,7 @@
require_once('admin.php');
if ( !current_user_can('edit_plugins') )
wp_die('<p>'.__('You do not have sufficient permissions to update plugins for this blog.').'</p>');
wp_die('<p>'.__('You do not have sufficient permissions to update plugins for this blog.').'</p>');
function request_filesystem_credentials($form_post, $type = '', $error = false) {
$req_cred = apply_filters('request_filesystem_credentials', '', $form_post, $type, $error);
@ -151,8 +151,8 @@ if ( isset($_GET['action']) ) {
<meta http-equiv="Content-Type" content="<?php bloginfo('html_type'); ?>; charset=<?php echo get_option('blog_charset'); ?>" />
<title><?php bloginfo('name') ?> &rsaquo; <?php _e('Plugin Reactivation'); ?> &#8212; <?php _e('WordPress'); ?></title>
<?php
wp_admin_css( 'css/global' );
wp_admin_css( 'css/colors' );
wp_admin_css( 'global', true );
wp_admin_css( 'colors', true );
?>
</head>
<body>

View File

@ -16,7 +16,7 @@ else
<head>
<meta http-equiv="Content-Type" content="<?php bloginfo('html_type'); ?>; charset=<?php echo get_option('blog_charset'); ?>" />
<title><?php _e('WordPress &rsaquo; Upgrade'); ?></title>
<?php wp_admin_css( 'css/install' ); ?>
<?php wp_admin_css( 'install', true ); ?>
</head>
<body>
<h1 id="logo"><img alt="WordPress" src="images/wordpress-logo.png" /></h1>

View File

@ -7,6 +7,7 @@ if ( ! current_user_can('switch_themes') )
wp_die( __( 'Cheatin&#8217; uh?' ));
wp_enqueue_script( array( 'wp-lists', 'admin-widgets' ) );
wp_admin_css( 'widgets' );
do_action( 'sidebar_admin_setup' );

View File

@ -1138,7 +1138,7 @@ function wp_admin_css_uri( $file = 'wp-admin' ) {
return apply_filters( 'wp_admin_css_uri', $_file, $file );
}
function wp_admin_css( $file = 'wp-admin' ) {
function wp_admin_css( $file = 'wp-admin', $force_echo = false ) {
global $wp_styles;
if ( !is_a($wp_styles, 'WP_Styles') )
$wp_styles = new WP_Styles();
@ -1146,7 +1146,7 @@ function wp_admin_css( $file = 'wp-admin' ) {
$handle = 0 === strpos( $file, 'css/' ) ? substr( $file, 4 ) : $file;
if ( $wp_styles->query( $handle ) ) {
if ( did_action( 'wp_print_styles' ) ) // we already printed the style queue. Print this one immediately
if ( $force_echo || did_action( 'wp_print_styles' ) ) // we already printed the style queue. Print this one immediately
wp_print_styles( $handle );
else // Add to style queue
wp_enqueue_style( $handle );

View File

@ -8,8 +8,8 @@ header('Content-Type: text/html; charset=' . get_bloginfo('charset'));
<title><?php _e('Rich Editor Help') ?></title>
<script type="text/javascript" src="tiny_mce_popup.js"></script>
<?php
wp_admin_css( 'css/global' );
wp_admin_css();
wp_admin_css( 'global', true );
wp_admin_css( 'wp-admin', true );
?>
<style type="text/css">
#wphead {

View File

@ -217,6 +217,8 @@ function wp_default_styles( &$styles ) {
$styles->add_data( 'ie', 'conditional', 'gte IE 6' );
$styles->add( 'colors', true ); // Register "meta" stylesheet for admin colors
$styles->add( 'colors-fresh', '/wp-admin/css/colors-fresh.css' ); // for login.php. Is there a better way?
$styles->add_data( 'colors-fresh', 'rtl', true );
$styles->add( 'global', '/wp-admin/css/global.css' );
$styles->add( 'media', '/wp-admin/css/media.css' );

View File

@ -14,8 +14,8 @@ function login_header($title = 'Login', $message = '', $wp_error = '') {
<title><?php bloginfo('name'); ?> &rsaquo; <?php echo $title; ?></title>
<meta http-equiv="Content-Type" content="<?php bloginfo('html_type'); ?>; charset=<?php bloginfo('charset'); ?>" />
<?php
wp_admin_css( 'css/login' );
wp_admin_css( 'css/colors-fresh' );
wp_admin_css( 'login', true );
wp_admin_css( 'colors-fresh', true );
?>
<script type="text/javascript">
function focusit() {