Make WordPress Core


Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-admin/admin-header.php

    r18349 r19522  
    1010if ( ! defined( 'WP_ADMIN' ) )
    1111    require_once( './admin.php' );
     12
     13// In case admin-header.php is included in a function.
     14global $title, $hook_suffix, $current_screen, $wp_locale, $pagenow, $wp_version, $is_iphone,
     15    $current_site, $update_title, $total_update_count, $parent_file;
     16
     17// Catch plugins that include admin-header.php before admin.php completes.
     18if ( empty( $current_screen ) )
     19    set_current_screen();
    1220
    1321get_admin_page_title();
     
    3038wp_user_settings();
    3139
     40_wp_admin_html_begin();
    3241?>
    33 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    34 <html xmlns="http://www.w3.org/1999/xhtml" <?php do_action('admin_xml_ns'); ?> <?php language_attributes(); ?>>
    35 <head>
    36 <meta http-equiv="Content-Type" content="<?php bloginfo('html_type'); ?>; charset=<?php echo get_option('blog_charset'); ?>" />
    3742<title><?php echo $admin_title; ?></title>
    3843<?php
    3944
    40 wp_admin_css( 'global' );
    41 wp_admin_css();
    42 wp_admin_css( 'colors' );
    43 wp_admin_css( 'ie' );
    44 if ( is_multisite() )
    45     wp_admin_css( 'ms' );
     45wp_enqueue_style( 'colors' );
     46wp_enqueue_style( 'ie' );
    4647wp_enqueue_script('utils');
    4748
     
    4950?>
    5051<script type="text/javascript">
    51 //<![CDATA[
    5252addLoadEvent = 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();}}};
    5353var userSettings = {
     
    5858    ajaxurl = '<?php echo admin_url('admin-ajax.php'); ?>',
    5959    pagenow = '<?php echo $current_screen->id; ?>',
    60     typenow = '<?php if ( isset($current_screen->post_type) ) echo $current_screen->post_type; ?>',
     60    typenow = '<?php echo $current_screen->post_type; ?>',
    6161    adminpage = '<?php echo $admin_body_class; ?>',
    6262    thousandsSeparator = '<?php echo addslashes( $wp_locale->number_format['thousands_sep'] ); ?>',
    6363    decimalPoint = '<?php echo addslashes( $wp_locale->number_format['decimal_point'] ); ?>',
    6464    isRtl = <?php echo (int) is_rtl(); ?>;
    65 //]]>
    6665</script>
    6766<?php
    68 
    69 if ( in_array( $pagenow, array('post.php', 'post-new.php') ) ) {
    70     wp_enqueue_script('quicktags');
    71 }
    7267
    7368do_action('admin_enqueue_scripts', $hook_suffix);
     
    8883    $admin_body_class .= ' rtl';
    8984
    90 $admin_body_class .= ' branch-' . str_replace( '.', '-', floatval( $wp_version ) );
     85$admin_body_class .= ' branch-' . str_replace( array( '.', ',' ), '-', floatval( $wp_version ) );
    9186$admin_body_class .= ' version-' . str_replace( '.', '-', preg_replace( '/^([.0-9]+).*/', '$1', $wp_version ) );
    9287$admin_body_class .= ' admin-color-' . sanitize_html_class( get_user_option( 'admin_color' ), 'fresh' );
     
    9792</head>
    9893<body class="wp-admin no-js <?php echo apply_filters( 'admin_body_class', '' ) . " $admin_body_class"; ?>">
    99 <script type="text/javascript">
    100 //<![CDATA[
    101 (function(){
    102 var c = document.body.className;
    103 c = c.replace(/no-js/, 'js');
    104 document.body.className = c;
    105 })();
    106 //]]>
    107 </script>
     94<script type="text/javascript">document.body.className = document.body.className.replace('no-js','js');</script>
    10895
    10996<div id="wpwrap">
    11097<?php require(ABSPATH . 'wp-admin/menu-header.php'); ?>
    11198<div id="wpcontent">
    112 <div id="wphead">
    113 <?php
    114 
    115 if ( is_network_admin() )
    116     $blog_name = sprintf( __('%s Network Admin'), esc_html($current_site->site_name) );
    117 elseif ( is_user_admin() )
    118     $blog_name = sprintf( __('%s Global Dashboard'), esc_html($current_site->site_name) );
    119 else
    120     $blog_name = get_bloginfo('name', 'display');
    121 if ( '' == $blog_name ) {
    122     $blog_name = __( 'Visit Site' );
    123 } else {
    124     $blog_name_excerpt = wp_html_excerpt($blog_name, 40);
    125     if ( $blog_name != $blog_name_excerpt )
    126         $blog_name_excerpt = trim($blog_name_excerpt) . '&hellip;';
    127     $blog_name = $blog_name_excerpt;
    128     unset($blog_name_excerpt);
    129 }
    130 $title_class = '';
    131 if ( function_exists('mb_strlen') ) {
    132     if ( mb_strlen($blog_name, 'UTF-8') > 30 )
    133         $title_class = 'class="long-title"';
    134 } else {
    135     if ( strlen($blog_name) > 30 )
    136         $title_class = 'class="long-title"';
    137 }
    138 ?>
    139 
    140 <img id="header-logo" src="<?php echo esc_url( includes_url( 'images/blank.gif' ) ); ?>" alt="" width="16" height="16" />
    141 <h1 id="site-heading" <?php echo $title_class ?>>
    142     <a href="<?php echo trailingslashit( get_bloginfo( 'url' ) ); ?>" title="<?php esc_attr_e('Visit Site') ?>">
    143         <span id="site-title"><?php echo $blog_name ?></span>
    144     </a>
    145 </h1>
    14699
    147100<?php
    148 
    149101do_action('in_admin_header');
    150 
    151 $links = array();
    152 
    153 // Generate user profile and info links.
    154 $links[5] = sprintf( __('Howdy, %1$s'), $user_identity );
    155 
    156 $links[8] = '<a href="profile.php" title="' . esc_attr__('Edit your profile') . '">' . __('Your Profile') . '</a>';
    157 
    158 if ( is_multisite() && is_super_admin() ) {
    159     if ( !is_network_admin() )
    160         $links[10] = '<a href="' . network_admin_url() . '" title="' . ( ! empty( $update_title ) ? $update_title : esc_attr__('Network Admin') ) . '">' . __('Network Admin') . ( ! empty( $total_update_count ) ? ' (' . number_format_i18n( $total_update_count ) . ')' : '' ) . '</a>';
    161     else
    162         $links[10] = '<a href="' . get_dashboard_url( get_current_user_id() ) . '" title="' . esc_attr__('Site Admin') . '">' . __('Site Admin') . '</a>';
    163 }
    164 
    165 $links[15] = '<a href="' . wp_logout_url() . '" title="' . esc_attr__('Log Out') . '">' . __('Log Out') . '</a>';
    166 
    167 $links = apply_filters( 'admin_user_info_links', $links, $current_user );
    168 ksort( $links );
    169 
    170 // Trim whitespace and pipes from links, then convert to list items.
    171 $links = array_map( 'trim', $links, array_fill( 0, count( $links ), " |\n\t" ) );
    172 
    173 $howdy = array_shift( $links );
    174 
    175 $links_no_js = implode( ' | ', $links );
    176 $links_js = '<li>' . implode( '</li><li>', $links ) . '</li>';
    177 
    178102?>
    179 
    180 <div id="wphead-info">
    181 <div id="user_info">
    182     <p class="hide-if-js"><?php echo "$howdy | $links_no_js"; ?></p>
    183 
    184     <div class="hide-if-no-js">
    185         <p><?php echo $howdy; ?></p>
    186         <div id="user_info_arrow"></div>
    187         <div id="user_info_links_wrap"><div id="user_info_links">
    188             <ul><?php echo $links_js; ?></ul>
    189         </div></div>
    190     </div>
    191 </div>
    192 </div>
    193 
    194 </div>
    195103
    196104<div id="wpbody">
     
    198106unset($title_class, $blog_name, $total_update_count, $update_title);
    199107
    200 $current_screen->parent_file = $parent_file;
    201 $current_screen->parent_base = preg_replace('/\?.*$/', '', $parent_file);
    202 $current_screen->parent_base = str_replace('.php', '', $current_screen->parent_base);
     108$current_screen->set_parentage( $parent_file );
     109
    203110?>
    204111
    205112<div id="wpbody-content">
    206113<?php
    207 screen_meta($current_screen);
     114
     115$current_screen->render_screen_meta();
    208116
    209117if ( is_network_admin() )
Note: See TracChangeset for help on using the changeset viewer.