web/wp-admin/admin-header.php
changeset 194 32102edaa81b
parent 136 bde1974c263b
child 204 09a1c134465b
equal deleted inserted replaced
193:2f6f6f7551ca 194:32102edaa81b
     5  * @package WordPress
     5  * @package WordPress
     6  * @subpackage Administration
     6  * @subpackage Administration
     7  */
     7  */
     8 
     8 
     9 @header('Content-Type: ' . get_option('html_type') . '; charset=' . get_option('blog_charset'));
     9 @header('Content-Type: ' . get_option('html_type') . '; charset=' . get_option('blog_charset'));
    10 if (!isset($_GET["page"])) require_once('admin.php');
    10 if ( ! defined( 'WP_ADMIN' ) )
       
    11 	require_once( './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();
    11 
    20 
    12 get_admin_page_title();
    21 get_admin_page_title();
    13 $title = esc_html( strip_tags( $title ) );
    22 $title = esc_html( strip_tags( $title ) );
       
    23 
       
    24 if ( is_network_admin() )
       
    25 	$admin_title = __( 'Network Admin' );
       
    26 elseif ( is_user_admin() )
       
    27 	$admin_title = __( 'Global Dashboard' );
       
    28 else
       
    29 	$admin_title = get_bloginfo( 'name' );
       
    30 
       
    31 if ( $admin_title == $title )
       
    32 	$admin_title = sprintf( __( '%1$s — WordPress' ), $title );
       
    33 else
       
    34 	$admin_title = sprintf( __( '%1$s ‹ %2$s — WordPress' ), $title, $admin_title );
       
    35 
       
    36 $admin_title = apply_filters( 'admin_title', $admin_title, $title );
       
    37 
    14 wp_user_settings();
    38 wp_user_settings();
    15 wp_menu_unfold();
    39 
       
    40 _wp_admin_html_begin();
    16 ?>
    41 ?>
    17 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    42 <title><?php echo $admin_title; ?></title>
    18 <html xmlns="http://www.w3.org/1999/xhtml" <?php do_action('admin_xml_ns'); ?> <?php language_attributes(); ?>>
       
    19 <head>
       
    20 <meta http-equiv="Content-Type" content="<?php bloginfo('html_type'); ?>; charset=<?php echo get_option('blog_charset'); ?>" />
       
    21 <title><?php echo $title; ?> &lsaquo; <?php bloginfo('name') ?>  &#8212; WordPress</title>
       
    22 <?php
    43 <?php
    23 
    44 
    24 wp_admin_css( 'css/global' );
    45 wp_enqueue_style( 'colors' );
    25 wp_admin_css();
    46 wp_enqueue_style( 'ie' );
    26 wp_admin_css( 'css/colors' );
       
    27 wp_admin_css( 'css/ie' );
       
    28 wp_enqueue_script('utils');
    47 wp_enqueue_script('utils');
    29 
       
    30 $hook_suffix = '';
       
    31 if ( isset($page_hook) )
       
    32 	$hook_suffix = "$page_hook";
       
    33 else if ( isset($plugin_page) )
       
    34 	$hook_suffix = "$plugin_page";
       
    35 else if ( isset($pagenow) )
       
    36 	$hook_suffix = "$pagenow";
       
    37 
    48 
    38 $admin_body_class = preg_replace('/[^a-z0-9_-]+/i', '-', $hook_suffix);
    49 $admin_body_class = preg_replace('/[^a-z0-9_-]+/i', '-', $hook_suffix);
    39 ?>
    50 ?>
    40 <script type="text/javascript">
    51 <script type="text/javascript">
    41 //<![CDATA[
       
    42 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();}}};
    52 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();}}};
    43 var userSettings = {'url':'<?php echo SITECOOKIEPATH; ?>','uid':'<?php if ( ! isset($current_user) ) $current_user = wp_get_current_user(); echo $current_user->ID; ?>','time':'<?php echo time() ?>'};
    53 var userSettings = {
    44 var ajaxurl = '<?php echo admin_url('admin-ajax.php'); ?>', pagenow = '<?php echo substr($pagenow, 0, -4); ?>', adminpage = '<?php echo $admin_body_class; ?>',  thousandsSeparator = '<?php echo $wp_locale->number_format['thousands_sep']; ?>', decimalPoint = '<?php echo $wp_locale->number_format['decimal_point']; ?>';
    54 		'url': '<?php echo SITECOOKIEPATH; ?>',
    45 //]]>
    55 		'uid': '<?php if ( ! isset($current_user) ) $current_user = wp_get_current_user(); echo $current_user->ID; ?>',
       
    56 		'time':'<?php echo time() ?>'
       
    57 	},
       
    58 	ajaxurl = '<?php echo admin_url( 'admin-ajax.php', 'relative' ); ?>',
       
    59 	pagenow = '<?php echo $current_screen->id; ?>',
       
    60 	typenow = '<?php echo $current_screen->post_type; ?>',
       
    61 	adminpage = '<?php echo $admin_body_class; ?>',
       
    62 	thousandsSeparator = '<?php echo addslashes( $wp_locale->number_format['thousands_sep'] ); ?>',
       
    63 	decimalPoint = '<?php echo addslashes( $wp_locale->number_format['decimal_point'] ); ?>',
       
    64 	isRtl = <?php echo (int) is_rtl(); ?>;
    46 </script>
    65 </script>
    47 <?php
    66 <?php
    48 
       
    49 if ( in_array( $pagenow, array('post.php', 'post-new.php', 'page.php', 'page-new.php') ) ) {
       
    50 	add_action( 'admin_print_footer_scripts', 'wp_tiny_mce', 25 );
       
    51 	wp_enqueue_script('quicktags');
       
    52 }
       
    53 
    67 
    54 do_action('admin_enqueue_scripts', $hook_suffix);
    68 do_action('admin_enqueue_scripts', $hook_suffix);
    55 do_action("admin_print_styles-$hook_suffix");
    69 do_action("admin_print_styles-$hook_suffix");
    56 do_action('admin_print_styles');
    70 do_action('admin_print_styles');
    57 do_action("admin_print_scripts-$hook_suffix");
    71 do_action("admin_print_scripts-$hook_suffix");
    58 do_action('admin_print_scripts');
    72 do_action('admin_print_scripts');
    59 do_action("admin_head-$hook_suffix");
    73 do_action("admin_head-$hook_suffix");
    60 do_action('admin_head');
    74 do_action('admin_head');
    61 
    75 
    62 if ( get_user_setting('mfold') == 'f' ) {
    76 if ( get_user_setting('mfold') == 'f' )
    63 	$admin_body_class .= ' folded';
    77 	$admin_body_class .= ' folded';
    64 }
       
    65 
    78 
    66 if ( $is_iphone ) { ?>
    79 if ( is_admin_bar_showing() )
    67 <style type="text/css">.row-actions{visibility:visible;}</style>
    80 	$admin_body_class .= ' admin-bar';
    68 <?php } ?>
    81 
       
    82 if ( is_rtl() )
       
    83 	$admin_body_class .= ' rtl';
       
    84 
       
    85 $admin_body_class .= ' branch-' . str_replace( array( '.', ',' ), '-', floatval( $wp_version ) );
       
    86 $admin_body_class .= ' version-' . str_replace( '.', '-', preg_replace( '/^([.0-9]+).*/', '$1', $wp_version ) );
       
    87 $admin_body_class .= ' admin-color-' . sanitize_html_class( get_user_option( 'admin_color' ), 'fresh' );
       
    88 $admin_body_class .= ' locale-' . sanitize_html_class( strtolower( str_replace( '_', '-', get_locale() ) ) );
       
    89 
       
    90 if ( wp_is_mobile() )
       
    91 	$admin_body_class .= ' mobile';
       
    92 
       
    93 $admin_body_class .= ' no-customize-support';
       
    94 
       
    95 ?>
    69 </head>
    96 </head>
    70 <body class="wp-admin no-js <?php echo apply_filters( 'admin_body_class', '' ) . " $admin_body_class"; ?>">
    97 <body class="wp-admin no-js <?php echo apply_filters( 'admin_body_class', '' ) . " $admin_body_class"; ?>">
    71 <script type="text/javascript">
    98 <script type="text/javascript">
    72 //<![CDATA[
    99 	document.body.className = document.body.className.replace('no-js','js');
    73 (function(){
       
    74 var c = document.body.className;
       
    75 c = c.replace(/no-js/, 'js');
       
    76 document.body.className = c;
       
    77 })();
       
    78 //]]>
       
    79 </script>
   100 </script>
    80 
   101 
    81 <div id="wpwrap">
       
    82 <div id="wpcontent">
       
    83 <div id="wphead">
       
    84 <?php
   102 <?php
    85 $blog_name = get_bloginfo('name', 'display');
   103 // If the customize-loader script is enqueued, make sure the customize
    86 if ( '' == $blog_name ) {
   104 // body classes are correct as early as possible.
    87 	$blog_name = '&nbsp;';
   105 if ( wp_script_is( 'customize-loader', 'queue' ) && current_user_can( 'edit_theme_options' ) )
    88 } else {
   106 	wp_customize_support_script();
    89 	$blog_name_excerpt = wp_html_excerpt($blog_name, 40);
       
    90 	if ( $blog_name != $blog_name_excerpt )
       
    91 		$blog_name_excerpt = trim($blog_name_excerpt) . '&hellip;';
       
    92 	$blog_name = $blog_name_excerpt;
       
    93 }
       
    94 $title_class = '';
       
    95 if ( function_exists('mb_strlen') ) {
       
    96 	if ( mb_strlen($blog_name, 'UTF-8') > 30 )
       
    97 		$title_class = 'class="long-title"';
       
    98 } else {
       
    99 	if ( strlen($blog_name) > 30 )
       
   100 		$title_class = 'class="long-title"';
       
   101 }
       
   102 ?>
   107 ?>
   103 
   108 
   104 <img id="header-logo" src="../wp-includes/images/blank.gif" alt="" width="32" height="32" /> <h1 id="site-heading" <?php echo $title_class ?>><a href="<?php echo trailingslashit( get_bloginfo('url') ); ?>" title="<?php _e('Visit Site') ?>"><span id="site-title"><?php echo $blog_name ?></span> <em id="site-visit-button"><?php _e('Visit Site') ?></em></a></h1>
   109 <div id="wpwrap">
       
   110 <?php require(ABSPATH . 'wp-admin/menu-header.php'); ?>
       
   111 <div id="wpcontent">
   105 
   112 
   106 <div id="wphead-info">
   113 <?php
   107 <div id="user_info">
   114 do_action('in_admin_header');
   108 <p><?php printf(__('Howdy, <a href="%1$s" title="Edit your profile">%2$s</a>'), 'profile.php', $user_identity) ?>
   115 ?>
   109 <?php if ( ! $is_opera ) { ?><span class="turbo-nag hidden"> | <a href="tools.php"><?php _e('Turbo') ?></a></span><?php } ?> |
       
   110 <a href="<?php echo wp_logout_url() ?>" title="<?php _e('Log Out') ?>"><?php _e('Log Out'); ?></a></p>
       
   111 </div>
       
   112 
       
   113 <?php favorite_actions($hook_suffix); ?>
       
   114 </div>
       
   115 </div>
       
   116 
   116 
   117 <div id="wpbody">
   117 <div id="wpbody">
   118 <?php require(ABSPATH . 'wp-admin/menu-header.php'); ?>
   118 <?php
       
   119 unset($title_class, $blog_name, $total_update_count, $update_title);
       
   120 
       
   121 $current_screen->set_parentage( $parent_file );
       
   122 
       
   123 ?>
   119 
   124 
   120 <div id="wpbody-content">
   125 <div id="wpbody-content">
   121 <?php
   126 <?php
   122 screen_meta($hook_suffix);
       
   123 
   127 
   124 do_action('admin_notices');
   128 $current_screen->render_screen_meta();
   125 
   129 
   126 if ( $parent_file == 'options-general.php' ) {
   130 if ( is_network_admin() )
       
   131 	do_action('network_admin_notices');
       
   132 elseif ( is_user_admin() )
       
   133 	do_action('user_admin_notices');
       
   134 else
       
   135 	do_action('admin_notices');
       
   136 
       
   137 do_action('all_admin_notices');
       
   138 
       
   139 if ( $parent_file == 'options-general.php' )
   127 	require(ABSPATH . 'wp-admin/options-head.php');
   140 	require(ABSPATH . 'wp-admin/options-head.php');
   128 }