author | ymh <ymh.work@gmail.com> |
Wed, 21 Sep 2022 18:19:35 +0200 | |
changeset 18 | be944660c56a |
parent 16 | a86126ab1dd4 |
child 19 | 3d72ae0968f4 |
permissions | -rw-r--r-- |
0 | 1 |
<?php |
2 |
/** |
|
3 |
* WordPress Administration Template Header |
|
4 |
* |
|
5 |
* @package WordPress |
|
6 |
* @subpackage Administration |
|
7 |
*/ |
|
8 |
||
16 | 9 |
header( 'Content-Type: ' . get_option( 'html_type' ) . '; charset=' . get_option( 'blog_charset' ) ); |
9 | 10 |
if ( ! defined( 'WP_ADMIN' ) ) { |
16 | 11 |
require_once __DIR__ . '/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 |
16 | 19 |
* @global WP_Screen $current_screen WordPress current screen object. |
20 |
* @global WP_Locale $wp_locale WordPress date and time locale object. |
|
7
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(); |
|
16 | 35 |
$title = strip_tags( $title ); |
0 | 36 |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
37 |
if ( is_network_admin() ) { |
16 | 38 |
/* translators: Network admin screen title. %s: Network title. */ |
39 |
$admin_title = sprintf( __( 'Network Admin: %s' ), get_network()->site_name ); |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
40 |
} elseif ( is_user_admin() ) { |
16 | 41 |
/* translators: User dashboard screen title. %s: Network title. */ |
42 |
$admin_title = sprintf( __( 'User Dashboard: %s' ), get_network()->site_name ); |
|
7
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 |
|
16 | 47 |
if ( $admin_title === $title ) { |
48 |
/* translators: Admin screen title. %s: Admin screen name. */ |
|
9 | 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 { |
16 | 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 |
?> |
|
16 | 74 |
<title><?php echo esc_html( $admin_title ); ?></title> |
0 | 75 |
<?php |
76 |
||
77 |
wp_enqueue_style( 'colors' ); |
|
9 | 78 |
wp_enqueue_script( 'utils' ); |
5 | 79 |
wp_enqueue_script( 'svg-painter' ); |
0 | 80 |
|
9 | 81 |
$admin_body_class = preg_replace( '/[^a-z0-9_-]+/i', '-', $hook_suffix ); |
0 | 82 |
?> |
83 |
<script type="text/javascript"> |
|
16 | 84 |
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();}}}; |
18 | 85 |
var ajaxurl = '<?php echo esc_js( admin_url( 'admin-ajax.php', 'relative' ) ); ?>', |
86 |
pagenow = '<?php echo esc_js( $current_screen->id ); ?>', |
|
87 |
typenow = '<?php echo esc_js( $current_screen->post_type ); ?>', |
|
88 |
adminpage = '<?php echo esc_js( $admin_body_class ); ?>', |
|
89 |
thousandsSeparator = '<?php echo esc_js( $wp_locale->number_format['thousands_sep'] ); ?>', |
|
90 |
decimalPoint = '<?php echo esc_js( $wp_locale->number_format['decimal_point'] ); ?>', |
|
0 | 91 |
isRtl = <?php echo (int) is_rtl(); ?>; |
92 |
</script> |
|
93 |
<?php |
|
94 |
||
95 |
/** |
|
96 |
* Enqueue scripts for all admin pages. |
|
97 |
* |
|
98 |
* @since 2.8.0 |
|
99 |
* |
|
100 |
* @param string $hook_suffix The current admin page. |
|
101 |
*/ |
|
102 |
do_action( 'admin_enqueue_scripts', $hook_suffix ); |
|
103 |
||
104 |
/** |
|
5 | 105 |
* Fires when styles are printed for a specific admin page based on $hook_suffix. |
0 | 106 |
* |
107 |
* @since 2.6.0 |
|
108 |
*/ |
|
16 | 109 |
do_action( "admin_print_styles-{$hook_suffix}" ); // phpcs:ignore WordPress.NamingConventions.ValidHookName.UseUnderscores |
0 | 110 |
|
111 |
/** |
|
5 | 112 |
* Fires when styles are printed for all admin pages. |
0 | 113 |
* |
114 |
* @since 2.6.0 |
|
115 |
*/ |
|
116 |
do_action( 'admin_print_styles' ); |
|
117 |
||
118 |
/** |
|
5 | 119 |
* Fires when scripts are printed for a specific admin page based on $hook_suffix. |
0 | 120 |
* |
121 |
* @since 2.1.0 |
|
122 |
*/ |
|
16 | 123 |
do_action( "admin_print_scripts-{$hook_suffix}" ); // phpcs:ignore WordPress.NamingConventions.ValidHookName.UseUnderscores |
0 | 124 |
|
125 |
/** |
|
5 | 126 |
* Fires when scripts are printed for all admin pages. |
0 | 127 |
* |
128 |
* @since 2.1.0 |
|
129 |
*/ |
|
130 |
do_action( 'admin_print_scripts' ); |
|
131 |
||
132 |
/** |
|
5 | 133 |
* Fires in head section for a specific admin page. |
134 |
* |
|
135 |
* The dynamic portion of the hook, `$hook_suffix`, refers to the hook suffix |
|
136 |
* for the admin page. |
|
0 | 137 |
* |
138 |
* @since 2.1.0 |
|
139 |
*/ |
|
16 | 140 |
do_action( "admin_head-{$hook_suffix}" ); // phpcs:ignore WordPress.NamingConventions.ValidHookName.UseUnderscores |
0 | 141 |
|
142 |
/** |
|
5 | 143 |
* Fires in head section for all admin pages. |
0 | 144 |
* |
145 |
* @since 2.1.0 |
|
146 |
*/ |
|
147 |
do_action( 'admin_head' ); |
|
148 |
||
16 | 149 |
if ( 'f' === get_user_setting( 'mfold' ) ) { |
0 | 150 |
$admin_body_class .= ' folded'; |
9 | 151 |
} |
0 | 152 |
|
9 | 153 |
if ( ! get_user_setting( 'unfold' ) ) { |
0 | 154 |
$admin_body_class .= ' auto-fold'; |
9 | 155 |
} |
0 | 156 |
|
9 | 157 |
if ( is_admin_bar_showing() ) { |
0 | 158 |
$admin_body_class .= ' admin-bar'; |
9 | 159 |
} |
0 | 160 |
|
9 | 161 |
if ( is_rtl() ) { |
0 | 162 |
$admin_body_class .= ' rtl'; |
9 | 163 |
} |
0 | 164 |
|
9 | 165 |
if ( $current_screen->post_type ) { |
0 | 166 |
$admin_body_class .= ' post-type-' . $current_screen->post_type; |
9 | 167 |
} |
0 | 168 |
|
9 | 169 |
if ( $current_screen->taxonomy ) { |
0 | 170 |
$admin_body_class .= ' taxonomy-' . $current_screen->taxonomy; |
9 | 171 |
} |
0 | 172 |
|
18 | 173 |
$admin_body_class .= ' branch-' . str_replace( array( '.', ',' ), '-', (float) get_bloginfo( 'version' ) ); |
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
174 |
$admin_body_class .= ' version-' . str_replace( '.', '-', preg_replace( '/^([.0-9]+).*/', '$1', get_bloginfo( 'version' ) ) ); |
0 | 175 |
$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
|
176 |
$admin_body_class .= ' locale-' . sanitize_html_class( strtolower( str_replace( '_', '-', get_user_locale() ) ) ); |
0 | 177 |
|
9 | 178 |
if ( wp_is_mobile() ) { |
0 | 179 |
$admin_body_class .= ' mobile'; |
9 | 180 |
} |
0 | 181 |
|
9 | 182 |
if ( is_multisite() ) { |
5 | 183 |
$admin_body_class .= ' multisite'; |
9 | 184 |
} |
5 | 185 |
|
9 | 186 |
if ( is_network_admin() ) { |
5 | 187 |
$admin_body_class .= ' network-admin'; |
9 | 188 |
} |
5 | 189 |
|
190 |
$admin_body_class .= ' no-customize-support no-svg'; |
|
0 | 191 |
|
9 | 192 |
if ( $current_screen->is_block_editor() ) { |
18 | 193 |
$admin_body_class .= ' block-editor-page wp-embed-responsive'; |
9 | 194 |
} |
195 |
||
18 | 196 |
$error_get_last = error_get_last(); |
16 | 197 |
|
198 |
// Print a CSS class to make PHP errors visible. |
|
18 | 199 |
if ( $error_get_last && WP_DEBUG && WP_DEBUG_DISPLAY && ini_get( 'display_errors' ) |
16 | 200 |
// Don't print the class for PHP notices in wp-config.php, as they happen before WP_DEBUG takes effect, |
201 |
// and should not be displayed with the `error_reporting` level previously set in wp-load.php. |
|
18 | 202 |
&& ( E_NOTICE !== $error_get_last['type'] || 'wp-config.php' !== wp_basename( $error_get_last['file'] ) ) |
16 | 203 |
) { |
204 |
$admin_body_class .= ' php-error'; |
|
205 |
} |
|
206 |
||
18 | 207 |
unset( $error_get_last ); |
16 | 208 |
|
0 | 209 |
?> |
210 |
</head> |
|
211 |
<?php |
|
212 |
/** |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
213 |
* Filters the CSS classes for the body tag in the admin. |
0 | 214 |
* |
5 | 215 |
* This filter differs from the {@see 'post_class'} and {@see 'body_class'} filters |
216 |
* in two important ways: |
|
217 |
* |
|
218 |
* 1. `$classes` is a space-separated string of class names instead of an array. |
|
219 |
* 2. Not all core admin classes are filterable, notably: wp-admin, wp-core-ui, |
|
220 |
* and no-js cannot be removed. |
|
0 | 221 |
* |
222 |
* @since 2.3.0 |
|
223 |
* |
|
5 | 224 |
* @param string $classes Space-separated list of CSS classes. |
0 | 225 |
*/ |
5 | 226 |
$admin_body_classes = apply_filters( 'admin_body_class', '' ); |
9 | 227 |
$admin_body_classes = ltrim( $admin_body_classes . ' ' . $admin_body_class ); |
0 | 228 |
?> |
9 | 229 |
<body class="wp-admin wp-core-ui no-js <?php echo $admin_body_classes; ?>"> |
0 | 230 |
<script type="text/javascript"> |
231 |
document.body.className = document.body.className.replace('no-js','js'); |
|
232 |
</script> |
|
233 |
||
234 |
<?php |
|
235 |
// Make sure the customize body classes are correct as early as possible. |
|
5 | 236 |
if ( current_user_can( 'customize' ) ) { |
0 | 237 |
wp_customize_support_script(); |
5 | 238 |
} |
0 | 239 |
?> |
240 |
||
241 |
<div id="wpwrap"> |
|
16 | 242 |
<?php require ABSPATH . 'wp-admin/menu-header.php'; ?> |
0 | 243 |
<div id="wpcontent"> |
244 |
||
245 |
<?php |
|
246 |
/** |
|
247 |
* Fires at the beginning of the content section in an admin page. |
|
248 |
* |
|
249 |
* @since 3.0.0 |
|
250 |
*/ |
|
251 |
do_action( 'in_admin_header' ); |
|
252 |
?> |
|
253 |
||
5 | 254 |
<div id="wpbody" role="main"> |
0 | 255 |
<?php |
9 | 256 |
unset( $blog_name, $total_update_count, $update_title ); |
0 | 257 |
|
258 |
$current_screen->set_parentage( $parent_file ); |
|
259 |
||
260 |
?> |
|
261 |
||
9 | 262 |
<div id="wpbody-content"> |
0 | 263 |
<?php |
264 |
||
265 |
$current_screen->render_screen_meta(); |
|
266 |
||
267 |
if ( is_network_admin() ) { |
|
268 |
/** |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
269 |
* Prints network admin screen notices. |
0 | 270 |
* |
271 |
* @since 3.1.0 |
|
272 |
*/ |
|
273 |
do_action( 'network_admin_notices' ); |
|
274 |
} elseif ( is_user_admin() ) { |
|
275 |
/** |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
276 |
* Prints user admin screen notices. |
0 | 277 |
* |
278 |
* @since 3.1.0 |
|
279 |
*/ |
|
280 |
do_action( 'user_admin_notices' ); |
|
281 |
} else { |
|
282 |
/** |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
283 |
* Prints admin screen notices. |
0 | 284 |
* |
285 |
* @since 3.1.0 |
|
286 |
*/ |
|
287 |
do_action( 'admin_notices' ); |
|
288 |
} |
|
289 |
||
290 |
/** |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
291 |
* Prints generic admin screen notices. |
0 | 292 |
* |
293 |
* @since 3.1.0 |
|
294 |
*/ |
|
295 |
do_action( 'all_admin_notices' ); |
|
296 |
||
16 | 297 |
if ( 'options-general.php' === $parent_file ) { |
298 |
require ABSPATH . 'wp-admin/options-head.php'; |
|
9 | 299 |
} |