Make WordPress Core


Ignore:
Timestamp:
11/30/2017 11:09:33 PM (4 years ago)
Author:
pento
Message:

Code is Poetry.
WordPress' code just... wasn't.
This is now dealt with.

Props jrf, pento, netweb, GaryJ, jdgrimes, westonruter, Greg Sherwood from PHPCS, and everyone who's ever contributed to WPCS and PHPCS.
Fixes #41057.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-admin/admin-header.php

    r42201 r42343  
    77 */
    88
    9 @header('Content-Type: ' . get_option('html_type') . '; charset=' . get_option('blog_charset'));
    10 if ( ! defined( 'WP_ADMIN' ) )
     9@header( 'Content-Type: ' . get_option( 'html_type' ) . '; charset=' . get_option( 'blog_charset' ) );
     10if ( ! defined( 'WP_ADMIN' ) ) {
    1111    require_once( dirname( __FILE__ ) . '/admin.php' );
     12}
    1213
    1314/**
     
    2728
    2829// Catch plugins that include admin-header.php before admin.php completes.
    29 if ( empty( $current_screen ) )
     30if ( empty( $current_screen ) ) {
    3031    set_current_screen();
     32}
    3133
    3234get_admin_page_title();
     
    7072wp_enqueue_style( 'colors' );
    7173wp_enqueue_style( 'ie' );
    72 wp_enqueue_script('utils');
     74wp_enqueue_script( 'utils' );
    7375wp_enqueue_script( 'svg-painter' );
    7476
    75 $admin_body_class = preg_replace('/[^a-z0-9_-]+/i', '-', $hook_suffix);
     77$admin_body_class = preg_replace( '/[^a-z0-9_-]+/i', '-', $hook_suffix );
    7678?>
    7779<script type="text/javascript">
     
    142144do_action( 'admin_head' );
    143145
    144 if ( get_user_setting('mfold') == 'f' )
     146if ( get_user_setting( 'mfold' ) == 'f' ) {
    145147    $admin_body_class .= ' folded';
    146 
    147 if ( !get_user_setting('unfold') )
     148}
     149
     150if ( ! get_user_setting( 'unfold' ) ) {
    148151    $admin_body_class .= ' auto-fold';
    149 
    150 if ( is_admin_bar_showing() )
     152}
     153
     154if ( is_admin_bar_showing() ) {
    151155    $admin_body_class .= ' admin-bar';
    152 
    153 if ( is_rtl() )
     156}
     157
     158if ( is_rtl() ) {
    154159    $admin_body_class .= ' rtl';
    155 
    156 if ( $current_screen->post_type )
     160}
     161
     162if ( $current_screen->post_type ) {
    157163    $admin_body_class .= ' post-type-' . $current_screen->post_type;
    158 
    159 if ( $current_screen->taxonomy )
     164}
     165
     166if ( $current_screen->taxonomy ) {
    160167    $admin_body_class .= ' taxonomy-' . $current_screen->taxonomy;
     168}
    161169
    162170$admin_body_class .= ' branch-' . str_replace( array( '.', ',' ), '-', floatval( get_bloginfo( 'version' ) ) );
     
    165173$admin_body_class .= ' locale-' . sanitize_html_class( strtolower( str_replace( '_', '-', get_user_locale() ) ) );
    166174
    167 if ( wp_is_mobile() )
     175if ( wp_is_mobile() ) {
    168176    $admin_body_class .= ' mobile';
    169 
    170 if ( is_multisite() )
     177}
     178
     179if ( is_multisite() ) {
    171180    $admin_body_class .= ' multisite';
    172 
    173 if ( is_network_admin() )
     181}
     182
     183if ( is_network_admin() ) {
    174184    $admin_body_class .= ' network-admin';
     185}
    175186
    176187$admin_body_class .= ' no-customize-support no-svg';
     
    208219
    209220<div id="wpwrap">
    210 <?php require(ABSPATH . 'wp-admin/menu-header.php'); ?>
     221<?php require( ABSPATH . 'wp-admin/menu-header.php' ); ?>
    211222<div id="wpcontent">
    212223
     
    222233<div id="wpbody" role="main">
    223234<?php
    224 unset($title_class, $blog_name, $total_update_count, $update_title);
     235unset( $title_class, $blog_name, $total_update_count, $update_title );
    225236
    226237$current_screen->set_parentage( $parent_file );
     
    228239?>
    229240
    230 <div id="wpbody-content" aria-label="<?php esc_attr_e('Main content'); ?>" tabindex="0">
     241<div id="wpbody-content" aria-label="<?php esc_attr_e( 'Main content' ); ?>" tabindex="0">
    231242<?php
    232243
     
    263274do_action( 'all_admin_notices' );
    264275
    265 if ( $parent_file == 'options-general.php' )
    266     require(ABSPATH . 'wp-admin/options-head.php');
     276if ( $parent_file == 'options-general.php' ) {
     277    require( ABSPATH . 'wp-admin/options-head.php' );
     278}
Note: See TracChangeset for help on using the changeset viewer.