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