wp/wp-admin/admin-header.php
changeset 18 be944660c56a
parent 16 a86126ab1dd4
child 19 3d72ae0968f4
equal deleted inserted replaced
17:34716fd837a4 18:be944660c56a
    80 
    80 
    81 $admin_body_class = preg_replace( '/[^a-z0-9_-]+/i', '-', $hook_suffix );
    81 $admin_body_class = preg_replace( '/[^a-z0-9_-]+/i', '-', $hook_suffix );
    82 ?>
    82 ?>
    83 <script type="text/javascript">
    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();}}};
    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 admin_url( 'admin-ajax.php', 'relative' ); ?>',
    85 var ajaxurl = '<?php echo esc_js( admin_url( 'admin-ajax.php', 'relative' ) ); ?>',
    86 	pagenow = '<?php echo $current_screen->id; ?>',
    86 	pagenow = '<?php echo esc_js( $current_screen->id ); ?>',
    87 	typenow = '<?php echo $current_screen->post_type; ?>',
    87 	typenow = '<?php echo esc_js( $current_screen->post_type ); ?>',
    88 	adminpage = '<?php echo $admin_body_class; ?>',
    88 	adminpage = '<?php echo esc_js( $admin_body_class ); ?>',
    89 	thousandsSeparator = '<?php echo addslashes( $wp_locale->number_format['thousands_sep'] ); ?>',
    89 	thousandsSeparator = '<?php echo esc_js( $wp_locale->number_format['thousands_sep'] ); ?>',
    90 	decimalPoint = '<?php echo addslashes( $wp_locale->number_format['decimal_point'] ); ?>',
    90 	decimalPoint = '<?php echo esc_js( $wp_locale->number_format['decimal_point'] ); ?>',
    91 	isRtl = <?php echo (int) is_rtl(); ?>;
    91 	isRtl = <?php echo (int) is_rtl(); ?>;
    92 </script>
    92 </script>
    93 <?php
    93 <?php
    94 
    94 
    95 /**
    95 /**
   168 
   168 
   169 if ( $current_screen->taxonomy ) {
   169 if ( $current_screen->taxonomy ) {
   170 	$admin_body_class .= ' taxonomy-' . $current_screen->taxonomy;
   170 	$admin_body_class .= ' taxonomy-' . $current_screen->taxonomy;
   171 }
   171 }
   172 
   172 
   173 $admin_body_class .= ' branch-' . str_replace( array( '.', ',' ), '-', floatval( get_bloginfo( 'version' ) ) );
   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' ) ) );
   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' );
   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() ) ) );
   176 $admin_body_class .= ' locale-' . sanitize_html_class( strtolower( str_replace( '_', '-', get_user_locale() ) ) );
   177 
   177 
   178 if ( wp_is_mobile() ) {
   178 if ( wp_is_mobile() ) {
   188 }
   188 }
   189 
   189 
   190 $admin_body_class .= ' no-customize-support no-svg';
   190 $admin_body_class .= ' no-customize-support no-svg';
   191 
   191 
   192 if ( $current_screen->is_block_editor() ) {
   192 if ( $current_screen->is_block_editor() ) {
   193 	// Default to is-fullscreen-mode to avoid jumps in the UI.
   193 	$admin_body_class .= ' block-editor-page wp-embed-responsive';
   194 	$admin_body_class .= ' block-editor-page is-fullscreen-mode wp-embed-responsive';
   194 }
   195 
   195 
   196 	if ( current_theme_supports( 'editor-styles' ) && current_theme_supports( 'dark-editor-style' ) ) {
   196 $error_get_last = error_get_last();
   197 		$admin_body_class .= ' is-dark-theme';
       
   198 	}
       
   199 }
       
   200 
       
   201 $error = error_get_last();
       
   202 
   197 
   203 // Print a CSS class to make PHP errors visible.
   198 // Print a CSS class to make PHP errors visible.
   204 if ( $error && WP_DEBUG && WP_DEBUG_DISPLAY && ini_get( 'display_errors' )
   199 if ( $error_get_last && WP_DEBUG && WP_DEBUG_DISPLAY && ini_get( 'display_errors' )
   205 	// Don't print the class for PHP notices in wp-config.php, as they happen before WP_DEBUG takes effect,
   200 	// Don't print the class for PHP notices in wp-config.php, as they happen before WP_DEBUG takes effect,
   206 	// and should not be displayed with the `error_reporting` level previously set in wp-load.php.
   201 	// and should not be displayed with the `error_reporting` level previously set in wp-load.php.
   207 	&& ( E_NOTICE !== $error['type'] || 'wp-config.php' !== wp_basename( $error['file'] ) )
   202 	&& ( E_NOTICE !== $error_get_last['type'] || 'wp-config.php' !== wp_basename( $error_get_last['file'] ) )
   208 ) {
   203 ) {
   209 	$admin_body_class .= ' php-error';
   204 	$admin_body_class .= ' php-error';
   210 }
   205 }
   211 
   206 
   212 unset( $error );
   207 unset( $error_get_last );
   213 
   208 
   214 ?>
   209 ?>
   215 </head>
   210 </head>
   216 <?php
   211 <?php
   217 /**
   212 /**