Make WordPress Core


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

    r42146 r42343  
    3939 */
    4040function wp_category_checklist( $post_id = 0, $descendants_and_self = 0, $selected_cats = false, $popular_cats = false, $walker = null, $checked_ontop = true ) {
    41     wp_terms_checklist( $post_id, array(
    42         'taxonomy' => 'category',
    43         'descendants_and_self' => $descendants_and_self,
    44         'selected_cats' => $selected_cats,
    45         'popular_cats' => $popular_cats,
    46         'walker' => $walker,
    47         'checked_ontop' => $checked_ontop
    48     ) );
     41    wp_terms_checklist(
     42        $post_id, array(
     43            'taxonomy'             => 'category',
     44            'descendants_and_self' => $descendants_and_self,
     45            'selected_cats'        => $selected_cats,
     46            'popular_cats'         => $popular_cats,
     47            'walker'               => $walker,
     48            'checked_ontop'        => $checked_ontop,
     49        )
     50    );
    4951}
    5052
     
    7678 */
    7779function wp_terms_checklist( $post_id = 0, $args = array() ) {
    78     $defaults = array(
     80    $defaults = array(
    7981        'descendants_and_self' => 0,
    80         'selected_cats' => false,
    81         'popular_cats' => false,
    82         'walker' => null,
    83         'taxonomy' => 'category',
    84         'checked_ontop' => true,
    85         'echo' => true,
     82        'selected_cats'        => false,
     83        'popular_cats'         => false,
     84        'walker'               => null,
     85        'taxonomy'             => 'category',
     86        'checked_ontop'        => true,
     87        'echo'                 => true,
    8688    );
    8789
     
    106108    }
    107109
    108     $taxonomy = $r['taxonomy'];
     110    $taxonomy             = $r['taxonomy'];
    109111    $descendants_and_self = (int) $r['descendants_and_self'];
    110112
    111113    $args = array( 'taxonomy' => $taxonomy );
    112114
    113     $tax = get_taxonomy( $taxonomy );
     115    $tax              = get_taxonomy( $taxonomy );
    114116    $args['disabled'] = ! current_user_can( $tax->cap->assign_terms );
    115117
     
    126128        $args['popular_cats'] = $r['popular_cats'];
    127129    } else {
    128         $args['popular_cats'] = get_terms( $taxonomy, array(
    129             'fields' => 'ids',
    130             'orderby' => 'count',
    131             'order' => 'DESC',
    132             'number' => 10,
    133             'hierarchical' => false
    134         ) );
     130        $args['popular_cats'] = get_terms(
     131            $taxonomy, array(
     132                'fields'       => 'ids',
     133                'orderby'      => 'count',
     134                'order'        => 'DESC',
     135                'number'       => 10,
     136                'hierarchical' => false,
     137            )
     138        );
    135139    }
    136140    if ( $descendants_and_self ) {
    137         $categories = (array) get_terms( $taxonomy, array(
    138             'child_of' => $descendants_and_self,
    139             'hierarchical' => 0,
    140             'hide_empty' => 0
    141         ) );
    142         $self = get_term( $descendants_and_self, $taxonomy );
     141        $categories = (array) get_terms(
     142            $taxonomy, array(
     143                'child_of'     => $descendants_and_self,
     144                'hierarchical' => 0,
     145                'hide_empty'   => 0,
     146            )
     147        );
     148        $self       = get_term( $descendants_and_self, $taxonomy );
    143149        array_unshift( $categories, $self );
    144150    } else {
     
    151157        // Post process $categories rather than adding an exclude to the get_terms() query to keep the query the same across all posts (for any query cache)
    152158        $checked_categories = array();
    153         $keys = array_keys( $categories );
     159        $keys               = array_keys( $categories );
    154160
    155161        foreach ( $keys as $k ) {
    156             if ( in_array( $categories[$k]->term_id, $args['selected_cats'] ) ) {
    157                 $checked_categories[] = $categories[$k];
    158                 unset( $categories[$k] );
     162            if ( in_array( $categories[ $k ]->term_id, $args['selected_cats'] ) ) {
     163                $checked_categories[] = $categories[ $k ];
     164                unset( $categories[ $k ] );
    159165            }
    160166        }
     
    192198    $post = get_post();
    193199
    194     if ( $post && $post->ID )
    195         $checked_terms = wp_get_object_terms($post->ID, $taxonomy, array('fields'=>'ids'));
    196     else
     200    if ( $post && $post->ID ) {
     201        $checked_terms = wp_get_object_terms( $post->ID, $taxonomy, array( 'fields' => 'ids' ) );
     202    } else {
    197203        $checked_terms = array();
    198 
    199     $terms = get_terms( $taxonomy, array( 'orderby' => 'count', 'order' => 'DESC', 'number' => $number, 'hierarchical' => false ) );
    200 
    201     $tax = get_taxonomy($taxonomy);
     204    }
     205
     206    $terms = get_terms(
     207        $taxonomy, array(
     208            'orderby'      => 'count',
     209            'order'        => 'DESC',
     210            'number'       => $number,
     211            'hierarchical' => false,
     212        )
     213    );
     214
     215    $tax = get_taxonomy( $taxonomy );
    202216
    203217    $popular_ids = array();
    204218    foreach ( (array) $terms as $term ) {
    205219        $popular_ids[] = $term->term_id;
    206         if ( !$echo ) // Hack for Ajax use.
     220        if ( ! $echo ) { // Hack for Ajax use.
    207221            continue;
    208         $id = "popular-$taxonomy-$term->term_id";
     222        }
     223        $id      = "popular-$taxonomy-$term->term_id";
    209224        $checked = in_array( $term->term_id, $checked_terms ) ? 'checked="checked"' : '';
    210225        ?>
     
    247262    }
    248263
    249     $categories = get_terms( 'link_category', array( 'orderby' => 'name', 'hide_empty' => 0 ) );
    250 
    251     if ( empty( $categories ) )
     264    $categories = get_terms(
     265        'link_category', array(
     266            'orderby'    => 'name',
     267            'hide_empty' => 0,
     268        )
     269    );
     270
     271    if ( empty( $categories ) ) {
    252272        return;
     273    }
    253274
    254275    foreach ( $categories as $category ) {
     
    256277
    257278        /** This filter is documented in wp-includes/category-template.php */
    258         $name = esc_html( apply_filters( 'the_category', $category->name, '', '' ) );
     279        $name    = esc_html( apply_filters( 'the_category', $category->name, '', '' ) );
    259280        $checked = in_array( $cat_id, $checked_categories ) ? ' checked="checked"' : '';
    260         echo '<li id="link-category-', $cat_id, '"><label for="in-link-category-', $cat_id, '" class="selectit"><input value="', $cat_id, '" type="checkbox" name="link_category[]" id="in-link-category-', $cat_id, '"', $checked, '/> ', $name, "</label></li>";
     281        echo '<li id="link-category-', $cat_id, '"><label for="in-link-category-', $cat_id, '" class="selectit"><input value="', $cat_id, '" type="checkbox" name="link_category[]" id="in-link-category-', $cat_id, '"', $checked, '/> ', $name, '</label></li>';
    261282    }
    262283}
     
    269290 * @param WP_Post $post Post object.
    270291 */
    271 function get_inline_data($post) {
    272     $post_type_object = get_post_type_object($post->post_type);
    273     if ( ! current_user_can( 'edit_post', $post->ID ) )
     292function get_inline_data( $post ) {
     293    $post_type_object = get_post_type_object( $post->post_type );
     294    if ( ! current_user_can( 'edit_post', $post->ID ) ) {
    274295        return;
     296    }
    275297
    276298    $title = esc_textarea( trim( $post->post_title ) );
     
    305327
    306328    $taxonomy_names = get_object_taxonomies( $post->post_type );
    307     foreach ( $taxonomy_names as $taxonomy_name) {
     329    foreach ( $taxonomy_names as $taxonomy_name ) {
    308330        $taxonomy = get_taxonomy( $taxonomy_name );
    309331
     
    326348            }
    327349
    328             echo '<div class="tags_input" id="'.$taxonomy_name.'_'.$post->ID.'">'
     350            echo '<div class="tags_input" id="' . $taxonomy_name . '_' . $post->ID . '">'
    329351                . esc_html( str_replace( ',', ', ', $terms_to_edit ) ) . '</div>';
    330352
     
    332354    }
    333355
    334     if ( !$post_type_object->hierarchical )
    335         echo '<div class="sticky">' . (is_sticky($post->ID) ? 'sticky' : '') . '</div>';
    336 
    337     if ( post_type_supports( $post->post_type, 'post-formats' ) )
     356    if ( ! $post_type_object->hierarchical ) {
     357        echo '<div class="sticky">' . ( is_sticky( $post->ID ) ? 'sticky' : '' ) . '</div>';
     358    }
     359
     360    if ( post_type_supports( $post->post_type, 'post-formats' ) ) {
    338361        echo '<div class="post_format">' . esc_html( get_post_format( $post->ID ) ) . '</div>';
     362    }
    339363
    340364    echo '</div>';
     
    370394     * @param array  $args    An array of default args.
    371395     */
    372     $content = apply_filters( 'wp_comment_reply', '', array( 'position' => $position, 'checkbox' => $checkbox, 'mode' => $mode ) );
    373 
    374     if ( ! empty($content) ) {
     396    $content = apply_filters(
     397        'wp_comment_reply', '', array(
     398            'position' => $position,
     399            'checkbox' => $checkbox,
     400            'mode'     => $mode,
     401        )
     402    );
     403
     404    if ( ! empty( $content ) ) {
    375405        echo $content;
    376406        return;
     
    379409    if ( ! $wp_list_table ) {
    380410        if ( $mode == 'single' ) {
    381             $wp_list_table = _get_list_table('WP_Post_Comments_List_Table');
     411            $wp_list_table = _get_list_table( 'WP_Post_Comments_List_Table' );
    382412        } else {
    383             $wp_list_table = _get_list_table('WP_Comments_List_Table');
     413            $wp_list_table = _get_list_table( 'WP_Comments_List_Table' );
    384414        }
    385415    }
     
    403433    <?php
    404434    $quicktags_settings = array( 'buttons' => 'strong,em,link,block,del,ins,img,ul,ol,li,code,close' );
    405     wp_editor( '', 'replycontent', array( 'media_buttons' => false, 'tinymce' => false, 'quicktags' => $quicktags_settings ) );
     435    wp_editor(
     436        '', 'replycontent', array(
     437            'media_buttons' => false,
     438            'tinymce'       => false,
     439            'quicktags'     => $quicktags_settings,
     440        )
     441    );
    406442    ?>
    407443    </div>
     
    409445    <div id="edithead" style="display:none;">
    410446        <div class="inside">
    411         <label for="author-name"><?php _e( 'Name' ) ?></label>
     447        <label for="author-name"><?php _e( 'Name' ); ?></label>
    412448        <input type="text" name="newcomment_author" size="50" value="" id="author-name" />
    413449        </div>
    414450
    415451        <div class="inside">
    416         <label for="author-email"><?php _e('Email') ?></label>
     452        <label for="author-email"><?php _e( 'Email' ); ?></label>
    417453        <input type="text" name="newcomment_author_email" size="50" value="" id="author-email" />
    418454        </div>
    419455
    420456        <div class="inside">
    421         <label for="author-url"><?php _e('URL') ?></label>
     457        <label for="author-url"><?php _e( 'URL' ); ?></label>
    422458        <input type="text" id="author-url" name="newcomment_author_url" class="code" size="103" value="" />
    423459        </div>
     
    446482    <input type="hidden" name="position" id="position" value="<?php echo $position; ?>" />
    447483    <input type="hidden" name="checkbox" id="checkbox" value="<?php echo $checkbox ? 1 : 0; ?>" />
    448     <input type="hidden" name="mode" id="mode" value="<?php echo esc_attr($mode); ?>" />
     484    <input type="hidden" name="mode" id="mode" value="<?php echo esc_attr( $mode ); ?>" />
    449485    <?php
    450486        wp_nonce_field( 'replyto-comment', '_ajax_nonce-replyto-comment', false );
    451         if ( current_user_can( 'unfiltered_html' ) )
    452             wp_nonce_field( 'unfiltered-html-comment', '_wp_unfiltered_html_comment', false );
     487    if ( current_user_can( 'unfiltered_html' ) ) {
     488        wp_nonce_field( 'unfiltered-html-comment', '_wp_unfiltered_html_comment', false );
     489    }
    453490    ?>
    454491    </fieldset>
     
    470507?>
    471508<div class="hidden" id="trash-undo-holder">
    472     <div class="trash-undo-inside"><?php printf(__('Comment by %s moved to the trash.'), '<strong></strong>'); ?> <span class="undo untrash"><a href="#"><?php _e('Undo'); ?></a></span></div>
     509    <div class="trash-undo-inside"><?php printf( __( 'Comment by %s moved to the trash.' ), '<strong></strong>' ); ?> <span class="undo untrash"><a href="#"><?php _e( 'Undo' ); ?></a></span></div>
    473510</div>
    474511<div class="hidden" id="spam-undo-holder">
    475     <div class="spam-undo-inside"><?php printf(__('Comment by %s marked as spam.'), '<strong></strong>'); ?> <span class="undo unspam"><a href="#"><?php _e('Undo'); ?></a></span></div>
     512    <div class="spam-undo-inside"><?php printf( __( 'Comment by %s marked as spam.' ), '<strong></strong>' ); ?> <span class="undo unspam"><a href="#"><?php _e( 'Undo' ); ?></a></span></div>
    476513</div>
    477514<?php
     
    507544    <thead>
    508545    <tr>
    509         <th class="left"><?php _ex( 'Name', 'meta name' ) ?></th>
    510         <th><?php _e( 'Value' ) ?></th>
     546        <th class="left"><?php _ex( 'Name', 'meta name' ); ?></th>
     547        <th><?php _e( 'Value' ); ?></th>
    511548    </tr>
    512549    </thead>
    513550    <tbody id='the-list' data-wp-lists='list:meta'>
    514551<?php
    515     foreach ( $meta as $entry )
    516         echo _list_meta_row( $entry, $count );
     552foreach ( $meta as $entry ) {
     553    echo _list_meta_row( $entry, $count );
     554}
    517555?>
    518556    </tbody>
     
    535573    static $update_nonce = '';
    536574
    537     if ( is_protected_meta( $entry['meta_key'], 'post' ) )
     575    if ( is_protected_meta( $entry['meta_key'], 'post' ) ) {
    538576        return '';
    539 
    540     if ( ! $update_nonce )
     577    }
     578
     579    if ( ! $update_nonce ) {
    541580        $update_nonce = wp_create_nonce( 'add-meta' );
     581    }
    542582
    543583    $r = '';
     
    555595    }
    556596
    557     $entry['meta_key'] = esc_attr($entry['meta_key']);
     597    $entry['meta_key']   = esc_attr( $entry['meta_key'] );
    558598    $entry['meta_value'] = esc_textarea( $entry['meta_value'] ); // using a <textarea />
    559     $entry['meta_id'] = (int) $entry['meta_id'];
     599    $entry['meta_id']    = (int) $entry['meta_id'];
    560600
    561601    $delete_nonce = wp_create_nonce( 'delete-meta_' . $entry['meta_id'] );
     
    568608    $r .= "\n\t\t";
    569609    $r .= get_submit_button( __( 'Update' ), 'updatemeta small', "meta-{$entry['meta_id']}-submit", false, array( 'data-wp-lists' => "add:the-list:meta-{$entry['meta_id']}::_ajax_nonce-add-meta=$update_nonce" ) );
    570     $r .= "</div>";
     610    $r .= '</div>';
    571611    $r .= wp_nonce_field( 'change-meta', '_ajax_nonce', false, false );
    572     $r .= "</td>";
     612    $r .= '</td>';
    573613
    574614    $r .= "\n\t\t<td><label class='screen-reader-text' for='meta-{$entry['meta_id']}-value'>" . __( 'Value' ) . "</label><textarea name='meta[{$entry['meta_id']}][value]' id='meta-{$entry['meta_id']}-value' rows='2' cols='30'>{$entry['meta_value']}</textarea></td>\n\t</tr>";
     
    612652         */
    613653        $limit = apply_filters( 'postmeta_form_limit', 30 );
    614         $sql = "SELECT DISTINCT meta_key
     654        $sql   = "SELECT DISTINCT meta_key
    615655            FROM $wpdb->postmeta
    616656            WHERE meta_key NOT BETWEEN '_' AND '_z'
     
    618658            ORDER BY meta_key
    619659            LIMIT %d";
    620         $keys = $wpdb->get_col( $wpdb->prepare( $sql, $wpdb->esc_like( '_' ) . '%', $limit ) );
     660        $keys  = $wpdb->get_col( $wpdb->prepare( $sql, $wpdb->esc_like( '_' ) . '%', $limit ) );
    621661    }
    622662
     
    628668    }
    629669?>
    630 <p><strong><?php _e( 'Add New Custom Field:' ) ?></strong></p>
     670<p><strong><?php _e( 'Add New Custom Field:' ); ?></strong></p>
    631671<table id="newmeta">
    632672<thead>
    633673<tr>
    634 <th class="left"><label for="<?php echo $meta_key_input_id; ?>"><?php _ex( 'Name', 'meta name' ) ?></label></th>
    635 <th><label for="metavalue"><?php _e( 'Value' ) ?></label></th>
     674<th class="left"><label for="<?php echo $meta_key_input_id; ?>"><?php _ex( 'Name', 'meta name' ); ?></label></th>
     675<th><label for="metavalue"><?php _e( 'Value' ); ?></label></th>
    636676</tr>
    637677</thead>
     
    645685<?php
    646686
    647     foreach ( $keys as $key ) {
    648         if ( is_protected_meta( $key, 'post' ) || ! current_user_can( 'add_post_meta', $post->ID, $key ) )
    649             continue;
    650         echo "\n<option value='" . esc_attr($key) . "'>" . esc_html($key) . "</option>";
    651     }
     687foreach ( $keys as $key ) {
     688    if ( is_protected_meta( $key, 'post' ) || ! current_user_can( 'add_post_meta', $post->ID, $key ) ) {
     689        continue;
     690    }
     691    echo "\n<option value='" . esc_attr( $key ) . "'>" . esc_html( $key ) . '</option>';
     692}
    652693?>
    653694</select>
    654695<input class="hide-if-js" type="text" id="metakeyinput" name="metakeyinput" value="" />
    655696<a href="#postcustomstuff" class="hide-if-no-js" onclick="jQuery('#metakeyinput, #metakeyselect, #enternew, #cancelnew').toggle();return false;">
    656 <span id="enternew"><?php _e('Enter new'); ?></span>
    657 <span id="cancelnew" class="hidden"><?php _e('Cancel'); ?></span></a>
     697<span id="enternew"><?php _e( 'Enter new' ); ?></span>
     698<span id="cancelnew" class="hidden"><?php _e( 'Cancel' ); ?></span></a>
    658699<?php } else { ?>
    659700<input type="text" id="metakeyinput" name="metakeyinput" value="" />
     
    665706<tr><td colspan="2">
    666707<div class="submit">
    667 <?php submit_button( __( 'Add Custom Field' ), '', 'addmeta', false, array( 'id' => 'newmeta-submit', 'data-wp-lists' => 'add:the-list:newmeta' ) ); ?>
     708<?php
     709submit_button(
     710    __( 'Add Custom Field' ), '', 'addmeta', false, array(
     711        'id'            => 'newmeta-submit',
     712        'data-wp-lists' => 'add:the-list:newmeta',
     713    )
     714);
     715?>
    668716</div>
    669717<?php wp_nonce_field( 'add-meta', '_ajax_nonce-add-meta', false ); ?>
     
    693741    $post = get_post();
    694742
    695     if ( $for_post )
    696         $edit = ! ( in_array($post->post_status, array('draft', 'pending') ) && (!$post->post_date_gmt || '0000-00-00 00:00:00' == $post->post_date_gmt ) );
     743    if ( $for_post ) {
     744        $edit = ! ( in_array( $post->post_status, array( 'draft', 'pending' ) ) && ( ! $post->post_date_gmt || '0000-00-00 00:00:00' == $post->post_date_gmt ) );
     745    }
    697746
    698747    $tab_index_attribute = '';
    699     if ( (int) $tab_index > 0 )
     748    if ( (int) $tab_index > 0 ) {
    700749        $tab_index_attribute = " tabindex=\"$tab_index\"";
     750    }
    701751
    702752    // todo: Remove this?
    703753    // echo '<label for="timestamp" style="display: block;"><input type="checkbox" class="checkbox" name="edit_date" value="1" id="timestamp"'.$tab_index_attribute.' /> '.__( 'Edit timestamp' ).'</label><br />';
    704754
    705     $time_adj = current_time('timestamp');
    706     $post_date = ($for_post) ? $post->post_date : get_comment()->comment_date;
    707     $jj = ($edit) ? mysql2date( 'd', $post_date, false ) : gmdate( 'd', $time_adj );
    708     $mm = ($edit) ? mysql2date( 'm', $post_date, false ) : gmdate( 'm', $time_adj );
    709     $aa = ($edit) ? mysql2date( 'Y', $post_date, false ) : gmdate( 'Y', $time_adj );
    710     $hh = ($edit) ? mysql2date( 'H', $post_date, false ) : gmdate( 'H', $time_adj );
    711     $mn = ($edit) ? mysql2date( 'i', $post_date, false ) : gmdate( 'i', $time_adj );
    712     $ss = ($edit) ? mysql2date( 's', $post_date, false ) : gmdate( 's', $time_adj );
     755    $time_adj  = current_time( 'timestamp' );
     756    $post_date = ( $for_post ) ? $post->post_date : get_comment()->comment_date;
     757    $jj        = ( $edit ) ? mysql2date( 'd', $post_date, false ) : gmdate( 'd', $time_adj );
     758    $mm        = ( $edit ) ? mysql2date( 'm', $post_date, false ) : gmdate( 'm', $time_adj );
     759    $aa        = ( $edit ) ? mysql2date( 'Y', $post_date, false ) : gmdate( 'Y', $time_adj );
     760    $hh        = ( $edit ) ? mysql2date( 'H', $post_date, false ) : gmdate( 'H', $time_adj );
     761    $mn        = ( $edit ) ? mysql2date( 'i', $post_date, false ) : gmdate( 'i', $time_adj );
     762    $ss        = ( $edit ) ? mysql2date( 's', $post_date, false ) : gmdate( 's', $time_adj );
    713763
    714764    $cur_jj = gmdate( 'd', $time_adj );
     
    719769
    720770    $month = '<label><span class="screen-reader-text">' . __( 'Month' ) . '</span><select ' . ( $multi ? '' : 'id="mm" ' ) . 'name="mm"' . $tab_index_attribute . ">\n";
    721     for ( $i = 1; $i < 13; $i = $i +1 ) {
    722         $monthnum = zeroise($i, 2);
     771    for ( $i = 1; $i < 13; $i = $i + 1 ) {
     772        $monthnum  = zeroise( $i, 2 );
    723773        $monthtext = $wp_locale->get_month_abbrev( $wp_locale->get_month( $i ) );
    724         $month .= "\t\t\t" . '<option value="' . $monthnum . '" data-text="' . $monthtext . '" ' . selected( $monthnum, $mm, false ) . '>';
     774        $month    .= "\t\t\t" . '<option value="' . $monthnum . '" data-text="' . $monthtext . '" ' . selected( $monthnum, $mm, false ) . '>';
    725775        /* translators: 1: month number (01, 02, etc.), 2: month abbreviation */
    726776        $month .= sprintf( __( '%1$s-%2$s' ), $monthnum, $monthtext ) . "</option>\n";
     
    728778    $month .= '</select></label>';
    729779
    730     $day = '<label><span class="screen-reader-text">' . __( 'Day' ) . '</span><input type="text" ' . ( $multi ? '' : 'id="jj" ' ) . 'name="jj" value="' . $jj . '" size="2" maxlength="2"' . $tab_index_attribute . ' autocomplete="off" /></label>';
    731     $year = '<label><span class="screen-reader-text">' . __( 'Year' ) . '</span><input type="text" ' . ( $multi ? '' : 'id="aa" ' ) . 'name="aa" value="' . $aa . '" size="4" maxlength="4"' . $tab_index_attribute . ' autocomplete="off" /></label>';
    732     $hour = '<label><span class="screen-reader-text">' . __( 'Hour' ) . '</span><input type="text" ' . ( $multi ? '' : 'id="hh" ' ) . 'name="hh" value="' . $hh . '" size="2" maxlength="2"' . $tab_index_attribute . ' autocomplete="off" /></label>';
     780    $day    = '<label><span class="screen-reader-text">' . __( 'Day' ) . '</span><input type="text" ' . ( $multi ? '' : 'id="jj" ' ) . 'name="jj" value="' . $jj . '" size="2" maxlength="2"' . $tab_index_attribute . ' autocomplete="off" /></label>';
     781    $year   = '<label><span class="screen-reader-text">' . __( 'Year' ) . '</span><input type="text" ' . ( $multi ? '' : 'id="aa" ' ) . 'name="aa" value="' . $aa . '" size="4" maxlength="4"' . $tab_index_attribute . ' autocomplete="off" /></label>';
     782    $hour   = '<label><span class="screen-reader-text">' . __( 'Hour' ) . '</span><input type="text" ' . ( $multi ? '' : 'id="hh" ' ) . 'name="hh" value="' . $hh . '" size="2" maxlength="2"' . $tab_index_attribute . ' autocomplete="off" /></label>';
    733783    $minute = '<label><span class="screen-reader-text">' . __( 'Minute' ) . '</span><input type="text" ' . ( $multi ? '' : 'id="mn" ' ) . 'name="mn" value="' . $mn . '" size="2" maxlength="2"' . $tab_index_attribute . ' autocomplete="off" /></label>';
    734784
     
    739789    echo '</div><input type="hidden" id="ss" name="ss" value="' . $ss . '" />';
    740790
    741     if ( $multi ) return;
     791    if ( $multi ) {
     792        return;
     793    }
    742794
    743795    echo "\n\n";
     
    759811
    760812<p>
    761 <a href="#edit_timestamp" class="save-timestamp hide-if-no-js button"><?php _e('OK'); ?></a>
    762 <a href="#edit_timestamp" class="cancel-timestamp hide-if-no-js button-cancel"><?php _e('Cancel'); ?></a>
     813<a href="#edit_timestamp" class="save-timestamp hide-if-no-js button"><?php _e( 'OK' ); ?></a>
     814<a href="#edit_timestamp" class="cancel-timestamp hide-if-no-js button-cancel"><?php _e( 'Cancel' ); ?></a>
    763815</p>
    764816<?php
     
    779831    foreach ( array_keys( $templates ) as $template ) {
    780832        $selected = selected( $default, $templates[ $template ], false );
    781         echo "\n\t<option value='" . esc_attr( $templates[ $template ] ) . "' $selected>" . esc_html( $template ) . "</option>";
     833        echo "\n\t<option value='" . esc_attr( $templates[ $template ] ) . "' $selected>" . esc_html( $template ) . '</option>';
    782834    }
    783835}
     
    800852function parent_dropdown( $default = 0, $parent = 0, $level = 0, $post = null ) {
    801853    global $wpdb;
    802     $post = get_post( $post );
    803     $items = $wpdb->get_results( $wpdb->prepare("SELECT ID, post_parent, post_title FROM $wpdb->posts WHERE post_parent = %d AND post_type = 'page' ORDER BY menu_order", $parent) );
     854    $post  = get_post( $post );
     855    $items = $wpdb->get_results( $wpdb->prepare( "SELECT ID, post_parent, post_title FROM $wpdb->posts WHERE post_parent = %d AND post_type = 'page' ORDER BY menu_order", $parent ) );
    804856
    805857    if ( $items ) {
    806858        foreach ( $items as $item ) {
    807859            // A page cannot be its own parent.
    808             if ( $post && $post->ID && $item->ID == $post->ID )
     860            if ( $post && $post->ID && $item->ID == $post->ID ) {
    809861                continue;
    810 
    811             $pad = str_repeat( '&nbsp;', $level * 3 );
     862            }
     863
     864            $pad      = str_repeat( '&nbsp;', $level * 3 );
    812865            $selected = selected( $default, $item->ID, false );
    813866
    814             echo "\n\t<option class='level-$level' value='$item->ID' $selected>$pad " . esc_html($item->post_title) . "</option>";
    815             parent_dropdown( $default, $item->ID, $level +1 );
     867            echo "\n\t<option class='level-$level' value='$item->ID' $selected>$pad " . esc_html( $item->post_title ) . '</option>';
     868            parent_dropdown( $default, $item->ID, $level + 1 );
    816869        }
    817870    } else {
     
    833886
    834887    foreach ( $editable_roles as $role => $details ) {
    835         $name = translate_user_role($details['name'] );
     888        $name = translate_user_role( $details['name'] );
    836889        // preselect specified role
    837890        if ( $selected == $role ) {
     
    863916     * @param int $max_upload_size Allowed upload size. Default 1 MB.
    864917     */
    865     $bytes = apply_filters( 'import_upload_size_limit', wp_max_upload_size() );
    866     $size = size_format( $bytes );
     918    $bytes      = apply_filters( 'import_upload_size_limit', wp_max_upload_size() );
     919    $size       = size_format( $bytes );
    867920    $upload_dir = wp_upload_dir();
    868921    if ( ! empty( $upload_dir['error'] ) ) :
    869         ?><div class="error"><p><?php _e('Before you can upload your import file, you will need to fix the following error:'); ?></p>
    870         <p><strong><?php echo $upload_dir['error']; ?></strong></p></div><?php
     922        ?>
     923        <div class="error"><p><?php _e( 'Before you can upload your import file, you will need to fix the following error:' ); ?></p>
     924        <p><strong><?php echo $upload_dir['error']; ?></strong></p></div>
     925                                <?php
    871926    else :
    872927?>
    873928<form enctype="multipart/form-data" id="import-upload-form" method="post" class="wp-upload-form" action="<?php echo esc_url( wp_nonce_url( $action, 'import-upload' ) ); ?>">
    874929<p>
    875 <label for="upload"><?php _e( 'Choose a file from your computer:' ); ?></label> (<?php printf( __('Maximum size: %s' ), $size ); ?>)
     930<label for="upload"><?php _e( 'Choose a file from your computer:' ); ?></label> (<?php printf( __( 'Maximum size: %s' ), $size ); ?>)
    876931<input type="file" id="upload" name="import" size="25" />
    877932<input type="hidden" name="action" value="save" />
    878933<input type="hidden" name="max_file_size" value="<?php echo $bytes; ?>" />
    879934</p>
    880 <?php submit_button( __('Upload file and import'), 'primary' ); ?>
     935<?php submit_button( __( 'Upload file and import' ), 'primary' ); ?>
    881936</form>
    882937<?php
     
    934989    $page = $screen->id;
    935990
    936     if ( !isset($wp_meta_boxes) )
     991    if ( ! isset( $wp_meta_boxes ) ) {
    937992        $wp_meta_boxes = array();
    938     if ( !isset($wp_meta_boxes[$page]) )
    939         $wp_meta_boxes[$page] = array();
    940     if ( !isset($wp_meta_boxes[$page][$context]) )
    941         $wp_meta_boxes[$page][$context] = array();
    942 
    943     foreach ( array_keys($wp_meta_boxes[$page]) as $a_context ) {
    944         foreach ( array('high', 'core', 'default', 'low') as $a_priority ) {
    945             if ( !isset($wp_meta_boxes[$page][$a_context][$a_priority][$id]) )
     993    }
     994    if ( ! isset( $wp_meta_boxes[ $page ] ) ) {
     995        $wp_meta_boxes[ $page ] = array();
     996    }
     997    if ( ! isset( $wp_meta_boxes[ $page ][ $context ] ) ) {
     998        $wp_meta_boxes[ $page ][ $context ] = array();
     999    }
     1000
     1001    foreach ( array_keys( $wp_meta_boxes[ $page ] ) as $a_context ) {
     1002        foreach ( array( 'high', 'core', 'default', 'low' ) as $a_priority ) {
     1003            if ( ! isset( $wp_meta_boxes[ $page ][ $a_context ][ $a_priority ][ $id ] ) ) {
    9461004                continue;
     1005            }
    9471006
    9481007            // If a core box was previously added or removed by a plugin, don't add.
    9491008            if ( 'core' == $priority ) {
    9501009                // If core box previously deleted, don't add
    951                 if ( false === $wp_meta_boxes[$page][$a_context][$a_priority][$id] )
     1010                if ( false === $wp_meta_boxes[ $page ][ $a_context ][ $a_priority ][ $id ] ) {
    9521011                    return;
     1012                }
    9531013
    9541014                /*
     
    9571017                 */
    9581018                if ( 'default' == $a_priority ) {
    959                     $wp_meta_boxes[$page][$a_context]['core'][$id] = $wp_meta_boxes[$page][$a_context]['default'][$id];
    960                     unset($wp_meta_boxes[$page][$a_context]['default'][$id]);
     1019                    $wp_meta_boxes[ $page ][ $a_context ]['core'][ $id ] = $wp_meta_boxes[ $page ][ $a_context ]['default'][ $id ];
     1020                    unset( $wp_meta_boxes[ $page ][ $a_context ]['default'][ $id ] );
    9611021                }
    9621022                return;
    9631023            }
    9641024            // If no priority given and id already present, use existing priority.
    965             if ( empty($priority) ) {
     1025            if ( empty( $priority ) ) {
    9661026                $priority = $a_priority;
    967             /*
    968              * Else, if we're adding to the sorted priority, we don't know the title
    969              * or callback. Grab them from the previously added context/priority.
    970              */
     1027                /*
     1028                * Else, if we're adding to the sorted priority, we don't know the title
     1029                * or callback. Grab them from the previously added context/priority.
     1030                */
    9711031            } elseif ( 'sorted' == $priority ) {
    972                 $title = $wp_meta_boxes[$page][$a_context][$a_priority][$id]['title'];
    973                 $callback = $wp_meta_boxes[$page][$a_context][$a_priority][$id]['callback'];
    974                 $callback_args = $wp_meta_boxes[$page][$a_context][$a_priority][$id]['args'];
     1032                $title         = $wp_meta_boxes[ $page ][ $a_context ][ $a_priority ][ $id ]['title'];
     1033                $callback      = $wp_meta_boxes[ $page ][ $a_context ][ $a_priority ][ $id ]['callback'];
     1034                $callback_args = $wp_meta_boxes[ $page ][ $a_context ][ $a_priority ][ $id ]['args'];
    9751035            }
    9761036            // An id can be in only one priority and one context.
    977             if ( $priority != $a_priority || $context != $a_context )
    978                 unset($wp_meta_boxes[$page][$a_context][$a_priority][$id]);
    979         }
    980     }
    981 
    982     if ( empty($priority) )
     1037            if ( $priority != $a_priority || $context != $a_context ) {
     1038                unset( $wp_meta_boxes[ $page ][ $a_context ][ $a_priority ][ $id ] );
     1039            }
     1040        }
     1041    }
     1042
     1043    if ( empty( $priority ) ) {
    9831044        $priority = 'low';
    984 
    985     if ( !isset($wp_meta_boxes[$page][$context][$priority]) )
    986         $wp_meta_boxes[$page][$context][$priority] = array();
    987 
    988     $wp_meta_boxes[$page][$context][$priority][$id] = array('id' => $id, 'title' => $title, 'callback' => $callback, 'args' => $callback_args);
     1045    }
     1046
     1047    if ( ! isset( $wp_meta_boxes[ $page ][ $context ][ $priority ] ) ) {
     1048        $wp_meta_boxes[ $page ][ $context ][ $priority ] = array();
     1049    }
     1050
     1051    $wp_meta_boxes[ $page ][ $context ][ $priority ][ $id ] = array(
     1052        'id'       => $id,
     1053        'title'    => $title,
     1054        'callback' => $callback,
     1055        'args'     => $callback_args,
     1056    );
    9891057}
    9901058
     
    10101078    static $already_sorted = false;
    10111079
    1012     if ( empty( $screen ) )
     1080    if ( empty( $screen ) ) {
    10131081        $screen = get_current_screen();
    1014     elseif ( is_string( $screen ) )
     1082    } elseif ( is_string( $screen ) ) {
    10151083        $screen = convert_to_screen( $screen );
     1084    }
    10161085
    10171086    $page = $screen->id;
     
    10191088    $hidden = get_hidden_meta_boxes( $screen );
    10201089
    1021     printf('<div id="%s-sortables" class="meta-box-sortables">', htmlspecialchars($context));
     1090    printf( '<div id="%s-sortables" class="meta-box-sortables">', htmlspecialchars( $context ) );
    10221091
    10231092    // Grab the ones the user has manually sorted. Pull them out of their previous context/priority and into the one the user chose
     
    10381107    if ( isset( $wp_meta_boxes[ $page ][ $context ] ) ) {
    10391108        foreach ( array( 'high', 'sorted', 'core', 'default', 'low' ) as $priority ) {
    1040             if ( isset( $wp_meta_boxes[ $page ][ $context ][ $priority ]) ) {
     1109            if ( isset( $wp_meta_boxes[ $page ][ $context ][ $priority ] ) ) {
    10411110                foreach ( (array) $wp_meta_boxes[ $page ][ $context ][ $priority ] as $box ) {
    1042                     if ( false == $box || ! $box['title'] )
     1111                    if ( false == $box || ! $box['title'] ) {
    10431112                        continue;
     1113                    }
    10441114                    $i++;
    1045                     $hidden_class = in_array($box['id'], $hidden) ? ' hide-if-js' : '';
    1046                     echo '<div id="' . $box['id'] . '" class="postbox ' . postbox_classes($box['id'], $page) . $hidden_class . '" ' . '>' . "\n";
     1115                    $hidden_class = in_array( $box['id'], $hidden ) ? ' hide-if-js' : '';
     1116                    echo '<div id="' . $box['id'] . '" class="postbox ' . postbox_classes( $box['id'], $page ) . $hidden_class . '" ' . '>' . "\n";
    10471117                    if ( 'dashboard_browser_nag' != $box['id'] ) {
    1048                         $widget_title = $box[ 'title' ];
    1049 
    1050                         if ( is_array( $box[ 'args' ] ) && isset( $box[ 'args' ][ '__widget_basename' ] ) ) {
    1051                             $widget_title = $box[ 'args' ][ '__widget_basename' ];
     1118                        $widget_title = $box['title'];
     1119
     1120                        if ( is_array( $box['args'] ) && isset( $box['args']['__widget_basename'] ) ) {
     1121                            $widget_title = $box['args']['__widget_basename'];
    10521122                            // Do not pass this parameter to the user callback function.
    1053                             unset( $box[ 'args' ][ '__widget_basename' ] );
     1123                            unset( $box['args']['__widget_basename'] );
    10541124                        }
    10551125
     
    10611131                    echo "<h2 class='hndle'><span>{$box['title']}</span></h2>\n";
    10621132                    echo '<div class="inside">' . "\n";
    1063                     call_user_func($box['callback'], $object, $box);
     1133                    call_user_func( $box['callback'], $object, $box );
    10641134                    echo "</div>\n";
    10651135                    echo "</div>\n";
     
    10691139    }
    10701140
    1071     echo "</div>";
     1141    echo '</div>';
    10721142
    10731143    return $i;
     
    11121182    $page = $screen->id;
    11131183
    1114     if ( !isset($wp_meta_boxes) )
     1184    if ( ! isset( $wp_meta_boxes ) ) {
    11151185        $wp_meta_boxes = array();
    1116     if ( !isset($wp_meta_boxes[$page]) )
    1117         $wp_meta_boxes[$page] = array();
    1118     if ( !isset($wp_meta_boxes[$page][$context]) )
    1119         $wp_meta_boxes[$page][$context] = array();
    1120 
    1121     foreach ( array('high', 'core', 'default', 'low') as $priority )
    1122         $wp_meta_boxes[$page][$context][$priority][$id] = false;
     1186    }
     1187    if ( ! isset( $wp_meta_boxes[ $page ] ) ) {
     1188        $wp_meta_boxes[ $page ] = array();
     1189    }
     1190    if ( ! isset( $wp_meta_boxes[ $page ][ $context ] ) ) {
     1191        $wp_meta_boxes[ $page ][ $context ] = array();
     1192    }
     1193
     1194    foreach ( array( 'high', 'core', 'default', 'low' ) as $priority ) {
     1195        $wp_meta_boxes[ $page ][ $context ][ $priority ][ $id ] = false;
     1196    }
    11231197}
    11241198
     
    11441218    wp_enqueue_script( 'accordion' );
    11451219
    1146     if ( empty( $screen ) )
     1220    if ( empty( $screen ) ) {
    11471221        $screen = get_current_screen();
    1148     elseif ( is_string( $screen ) )
     1222    } elseif ( is_string( $screen ) ) {
    11491223        $screen = convert_to_screen( $screen );
     1224    }
    11501225
    11511226    $page = $screen->id;
    11521227
    1153     $hidden = get_hidden_meta_boxes( $screen );
     1228    $hidden     = get_hidden_meta_boxes( $screen );
    11541229    ?>
    11551230    <div id="side-sortables" class="accordion-container">
    11561231        <ul class="outer-border">
    11571232    <?php
    1158     $i = 0;
     1233    $i          = 0;
    11591234    $first_open = false;
    11601235
     
    11631238            if ( isset( $wp_meta_boxes[ $page ][ $context ][ $priority ] ) ) {
    11641239                foreach ( $wp_meta_boxes[ $page ][ $context ][ $priority ] as $box ) {
    1165                     if ( false == $box || ! $box['title'] )
     1240                    if ( false == $box || ! $box['title'] ) {
    11661241                        continue;
     1242                    }
    11671243                    $i++;
    11681244                    $hidden_class = in_array( $box['id'], $hidden ) ? 'hide-if-js' : '';
     
    12191295 *                           add_options_page();
    12201296 */
    1221 function add_settings_section($id, $title, $callback, $page) {
     1297function add_settings_section( $id, $title, $callback, $page ) {
    12221298    global $wp_settings_sections;
    12231299
    12241300    if ( 'misc' == $page ) {
    1225         _deprecated_argument( __FUNCTION__, '3.0.0',
     1301        _deprecated_argument(
     1302            __FUNCTION__, '3.0.0',
    12261303            /* translators: %s: misc */
    1227             sprintf( __( 'The "%s" options group has been removed. Use another settings group.' ),
     1304            sprintf(
     1305                __( 'The "%s" options group has been removed. Use another settings group.' ),
    12281306                'misc'
    12291307            )
     
    12331311
    12341312    if ( 'privacy' == $page ) {
    1235         _deprecated_argument( __FUNCTION__, '3.5.0',
     1313        _deprecated_argument(
     1314            __FUNCTION__, '3.5.0',
    12361315            /* translators: %s: privacy */
    1237             sprintf( __( 'The "%s" options group has been removed. Use another settings group.' ),
     1316            sprintf(
     1317                __( 'The "%s" options group has been removed. Use another settings group.' ),
    12381318                'privacy'
    12391319            )
     
    12421322    }
    12431323
    1244     $wp_settings_sections[$page][$id] = array('id' => $id, 'title' => $title, 'callback' => $callback);
     1324    $wp_settings_sections[ $page ][ $id ] = array(
     1325        'id'       => $id,
     1326        'title'    => $title,
     1327        'callback' => $callback,
     1328    );
    12451329}
    12461330
     
    12801364 * }
    12811365 */
    1282 function add_settings_field($id, $title, $callback, $page, $section = 'default', $args = array()) {
     1366function add_settings_field( $id, $title, $callback, $page, $section = 'default', $args = array() ) {
    12831367    global $wp_settings_fields;
    12841368
    12851369    if ( 'misc' == $page ) {
    1286         _deprecated_argument( __FUNCTION__, '3.0.0',
     1370        _deprecated_argument(
     1371            __FUNCTION__, '3.0.0',
    12871372            /* translators: %s: misc */
    1288             sprintf( __( 'The "%s" options group has been removed. Use another settings group.' ),
     1373            sprintf(
     1374                __( 'The "%s" options group has been removed. Use another settings group.' ),
    12891375                'misc'
    12901376            )
     
    12941380
    12951381    if ( 'privacy' == $page ) {
    1296         _deprecated_argument( __FUNCTION__, '3.5.0',
     1382        _deprecated_argument(
     1383            __FUNCTION__, '3.5.0',
    12971384            /* translators: %s: privacy */
    1298             sprintf( __( 'The "%s" options group has been removed. Use another settings group.' ),
     1385            sprintf(
     1386                __( 'The "%s" options group has been removed. Use another settings group.' ),
    12991387                'privacy'
    13001388            )
     
    13031391    }
    13041392
    1305     $wp_settings_fields[$page][$section][$id] = array('id' => $id, 'title' => $title, 'callback' => $callback, 'args' => $args);
     1393    $wp_settings_fields[ $page ][ $section ][ $id ] = array(
     1394        'id'       => $id,
     1395        'title'    => $title,
     1396        'callback' => $callback,
     1397        'args'     => $args,
     1398    );
    13061399}
    13071400
     
    13221415    global $wp_settings_sections, $wp_settings_fields;
    13231416
    1324     if ( ! isset( $wp_settings_sections[$page] ) )
     1417    if ( ! isset( $wp_settings_sections[ $page ] ) ) {
    13251418        return;
    1326 
    1327     foreach ( (array) $wp_settings_sections[$page] as $section ) {
    1328         if ( $section['title'] )
     1419    }
     1420
     1421    foreach ( (array) $wp_settings_sections[ $page ] as $section ) {
     1422        if ( $section['title'] ) {
    13291423            echo "<h2>{$section['title']}</h2>\n";
    1330 
    1331         if ( $section['callback'] )
     1424        }
     1425
     1426        if ( $section['callback'] ) {
    13321427            call_user_func( $section['callback'], $section );
    1333 
    1334         if ( ! isset( $wp_settings_fields ) || !isset( $wp_settings_fields[$page] ) || !isset( $wp_settings_fields[$page][$section['id']] ) )
     1428        }
     1429
     1430        if ( ! isset( $wp_settings_fields ) || ! isset( $wp_settings_fields[ $page ] ) || ! isset( $wp_settings_fields[ $page ][ $section['id'] ] ) ) {
    13351431            continue;
     1432        }
    13361433        echo '<table class="form-table">';
    13371434        do_settings_fields( $page, $section['id'] );
     
    13541451 * @param string $section Slug title of the settings section who's fields you want to show.
    13551452 */
    1356 function do_settings_fields($page, $section) {
     1453function do_settings_fields( $page, $section ) {
    13571454    global $wp_settings_fields;
    13581455
    1359     if ( ! isset( $wp_settings_fields[$page][$section] ) )
     1456    if ( ! isset( $wp_settings_fields[ $page ][ $section ] ) ) {
    13601457        return;
    1361 
    1362     foreach ( (array) $wp_settings_fields[$page][$section] as $field ) {
     1458    }
     1459
     1460    foreach ( (array) $wp_settings_fields[ $page ][ $section ] as $field ) {
    13631461        $class = '';
    13641462
     
    13761474
    13771475        echo '<td>';
    1378         call_user_func($field['callback'], $field['args']);
     1476        call_user_func( $field['callback'], $field['args'] );
    13791477        echo '</td>';
    13801478        echo '</tr>';
     
    14131511        'code'    => $code,
    14141512        'message' => $message,
    1415         'type'    => $type
     1513        'type'    => $type,
    14161514    );
    14171515}
     
    14481546     * any settings errors you want to show by default.
    14491547     */
    1450     if ( $sanitize )
     1548    if ( $sanitize ) {
    14511549        sanitize_option( $setting, get_option( $setting ) );
     1550    }
    14521551
    14531552    // If settings were passed back from options.php then use them.
     
    14661565        $setting_errors = array();
    14671566        foreach ( (array) $wp_settings_errors as $key => $details ) {
    1468             if ( $setting == $details['setting'] )
    1469                 $setting_errors[] = $wp_settings_errors[$key];
     1567            if ( $setting == $details['setting'] ) {
     1568                $setting_errors[] = $wp_settings_errors[ $key ];
     1569            }
    14701570        }
    14711571        return $setting_errors;
     
    15041604function settings_errors( $setting = '', $sanitize = false, $hide_on_update = false ) {
    15051605
    1506     if ( $hide_on_update && ! empty( $_GET['settings-updated'] ) )
     1606    if ( $hide_on_update && ! empty( $_GET['settings-updated'] ) ) {
    15071607        return;
     1608    }
    15081609
    15091610    $settings_errors = get_settings_errors( $setting, $sanitize );
    15101611
    1511     if ( empty( $settings_errors ) )
     1612    if ( empty( $settings_errors ) ) {
    15121613        return;
     1614    }
    15131615
    15141616    $output = '';
    15151617    foreach ( $settings_errors as $key => $details ) {
    1516         $css_id = 'setting-error-' . $details['code'];
     1618        $css_id    = 'setting-error-' . $details['code'];
    15171619        $css_class = $details['type'] . ' settings-error notice is-dismissible';
    1518         $output .= "<div id='$css_id' class='$css_class'> \n";
    1519         $output .= "<p><strong>{$details['message']}</strong></p>";
    1520         $output .= "</div> \n";
     1620        $output   .= "<div id='$css_id' class='$css_class'> \n";
     1621        $output   .= "<p><strong>{$details['message']}</strong></p>";
     1622        $output   .= "</div> \n";
    15211623    }
    15221624    echo $output;
     
    15301632 * @param string $found_action
    15311633 */
    1532 function find_posts_div($found_action = '') {
     1634function find_posts_div( $found_action = '' ) {
    15331635?>
    15341636    <div id="find-posts" class="find-box" style="display: none;">
     
    15401642            <div class="find-box-search">
    15411643                <?php if ( $found_action ) { ?>
    1542                     <input type="hidden" name="found_action" value="<?php echo esc_attr($found_action); ?>" />
     1644                    <input type="hidden" name="found_action" value="<?php echo esc_attr( $found_action ); ?>" />
    15431645                <?php } ?>
    15441646                <input type="hidden" name="affected" id="affected" value="" />
     
    15691671function the_post_password() {
    15701672    $post = get_post();
    1571     if ( isset( $post->post_password ) )
     1673    if ( isset( $post->post_password ) ) {
    15721674        echo esc_attr( $post->post_password );
     1675    }
    15731676}
    15741677
     
    15861689function _draft_or_post_title( $post = 0 ) {
    15871690    $title = get_the_title( $post );
    1588     if ( empty( $title ) )
     1691    if ( empty( $title ) ) {
    15891692        $title = __( '(no title)' );
     1693    }
    15901694    return esc_html( $title );
    15911695}
     
    16001704 */
    16011705function _admin_search_query() {
    1602     echo isset($_REQUEST['s']) ? esc_attr( wp_unslash( $_REQUEST['s'] ) ) : '';
     1706    echo isset( $_REQUEST['s'] ) ? esc_attr( wp_unslash( $_REQUEST['s'] ) ) : '';
    16031707}
    16041708
     
    16181722    show_admin_bar( false );
    16191723    global $hook_suffix, $admin_body_class, $wp_locale;
    1620     $admin_body_class = preg_replace('/[^a-z0-9_-]+/i', '-', $hook_suffix);
     1724    $admin_body_class = preg_replace( '/[^a-z0-9_-]+/i', '-', $hook_suffix );
    16211725
    16221726    $current_screen = get_current_screen();
     
    16251729    _wp_admin_html_begin();
    16261730?>
    1627 <title><?php bloginfo('name') ?> &rsaquo; <?php echo $title ?> &#8212; <?php _e('WordPress'); ?></title>
     1731<title><?php bloginfo( 'name' ); ?> &rsaquo; <?php echo $title; ?> &#8212; <?php _e( 'WordPress' ); ?></title>
    16281732<?php
    16291733wp_enqueue_style( 'colors' );
     
    16641768$admin_body_class .= ' locale-' . sanitize_html_class( strtolower( str_replace( '_', '-', get_user_locale() ) ) );
    16651769
    1666 if ( is_rtl() )
     1770if ( is_rtl() ) {
    16671771    $admin_body_class .= ' rtl';
     1772}
    16681773
    16691774?>
     
    16731778$admin_body_classes = apply_filters( 'admin_body_class', '' );
    16741779?>
    1675 <body<?php
     1780<body
     1781<?php
    16761782/**
    16771783 * @global string $body_id
    16781784 */
    1679 if ( isset($GLOBALS['body_id']) ) echo ' id="' . $GLOBALS['body_id'] . '"'; ?> class="wp-admin wp-core-ui no-js iframe <?php echo $admin_body_classes . ' ' . $admin_body_class; ?>">
     1785if ( isset( $GLOBALS['body_id'] ) ) {
     1786    echo ' id="' . $GLOBALS['body_id'] . '"';
     1787}
     1788?>
     1789 class="wp-admin wp-core-ui no-js iframe <?php echo $admin_body_classes . ' ' . $admin_body_class; ?>">
    16801790<script type="text/javascript">
    16811791(function(){
     
    17241834
    17251835/**
    1726  *
    17271836 * @param WP_Post $post
    17281837 */
    1729 function _post_states($post) {
     1838function _post_states( $post ) {
    17301839    $post_states = array();
    1731     if ( isset( $_REQUEST['post_status'] ) )
     1840    if ( isset( $_REQUEST['post_status'] ) ) {
    17321841        $post_status = $_REQUEST['post_status'];
    1733     else
     1842    } else {
    17341843        $post_status = '';
    1735 
    1736     if ( !empty($post->post_password) )
    1737         $post_states['protected'] = __('Password protected');
    1738     if ( 'private' == $post->post_status && 'private' != $post_status )
    1739         $post_states['private'] = __('Private');
     1844    }
     1845
     1846    if ( ! empty( $post->post_password ) ) {
     1847        $post_states['protected'] = __( 'Password protected' );
     1848    }
     1849    if ( 'private' == $post->post_status && 'private' != $post_status ) {
     1850        $post_states['private'] = __( 'Private' );
     1851    }
    17401852    if ( 'draft' === $post->post_status ) {
    17411853        if ( get_post_meta( $post->ID, '_customize_changeset_uuid', true ) ) {
     
    17471859        $post_states[] = __( 'Customization Draft' );
    17481860    }
    1749     if ( 'pending' == $post->post_status && 'pending' != $post_status )
    1750         $post_states['pending'] = _x('Pending', 'post status');
    1751     if ( is_sticky($post->ID) )
    1752         $post_states['sticky'] = __('Sticky');
     1861    if ( 'pending' == $post->post_status && 'pending' != $post_status ) {
     1862        $post_states['pending'] = _x( 'Pending', 'post status' );
     1863    }
     1864    if ( is_sticky( $post->ID ) ) {
     1865        $post_states['sticky'] = __( 'Sticky' );
     1866    }
    17531867
    17541868    if ( 'future' === $post->post_status ) {
     
    17771891    $post_states = apply_filters( 'display_post_states', $post_states, $post );
    17781892
    1779     if ( ! empty($post_states) ) {
    1780         $state_count = count($post_states);
    1781         $i = 0;
     1893    if ( ! empty( $post_states ) ) {
     1894        $state_count = count( $post_states );
     1895        $i           = 0;
    17821896        echo ' &mdash; ';
    17831897        foreach ( $post_states as $state ) {
     
    17911905
    17921906/**
    1793  *
    17941907 * @param WP_Post $post
    17951908 */
    17961909function _media_states( $post ) {
    17971910    $media_states = array();
    1798     $stylesheet = get_option('stylesheet');
    1799 
    1800     if ( current_theme_supports( 'custom-header') ) {
    1801         $meta_header = get_post_meta($post->ID, '_wp_attachment_is_custom_header', true );
     1911    $stylesheet   = get_option( 'stylesheet' );
     1912
     1913    if ( current_theme_supports( 'custom-header' ) ) {
     1914        $meta_header = get_post_meta( $post->ID, '_wp_attachment_is_custom_header', true );
    18021915
    18031916        if ( is_random_header_image() ) {
     
    18221935    }
    18231936
    1824     if ( current_theme_supports( 'custom-background') ) {
    1825         $meta_background = get_post_meta($post->ID, '_wp_attachment_is_custom_background', true );
     1937    if ( current_theme_supports( 'custom-background' ) ) {
     1938        $meta_background = get_post_meta( $post->ID, '_wp_attachment_is_custom_background', true );
    18261939
    18271940        if ( ! empty( $meta_background ) && $meta_background == $stylesheet ) {
     
    18571970    if ( ! empty( $media_states ) ) {
    18581971        $state_count = count( $media_states );
    1859         $i = 0;
     1972        $i           = 0;
    18601973        echo ' &mdash; ';
    18611974        foreach ( $media_states as $state ) {
     
    19792092 */
    19802093function get_submit_button( $text = '', $type = 'primary large', $name = 'submit', $wrap = true, $other_attributes = '' ) {
    1981     if ( ! is_array( $type ) )
     2094    if ( ! is_array( $type ) ) {
    19822095        $type = explode( ' ', $type );
     2096    }
    19832097
    19842098    $button_shorthand = array( 'primary', 'small', 'large' );
    1985     $classes = array( 'button' );
     2099    $classes          = array( 'button' );
    19862100    foreach ( $type as $t ) {
    1987         if ( 'secondary' === $t || 'button-secondary' === $t )
     2101        if ( 'secondary' === $t || 'button-secondary' === $t ) {
    19882102            continue;
     2103        }
    19892104        $classes[] = in_array( $t, $button_shorthand ) ? 'button-' . $t : $t;
    19902105    }
     
    20122127    // Don't output empty name and id attributes.
    20132128    $name_attr = $name ? ' name="' . esc_attr( $name ) . '"' : '';
    2014     $id_attr = $id ? ' id="' . esc_attr( $id ) . '"' : '';
    2015 
    2016     $button = '<input type="submit"' . $name_attr . $id_attr . ' class="' . esc_attr( $class );
    2017     $button .= '" value="' . esc_attr( $text ) . '" ' . $attributes . ' />';
     2129    $id_attr   = $id ? ' id="' . esc_attr( $id ) . '"' : '';
     2130
     2131    $button  = '<input type="submit"' . $name_attr . $id_attr . ' class="' . esc_attr( $class );
     2132    $button .= '" value="' . esc_attr( $text ) . '" ' . $attributes . ' />';
    20182133
    20192134    if ( $wrap ) {
     
    20252140
    20262141/**
    2027  *
    20282142 * @global bool $is_IE
    20292143 */
     
    20332147    $admin_html_class = ( is_admin_bar_showing() ) ? 'wp-toolbar' : '';
    20342148
    2035     if ( $is_IE )
    2036         @header('X-UA-Compatible: IE=edge');
     2149    if ( $is_IE ) {
     2150        @header( 'X-UA-Compatible: IE=edge' );
     2151    }
    20372152
    20382153?>
    20392154<!DOCTYPE html>
    20402155<!--[if IE 8]>
    2041 <html xmlns="http://www.w3.org/1999/xhtml" class="ie8 <?php echo $admin_html_class; ?>" <?php
    2042     /**
    2043      * Fires inside the HTML tag in the admin header.
    2044      *
    2045      * @since 2.2.0
    2046      */
    2047     do_action( 'admin_xml_ns' );
    2048 ?> <?php language_attributes(); ?>>
     2156<html xmlns="http://www.w3.org/1999/xhtml" class="ie8 <?php echo $admin_html_class; ?>"
     2157                                                                    <?php
     2158                                                                    /**
     2159                                                                     * Fires inside the HTML tag in the admin header.
     2160                                                                     *
     2161                                                                     * @since 2.2.0
     2162                                                                     */
     2163                                                                    do_action( 'admin_xml_ns' );
     2164?>
     2165    <?php language_attributes(); ?>>
    20492166<![endif]-->
    20502167<!--[if !(IE 8) ]><!-->
    2051 <html xmlns="http://www.w3.org/1999/xhtml" class="<?php echo $admin_html_class; ?>" <?php
    2052     /** This action is documented in wp-admin/includes/template.php */
    2053     do_action( 'admin_xml_ns' );
    2054 ?> <?php language_attributes(); ?>>
     2168<html xmlns="http://www.w3.org/1999/xhtml" class="<?php echo $admin_html_class; ?>"
     2169                                                                <?php
     2170                                                                /** This action is documented in wp-admin/includes/template.php */
     2171                                                                do_action( 'admin_xml_ns' );
     2172?>
     2173    <?php language_attributes(); ?>>
    20552174<!--<![endif]-->
    20562175<head>
    2057 <meta http-equiv="Content-Type" content="<?php bloginfo('html_type'); ?>; charset=<?php echo get_option('blog_charset'); ?>" />
     2176<meta http-equiv="Content-Type" content="<?php bloginfo( 'html_type' ); ?>; charset=<?php echo get_option( 'blog_charset' ); ?>" />
    20582177<?php
    20592178}
     
    20802199            '3.3.0'
    20812200        );
    2082         return (object) array( 'id' => '_invalid', 'base' => '_are_belong_to_us' );
     2201        return (object) array(
     2202            'id'   => '_invalid',
     2203            'base' => '_are_belong_to_us',
     2204        );
    20832205    }
    20842206
     
    20972219    <p class="local-restore">
    20982220        <?php _e( 'The backup of this post in your browser is different from the version below.' ); ?>
    2099         <button type="button" class="button restore-backup"><?php _e('Restore the backup'); ?></button>
     2221        <button type="button" class="button restore-backup"><?php _e( 'Restore the backup' ); ?></button>
    21002222    </p>
    21012223    <p class="help">
     
    21362258        'echo'   => true,
    21372259    );
    2138     $r = wp_parse_args( $args, $defaults );
     2260    $r        = wp_parse_args( $args, $defaults );
    21392261
    21402262    // Non-English decimal places when the $rating is coming from a string
     
    21472269
    21482270    // Calculate the number of each type of star needed
    2149     $full_stars = floor( $rating );
    2150     $half_stars = ceil( $rating - $full_stars );
     2271    $full_stars  = floor( $rating );
     2272    $half_stars  = ceil( $rating - $full_stars );
    21512273    $empty_stars = 5 - $full_stars - $half_stars;
    21522274
     
    21542276        /* translators: 1: The rating, 2: The number of ratings */
    21552277        $format = _n( '%1$s rating based on %2$s rating', '%1$s rating based on %2$s ratings', $r['number'] );
    2156         $title = sprintf( $format, number_format_i18n( $rating, 1 ), number_format_i18n( $r['number'] ) );
     2278        $title  = sprintf( $format, number_format_i18n( $rating, 1 ), number_format_i18n( $r['number'] ) );
    21572279    } else {
    21582280        /* translators: 1: The rating */
     
    21602282    }
    21612283
    2162     $output = '<div class="star-rating">';
     2284    $output  = '<div class="star-rating">';
    21632285    $output .= '<span class="screen-reader-text">' . $title . '</span>';
    21642286    $output .= str_repeat( '<div class="star star-full" aria-hidden="true"></div>', $full_stars );
Note: See TracChangeset for help on using the changeset viewer.