WordPress.org

Make WordPress Core


Ignore:
Timestamp:
11/30/2017 11:09:33 PM (3 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/index.php

    r42201 r42343  
    1111
    1212/** Load WordPress dashboard API */
    13 require_once(ABSPATH . 'wp-admin/includes/dashboard.php');
     13require_once( ABSPATH . 'wp-admin/includes/dashboard.php' );
    1414
    1515wp_dashboard_setup();
     
    2121    wp_enqueue_script( 'updates' );
    2222}
    23 if ( current_user_can( 'upload_files' ) )
     23if ( current_user_can( 'upload_files' ) ) {
    2424    wp_enqueue_script( 'media-upload' );
     25}
    2526add_thickbox();
    2627
    27 if ( wp_is_mobile() )
     28if ( wp_is_mobile() ) {
    2829    wp_enqueue_script( 'jquery-touch-punch' );
     30}
    2931
    30 $title = __('Dashboard');
     32$title       = __( 'Dashboard' );
    3133$parent_file = 'index.php';
    3234
     
    3537$screen = get_current_screen();
    3638
    37 $screen->add_help_tab( array(
    38     'id'      => 'overview',
    39     'title'   => __( 'Overview' ),
    40     'content' => $help,
    41 ) );
     39$screen->add_help_tab(
     40    array(
     41        'id'      => 'overview',
     42        'title'   => __( 'Overview' ),
     43        'content' => $help,
     44    )
     45);
    4246
    4347// Help tabs
     
    4650$help .= '<p>' . __( 'Links in the Toolbar at the top of the screen connect your dashboard and the front end of your site, and provide access to your profile and helpful WordPress information.' ) . '</p>';
    4751
    48 $screen->add_help_tab( array(
    49     'id'      => 'help-navigation',
    50     'title'   => __( 'Navigation' ),
    51     'content' => $help,
    52 ) );
     52$screen->add_help_tab(
     53    array(
     54        'id'      => 'help-navigation',
     55        'title'   => __( 'Navigation' ),
     56        'content' => $help,
     57    )
     58);
    5359
    5460$help  = '<p>' . __( 'You can use the following controls to arrange your Dashboard screen to suit your workflow. This is true on most other administration screens as well.' ) . '</p>';
     
    5763$help .= '<p>' . __( '<strong>Box Controls</strong> &mdash; Click the title bar of the box to expand or collapse it. Some boxes added by plugins may have configurable content, and will show a &#8220;Configure&#8221; link in the title bar if you hover over it.' ) . '</p>';
    5864
    59 $screen->add_help_tab( array(
    60     'id'      => 'help-layout',
    61     'title'   => __( 'Layout' ),
    62     'content' => $help,
    63 ) );
     65$screen->add_help_tab(
     66    array(
     67        'id'      => 'help-layout',
     68        'title'   => __( 'Layout' ),
     69        'content' => $help,
     70    )
     71);
    6472
    65 $help  = '<p>' . __( 'The boxes on your Dashboard screen are:' ) . '</p>';
    66 if ( current_user_can( 'edit_posts' ) )
     73$help = '<p>' . __( 'The boxes on your Dashboard screen are:' ) . '</p>';
     74if ( current_user_can( 'edit_posts' ) ) {
    6775    $help .= '<p>' . __( '<strong>At A Glance</strong> &mdash; Displays a summary of the content on your site and identifies which theme and version of WordPress you are using.' ) . '</p>';
     76}
    6877    $help .= '<p>' . __( '<strong>Activity</strong> &mdash; Shows the upcoming scheduled posts, recently published posts, and the most recent comments on your posts and allows you to moderate them.' ) . '</p>';
    69 if ( is_blog_admin() && current_user_can( 'edit_posts' ) )
     78if ( is_blog_admin() && current_user_can( 'edit_posts' ) ) {
    7079    $help .= '<p>' . __( "<strong>Quick Draft</strong> &mdash; Allows you to create a new post and save it as a draft. Also displays links to the 5 most recent draft posts you've started." ) . '</p>';
    71 if ( ! is_multisite() && current_user_can( 'install_plugins' ) )
     80}
     81if ( ! is_multisite() && current_user_can( 'install_plugins' ) ) {
    7282    $help .= '<p>' . sprintf(
    7383        /* translators: %s: WordPress Planet URL */
     
    7585        __( 'https://planet.wordpress.org/' )
    7686    ) . '</p>';
    77 else
     87} else {
    7888    $help .= '<p>' . sprintf(
    7989        /* translators: %s: WordPress Planet URL */
     
    8191        __( 'https://planet.wordpress.org/' )
    8292    ) . '</p>';
    83 if ( current_user_can( 'edit_theme_options' ) )
     93}
     94if ( current_user_can( 'edit_theme_options' ) ) {
    8495    $help .= '<p>' . __( '<strong>Welcome</strong> &mdash; Shows links for some of the most common tasks when setting up a new site.' ) . '</p>';
     96}
    8597
    86 $screen->add_help_tab( array(
    87     'id'      => 'help-content',
    88     'title'   => __( 'Content' ),
    89     'content' => $help,
    90 ) );
     98$screen->add_help_tab(
     99    array(
     100        'id'      => 'help-content',
     101        'title'   => __( 'Content' ),
     102        'content' => $help,
     103    )
     104);
    91105
    92106unset( $help );
     
    104118    <h1><?php echo esc_html( $title ); ?></h1>
    105119
    106 <?php if ( has_action( 'welcome_panel' ) && current_user_can( 'edit_theme_options' ) ) :
     120<?php
     121if ( has_action( 'welcome_panel' ) && current_user_can( 'edit_theme_options' ) ) :
    107122    $classes = 'welcome-panel';
    108123
     
    110125    // 0 = hide, 1 = toggled to show or single site creator, 2 = multisite site owner
    111126    $hide = 0 == $option || ( 2 == $option && wp_get_current_user()->user_email != get_option( 'admin_email' ) );
    112     if ( $hide )
    113         $classes .= ' hidden'; ?>
     127    if ( $hide ) {
     128        $classes .= ' hidden';
     129    }
     130        ?>
    114131
    115132    <div id="welcome-panel" class="<?php echo esc_attr( $classes ); ?>">
Note: See TracChangeset for help on using the changeset viewer.