PageRenderTime 56ms CodeModel.GetById 30ms RepoModel.GetById 0ms app.codeStats 0ms

/wp-admin/admin-header.php

https://github.com/muskmelon/Greemo
PHP | 219 lines | 167 code | 40 blank | 12 comment | 28 complexity | 2644993e8d3e21ad198fde3a49d660b5 MD5 | raw file
  1. <?php
  2. /**
  3. * WordPress Administration Template Header
  4. *
  5. * @package WordPress
  6. * @subpackage Administration
  7. */
  8. @header('Content-Type: ' . get_option('html_type') . '; charset=' . get_option('blog_charset'));
  9. if ( ! defined( 'WP_ADMIN' ) )
  10. require_once( './admin.php' );
  11. get_admin_page_title();
  12. $title = esc_html( strip_tags( $title ) );
  13. if ( is_network_admin() )
  14. $admin_title = __( 'Network Admin' );
  15. elseif ( is_user_admin() )
  16. $admin_title = __( 'Global Dashboard' );
  17. else
  18. $admin_title = get_bloginfo( 'name' );
  19. if ( $admin_title == $title )
  20. $admin_title = sprintf( __( '%1$s &#8212; WordPress' ), $title );
  21. else
  22. $admin_title = sprintf( __( '%1$s &lsaquo; %2$s &#8212; WordPress' ), $title, $admin_title );
  23. $admin_title = apply_filters( 'admin_title', $admin_title, $title );
  24. wp_user_settings();
  25. ?>
  26. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  27. <html xmlns="http://www.w3.org/1999/xhtml" <?php do_action('admin_xml_ns'); ?> <?php language_attributes(); ?>>
  28. <head>
  29. <meta http-equiv="Content-Type" content="<?php bloginfo('html_type'); ?>; charset=<?php echo get_option('blog_charset'); ?>" />
  30. <title><?php echo $admin_title; ?></title>
  31. <?php
  32. wp_admin_css( 'global' );
  33. wp_admin_css();
  34. wp_admin_css( 'colors' );
  35. wp_admin_css( 'ie' );
  36. if ( is_multisite() )
  37. wp_admin_css( 'ms' );
  38. wp_enqueue_script('utils');
  39. $admin_body_class = preg_replace('/[^a-z0-9_-]+/i', '-', $hook_suffix);
  40. ?>
  41. <script type="text/javascript">
  42. //<![CDATA[
  43. 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();}}};
  44. var userSettings = {
  45. 'url': '<?php echo SITECOOKIEPATH; ?>',
  46. 'uid': '<?php if ( ! isset($current_user) ) $current_user = wp_get_current_user(); echo $current_user->ID; ?>',
  47. 'time':'<?php echo time() ?>'
  48. },
  49. ajaxurl = '<?php echo admin_url('admin-ajax.php'); ?>',
  50. pagenow = '<?php echo $current_screen->id; ?>',
  51. typenow = '<?php if ( isset($current_screen->post_type) ) echo $current_screen->post_type; ?>',
  52. adminpage = '<?php echo $admin_body_class; ?>',
  53. thousandsSeparator = '<?php echo addslashes( $wp_locale->number_format['thousands_sep'] ); ?>',
  54. decimalPoint = '<?php echo addslashes( $wp_locale->number_format['decimal_point'] ); ?>',
  55. isRtl = <?php echo (int) is_rtl(); ?>;
  56. //]]>
  57. </script>
  58. <?php
  59. if ( in_array( $pagenow, array('post.php', 'post-new.php') ) ) {
  60. wp_enqueue_script('quicktags');
  61. }
  62. do_action('admin_enqueue_scripts', $hook_suffix);
  63. do_action("admin_print_styles-$hook_suffix");
  64. do_action('admin_print_styles');
  65. do_action("admin_print_scripts-$hook_suffix");
  66. do_action('admin_print_scripts');
  67. do_action("admin_head-$hook_suffix");
  68. do_action('admin_head');
  69. if ( get_user_setting('mfold') == 'f' )
  70. $admin_body_class .= ' folded';
  71. if ( is_admin_bar_showing() )
  72. $admin_body_class .= ' admin-bar';
  73. if ( is_rtl() )
  74. $admin_body_class .= ' rtl';
  75. $admin_body_class .= ' branch-' . str_replace( '.', '-', floatval( $wp_version ) );
  76. $admin_body_class .= ' version-' . str_replace( '.', '-', preg_replace( '/^([.0-9]+).*/', '$1', $wp_version ) );
  77. $admin_body_class .= ' admin-color-' . sanitize_html_class( get_user_option( 'admin_color' ), 'fresh' );
  78. if ( $is_iphone ) { ?>
  79. <style type="text/css">.row-actions{visibility:visible;}</style>
  80. <?php } ?>
  81. </head>
  82. <body class="wp-admin no-js <?php echo apply_filters( 'admin_body_class', '' ) . " $admin_body_class"; ?>">
  83. <script type="text/javascript">
  84. //<![CDATA[
  85. (function(){
  86. var c = document.body.className;
  87. c = c.replace(/no-js/, 'js');
  88. document.body.className = c;
  89. })();
  90. //]]>
  91. </script>
  92. <div id="wpwrap">
  93. <?php require(ABSPATH . 'wp-admin/menu-header.php'); ?>
  94. <div id="wpcontent">
  95. <div id="wphead">
  96. <?php
  97. if ( is_network_admin() )
  98. $blog_name = sprintf( __('%s Network Admin'), esc_html($current_site->site_name) );
  99. elseif ( is_user_admin() )
  100. $blog_name = sprintf( __('%s Global Dashboard'), esc_html($current_site->site_name) );
  101. else
  102. $blog_name = get_bloginfo('name', 'display');
  103. if ( '' == $blog_name ) {
  104. $blog_name = __( 'Visit Site' );
  105. } else {
  106. $blog_name_excerpt = wp_html_excerpt($blog_name, 40);
  107. if ( $blog_name != $blog_name_excerpt )
  108. $blog_name_excerpt = trim($blog_name_excerpt) . '&hellip;';
  109. $blog_name = $blog_name_excerpt;
  110. unset($blog_name_excerpt);
  111. }
  112. $title_class = '';
  113. if ( function_exists('mb_strlen') ) {
  114. if ( mb_strlen($blog_name, 'UTF-8') > 30 )
  115. $title_class = 'class="long-title"';
  116. } else {
  117. if ( strlen($blog_name) > 30 )
  118. $title_class = 'class="long-title"';
  119. }
  120. ?>
  121. <img id="header-logo" src="<?php echo esc_url( includes_url( 'images/blank.gif' ) ); ?>" alt="" width="16" height="16" />
  122. <h1 id="site-heading" <?php echo $title_class ?>>
  123. <a href="<?php echo trailingslashit( get_bloginfo( 'url' ) ); ?>" title="<?php esc_attr_e('Visit Site') ?>">
  124. <span id="site-title"><?php echo $blog_name ?></span>
  125. </a>
  126. </h1>
  127. <?php
  128. do_action('in_admin_header');
  129. $links = array();
  130. // Generate user profile and info links.
  131. $links[5] = sprintf( __('Howdy, %1$s'), $user_identity );
  132. $links[8] = '<a href="profile.php" title="' . esc_attr__('Edit your profile') . '">' . __('Your Profile') . '</a>';
  133. if ( is_multisite() && is_super_admin() ) {
  134. if ( !is_network_admin() )
  135. $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>';
  136. else
  137. $links[10] = '<a href="' . get_dashboard_url( get_current_user_id() ) . '" title="' . esc_attr__('Site Admin') . '">' . __('Site Admin') . '</a>';
  138. }
  139. $links[15] = '<a href="' . wp_logout_url() . '" title="' . esc_attr__('Log Out') . '">' . __('Log Out') . '</a>';
  140. $links = apply_filters( 'admin_user_info_links', $links, $current_user );
  141. ksort( $links );
  142. // Trim whitespace and pipes from links, then convert to list items.
  143. $links = array_map( 'trim', $links, array_fill( 0, count( $links ), " |\n\t" ) );
  144. $howdy = array_shift( $links );
  145. $links_no_js = implode( ' | ', $links );
  146. $links_js = '<li>' . implode( '</li><li>', $links ) . '</li>';
  147. ?>
  148. <div id="wphead-info">
  149. <div id="user_info">
  150. <p class="hide-if-js"><?php echo "$howdy | $links_no_js"; ?></p>
  151. <div class="hide-if-no-js">
  152. <p><?php echo $howdy; ?></p>
  153. <div id="user_info_arrow"></div>
  154. <div id="user_info_links_wrap"><div id="user_info_links">
  155. <ul><?php echo $links_js; ?></ul>
  156. </div></div>
  157. </div>
  158. </div>
  159. </div>
  160. </div>
  161. <div id="wpbody">
  162. <?php
  163. unset($title_class, $blog_name, $total_update_count, $update_title);
  164. $current_screen->parent_file = $parent_file;
  165. $current_screen->parent_base = preg_replace('/\?.*$/', '', $parent_file);
  166. $current_screen->parent_base = str_replace('.php', '', $current_screen->parent_base);
  167. ?>
  168. <div id="wpbody-content">
  169. <?php
  170. screen_meta($current_screen);
  171. if ( is_network_admin() )
  172. do_action('network_admin_notices');
  173. elseif ( is_user_admin() )
  174. do_action('user_admin_notices');
  175. else
  176. do_action('admin_notices');
  177. do_action('all_admin_notices');
  178. if ( $parent_file == 'options-general.php' )
  179. require(ABSPATH . 'wp-admin/options-head.php');