[ Index ] |
PHP Cross Reference of WordPress |
[Summary view] [Print] [Text view]
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 __DIR__ . '/admin.php'; 12 } 13 14 /** 15 * In case admin-header.php is included in a function. 16 * 17 * @global string $title 18 * @global string $hook_suffix 19 * @global WP_Screen $current_screen WordPress current screen object. 20 * @global WP_Locale $wp_locale WordPress date and time locale object. 21 * @global string $pagenow 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, 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 34 get_admin_page_title(); 35 $title = strip_tags( $title ); 36 37 if ( is_network_admin() ) { 38 /* translators: Network admin screen title. %s: Network title. */ 39 $admin_title = sprintf( __( 'Network Admin: %s' ), get_network()->site_name ); 40 } elseif ( is_user_admin() ) { 41 /* translators: User dashboard screen title. %s: Network title. */ 42 $admin_title = sprintf( __( 'User Dashboard: %s' ), get_network()->site_name ); 43 } else { 44 $admin_title = get_bloginfo( 'name' ); 45 } 46 47 if ( $admin_title === $title ) { 48 /* translators: Admin screen title. %s: Admin screen name. */ 49 $admin_title = sprintf( __( '%s — WordPress' ), $title ); 50 } else { 51 /* translators: Admin screen title. 1: Admin screen name, 2: Network or site name. */ 52 $admin_title = sprintf( __( '%1$s ‹ %2$s — WordPress' ), $title, $admin_title ); 53 } 54 55 if ( wp_is_recovery_mode() ) { 56 /* translators: %s: Admin screen title. */ 57 $admin_title = sprintf( __( 'Recovery Mode — %s' ), $admin_title ); 58 } 59 60 /** 61 * Filters the title tag content for an admin page. 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 esc_html( $admin_title ); ?></title> 75 <?php 76 77 wp_enqueue_style( 'colors' ); 78 wp_enqueue_script( 'utils' ); 79 wp_enqueue_script( 'svg-painter' ); 80 81 $admin_body_class = preg_replace( '/[^a-z0-9_-]+/i', '-', $hook_suffix ); 82 ?> 83 <script type="text/javascript"> 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();}}}; 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'] ); ?>', 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 /** 105 * Fires when styles are printed for a specific admin page based on $hook_suffix. 106 * 107 * @since 2.6.0 108 */ 109 do_action( "admin_print_styles-{$hook_suffix}" ); // phpcs:ignore WordPress.NamingConventions.ValidHookName.UseUnderscores 110 111 /** 112 * Fires when styles are printed for all admin pages. 113 * 114 * @since 2.6.0 115 */ 116 do_action( 'admin_print_styles' ); 117 118 /** 119 * Fires when scripts are printed for a specific admin page based on $hook_suffix. 120 * 121 * @since 2.1.0 122 */ 123 do_action( "admin_print_scripts-{$hook_suffix}" ); // phpcs:ignore WordPress.NamingConventions.ValidHookName.UseUnderscores 124 125 /** 126 * Fires when scripts are printed for all admin pages. 127 * 128 * @since 2.1.0 129 */ 130 do_action( 'admin_print_scripts' ); 131 132 /** 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. 137 * 138 * @since 2.1.0 139 */ 140 do_action( "admin_head-{$hook_suffix}" ); // phpcs:ignore WordPress.NamingConventions.ValidHookName.UseUnderscores 141 142 /** 143 * Fires in head section for all admin pages. 144 * 145 * @since 2.1.0 146 */ 147 do_action( 'admin_head' ); 148 149 if ( 'f' === get_user_setting( 'mfold' ) ) { 150 $admin_body_class .= ' folded'; 151 } 152 153 if ( ! get_user_setting( 'unfold' ) ) { 154 $admin_body_class .= ' auto-fold'; 155 } 156 157 if ( is_admin_bar_showing() ) { 158 $admin_body_class .= ' admin-bar'; 159 } 160 161 if ( is_rtl() ) { 162 $admin_body_class .= ' rtl'; 163 } 164 165 if ( $current_screen->post_type ) { 166 $admin_body_class .= ' post-type-' . $current_screen->post_type; 167 } 168 169 if ( $current_screen->taxonomy ) { 170 $admin_body_class .= ' taxonomy-' . $current_screen->taxonomy; 171 } 172 173 $admin_body_class .= ' branch-' . str_replace( array( '.', ',' ), '-', (float) get_bloginfo( 'version' ) ); 174 $admin_body_class .= ' version-' . str_replace( '.', '-', preg_replace( '/^([.0-9]+).*/', '$1', get_bloginfo( 'version' ) ) ); 175 $admin_body_class .= ' admin-color-' . sanitize_html_class( get_user_option( 'admin_color' ), 'fresh' ); 176 $admin_body_class .= ' locale-' . sanitize_html_class( strtolower( str_replace( '_', '-', get_user_locale() ) ) ); 177 178 if ( wp_is_mobile() ) { 179 $admin_body_class .= ' mobile'; 180 } 181 182 if ( is_multisite() ) { 183 $admin_body_class .= ' multisite'; 184 } 185 186 if ( is_network_admin() ) { 187 $admin_body_class .= ' network-admin'; 188 } 189 190 $admin_body_class .= ' no-customize-support no-svg'; 191 192 if ( $current_screen->is_block_editor() ) { 193 // Default to is-fullscreen-mode to avoid jumps in the UI. 194 $admin_body_class .= ' block-editor-page is-fullscreen-mode wp-embed-responsive'; 195 } 196 197 $error_get_last = error_get_last(); 198 199 // Print a CSS class to make PHP errors visible. 200 if ( $error_get_last && WP_DEBUG && WP_DEBUG_DISPLAY && ini_get( 'display_errors' ) 201 // Don't print the class for PHP notices in wp-config.php, as they happen before WP_DEBUG takes effect, 202 // and should not be displayed with the `error_reporting` level previously set in wp-load.php. 203 && ( E_NOTICE !== $error_get_last['type'] || 'wp-config.php' !== wp_basename( $error_get_last['file'] ) ) 204 ) { 205 $admin_body_class .= ' php-error'; 206 } 207 208 unset( $error_get_last ); 209 210 ?> 211 </head> 212 <?php 213 /** 214 * Filters the CSS classes for the body tag in the admin. 215 * 216 * This filter differs from the {@see 'post_class'} and {@see 'body_class'} filters 217 * in two important ways: 218 * 219 * 1. `$classes` is a space-separated string of class names instead of an array. 220 * 2. Not all core admin classes are filterable, notably: wp-admin, wp-core-ui, 221 * and no-js cannot be removed. 222 * 223 * @since 2.3.0 224 * 225 * @param string $classes Space-separated list of CSS classes. 226 */ 227 $admin_body_classes = apply_filters( 'admin_body_class', '' ); 228 $admin_body_classes = ltrim( $admin_body_classes . ' ' . $admin_body_class ); 229 ?> 230 <body class="wp-admin wp-core-ui no-js <?php echo $admin_body_classes; ?>"> 231 <script type="text/javascript"> 232 document.body.className = document.body.className.replace('no-js','js'); 233 </script> 234 235 <?php 236 // Make sure the customize body classes are correct as early as possible. 237 if ( current_user_can( 'customize' ) ) { 238 wp_customize_support_script(); 239 } 240 ?> 241 242 <div id="wpwrap"> 243 <?php require ABSPATH . 'wp-admin/menu-header.php'; ?> 244 <div id="wpcontent"> 245 246 <?php 247 /** 248 * Fires at the beginning of the content section in an admin page. 249 * 250 * @since 3.0.0 251 */ 252 do_action( 'in_admin_header' ); 253 ?> 254 255 <div id="wpbody" role="main"> 256 <?php 257 unset( $blog_name, $total_update_count, $update_title ); 258 259 $current_screen->set_parentage( $parent_file ); 260 261 ?> 262 263 <div id="wpbody-content"> 264 <?php 265 266 $current_screen->render_screen_meta(); 267 268 if ( is_network_admin() ) { 269 /** 270 * Prints network admin screen notices. 271 * 272 * @since 3.1.0 273 */ 274 do_action( 'network_admin_notices' ); 275 } elseif ( is_user_admin() ) { 276 /** 277 * Prints user admin screen notices. 278 * 279 * @since 3.1.0 280 */ 281 do_action( 'user_admin_notices' ); 282 } else { 283 /** 284 * Prints admin screen notices. 285 * 286 * @since 3.1.0 287 */ 288 do_action( 'admin_notices' ); 289 } 290 291 /** 292 * Prints generic admin screen notices. 293 * 294 * @since 3.1.0 295 */ 296 do_action( 'all_admin_notices' ); 297 298 if ( 'options-general.php' === $parent_file ) { 299 require ABSPATH . 'wp-admin/options-head.php'; 300 }
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
Generated: Mon Mar 1 01:00:03 2021 | Cross-referenced by PHPXref 0.7.1 |