wp/wp-admin/admin-header.php
changeset 0 d970ebf37754
child 5 5e2f62d02dcd
equal deleted inserted replaced
-1:000000000000 0:d970ebf37754
       
     1 <?php
       
     2 /**
       
     3  * WordPress Administration Template Header
       
     4  *
       
     5  * @package WordPress
       
     6  * @subpackage Administration
       
     7  */
       
     8 
       
     9 @header('Content-Type: ' . get_option('html_type') . '; charset=' . get_option('blog_charset'));
       
    10 if ( ! defined( 'WP_ADMIN' ) )
       
    11 	require_once( dirname( __FILE__ ) . '/admin.php' );
       
    12 
       
    13 // In case admin-header.php is included in a function.
       
    14 global $title, $hook_suffix, $current_screen, $wp_locale, $pagenow, $wp_version,
       
    15 	$current_site, $update_title, $total_update_count, $parent_file;
       
    16 
       
    17 // Catch plugins that include admin-header.php before admin.php completes.
       
    18 if ( empty( $current_screen ) )
       
    19 	set_current_screen();
       
    20 
       
    21 get_admin_page_title();
       
    22 $title = esc_html( strip_tags( $title ) );
       
    23 
       
    24 if ( is_network_admin() )
       
    25 	$admin_title = sprintf( __('Network Admin: %s'), esc_html( $current_site->site_name ) );
       
    26 elseif ( is_user_admin() )
       
    27 	$admin_title = sprintf( __('Global Dashboard: %s'), esc_html( $current_site->site_name ) );
       
    28 else
       
    29 	$admin_title = get_bloginfo( 'name' );
       
    30 
       
    31 if ( $admin_title == $title )
       
    32 	$admin_title = sprintf( __( '%1$s &#8212; WordPress' ), $title );
       
    33 else
       
    34 	$admin_title = sprintf( __( '%1$s &lsaquo; %2$s &#8212; WordPress' ), $title, $admin_title );
       
    35 
       
    36 /**
       
    37  * Filter the <title> content for an admin page.
       
    38  *
       
    39  * @since 3.1.0
       
    40  *
       
    41  * @param string $admin_title The page title, with extra context added.
       
    42  * @param string $title       The original page title.
       
    43  */
       
    44 $admin_title = apply_filters( 'admin_title', $admin_title, $title );
       
    45 
       
    46 wp_user_settings();
       
    47 
       
    48 _wp_admin_html_begin();
       
    49 ?>
       
    50 <title><?php echo $admin_title; ?></title>
       
    51 <?php
       
    52 
       
    53 wp_enqueue_style( 'colors' );
       
    54 wp_enqueue_style( 'ie' );
       
    55 wp_enqueue_script('utils');
       
    56 
       
    57 $admin_body_class = preg_replace('/[^a-z0-9_-]+/i', '-', $hook_suffix);
       
    58 ?>
       
    59 <script type="text/javascript">
       
    60 addLoadEvent = function(func){if(typeof jQuery!="undefined")jQuery(document).ready(func);else if(typeof wpOnload!='function'){wpOnload=func;}else{var oldonload=wpOnload;wpOnload=function(){oldonload();func();}}};
       
    61 var ajaxurl = '<?php echo admin_url( 'admin-ajax.php', 'relative' ); ?>',
       
    62 	pagenow = '<?php echo $current_screen->id; ?>',
       
    63 	typenow = '<?php echo $current_screen->post_type; ?>',
       
    64 	adminpage = '<?php echo $admin_body_class; ?>',
       
    65 	thousandsSeparator = '<?php echo addslashes( $wp_locale->number_format['thousands_sep'] ); ?>',
       
    66 	decimalPoint = '<?php echo addslashes( $wp_locale->number_format['decimal_point'] ); ?>',
       
    67 	isRtl = <?php echo (int) is_rtl(); ?>;
       
    68 </script>
       
    69 <?php
       
    70 
       
    71 /**
       
    72  * Enqueue scripts for all admin pages.
       
    73  *
       
    74  * @since 2.8.0
       
    75  *
       
    76  * @param string $hook_suffix The current admin page.
       
    77  */
       
    78 do_action( 'admin_enqueue_scripts', $hook_suffix );
       
    79 
       
    80 /**
       
    81  * Print styles for a specific admin page based on $hook_suffix.
       
    82  *
       
    83  * @since 2.6.0
       
    84  */
       
    85 do_action( "admin_print_styles-$hook_suffix" );
       
    86 
       
    87 /**
       
    88  * Print styles for all admin pages.
       
    89  *
       
    90  * @since 2.6.0
       
    91  */
       
    92 do_action( 'admin_print_styles' );
       
    93 
       
    94 /**
       
    95  * Print scripts for a specific admin page based on $hook_suffix.
       
    96  *
       
    97  * @since 2.1.0
       
    98  */
       
    99 do_action( "admin_print_scripts-$hook_suffix" );
       
   100 
       
   101 /**
       
   102  * Print scripts for all admin pages.
       
   103  *
       
   104  * @since 2.1.0
       
   105  */
       
   106 do_action( 'admin_print_scripts' );
       
   107 
       
   108 /**
       
   109  * Fires in <head> for a specific admin page based on $hook_suffix.
       
   110  *
       
   111  * @since 2.1.0
       
   112  */
       
   113 do_action( "admin_head-$hook_suffix" );
       
   114 
       
   115 /**
       
   116  * Fires in <head> for all admin pages.
       
   117  *
       
   118  * @since 2.1.0
       
   119  */
       
   120 do_action( 'admin_head' );
       
   121 
       
   122 if ( get_user_setting('mfold') == 'f' )
       
   123 	$admin_body_class .= ' folded';
       
   124 
       
   125 if ( !get_user_setting('unfold') )
       
   126 	$admin_body_class .= ' auto-fold';
       
   127 
       
   128 if ( is_admin_bar_showing() )
       
   129 	$admin_body_class .= ' admin-bar';
       
   130 
       
   131 if ( is_rtl() )
       
   132 	$admin_body_class .= ' rtl';
       
   133 
       
   134 if ( $current_screen->post_type )
       
   135 	$admin_body_class .= ' post-type-' . $current_screen->post_type;
       
   136 
       
   137 if ( $current_screen->taxonomy )
       
   138 	$admin_body_class .= ' taxonomy-' . $current_screen->taxonomy;
       
   139 
       
   140 $admin_body_class .= ' branch-' . str_replace( array( '.', ',' ), '-', floatval( $wp_version ) );
       
   141 $admin_body_class .= ' version-' . str_replace( '.', '-', preg_replace( '/^([.0-9]+).*/', '$1', $wp_version ) );
       
   142 $admin_body_class .= ' admin-color-' . sanitize_html_class( get_user_option( 'admin_color' ), 'fresh' );
       
   143 $admin_body_class .= ' locale-' . sanitize_html_class( strtolower( str_replace( '_', '-', get_locale() ) ) );
       
   144 
       
   145 if ( wp_is_mobile() )
       
   146 	$admin_body_class .= ' mobile';
       
   147 
       
   148 $admin_body_class .= ' no-customize-support';
       
   149 
       
   150 ?>
       
   151 </head>
       
   152 <?php
       
   153 /**
       
   154  * Filter the admin <body> CSS classes.
       
   155  *
       
   156  * This filter differs from the post_class or body_class filters in two important ways:
       
   157  * 1. $classes is a space-separated string of class names instead of an array.
       
   158  * 2. Not all core admin classes are filterable, notably: wp-admin, wp-core-ui, and no-js cannot be removed.
       
   159  *
       
   160  * @since 2.3.0
       
   161  *
       
   162  * @param string $classes Space-separated string of CSS classes.
       
   163  */
       
   164 ?>
       
   165 <body class="wp-admin wp-core-ui no-js <?php echo apply_filters( 'admin_body_class', '' ) . " $admin_body_class"; ?>">
       
   166 <script type="text/javascript">
       
   167 	document.body.className = document.body.className.replace('no-js','js');
       
   168 </script>
       
   169 
       
   170 <?php
       
   171 // Make sure the customize body classes are correct as early as possible.
       
   172 if ( current_user_can( 'edit_theme_options' ) )
       
   173 	wp_customize_support_script();
       
   174 ?>
       
   175 
       
   176 <div id="wpwrap">
       
   177 <a tabindex="1" href="#wpbody-content" class="screen-reader-shortcut"><?php _e('Skip to main content'); ?></a>
       
   178 <?php require(ABSPATH . 'wp-admin/menu-header.php'); ?>
       
   179 <div id="wpcontent">
       
   180 
       
   181 <?php
       
   182 /**
       
   183  * Fires at the beginning of the content section in an admin page.
       
   184  *
       
   185  * @since 3.0.0
       
   186  */
       
   187 do_action( 'in_admin_header' );
       
   188 ?>
       
   189 
       
   190 <div id="wpbody">
       
   191 <?php
       
   192 unset($title_class, $blog_name, $total_update_count, $update_title);
       
   193 
       
   194 $current_screen->set_parentage( $parent_file );
       
   195 
       
   196 ?>
       
   197 
       
   198 <div id="wpbody-content" aria-label="<?php esc_attr_e('Main content'); ?>" tabindex="0">
       
   199 <?php
       
   200 
       
   201 $current_screen->render_screen_meta();
       
   202 
       
   203 if ( is_network_admin() ) {
       
   204 	/**
       
   205 	 * Print network admin screen notices.
       
   206 	 *
       
   207 	 * @since 3.1.0
       
   208 	 */
       
   209 	do_action( 'network_admin_notices' );
       
   210 } elseif ( is_user_admin() ) {
       
   211 	/**
       
   212 	 * Print user admin screen notices.
       
   213 	 *
       
   214 	 * @since 3.1.0
       
   215 	 */
       
   216 	do_action( 'user_admin_notices' );
       
   217 } else {
       
   218 	/**
       
   219 	 * Print admin screen notices.
       
   220 	 *
       
   221 	 * @since 3.1.0
       
   222 	 */
       
   223 	do_action( 'admin_notices' );
       
   224 }
       
   225 
       
   226 /**
       
   227  * Print generic admin screen notices.
       
   228  *
       
   229  * @since 3.1.0
       
   230  */
       
   231 do_action( 'all_admin_notices' );
       
   232 
       
   233 if ( $parent_file == 'options-general.php' )
       
   234 	require(ABSPATH . 'wp-admin/options-head.php');