author | ymh <ymh.work@gmail.com> |
Tue, 15 Oct 2019 15:48:13 +0200 | |
changeset 13 | d255fe9cd479 |
parent 9 | 177826044cd9 |
child 16 | a86126ab1dd4 |
permissions | -rw-r--r-- |
0 | 1 |
<?php |
2 |
/** |
|
3 |
* WordPress Administration Template Header |
|
4 |
* |
|
5 |
* @package WordPress |
|
6 |
* @subpackage Administration |
|
7 |
*/ |
|
8 |
||
9 | 9 |
@header( 'Content-Type: ' . get_option( 'html_type' ) . '; charset=' . get_option( 'blog_charset' ) ); |
10 |
if ( ! defined( 'WP_ADMIN' ) ) { |
|
0 | 11 |
require_once( dirname( __FILE__ ) . '/admin.php' ); |
9 | 12 |
} |
0 | 13 |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
14 |
/** |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
15 |
* In case admin-header.php is included in a function. |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
16 |
* |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
17 |
* @global string $title |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
18 |
* @global string $hook_suffix |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
19 |
* @global WP_Screen $current_screen |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
20 |
* @global WP_Locale $wp_locale |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
21 |
* @global string $pagenow |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
22 |
* @global string $update_title |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
23 |
* @global int $total_update_count |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
24 |
* @global string $parent_file |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
25 |
*/ |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
26 |
global $title, $hook_suffix, $current_screen, $wp_locale, $pagenow, |
5 | 27 |
$update_title, $total_update_count, $parent_file; |
0 | 28 |
|
29 |
// Catch plugins that include admin-header.php before admin.php completes. |
|
9 | 30 |
if ( empty( $current_screen ) ) { |
0 | 31 |
set_current_screen(); |
9 | 32 |
} |
0 | 33 |
|
34 |
get_admin_page_title(); |
|
35 |
$title = esc_html( strip_tags( $title ) ); |
|
36 |
||
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
37 |
if ( is_network_admin() ) { |
9 | 38 |
/* translators: Network admin screen title. %s: Network name */ |
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
39 |
$admin_title = sprintf( __( 'Network Admin: %s' ), esc_html( get_network()->site_name ) ); |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
40 |
} elseif ( is_user_admin() ) { |
9 | 41 |
/* translators: User dashboard screen title. %s: Network name */ |
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
42 |
$admin_title = sprintf( __( 'User Dashboard: %s' ), esc_html( get_network()->site_name ) ); |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
43 |
} else { |
0 | 44 |
$admin_title = get_bloginfo( 'name' ); |
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
45 |
} |
0 | 46 |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
47 |
if ( $admin_title == $title ) { |
9 | 48 |
/* translators: Admin screen title. %s: Admin screen name */ |
49 |
$admin_title = sprintf( __( '%s — WordPress' ), $title ); |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
50 |
} else { |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
51 |
/* translators: Admin screen title. 1: Admin screen name, 2: Network or site name */ |
0 | 52 |
$admin_title = sprintf( __( '%1$s ‹ %2$s — WordPress' ), $title, $admin_title ); |
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
53 |
} |
0 | 54 |
|
9 | 55 |
if ( wp_is_recovery_mode() ) { |
56 |
/* translators: %s: Admin screen title. */ |
|
57 |
$admin_title = sprintf( __( 'Recovery Mode — %s' ), $admin_title ); |
|
58 |
} |
|
59 |
||
0 | 60 |
/** |
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
61 |
* Filters the title tag content for an admin page. |
0 | 62 |
* |
63 |
* @since 3.1.0 |
|
64 |
* |
|
65 |
* @param string $admin_title The page title, with extra context added. |
|
66 |
* @param string $title The original page title. |
|
67 |
*/ |
|
68 |
$admin_title = apply_filters( 'admin_title', $admin_title, $title ); |
|
69 |
||
70 |
wp_user_settings(); |
|
71 |
||
72 |
_wp_admin_html_begin(); |
|
73 |
?> |
|
74 |
<title><?php echo $admin_title; ?></title> |
|
75 |
<?php |
|
76 |
||
77 |
wp_enqueue_style( 'colors' ); |
|
78 |
wp_enqueue_style( 'ie' ); |
|
9 | 79 |
wp_enqueue_script( 'utils' ); |
5 | 80 |
wp_enqueue_script( 'svg-painter' ); |
0 | 81 |
|
9 | 82 |
$admin_body_class = preg_replace( '/[^a-z0-9_-]+/i', '-', $hook_suffix ); |
0 | 83 |
?> |
84 |
<script type="text/javascript"> |
|
85 |
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();}}}; |
|
86 |
var ajaxurl = '<?php echo admin_url( 'admin-ajax.php', 'relative' ); ?>', |
|
87 |
pagenow = '<?php echo $current_screen->id; ?>', |
|
88 |
typenow = '<?php echo $current_screen->post_type; ?>', |
|
89 |
adminpage = '<?php echo $admin_body_class; ?>', |
|
90 |
thousandsSeparator = '<?php echo addslashes( $wp_locale->number_format['thousands_sep'] ); ?>', |
|
91 |
decimalPoint = '<?php echo addslashes( $wp_locale->number_format['decimal_point'] ); ?>', |
|
92 |
isRtl = <?php echo (int) is_rtl(); ?>; |
|
93 |
</script> |
|
5 | 94 |
<meta name="viewport" content="width=device-width,initial-scale=1.0"> |
0 | 95 |
<?php |
96 |
||
97 |
/** |
|
98 |
* Enqueue scripts for all admin pages. |
|
99 |
* |
|
100 |
* @since 2.8.0 |
|
101 |
* |
|
102 |
* @param string $hook_suffix The current admin page. |
|
103 |
*/ |
|
104 |
do_action( 'admin_enqueue_scripts', $hook_suffix ); |
|
105 |
||
106 |
/** |
|
5 | 107 |
* Fires when styles are printed for a specific admin page based on $hook_suffix. |
0 | 108 |
* |
109 |
* @since 2.6.0 |
|
110 |
*/ |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
111 |
do_action( "admin_print_styles-{$hook_suffix}" ); |
0 | 112 |
|
113 |
/** |
|
5 | 114 |
* Fires when styles are printed for all admin pages. |
0 | 115 |
* |
116 |
* @since 2.6.0 |
|
117 |
*/ |
|
118 |
do_action( 'admin_print_styles' ); |
|
119 |
||
120 |
/** |
|
5 | 121 |
* Fires when scripts are printed for a specific admin page based on $hook_suffix. |
0 | 122 |
* |
123 |
* @since 2.1.0 |
|
124 |
*/ |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
125 |
do_action( "admin_print_scripts-{$hook_suffix}" ); |
0 | 126 |
|
127 |
/** |
|
5 | 128 |
* Fires when scripts are printed for all admin pages. |
0 | 129 |
* |
130 |
* @since 2.1.0 |
|
131 |
*/ |
|
132 |
do_action( 'admin_print_scripts' ); |
|
133 |
||
134 |
/** |
|
5 | 135 |
* Fires in head section for a specific admin page. |
136 |
* |
|
137 |
* The dynamic portion of the hook, `$hook_suffix`, refers to the hook suffix |
|
138 |
* for the admin page. |
|
0 | 139 |
* |
140 |
* @since 2.1.0 |
|
141 |
*/ |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
142 |
do_action( "admin_head-{$hook_suffix}" ); |
0 | 143 |
|
144 |
/** |
|
5 | 145 |
* Fires in head section for all admin pages. |
0 | 146 |
* |
147 |
* @since 2.1.0 |
|
148 |
*/ |
|
149 |
do_action( 'admin_head' ); |
|
150 |
||
9 | 151 |
if ( get_user_setting( 'mfold' ) == 'f' ) { |
0 | 152 |
$admin_body_class .= ' folded'; |
9 | 153 |
} |
0 | 154 |
|
9 | 155 |
if ( ! get_user_setting( 'unfold' ) ) { |
0 | 156 |
$admin_body_class .= ' auto-fold'; |
9 | 157 |
} |
0 | 158 |
|
9 | 159 |
if ( is_admin_bar_showing() ) { |
0 | 160 |
$admin_body_class .= ' admin-bar'; |
9 | 161 |
} |
0 | 162 |
|
9 | 163 |
if ( is_rtl() ) { |
0 | 164 |
$admin_body_class .= ' rtl'; |
9 | 165 |
} |
0 | 166 |
|
9 | 167 |
if ( $current_screen->post_type ) { |
0 | 168 |
$admin_body_class .= ' post-type-' . $current_screen->post_type; |
9 | 169 |
} |
0 | 170 |
|
9 | 171 |
if ( $current_screen->taxonomy ) { |
0 | 172 |
$admin_body_class .= ' taxonomy-' . $current_screen->taxonomy; |
9 | 173 |
} |
0 | 174 |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
175 |
$admin_body_class .= ' branch-' . str_replace( array( '.', ',' ), '-', floatval( get_bloginfo( 'version' ) ) ); |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
176 |
$admin_body_class .= ' version-' . str_replace( '.', '-', preg_replace( '/^([.0-9]+).*/', '$1', get_bloginfo( 'version' ) ) ); |
0 | 177 |
$admin_body_class .= ' admin-color-' . sanitize_html_class( get_user_option( 'admin_color' ), 'fresh' ); |
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
178 |
$admin_body_class .= ' locale-' . sanitize_html_class( strtolower( str_replace( '_', '-', get_user_locale() ) ) ); |
0 | 179 |
|
9 | 180 |
if ( wp_is_mobile() ) { |
0 | 181 |
$admin_body_class .= ' mobile'; |
9 | 182 |
} |
0 | 183 |
|
9 | 184 |
if ( is_multisite() ) { |
5 | 185 |
$admin_body_class .= ' multisite'; |
9 | 186 |
} |
5 | 187 |
|
9 | 188 |
if ( is_network_admin() ) { |
5 | 189 |
$admin_body_class .= ' network-admin'; |
9 | 190 |
} |
5 | 191 |
|
192 |
$admin_body_class .= ' no-customize-support no-svg'; |
|
0 | 193 |
|
9 | 194 |
if ( $current_screen->is_block_editor() ) { |
195 |
// Default to is-fullscreen-mode to avoid jumps in the UI. |
|
196 |
$admin_body_class .= ' block-editor-page is-fullscreen-mode wp-embed-responsive'; |
|
197 |
||
198 |
if ( current_theme_supports( 'editor-styles' ) && current_theme_supports( 'dark-editor-style' ) ) { |
|
199 |
$admin_body_class .= ' is-dark-theme'; |
|
200 |
} |
|
201 |
} |
|
202 |
||
0 | 203 |
?> |
204 |
</head> |
|
205 |
<?php |
|
206 |
/** |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
207 |
* Filters the CSS classes for the body tag in the admin. |
0 | 208 |
* |
5 | 209 |
* This filter differs from the {@see 'post_class'} and {@see 'body_class'} filters |
210 |
* in two important ways: |
|
211 |
* |
|
212 |
* 1. `$classes` is a space-separated string of class names instead of an array. |
|
213 |
* 2. Not all core admin classes are filterable, notably: wp-admin, wp-core-ui, |
|
214 |
* and no-js cannot be removed. |
|
0 | 215 |
* |
216 |
* @since 2.3.0 |
|
217 |
* |
|
5 | 218 |
* @param string $classes Space-separated list of CSS classes. |
0 | 219 |
*/ |
5 | 220 |
$admin_body_classes = apply_filters( 'admin_body_class', '' ); |
9 | 221 |
$admin_body_classes = ltrim( $admin_body_classes . ' ' . $admin_body_class ); |
0 | 222 |
?> |
9 | 223 |
<body class="wp-admin wp-core-ui no-js <?php echo $admin_body_classes; ?>"> |
0 | 224 |
<script type="text/javascript"> |
225 |
document.body.className = document.body.className.replace('no-js','js'); |
|
226 |
</script> |
|
227 |
||
228 |
<?php |
|
229 |
// Make sure the customize body classes are correct as early as possible. |
|
5 | 230 |
if ( current_user_can( 'customize' ) ) { |
0 | 231 |
wp_customize_support_script(); |
5 | 232 |
} |
0 | 233 |
?> |
234 |
||
235 |
<div id="wpwrap"> |
|
9 | 236 |
<?php require( ABSPATH . 'wp-admin/menu-header.php' ); ?> |
0 | 237 |
<div id="wpcontent"> |
238 |
||
239 |
<?php |
|
240 |
/** |
|
241 |
* Fires at the beginning of the content section in an admin page. |
|
242 |
* |
|
243 |
* @since 3.0.0 |
|
244 |
*/ |
|
245 |
do_action( 'in_admin_header' ); |
|
246 |
?> |
|
247 |
||
5 | 248 |
<div id="wpbody" role="main"> |
0 | 249 |
<?php |
9 | 250 |
unset( $blog_name, $total_update_count, $update_title ); |
0 | 251 |
|
252 |
$current_screen->set_parentage( $parent_file ); |
|
253 |
||
254 |
?> |
|
255 |
||
9 | 256 |
<div id="wpbody-content"> |
0 | 257 |
<?php |
258 |
||
259 |
$current_screen->render_screen_meta(); |
|
260 |
||
261 |
if ( is_network_admin() ) { |
|
262 |
/** |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
263 |
* Prints network admin screen notices. |
0 | 264 |
* |
265 |
* @since 3.1.0 |
|
266 |
*/ |
|
267 |
do_action( 'network_admin_notices' ); |
|
268 |
} elseif ( is_user_admin() ) { |
|
269 |
/** |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
270 |
* Prints user admin screen notices. |
0 | 271 |
* |
272 |
* @since 3.1.0 |
|
273 |
*/ |
|
274 |
do_action( 'user_admin_notices' ); |
|
275 |
} else { |
|
276 |
/** |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
277 |
* Prints admin screen notices. |
0 | 278 |
* |
279 |
* @since 3.1.0 |
|
280 |
*/ |
|
281 |
do_action( 'admin_notices' ); |
|
282 |
} |
|
283 |
||
284 |
/** |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
285 |
* Prints generic admin screen notices. |
0 | 286 |
* |
287 |
* @since 3.1.0 |
|
288 |
*/ |
|
289 |
do_action( 'all_admin_notices' ); |
|
290 |
||
9 | 291 |
if ( $parent_file == 'options-general.php' ) { |
292 |
require( ABSPATH . 'wp-admin/options-head.php' ); |
|
293 |
} |