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