Make WordPress Core


Ignore:
File:
1 edited

Legend:

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

    r19522 r18349  
    1111    require_once( './admin.php' );
    1212
    13 // In case admin-header.php is included in a function.
    14 global $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.
    18 if ( empty( $current_screen ) )
    19     set_current_screen();
    20 
    2113get_admin_page_title();
    2214$title = esc_html( strip_tags( $title ) );
     
    3830wp_user_settings();
    3931
    40 _wp_admin_html_begin();
    41 ?>
     32?>
     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'); ?>" />
    4237<title><?php echo $admin_title; ?></title>
    4338<?php
    4439
    45 wp_enqueue_style( 'colors' );
    46 wp_enqueue_style( 'ie' );
     40wp_admin_css( 'global' );
     41wp_admin_css();
     42wp_admin_css( 'colors' );
     43wp_admin_css( 'ie' );
     44if ( is_multisite() )
     45    wp_admin_css( 'ms' );
    4746wp_enqueue_script('utils');
    4847
     
    5049?>
    5150<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 echo $current_screen->post_type; ?>',
     60    typenow = '<?php if ( isset($current_screen->post_type) ) 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//]]>
    6566</script>
    6667<?php
     68
     69if ( in_array( $pagenow, array('post.php', 'post-new.php') ) ) {
     70    wp_enqueue_script('quicktags');
     71}
    6772
    6873do_action('admin_enqueue_scripts', $hook_suffix);
     
    8388    $admin_body_class .= ' rtl';
    8489
    85 $admin_body_class .= ' branch-' . str_replace( array( '.', ',' ), '-', floatval( $wp_version ) );
     90$admin_body_class .= ' branch-' . str_replace( '.', '-', floatval( $wp_version ) );
    8691$admin_body_class .= ' version-' . str_replace( '.', '-', preg_replace( '/^([.0-9]+).*/', '$1', $wp_version ) );
    8792$admin_body_class .= ' admin-color-' . sanitize_html_class( get_user_option( 'admin_color' ), 'fresh' );
     
    9297</head>
    9398<body class="wp-admin no-js <?php echo apply_filters( 'admin_body_class', '' ) . " $admin_body_class"; ?>">
    94 <script type="text/javascript">document.body.className = document.body.className.replace('no-js','js');</script>
     99<script type="text/javascript">
     100//<![CDATA[
     101(function(){
     102var c = document.body.className;
     103c = c.replace(/no-js/, 'js');
     104document.body.className = c;
     105})();
     106//]]>
     107</script>
    95108
    96109<div id="wpwrap">
    97110<?php require(ABSPATH . 'wp-admin/menu-header.php'); ?>
    98111<div id="wpcontent">
    99 
    100 <?php
     112<div id="wphead">
     113<?php
     114
     115if ( is_network_admin() )
     116    $blog_name = sprintf( __('%s Network Admin'), esc_html($current_site->site_name) );
     117elseif ( is_user_admin() )
     118    $blog_name = sprintf( __('%s Global Dashboard'), esc_html($current_site->site_name) );
     119else
     120    $blog_name = get_bloginfo('name', 'display');
     121if ( '' == $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 = '';
     131if ( 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>
     146
     147<?php
     148
    101149do_action('in_admin_header');
    102 ?>
     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
     158if ( 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 );
     168ksort( $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
     178?>
     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>
    103195
    104196<div id="wpbody">
     
    106198unset($title_class, $blog_name, $total_update_count, $update_title);
    107199
    108 $current_screen->set_parentage( $parent_file );
    109 
     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);
    110203?>
    111204
    112205<div id="wpbody-content">
    113206<?php
    114 
    115 $current_screen->render_screen_meta();
     207screen_meta($current_screen);
    116208
    117209if ( is_network_admin() )
Note: See TracChangeset for help on using the changeset viewer.