author | ymh <ymh.work@gmail.com> |
Fri, 05 Sep 2025 18:52:52 +0200 | |
changeset 22 | 8c2e4d02f4ef |
parent 21 | 48c4eec2b7e6 |
permissions | -rw-r--r-- |
0 | 1 |
<?php |
2 |
/** |
|
3 |
* WordPress Administration Template Header |
|
4 |
* |
|
5 |
* @package WordPress |
|
6 |
* @subpackage Administration |
|
7 |
*/ |
|
8 |
||
22
8c2e4d02f4ef
Update WordPress to latest version (6.7)
ymh <ymh.work@gmail.com>
parents:
21
diff
changeset
|
9 |
// Don't load directly. |
8c2e4d02f4ef
Update WordPress to latest version (6.7)
ymh <ymh.work@gmail.com>
parents:
21
diff
changeset
|
10 |
if ( ! defined( 'ABSPATH' ) ) { |
8c2e4d02f4ef
Update WordPress to latest version (6.7)
ymh <ymh.work@gmail.com>
parents:
21
diff
changeset
|
11 |
die( '-1' ); |
8c2e4d02f4ef
Update WordPress to latest version (6.7)
ymh <ymh.work@gmail.com>
parents:
21
diff
changeset
|
12 |
} |
8c2e4d02f4ef
Update WordPress to latest version (6.7)
ymh <ymh.work@gmail.com>
parents:
21
diff
changeset
|
13 |
|
16 | 14 |
header( 'Content-Type: ' . get_option( 'html_type' ) . '; charset=' . get_option( 'blog_charset' ) ); |
9 | 15 |
if ( ! defined( 'WP_ADMIN' ) ) { |
16 | 16 |
require_once __DIR__ . '/admin.php'; |
9 | 17 |
} |
0 | 18 |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
19 |
/** |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
20 |
* 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
|
21 |
* |
21
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
22 |
* @global string $title The title of the current screen. |
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
23 |
* @global string $hook_suffix |
16 | 24 |
* @global WP_Screen $current_screen WordPress current screen object. |
25 |
* @global WP_Locale $wp_locale WordPress date and time locale object. |
|
19 | 26 |
* @global string $pagenow The filename of the current screen. |
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
27 |
* @global string $update_title |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
28 |
* @global int $total_update_count |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
29 |
* @global string $parent_file |
19 | 30 |
* @global string $typenow The post type of the current screen. |
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
31 |
*/ |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
32 |
global $title, $hook_suffix, $current_screen, $wp_locale, $pagenow, |
19 | 33 |
$update_title, $total_update_count, $parent_file, $typenow; |
0 | 34 |
|
35 |
// Catch plugins that include admin-header.php before admin.php completes. |
|
9 | 36 |
if ( empty( $current_screen ) ) { |
0 | 37 |
set_current_screen(); |
9 | 38 |
} |
0 | 39 |
|
40 |
get_admin_page_title(); |
|
16 | 41 |
$title = strip_tags( $title ); |
0 | 42 |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
43 |
if ( is_network_admin() ) { |
16 | 44 |
/* translators: Network admin screen title. %s: Network title. */ |
45 |
$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
|
46 |
} elseif ( is_user_admin() ) { |
16 | 47 |
/* translators: User dashboard screen title. %s: Network title. */ |
48 |
$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
|
49 |
} else { |
0 | 50 |
$admin_title = get_bloginfo( 'name' ); |
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
51 |
} |
0 | 52 |
|
16 | 53 |
if ( $admin_title === $title ) { |
54 |
/* translators: Admin screen title. %s: Admin screen name. */ |
|
9 | 55 |
$admin_title = sprintf( __( '%s — WordPress' ), $title ); |
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
56 |
} else { |
19 | 57 |
$screen_title = $title; |
58 |
||
59 |
if ( 'post' === $current_screen->base && 'add' !== $current_screen->action ) { |
|
60 |
$post_title = get_the_title(); |
|
61 |
if ( ! empty( $post_title ) ) { |
|
62 |
$post_type_obj = get_post_type_object( $typenow ); |
|
63 |
$screen_title = sprintf( |
|
64 |
/* translators: Editor admin screen title. 1: "Edit item" text for the post type, 2: Post title. */ |
|
65 |
__( '%1$s “%2$s”' ), |
|
66 |
$post_type_obj->labels->edit_item, |
|
67 |
$post_title |
|
68 |
); |
|
69 |
} |
|
70 |
} |
|
71 |
||
16 | 72 |
/* translators: Admin screen title. 1: Admin screen name, 2: Network or site name. */ |
19 | 73 |
$admin_title = sprintf( __( '%1$s ‹ %2$s — WordPress' ), $screen_title, $admin_title ); |
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
74 |
} |
0 | 75 |
|
9 | 76 |
if ( wp_is_recovery_mode() ) { |
77 |
/* translators: %s: Admin screen title. */ |
|
78 |
$admin_title = sprintf( __( 'Recovery Mode — %s' ), $admin_title ); |
|
79 |
} |
|
80 |
||
0 | 81 |
/** |
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
82 |
* Filters the title tag content for an admin page. |
0 | 83 |
* |
84 |
* @since 3.1.0 |
|
85 |
* |
|
86 |
* @param string $admin_title The page title, with extra context added. |
|
87 |
* @param string $title The original page title. |
|
88 |
*/ |
|
89 |
$admin_title = apply_filters( 'admin_title', $admin_title, $title ); |
|
90 |
||
91 |
wp_user_settings(); |
|
92 |
||
93 |
_wp_admin_html_begin(); |
|
94 |
?> |
|
16 | 95 |
<title><?php echo esc_html( $admin_title ); ?></title> |
0 | 96 |
<?php |
97 |
||
98 |
wp_enqueue_style( 'colors' ); |
|
9 | 99 |
wp_enqueue_script( 'utils' ); |
5 | 100 |
wp_enqueue_script( 'svg-painter' ); |
0 | 101 |
|
9 | 102 |
$admin_body_class = preg_replace( '/[^a-z0-9_-]+/i', '-', $hook_suffix ); |
0 | 103 |
?> |
104 |
<script type="text/javascript"> |
|
19 | 105 |
addLoadEvent = function(func){if(typeof jQuery!=='undefined')jQuery(function(){func();});else if(typeof wpOnload!=='function'){wpOnload=func;}else{var oldonload=wpOnload;wpOnload=function(){oldonload();func();}}}; |
18 | 106 |
var ajaxurl = '<?php echo esc_js( admin_url( 'admin-ajax.php', 'relative' ) ); ?>', |
107 |
pagenow = '<?php echo esc_js( $current_screen->id ); ?>', |
|
108 |
typenow = '<?php echo esc_js( $current_screen->post_type ); ?>', |
|
109 |
adminpage = '<?php echo esc_js( $admin_body_class ); ?>', |
|
110 |
thousandsSeparator = '<?php echo esc_js( $wp_locale->number_format['thousands_sep'] ); ?>', |
|
111 |
decimalPoint = '<?php echo esc_js( $wp_locale->number_format['decimal_point'] ); ?>', |
|
0 | 112 |
isRtl = <?php echo (int) is_rtl(); ?>; |
113 |
</script> |
|
114 |
<?php |
|
115 |
||
116 |
/** |
|
21
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
117 |
* Fires when enqueuing scripts for all admin pages. |
0 | 118 |
* |
119 |
* @since 2.8.0 |
|
120 |
* |
|
121 |
* @param string $hook_suffix The current admin page. |
|
122 |
*/ |
|
123 |
do_action( 'admin_enqueue_scripts', $hook_suffix ); |
|
124 |
||
125 |
/** |
|
5 | 126 |
* Fires when styles are printed for a specific admin page based on $hook_suffix. |
0 | 127 |
* |
128 |
* @since 2.6.0 |
|
129 |
*/ |
|
16 | 130 |
do_action( "admin_print_styles-{$hook_suffix}" ); // phpcs:ignore WordPress.NamingConventions.ValidHookName.UseUnderscores |
0 | 131 |
|
132 |
/** |
|
5 | 133 |
* Fires when styles are printed for all admin pages. |
0 | 134 |
* |
135 |
* @since 2.6.0 |
|
136 |
*/ |
|
137 |
do_action( 'admin_print_styles' ); |
|
138 |
||
139 |
/** |
|
5 | 140 |
* Fires when scripts are printed for a specific admin page based on $hook_suffix. |
0 | 141 |
* |
142 |
* @since 2.1.0 |
|
143 |
*/ |
|
16 | 144 |
do_action( "admin_print_scripts-{$hook_suffix}" ); // phpcs:ignore WordPress.NamingConventions.ValidHookName.UseUnderscores |
0 | 145 |
|
146 |
/** |
|
5 | 147 |
* Fires when scripts are printed for all admin pages. |
0 | 148 |
* |
149 |
* @since 2.1.0 |
|
150 |
*/ |
|
151 |
do_action( 'admin_print_scripts' ); |
|
152 |
||
153 |
/** |
|
5 | 154 |
* Fires in head section for a specific admin page. |
155 |
* |
|
19 | 156 |
* The dynamic portion of the hook name, `$hook_suffix`, refers to the hook suffix |
5 | 157 |
* for the admin page. |
0 | 158 |
* |
159 |
* @since 2.1.0 |
|
160 |
*/ |
|
16 | 161 |
do_action( "admin_head-{$hook_suffix}" ); // phpcs:ignore WordPress.NamingConventions.ValidHookName.UseUnderscores |
0 | 162 |
|
163 |
/** |
|
5 | 164 |
* Fires in head section for all admin pages. |
0 | 165 |
* |
166 |
* @since 2.1.0 |
|
167 |
*/ |
|
168 |
do_action( 'admin_head' ); |
|
169 |
||
16 | 170 |
if ( 'f' === get_user_setting( 'mfold' ) ) { |
0 | 171 |
$admin_body_class .= ' folded'; |
9 | 172 |
} |
0 | 173 |
|
9 | 174 |
if ( ! get_user_setting( 'unfold' ) ) { |
0 | 175 |
$admin_body_class .= ' auto-fold'; |
9 | 176 |
} |
0 | 177 |
|
9 | 178 |
if ( is_admin_bar_showing() ) { |
0 | 179 |
$admin_body_class .= ' admin-bar'; |
9 | 180 |
} |
0 | 181 |
|
9 | 182 |
if ( is_rtl() ) { |
0 | 183 |
$admin_body_class .= ' rtl'; |
9 | 184 |
} |
0 | 185 |
|
9 | 186 |
if ( $current_screen->post_type ) { |
0 | 187 |
$admin_body_class .= ' post-type-' . $current_screen->post_type; |
9 | 188 |
} |
0 | 189 |
|
9 | 190 |
if ( $current_screen->taxonomy ) { |
0 | 191 |
$admin_body_class .= ' taxonomy-' . $current_screen->taxonomy; |
9 | 192 |
} |
0 | 193 |
|
18 | 194 |
$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
|
195 |
$admin_body_class .= ' version-' . str_replace( '.', '-', preg_replace( '/^([.0-9]+).*/', '$1', get_bloginfo( 'version' ) ) ); |
0 | 196 |
$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
|
197 |
$admin_body_class .= ' locale-' . sanitize_html_class( strtolower( str_replace( '_', '-', get_user_locale() ) ) ); |
0 | 198 |
|
9 | 199 |
if ( wp_is_mobile() ) { |
0 | 200 |
$admin_body_class .= ' mobile'; |
9 | 201 |
} |
0 | 202 |
|
9 | 203 |
if ( is_multisite() ) { |
5 | 204 |
$admin_body_class .= ' multisite'; |
9 | 205 |
} |
5 | 206 |
|
9 | 207 |
if ( is_network_admin() ) { |
5 | 208 |
$admin_body_class .= ' network-admin'; |
9 | 209 |
} |
5 | 210 |
|
22
8c2e4d02f4ef
Update WordPress to latest version (6.7)
ymh <ymh.work@gmail.com>
parents:
21
diff
changeset
|
211 |
$admin_body_class .= ' no-customize-support svg'; |
0 | 212 |
|
9 | 213 |
if ( $current_screen->is_block_editor() ) { |
18 | 214 |
$admin_body_class .= ' block-editor-page wp-embed-responsive'; |
9 | 215 |
} |
216 |
||
22
8c2e4d02f4ef
Update WordPress to latest version (6.7)
ymh <ymh.work@gmail.com>
parents:
21
diff
changeset
|
217 |
$admin_body_class .= ' wp-theme-' . sanitize_html_class( get_template() ); |
8c2e4d02f4ef
Update WordPress to latest version (6.7)
ymh <ymh.work@gmail.com>
parents:
21
diff
changeset
|
218 |
if ( is_child_theme() ) { |
8c2e4d02f4ef
Update WordPress to latest version (6.7)
ymh <ymh.work@gmail.com>
parents:
21
diff
changeset
|
219 |
$admin_body_class .= ' wp-child-theme-' . sanitize_html_class( get_stylesheet() ); |
8c2e4d02f4ef
Update WordPress to latest version (6.7)
ymh <ymh.work@gmail.com>
parents:
21
diff
changeset
|
220 |
} |
8c2e4d02f4ef
Update WordPress to latest version (6.7)
ymh <ymh.work@gmail.com>
parents:
21
diff
changeset
|
221 |
|
18 | 222 |
$error_get_last = error_get_last(); |
16 | 223 |
|
224 |
// Print a CSS class to make PHP errors visible. |
|
18 | 225 |
if ( $error_get_last && WP_DEBUG && WP_DEBUG_DISPLAY && ini_get( 'display_errors' ) |
16 | 226 |
// Don't print the class for PHP notices in wp-config.php, as they happen before WP_DEBUG takes effect, |
227 |
// and should not be displayed with the `error_reporting` level previously set in wp-load.php. |
|
18 | 228 |
&& ( E_NOTICE !== $error_get_last['type'] || 'wp-config.php' !== wp_basename( $error_get_last['file'] ) ) |
16 | 229 |
) { |
230 |
$admin_body_class .= ' php-error'; |
|
231 |
} |
|
232 |
||
18 | 233 |
unset( $error_get_last ); |
16 | 234 |
|
0 | 235 |
?> |
236 |
</head> |
|
237 |
<?php |
|
238 |
/** |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
239 |
* Filters the CSS classes for the body tag in the admin. |
0 | 240 |
* |
5 | 241 |
* This filter differs from the {@see 'post_class'} and {@see 'body_class'} filters |
242 |
* in two important ways: |
|
243 |
* |
|
244 |
* 1. `$classes` is a space-separated string of class names instead of an array. |
|
245 |
* 2. Not all core admin classes are filterable, notably: wp-admin, wp-core-ui, |
|
246 |
* and no-js cannot be removed. |
|
0 | 247 |
* |
248 |
* @since 2.3.0 |
|
249 |
* |
|
5 | 250 |
* @param string $classes Space-separated list of CSS classes. |
0 | 251 |
*/ |
5 | 252 |
$admin_body_classes = apply_filters( 'admin_body_class', '' ); |
9 | 253 |
$admin_body_classes = ltrim( $admin_body_classes . ' ' . $admin_body_class ); |
0 | 254 |
?> |
21
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
255 |
<body class="wp-admin wp-core-ui no-js <?php echo esc_attr( $admin_body_classes ); ?>"> |
0 | 256 |
<script type="text/javascript"> |
257 |
document.body.className = document.body.className.replace('no-js','js'); |
|
258 |
</script> |
|
259 |
||
260 |
<?php |
|
261 |
// Make sure the customize body classes are correct as early as possible. |
|
5 | 262 |
if ( current_user_can( 'customize' ) ) { |
0 | 263 |
wp_customize_support_script(); |
5 | 264 |
} |
0 | 265 |
?> |
266 |
||
267 |
<div id="wpwrap"> |
|
16 | 268 |
<?php require ABSPATH . 'wp-admin/menu-header.php'; ?> |
0 | 269 |
<div id="wpcontent"> |
270 |
||
271 |
<?php |
|
272 |
/** |
|
273 |
* Fires at the beginning of the content section in an admin page. |
|
274 |
* |
|
275 |
* @since 3.0.0 |
|
276 |
*/ |
|
277 |
do_action( 'in_admin_header' ); |
|
278 |
?> |
|
279 |
||
5 | 280 |
<div id="wpbody" role="main"> |
0 | 281 |
<?php |
9 | 282 |
unset( $blog_name, $total_update_count, $update_title ); |
0 | 283 |
|
284 |
$current_screen->set_parentage( $parent_file ); |
|
285 |
||
286 |
?> |
|
287 |
||
9 | 288 |
<div id="wpbody-content"> |
0 | 289 |
<?php |
290 |
||
291 |
$current_screen->render_screen_meta(); |
|
292 |
||
293 |
if ( is_network_admin() ) { |
|
294 |
/** |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
295 |
* Prints network admin screen notices. |
0 | 296 |
* |
297 |
* @since 3.1.0 |
|
298 |
*/ |
|
299 |
do_action( 'network_admin_notices' ); |
|
300 |
} elseif ( is_user_admin() ) { |
|
301 |
/** |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
302 |
* Prints user admin screen notices. |
0 | 303 |
* |
304 |
* @since 3.1.0 |
|
305 |
*/ |
|
306 |
do_action( 'user_admin_notices' ); |
|
307 |
} else { |
|
308 |
/** |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
309 |
* Prints admin screen notices. |
0 | 310 |
* |
311 |
* @since 3.1.0 |
|
312 |
*/ |
|
313 |
do_action( 'admin_notices' ); |
|
314 |
} |
|
315 |
||
316 |
/** |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
317 |
* Prints generic admin screen notices. |
0 | 318 |
* |
319 |
* @since 3.1.0 |
|
320 |
*/ |
|
321 |
do_action( 'all_admin_notices' ); |
|
322 |
||
16 | 323 |
if ( 'options-general.php' === $parent_file ) { |
324 |
require ABSPATH . 'wp-admin/options-head.php'; |
|
9 | 325 |
} |