WordPress.org

Make WordPress Core


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

    r42228 r42343  
    2323    global $action;
    2424
    25     $post_type = $post->post_type;
    26     $post_type_object = get_post_type_object($post_type);
    27     $can_publish = current_user_can($post_type_object->cap->publish_posts);
     25    $post_type        = $post->post_type;
     26    $post_type_object = get_post_type_object( $post_type );
     27    $can_publish      = current_user_can( $post_type_object->cap->publish_posts );
    2828?>
    2929<div class="submitbox" id="submitpost">
     
    3939<div id="save-action">
    4040<?php
    41     if ( 'publish' != $post->post_status && 'future' != $post->post_status && 'pending' != $post->post_status ) {
    42         $private_style = '';
    43         if ( 'private' == $post->post_status ) {
    44             $private_style = 'style="display:none"';
    45         }
    46 ?>
    47 <input <?php echo $private_style; ?> type="submit" name="save" id="save-post" value="<?php esc_attr_e('Save Draft'); ?>" class="button" />
     41if ( 'publish' != $post->post_status && 'future' != $post->post_status && 'pending' != $post->post_status ) {
     42    $private_style = '';
     43    if ( 'private' == $post->post_status ) {
     44        $private_style = 'style="display:none"';
     45    }
     46?>
     47<input <?php echo $private_style; ?> type="submit" name="save" id="save-post" value="<?php esc_attr_e( 'Save Draft' ); ?>" class="button" />
    4848<span class="spinner"></span>
    4949<?php } elseif ( 'pending' == $post->post_status && $can_publish ) { ?>
    50 <input type="submit" name="save" id="save-post" value="<?php esc_attr_e('Save as Pending'); ?>" class="button" />
     50<input type="submit" name="save" id="save-post" value="<?php esc_attr_e( 'Save as Pending' ); ?>" class="button" />
    5151<span class="spinner"></span>
    5252<?php } ?>
     
    6262}
    6363
    64 $preview_button = sprintf( '%1$s<span class="screen-reader-text"> %2$s</span>',
     64$preview_button = sprintf(
     65    '%1$s<span class="screen-reader-text"> %2$s</span>',
    6566    $preview_button_text,
    6667    /* translators: accessibility text */
     
    8889
    8990<div class="misc-pub-section misc-pub-post-status">
    90 <?php _e( 'Status:' ) ?> <span id="post-status-display"><?php
    91 
    92 switch ( $post->post_status ) {
    93     case 'private':
    94         _e('Privately Published');
    95         break;
    96     case 'publish':
    97         _e('Published');
    98         break;
    99     case 'future':
    100         _e('Scheduled');
    101         break;
    102     case 'pending':
    103         _e('Pending Review');
    104         break;
    105     case 'draft':
    106     case 'auto-draft':
    107         _e('Draft');
    108         break;
    109 }
     91<?php _e( 'Status:' ); ?> <span id="post-status-display">
     92            <?php
     93
     94            switch ( $post->post_status ) {
     95                case 'private':
     96                    _e( 'Privately Published' );
     97                    break;
     98                case 'publish':
     99                    _e( 'Published' );
     100                    break;
     101                case 'future':
     102                    _e( 'Scheduled' );
     103                    break;
     104                case 'pending':
     105                    _e( 'Pending Review' );
     106                    break;
     107                case 'draft':
     108                case 'auto-draft':
     109                    _e( 'Draft' );
     110                    break;
     111            }
    110112?>
    111113</span>
    112114<?php
    113     if ( 'publish' == $post->post_status || 'private' == $post->post_status || $can_publish ) {
    114         $private_style = '';
    115         if ( 'private' == $post->post_status ) {
    116             $private_style = 'style="display:none"';
    117         }
     115if ( 'publish' == $post->post_status || 'private' == $post->post_status || $can_publish ) {
     116    $private_style = '';
     117    if ( 'private' == $post->post_status ) {
     118        $private_style = 'style="display:none"';
     119    }
    118120?>
    119121<a href="#post_status" <?php echo $private_style; ?> class="edit-post-status hide-if-no-js" role="button"><span aria-hidden="true"><?php _e( 'Edit' ); ?></span> <span class="screen-reader-text"><?php _e( 'Edit status' ); ?></span></a>
    120122
    121123<div id="post-status-select" class="hide-if-js">
    122 <input type="hidden" name="hidden_post_status" id="hidden_post_status" value="<?php echo esc_attr( ('auto-draft' == $post->post_status ) ? 'draft' : $post->post_status); ?>" />
    123 <label for="post_status" class="screen-reader-text"><?php _e( 'Set status' ) ?></label>
     124<input type="hidden" name="hidden_post_status" id="hidden_post_status" value="<?php echo esc_attr( ( 'auto-draft' == $post->post_status ) ? 'draft' : $post->post_status ); ?>" />
     125<label for="post_status" class="screen-reader-text"><?php _e( 'Set status' ); ?></label>
    124126<select name="post_status" id="post_status">
    125127<?php if ( 'publish' == $post->post_status ) : ?>
    126 <option<?php selected( $post->post_status, 'publish' ); ?> value='publish'><?php _e('Published') ?></option>
     128<option<?php selected( $post->post_status, 'publish' ); ?> value='publish'><?php _e( 'Published' ); ?></option>
    127129<?php elseif ( 'private' == $post->post_status ) : ?>
    128 <option<?php selected( $post->post_status, 'private' ); ?> value='publish'><?php _e('Privately Published') ?></option>
     130<option<?php selected( $post->post_status, 'private' ); ?> value='publish'><?php _e( 'Privately Published' ); ?></option>
    129131<?php elseif ( 'future' == $post->post_status ) : ?>
    130 <option<?php selected( $post->post_status, 'future' ); ?> value='future'><?php _e('Scheduled') ?></option>
     132<option<?php selected( $post->post_status, 'future' ); ?> value='future'><?php _e( 'Scheduled' ); ?></option>
    131133<?php endif; ?>
    132 <option<?php selected( $post->post_status, 'pending' ); ?> value='pending'><?php _e('Pending Review') ?></option>
     134<option<?php selected( $post->post_status, 'pending' ); ?> value='pending'><?php _e( 'Pending Review' ); ?></option>
    133135<?php if ( 'auto-draft' == $post->post_status ) : ?>
    134 <option<?php selected( $post->post_status, 'auto-draft' ); ?> value='draft'><?php _e('Draft') ?></option>
     136<option<?php selected( $post->post_status, 'auto-draft' ); ?> value='draft'><?php _e( 'Draft' ); ?></option>
    135137<?php else : ?>
    136 <option<?php selected( $post->post_status, 'draft' ); ?> value='draft'><?php _e('Draft') ?></option>
     138<option<?php selected( $post->post_status, 'draft' ); ?> value='draft'><?php _e( 'Draft' ); ?></option>
    137139<?php endif; ?>
    138140</select>
    139 <a href="#post_status" class="save-post-status hide-if-no-js button"><?php _e('OK'); ?></a>
    140 <a href="#post_status" class="cancel-post-status hide-if-no-js button-cancel"><?php _e('Cancel'); ?></a>
     141<a href="#post_status" class="save-post-status hide-if-no-js button"><?php _e( 'OK' ); ?></a>
     142<a href="#post_status" class="cancel-post-status hide-if-no-js button-cancel"><?php _e( 'Cancel' ); ?></a>
    141143</div>
    142144
     
    145147
    146148<div class="misc-pub-section misc-pub-visibility" id="visibility">
    147 <?php _e('Visibility:'); ?> <span id="post-visibility-display"><?php
    148 
    149 if ( 'private' == $post->post_status ) {
    150     $post->post_password = '';
    151     $visibility = 'private';
    152     $visibility_trans = __('Private');
    153 } elseif ( !empty( $post->post_password ) ) {
    154     $visibility = 'password';
    155     $visibility_trans = __('Password protected');
    156 } elseif ( $post_type == 'post' && is_sticky( $post->ID ) ) {
    157     $visibility = 'public';
    158     $visibility_trans = __('Public, Sticky');
    159 } else {
    160     $visibility = 'public';
    161     $visibility_trans = __('Public');
    162 }
    163 
    164 echo esc_html( $visibility_trans ); ?></span>
     149<?php _e( 'Visibility:' ); ?> <span id="post-visibility-display">
     150                            <?php
     151
     152                            if ( 'private' == $post->post_status ) {
     153                                $post->post_password = '';
     154                                $visibility          = 'private';
     155                                $visibility_trans    = __( 'Private' );
     156                            } elseif ( ! empty( $post->post_password ) ) {
     157                                $visibility       = 'password';
     158                                $visibility_trans = __( 'Password protected' );
     159                            } elseif ( $post_type == 'post' && is_sticky( $post->ID ) ) {
     160                                $visibility       = 'public';
     161                                $visibility_trans = __( 'Public, Sticky' );
     162                            } else {
     163                                $visibility       = 'public';
     164                                $visibility_trans = __( 'Public' );
     165                            }
     166
     167                            echo esc_html( $visibility_trans );
     168?>
     169</span>
    165170<?php if ( $can_publish ) { ?>
    166171<a href="#visibility" class="edit-visibility hide-if-no-js" role="button"><span aria-hidden="true"><?php _e( 'Edit' ); ?></span> <span class="screen-reader-text"><?php _e( 'Edit visibility' ); ?></span></a>
    167172
    168173<div id="post-visibility-select" class="hide-if-js">
    169 <input type="hidden" name="hidden_post_password" id="hidden-post-password" value="<?php echo esc_attr($post->post_password); ?>" />
    170 <?php if ($post_type == 'post'): ?>
    171 <input type="checkbox" style="display:none" name="hidden_post_sticky" id="hidden-post-sticky" value="sticky" <?php checked(is_sticky($post->ID)); ?> />
     174<input type="hidden" name="hidden_post_password" id="hidden-post-password" value="<?php echo esc_attr( $post->post_password ); ?>" />
     175<?php if ( $post_type == 'post' ) : ?>
     176<input type="checkbox" style="display:none" name="hidden_post_sticky" id="hidden-post-sticky" value="sticky" <?php checked( is_sticky( $post->ID ) ); ?> />
    172177<?php endif; ?>
    173178<input type="hidden" name="hidden_post_visibility" id="hidden-post-visibility" value="<?php echo esc_attr( $visibility ); ?>" />
    174 <input type="radio" name="visibility" id="visibility-radio-public" value="public" <?php checked( $visibility, 'public' ); ?> /> <label for="visibility-radio-public" class="selectit"><?php _e('Public'); ?></label><br />
     179<input type="radio" name="visibility" id="visibility-radio-public" value="public" <?php checked( $visibility, 'public' ); ?> /> <label for="visibility-radio-public" class="selectit"><?php _e( 'Public' ); ?></label><br />
    175180<?php if ( $post_type == 'post' && current_user_can( 'edit_others_posts' ) ) : ?>
    176181<span id="sticky-span"><input id="sticky" name="sticky" type="checkbox" value="sticky" <?php checked( is_sticky( $post->ID ) ); ?> /> <label for="sticky" class="selectit"><?php _e( 'Stick this post to the front page' ); ?></label><br /></span>
    177182<?php endif; ?>
    178 <input type="radio" name="visibility" id="visibility-radio-password" value="password" <?php checked( $visibility, 'password' ); ?> /> <label for="visibility-radio-password" class="selectit"><?php _e('Password protected'); ?></label><br />
    179 <span id="password-span"><label for="post_password"><?php _e('Password:'); ?></label> <input type="text" name="post_password" id="post_password" value="<?php echo esc_attr($post->post_password); ?>"  maxlength="255" /><br /></span>
    180 <input type="radio" name="visibility" id="visibility-radio-private" value="private" <?php checked( $visibility, 'private' ); ?> /> <label for="visibility-radio-private" class="selectit"><?php _e('Private'); ?></label><br />
     183<input type="radio" name="visibility" id="visibility-radio-password" value="password" <?php checked( $visibility, 'password' ); ?> /> <label for="visibility-radio-password" class="selectit"><?php _e( 'Password protected' ); ?></label><br />
     184<span id="password-span"><label for="post_password"><?php _e( 'Password:' ); ?></label> <input type="text" name="post_password" id="post_password" value="<?php echo esc_attr( $post->post_password ); ?>"  maxlength="255" /><br /></span>
     185<input type="radio" name="visibility" id="visibility-radio-private" value="private" <?php checked( $visibility, 'private' ); ?> /> <label for="visibility-radio-private" class="selectit"><?php _e( 'Private' ); ?></label><br />
    181186
    182187<p>
    183     <a href="#visibility" class="save-post-visibility hide-if-no-js button"><?php _e('OK'); ?></a>
    184     <a href="#visibility" class="cancel-post-visibility hide-if-no-js button-cancel"><?php _e('Cancel'); ?></a>
     188    <a href="#visibility" class="save-post-visibility hide-if-no-js button"><?php _e( 'OK' ); ?></a>
     189    <a href="#visibility" class="cancel-post-visibility hide-if-no-js button-cancel"><?php _e( 'Cancel' ); ?></a>
    185190</p>
    186191</div>
     
    195200    if ( 'future' == $post->post_status ) { // scheduled for publishing at a future date
    196201        /* translators: Post date information. 1: Date on which the post is currently scheduled to be published */
    197         $stamp = __('Scheduled for: <b>%1$s</b>');
     202        $stamp = __( 'Scheduled for: <b>%1$s</b>' );
    198203    } elseif ( 'publish' == $post->post_status || 'private' == $post->post_status ) { // already published
    199204        /* translators: Post date information. 1: Date on which the post was published */
    200         $stamp = __('Published on: <b>%1$s</b>');
     205        $stamp = __( 'Published on: <b>%1$s</b>' );
    201206    } elseif ( '0000-00-00 00:00:00' == $post->post_date_gmt ) { // draft, 1 or more saves, no date specified
    202         $stamp = __('Publish <b>immediately</b>');
     207        $stamp = __( 'Publish <b>immediately</b>' );
    203208    } elseif ( time() < strtotime( $post->post_date_gmt . ' +0000' ) ) { // draft, 1 or more saves, future date specified
    204209        /* translators: Post date information. 1: Date on which the post is to be published */
    205         $stamp = __('Schedule for: <b>%1$s</b>');
     210        $stamp = __( 'Schedule for: <b>%1$s</b>' );
    206211    } else { // draft, 1 or more saves, date specified
    207212        /* translators: Post date information. 1: Date on which the post is to be published */
    208         $stamp = __('Publish on: <b>%1$s</b>');
     213        $stamp = __( 'Publish on: <b>%1$s</b>' );
    209214    }
    210215    $date = date_i18n( $datef, strtotime( $post->post_date ) );
    211216} else { // draft (no saves, and thus no date specified)
    212     $stamp = __('Publish <b>immediately</b>');
    213     $date = date_i18n( $datef, strtotime( current_time('mysql') ) );
    214 }
    215 
    216 if ( ! empty( $args['args']['revisions_count'] ) ) : ?>
     217    $stamp = __( 'Publish <b>immediately</b>' );
     218    $date  = date_i18n( $datef, strtotime( current_time( 'mysql' ) ) );
     219}
     220
     221if ( ! empty( $args['args']['revisions_count'] ) ) :
     222?>
    217223<div class="misc-pub-section misc-pub-revisions">
    218224    <?php
     
    222228    <a class="hide-if-no-js" href="<?php echo esc_url( get_edit_post_link( $args['args']['revision_id'] ) ); ?>"><span aria-hidden="true"><?php _ex( 'Browse', 'revisions' ); ?></span> <span class="screen-reader-text"><?php _e( 'Browse revisions' ); ?></span></a>
    223229</div>
    224 <?php endif;
    225 
    226 if ( $can_publish ) : // Contributors don't get to choose the date of publish ?>
     230<?php
     231endif;
     232
     233if ( $can_publish ) : // Contributors don't get to choose the date of publish
     234?>
    227235<div class="misc-pub-section curtime misc-pub-curtime">
    228236    <span id="timestamp">
    229     <?php printf($stamp, $date); ?></span>
     237    <?php printf( $stamp, $date ); ?></span>
    230238    <a href="#edit_timestamp" class="edit-timestamp hide-if-no-js" role="button"><span aria-hidden="true"><?php _e( 'Edit' ); ?></span> <span class="screen-reader-text"><?php _e( 'Edit date and time' ); ?></span></a>
    231239    <fieldset id="timestampdiv" class="hide-if-js">
     
    286294<div id="delete-action">
    287295<?php
    288 if ( current_user_can( "delete_post", $post->ID ) ) {
    289     if ( !EMPTY_TRASH_DAYS )
    290         $delete_text = __('Delete Permanently');
    291     else
    292         $delete_text = __('Move to Trash');
     296if ( current_user_can( 'delete_post', $post->ID ) ) {
     297    if ( ! EMPTY_TRASH_DAYS ) {
     298        $delete_text = __( 'Delete Permanently' );
     299    } else {
     300        $delete_text = __( 'Move to Trash' );
     301    }
    293302    ?>
    294 <a class="submitdelete deletion" href="<?php echo get_delete_post_link($post->ID); ?>"><?php echo $delete_text; ?></a><?php
    295 } ?>
     303<a class="submitdelete deletion" href="<?php echo get_delete_post_link( $post->ID ); ?>"><?php echo $delete_text; ?></a>
     304                                                    <?php
     305}
     306?>
    296307</div>
    297308
     
    299310<span class="spinner"></span>
    300311<?php
    301 if ( !in_array( $post->post_status, array('publish', 'future', 'private') ) || 0 == $post->ID ) {
     312if ( ! in_array( $post->post_status, array( 'publish', 'future', 'private' ) ) || 0 == $post->ID ) {
    302313    if ( $can_publish ) :
    303         if ( !empty($post->post_date_gmt) && time() < strtotime( $post->post_date_gmt . ' +0000' ) ) : ?>
     314        if ( ! empty( $post->post_date_gmt ) && time() < strtotime( $post->post_date_gmt . ' +0000' ) ) :
     315        ?>
    304316        <input name="original_publish" type="hidden" id="original_publish" value="<?php echo esc_attr_x( 'Schedule', 'post action/button label' ); ?>" />
    305317        <?php submit_button( _x( 'Schedule', 'post action/button label' ), 'primary large', 'publish', false ); ?>
    306318<?php   else : ?>
    307         <input name="original_publish" type="hidden" id="original_publish" value="<?php esc_attr_e('Publish') ?>" />
     319        <input name="original_publish" type="hidden" id="original_publish" value="<?php esc_attr_e( 'Publish' ); ?>" />
    308320        <?php submit_button( __( 'Publish' ), 'primary large', 'publish', false ); ?>
    309 <?php   endif;
    310     else : ?>
    311         <input name="original_publish" type="hidden" id="original_publish" value="<?php esc_attr_e('Submit for Review') ?>" />
     321<?php
     322endif;
     323    else :
     324    ?>
     325        <input name="original_publish" type="hidden" id="original_publish" value="<?php esc_attr_e( 'Submit for Review' ); ?>" />
    312326        <?php submit_button( __( 'Submit for Review' ), 'primary large', 'publish', false ); ?>
    313327<?php
    314328    endif;
    315 } else { ?>
    316         <input name="original_publish" type="hidden" id="original_publish" value="<?php esc_attr_e('Update') ?>" />
    317         <input name="save" type="submit" class="button button-primary button-large" id="publish" value="<?php esc_attr_e( 'Update' ) ?>" />
    318 <?php
    319 } ?>
     329} else {
     330?>
     331        <input name="original_publish" type="hidden" id="original_publish" value="<?php esc_attr_e( 'Update' ); ?>" />
     332        <input name="save" type="submit" class="button button-primary button-large" id="publish" value="<?php esc_attr_e( 'Update' ); ?>" />
     333<?php
     334}
     335?>
    320336</div>
    321337<div class="clear"></div>
     
    347363<div id="misc-publishing-actions">
    348364    <div class="misc-pub-section curtime misc-pub-curtime">
    349         <span id="timestamp"><?php
     365        <span id="timestamp">
     366        <?php
    350367            $date = date_i18n(
    351368                /* translators: Publish box date format, see https://secure.php.net/date */
     
    353370                strtotime( $post->post_date )
    354371            );
    355             printf(
    356                 /* translators: Attachment information. %s: Date the attachment was uploaded */
    357                 __( 'Uploaded on: %s' ),
    358                 '<b>' . $date . '</b>'
    359             );
    360         ?></span>
     372                            printf(
     373                                /* translators: Attachment information. %s: Date the attachment was uploaded */
     374                                __( 'Uploaded on: %s' ),
     375                                '<b>' . $date . '</b>'
     376                            );
     377        ?>
     378        </span>
    361379    </div><!-- .misc-pub-section -->
    362380
     
    369387     * @since 4.9.0 Added the `$post` parameter.
    370388     *
    371      * @param WP_Post $post WP_Post object for the current attachment. 
     389     * @param WP_Post $post WP_Post object for the current attachment.
    372390     */
    373391    do_action( 'attachment_submitbox_misc_actions', $post );
     
    380398    <div id="delete-action">
    381399    <?php
    382     if ( current_user_can( 'delete_post', $post->ID ) )
     400    if ( current_user_can( 'delete_post', $post->ID ) ) {
    383401        if ( EMPTY_TRASH_DAYS && MEDIA_TRASH ) {
    384             echo "<a class='submitdelete deletion' href='" . get_delete_post_link( $post->ID ) . "'>" . _x( 'Trash', 'verb' ) . "</a>";
     402            echo "<a class='submitdelete deletion' href='" . get_delete_post_link( $post->ID ) . "'>" . _x( 'Trash', 'verb' ) . '</a>';
    385403        } else {
    386404            $delete_ays = ! MEDIA_TRASH ? " onclick='return showNotice.warn();'" : '';
    387             echo  "<a class='submitdelete deletion'$delete_ays href='" . get_delete_post_link( $post->ID, null, true ) . "'>" . __( 'Delete Permanently' ) . "</a>";
     405            echo  "<a class='submitdelete deletion'$delete_ays href='" . get_delete_post_link( $post->ID, null, true ) . "'>" . __( 'Delete Permanently' ) . '</a>';
    388406        }
     407    }
    389408    ?>
    390409    </div>
     
    392411    <div id="publishing-action">
    393412        <span class="spinner"></span>
    394         <input name="original_publish" type="hidden" id="original_publish" value="<?php esc_attr_e('Update') ?>" />
    395         <input name="save" type="submit" class="button button-primary button-large" id="publish" value="<?php esc_attr_e( 'Update' ) ?>" />
     413        <input name="original_publish" type="hidden" id="original_publish" value="<?php esc_attr_e( 'Update' ); ?>" />
     414        <input name="save" type="submit" class="button button-primary button-large" id="publish" value="<?php esc_attr_e( 'Update' ); ?>" />
    396415    </div>
    397416    <div class="clear"></div>
     
    420439function post_format_meta_box( $post, $box ) {
    421440    if ( current_theme_supports( 'post-formats' ) && post_type_supports( $post->post_type, 'post-formats' ) ) :
    422     $post_formats = get_theme_support( 'post-formats' );
    423 
    424     if ( is_array( $post_formats[0] ) ) :
    425         $post_format = get_post_format( $post->ID );
    426         if ( !$post_format )
    427             $post_format = '0';
    428         // Add in the current one if it isn't there yet, in case the current theme doesn't support it
    429         if ( $post_format && !in_array( $post_format, $post_formats[0] ) )
    430             $post_formats[0][] = $post_format;
    431     ?>
    432     <div id="post-formats-select">
     441        $post_formats = get_theme_support( 'post-formats' );
     442
     443        if ( is_array( $post_formats[0] ) ) :
     444            $post_format = get_post_format( $post->ID );
     445            if ( ! $post_format ) {
     446                $post_format = '0';
     447            }
     448            // Add in the current one if it isn't there yet, in case the current theme doesn't support it
     449            if ( $post_format && ! in_array( $post_format, $post_formats[0] ) ) {
     450                $post_formats[0][] = $post_format;
     451            }
     452        ?>
     453        <div id="post-formats-select">
    433454        <fieldset>
    434455            <legend class="screen-reader-text"><?php _e( 'Post Formats' ); ?></legend>
     
    439460        </fieldset>
    440461    </div>
    441     <?php endif; endif;
     462    <?php
     463    endif;
     464endif;
    442465}
    443466
     
    470493        $args = $box['args'];
    471494    }
    472     $r = wp_parse_args( $args, $defaults );
    473     $tax_name = esc_attr( $r['taxonomy'] );
    474     $taxonomy = get_taxonomy( $r['taxonomy'] );
     495    $r                     = wp_parse_args( $args, $defaults );
     496    $tax_name              = esc_attr( $r['taxonomy'] );
     497    $taxonomy              = get_taxonomy( $r['taxonomy'] );
    475498    $user_can_assign_terms = current_user_can( $taxonomy->cap->assign_terms );
    476     $comma = _x( ',', 'tag delimiter' );
    477     $terms_to_edit = get_terms_to_edit( $post->ID, $tax_name );
     499    $comma                 = _x( ',', 'tag delimiter' );
     500    $terms_to_edit         = get_terms_to_edit( $post->ID, $tax_name );
    478501    if ( ! is_string( $terms_to_edit ) ) {
    479502        $terms_to_edit = '';
     
    486509        <p><textarea name="<?php echo "tax_input[$tax_name]"; ?>" rows="3" cols="20" class="the-tags" id="tax-input-<?php echo $tax_name; ?>" <?php disabled( ! $user_can_assign_terms ); ?> aria-describedby="new-tag-<?php echo $tax_name; ?>-desc"><?php echo str_replace( ',', $comma . ' ', $terms_to_edit ); // textarea_escaped by esc_attr() ?></textarea></p>
    487510    </div>
    488     <?php if ( $user_can_assign_terms ) : ?>
     511    <?php if ( $user_can_assign_terms ) : ?>
    489512    <div class="ajaxtag hide-if-no-js">
    490513        <label class="screen-reader-text" for="new-tag-<?php echo $tax_name; ?>"><?php echo $taxonomy->labels->add_new_item; ?></label>
    491514        <p><input data-wp-taxonomy="<?php echo $tax_name; ?>" type="text" id="new-tag-<?php echo $tax_name; ?>" name="newtag[<?php echo $tax_name; ?>]" class="newtag form-input-tip" size="16" autocomplete="off" aria-describedby="new-tag-<?php echo $tax_name; ?>-desc" value="" />
    492         <input type="button" class="button tagadd" value="<?php esc_attr_e('Add'); ?>" /></p>
     515        <input type="button" class="button tagadd" value="<?php esc_attr_e( 'Add' ); ?>" /></p>
    493516    </div>
    494517    <p class="howto" id="new-tag-<?php echo $tax_name; ?>-desc"><?php echo $taxonomy->labels->separate_items_with_commas; ?></p>
    495     <?php elseif ( empty( $terms_to_edit ) ): ?>
     518    <?php elseif ( empty( $terms_to_edit ) ) : ?>
    496519        <p><?php echo $taxonomy->labels->no_terms; ?></p>
    497520    <?php endif; ?>
     
    533556        $args = $box['args'];
    534557    }
    535     $r = wp_parse_args( $args, $defaults );
     558    $r        = wp_parse_args( $args, $defaults );
    536559    $tax_name = esc_attr( $r['taxonomy'] );
    537560    $taxonomy = get_taxonomy( $r['taxonomy'] );
     
    555578            ?>
    556579            <ul id="<?php echo $tax_name; ?>checklist" data-wp-lists="list:<?php echo $tax_name; ?>" class="categorychecklist form-no-clear">
    557                 <?php wp_terms_checklist( $post->ID, array( 'taxonomy' => $tax_name, 'popular_cats' => $popular_ids ) ); ?>
     580                <?php
     581                wp_terms_checklist(
     582                    $post->ID, array(
     583                        'taxonomy'     => $tax_name,
     584                        'popular_cats' => $popular_ids,
     585                    )
     586                );
     587?>
    558588            </ul>
    559589        </div>
     
    627657 * @param object $post
    628658 */
    629 function post_excerpt_meta_box($post) {
    630 ?>
    631 <label class="screen-reader-text" for="excerpt"><?php _e('Excerpt') ?></label><textarea rows="1" cols="40" name="excerpt" id="excerpt"><?php echo $post->post_excerpt; // textarea_escaped ?></textarea>
    632 <p><?php
     659function post_excerpt_meta_box( $post ) {
     660?>
     661<label class="screen-reader-text" for="excerpt"><?php _e( 'Excerpt' ); ?></label><textarea rows="1" cols="40" name="excerpt" id="excerpt"><?php echo $post->post_excerpt; // textarea_escaped ?></textarea>
     662<p>
     663<?php
    633664    printf(
    634665        /* translators: %s: Codex URL */
     
    636667        __( 'https://codex.wordpress.org/Excerpt' )
    637668    );
    638 ?></p>
     669?>
     670</p>
    639671<?php
    640672}
     
    647679 * @param object $post
    648680 */
    649 function post_trackback_meta_box($post) {
     681function post_trackback_meta_box( $post ) {
    650682    $form_trackback = '<input type="text" name="trackback_url" id="trackback_url" class="code" value="' .
    651683        esc_attr( str_replace( "\n", ' ', $post->to_ping ) ) . '" aria-describedby="trackback-url-desc" />';
    652     if ('' != $post->pinged) {
    653         $pings = '<p>'. __('Already pinged:') . '</p><ul>';
    654         $already_pinged = explode("\n", trim($post->pinged));
    655         foreach ($already_pinged as $pinged_url) {
    656             $pings .= "\n\t<li>" . esc_html($pinged_url) . "</li>";
     684    if ( '' != $post->pinged ) {
     685        $pings          = '<p>' . __( 'Already pinged:' ) . '</p><ul>';
     686        $already_pinged = explode( "\n", trim( $post->pinged ) );
     687        foreach ( $already_pinged as $pinged_url ) {
     688            $pings .= "\n\t<li>" . esc_html( $pinged_url ) . '</li>';
    657689        }
    658690        $pings .= '</ul>';
     
    665697</p>
    666698<p id="trackback-url-desc" class="howto"><?php _e( 'Separate multiple URLs with spaces' ); ?></p>
    667 <p><?php
     699<p>
     700<?php
    668701    printf(
    669702        /* translators: %s: Codex URL */
     
    671704        __( 'https://codex.wordpress.org/Introduction_to_Blogging#Managing_Comments' )
    672705    );
    673 ?></p>
    674 <?php
    675 if ( ! empty($pings) )
     706?>
     707</p>
     708<?php
     709if ( ! empty( $pings ) ) {
    676710    echo $pings;
    677711}
     712}
    678713
    679714/**
     
    684719 * @param object $post
    685720 */
    686 function post_custom_meta_box($post) {
     721function post_custom_meta_box( $post ) {
    687722?>
    688723<div id="postcustomstuff">
    689724<div id="ajax-response"></div>
    690725<?php
    691 $metadata = has_meta($post->ID);
     726$metadata = has_meta( $post->ID );
    692727foreach ( $metadata as $key => $value ) {
    693     if ( is_protected_meta( $metadata[ $key ][ 'meta_key' ], 'post' ) || ! current_user_can( 'edit_post_meta', $post->ID, $metadata[ $key ][ 'meta_key' ] ) )
     728    if ( is_protected_meta( $metadata[ $key ]['meta_key'], 'post' ) || ! current_user_can( 'edit_post_meta', $post->ID, $metadata[ $key ]['meta_key'] ) ) {
    694729        unset( $metadata[ $key ] );
     730    }
    695731}
    696732list_meta( $metadata );
    697 meta_form( $post ); ?>
    698 </div>
    699 <p><?php
     733meta_form( $post );
     734?>
     735</div>
     736<p>
     737<?php
    700738    printf(
    701739        /* translators: %s: Codex URL */
     
    703741        __( 'https://codex.wordpress.org/Using_Custom_Fields' )
    704742    );
    705 ?></p>
     743?>
     744</p>
    706745<?php
    707746}
     
    714753 * @param object $post
    715754 */
    716 function post_comment_status_meta_box($post) {
     755function post_comment_status_meta_box( $post ) {
    717756?>
    718757<input name="advanced_view" type="hidden" value="1" />
    719758<p class="meta-options">
    720     <label for="comment_status" class="selectit"><input name="comment_status" type="checkbox" id="comment_status" value="open" <?php checked($post->comment_status, 'open'); ?> /> <?php _e( 'Allow comments' ) ?></label><br />
    721     <label for="ping_status" class="selectit"><input name="ping_status" type="checkbox" id="ping_status" value="open" <?php checked($post->ping_status, 'open'); ?> /> <?php
    722         printf(
    723             /* translators: %s: Codex URL */
    724             __( 'Allow <a href="%s">trackbacks and pingbacks</a> on this page' ),
    725             __( 'https://codex.wordpress.org/Introduction_to_Blogging#Managing_Comments' ) );
    726         ?></label>
     759    <label for="comment_status" class="selectit"><input name="comment_status" type="checkbox" id="comment_status" value="open" <?php checked( $post->comment_status, 'open' ); ?> /> <?php _e( 'Allow comments' ); ?></label><br />
     760    <label for="ping_status" class="selectit"><input name="ping_status" type="checkbox" id="ping_status" value="open" <?php checked( $post->ping_status, 'open' ); ?> />
     761                                                                                                                                                        <?php
     762                                                                                                                                                        printf(
     763                                                                                                                                                            /* translators: %s: Codex URL */
     764                                                                                                                                                            __( 'Allow <a href="%s">trackbacks and pingbacks</a> on this page' ),
     765                                                                                                                                                            __( 'https://codex.wordpress.org/Introduction_to_Blogging#Managing_Comments' )
     766                                                                                                                                                        );
     767        ?>
     768        </label>
    727769    <?php
    728770    /**
     
    747789 * @return array
    748790 */
    749 function post_comment_meta_box_thead($result) {
    750     unset($result['cb'], $result['response']);
     791function post_comment_meta_box_thead( $result ) {
     792    unset( $result['cb'], $result['response'] );
    751793    return $result;
    752794}
     
    762804    wp_nonce_field( 'get-comments', 'add_comment_nonce', false );
    763805    ?>
    764     <p class="hide-if-no-js" id="add-new-comment"><a class="button" href="#commentstatusdiv" onclick="window.commentReply && commentReply.addcomment(<?php echo $post->ID; ?>);return false;"><?php _e('Add comment'); ?></a></p>
     806    <p class="hide-if-no-js" id="add-new-comment"><a class="button" href="#commentstatusdiv" onclick="window.commentReply && commentReply.addcomment(<?php echo $post->ID; ?>);return false;"><?php _e( 'Add comment' ); ?></a></p>
    765807    <?php
    766808
    767     $total = get_comments( array( 'post_id' => $post->ID, 'number' => 1, 'count' => true ) );
    768     $wp_list_table = _get_list_table('WP_Post_Comments_List_Table');
     809    $total         = get_comments(
     810        array(
     811            'post_id' => $post->ID,
     812            'number'  => 1,
     813            'count'   => true,
     814        )
     815    );
     816    $wp_list_table = _get_list_table( 'WP_Post_Comments_List_Table' );
    769817    $wp_list_table->display( true );
    770818
    771819    if ( 1 > $total ) {
    772         echo '<p id="no-comments">' . __('No comments yet.') . '</p>';
     820        echo '<p id="no-comments">' . __( 'No comments yet.' ) . '</p>';
    773821    } else {
    774822        $hidden = get_hidden_meta_boxes( get_current_screen() );
    775         if ( ! in_array('commentsdiv', $hidden) ) {
     823        if ( ! in_array( 'commentsdiv', $hidden ) ) {
    776824            ?>
    777825            <script type="text/javascript">jQuery(document).ready(function(){commentsBox.get(<?php echo $total; ?>, 10);});</script>
     
    780828
    781829        ?>
    782         <p class="hide-if-no-js" id="show-comments"><a href="#commentstatusdiv" onclick="commentsBox.load(<?php echo $total; ?>);return false;"><?php _e('Show comments'); ?></a> <span class="spinner"></span></p>
     830        <p class="hide-if-no-js" id="show-comments"><a href="#commentstatusdiv" onclick="commentsBox.load(<?php echo $total; ?>);return false;"><?php _e( 'Show comments' ); ?></a> <span class="spinner"></span></p>
    783831        <?php
    784832    }
     
    794842 * @param object $post
    795843 */
    796 function post_slug_meta_box($post) {
    797 /** This filter is documented in wp-admin/edit-tag-form.php */
    798 $editable_slug = apply_filters( 'editable_slug', $post->post_name, $post );
    799 ?>
    800 <label class="screen-reader-text" for="post_name"><?php _e('Slug') ?></label><input name="post_name" type="text" size="13" id="post_name" value="<?php echo esc_attr( $editable_slug ); ?>" />
     844function post_slug_meta_box( $post ) {
     845    /** This filter is documented in wp-admin/edit-tag-form.php */
     846    $editable_slug = apply_filters( 'editable_slug', $post->post_name, $post );
     847?>
     848<label class="screen-reader-text" for="post_name"><?php _e( 'Slug' ); ?></label><input name="post_name" type="text" size="13" id="post_name" value="<?php echo esc_attr( $editable_slug ); ?>" />
    801849<?php
    802850}
     
    811859 * @param object $post
    812860 */
    813 function post_author_meta_box($post) {
     861function post_author_meta_box( $post ) {
    814862    global $user_ID;
    815863?>
    816 <label class="screen-reader-text" for="post_author_override"><?php _e('Author'); ?></label>
    817 <?php
    818     wp_dropdown_users( array(
    819         'who' => 'authors',
    820         'name' => 'post_author_override',
    821         'selected' => empty($post->ID) ? $user_ID : $post->post_author,
    822         'include_selected' => true,
    823         'show' => 'display_name_with_login',
    824     ) );
     864<label class="screen-reader-text" for="post_author_override"><?php _e( 'Author' ); ?></label>
     865<?php
     866    wp_dropdown_users(
     867        array(
     868            'who'              => 'authors',
     869            'name'             => 'post_author_override',
     870            'selected'         => empty( $post->ID ) ? $user_ID : $post->post_author,
     871            'include_selected' => true,
     872            'show'             => 'display_name_with_login',
     873        )
     874    );
    825875}
    826876
     
    845895 * @param object $post
    846896 */
    847 function page_attributes_meta_box($post) {
     897function page_attributes_meta_box( $post ) {
    848898    if ( is_post_type_hierarchical( $post->post_type ) ) :
    849899        $dropdown_args = array(
     
    852902            'selected'         => $post->post_parent,
    853903            'name'             => 'parent_id',
    854             'show_option_none' => __('(no parent)'),
     904            'show_option_none' => __( '(no parent)' ),
    855905            'sort_column'      => 'menu_order, post_title',
    856906            'echo'             => 0,
     
    868918         */
    869919        $dropdown_args = apply_filters( 'page_attributes_dropdown_pages_args', $dropdown_args, $post );
    870         $pages = wp_dropdown_pages( $dropdown_args );
    871         if ( ! empty($pages) ) :
     920        $pages         = wp_dropdown_pages( $dropdown_args );
     921        if ( ! empty( $pages ) ) :
    872922?>
    873923<p class="post-attributes-label-wrapper"><label class="post-attributes-label" for="parent_id"><?php _e( 'Parent' ); ?></label></p>
     
    880930        $template = ! empty( $post->page_template ) ? $post->page_template : false;
    881931        ?>
    882 <p class="post-attributes-label-wrapper"><label class="post-attributes-label" for="page_template"><?php _e( 'Template' ); ?></label><?php
    883     /**
    884      * Fires immediately after the label inside the 'Template' section
    885      * of the 'Page Attributes' meta box.
    886      *
    887      * @since 4.4.0
    888      *
    889      * @param string  $template The template used for the current post.
    890      * @param WP_Post $post     The current post.
    891      */
    892     do_action( 'page_attributes_meta_box_template', $template, $post );
    893 ?></p>
     932<p class="post-attributes-label-wrapper"><label class="post-attributes-label" for="page_template"><?php _e( 'Template' ); ?></label>
     933                                                                                                            <?php
     934                                                                                                            /**
     935                                                                                                             * Fires immediately after the label inside the 'Template' section
     936                                                                                                             * of the 'Page Attributes' meta box.
     937                                                                                                             *
     938                                                                                                             * @since 4.4.0
     939                                                                                                             *
     940                                                                                                             * @param string  $template The template used for the current post.
     941                                                                                                             * @param WP_Post $post     The current post.
     942                                                                                                             */
     943                                                                                                            do_action( 'page_attributes_meta_box_template', $template, $post );
     944?>
     945</p>
    894946<select name="page_template" id="page_template">
    895947<?php
     
    903955 *                        include 'meta-box' or 'quick-edit'.
    904956 */
    905 $default_title = apply_filters( 'default_page_template_title',  __( 'Default Template' ), 'meta-box' );
     957$default_title = apply_filters( 'default_page_template_title', __( 'Default Template' ), 'meta-box' );
    906958?>
    907959<option value="default"><?php echo esc_html( $default_title ); ?></option>
     
    924976<?php if ( 'page' == $post->post_type && get_current_screen()->get_help_tabs() ) : ?>
    925977<p><?php _e( 'Need help? Use the Help tab above the screen title.' ); ?></p>
    926 <?php endif;
     978<?php
     979endif;
    927980    endif;
    928981}
     
    937990 * @param object $link
    938991 */
    939 function link_submit_meta_box($link) {
     992function link_submit_meta_box( $link ) {
    940993?>
    941994<div class="submitbox" id="submitlink">
     
    9501003<div id="minor-publishing-actions">
    9511004<div id="preview-action">
    952 <?php if ( !empty($link->link_id) ) { ?>
    953     <a class="preview button" href="<?php echo $link->link_url; ?>" target="_blank"><?php _e('Visit Link'); ?></a>
     1005<?php if ( ! empty( $link->link_id ) ) { ?>
     1006    <a class="preview button" href="<?php echo $link->link_url; ?>" target="_blank"><?php _e( 'Visit Link' ); ?></a>
    9541007<?php } ?>
    9551008</div>
     
    9591012<div id="misc-publishing-actions">
    9601013<div class="misc-pub-section misc-pub-private">
    961     <label for="link_private" class="selectit"><input id="link_private" name="link_visible" type="checkbox" value="N" <?php checked($link->link_visible, 'N'); ?> /> <?php _e('Keep this link private') ?></label>
     1014    <label for="link_private" class="selectit"><input id="link_private" name="link_visible" type="checkbox" value="N" <?php checked( $link->link_visible, 'N' ); ?> /> <?php _e( 'Keep this link private' ); ?></label>
    9621015</div>
    9631016</div>
     
    9721025<div id="delete-action">
    9731026<?php
    974 if ( !empty($_GET['action']) && 'edit' == $_GET['action'] && current_user_can('manage_links') ) { ?>
    975     <a class="submitdelete deletion" href="<?php echo wp_nonce_url("link.php?action=delete&amp;link_id=$link->link_id", 'delete-bookmark_' . $link->link_id); ?>" onclick="if ( confirm('<?php echo esc_js(sprintf(__("You are about to delete this link '%s'\n  'Cancel' to stop, 'OK' to delete."), $link->link_name )); ?>') ) {return true;}return false;"><?php _e('Delete'); ?></a>
     1027if ( ! empty( $_GET['action'] ) && 'edit' == $_GET['action'] && current_user_can( 'manage_links' ) ) {
     1028?>
     1029    <a class="submitdelete deletion" href="<?php echo wp_nonce_url( "link.php?action=delete&amp;link_id=$link->link_id", 'delete-bookmark_' . $link->link_id ); ?>" onclick="if ( confirm('<?php echo esc_js( sprintf( __( "You are about to delete this link '%s'\n  'Cancel' to stop, 'OK' to delete." ), $link->link_name ) ); ?>') ) {return true;}return false;"><?php _e( 'Delete' ); ?></a>
    9761030<?php } ?>
    9771031</div>
    9781032
    9791033<div id="publishing-action">
    980 <?php if ( !empty($link->link_id) ) { ?>
    981     <input name="save" type="submit" class="button button-primary button-large" id="publish" value="<?php esc_attr_e( 'Update Link' ) ?>" />
     1034<?php if ( ! empty( $link->link_id ) ) { ?>
     1035    <input name="save" type="submit" class="button button-primary button-large" id="publish" value="<?php esc_attr_e( 'Update Link' ); ?>" />
    9821036<?php } else { ?>
    983     <input name="save" type="submit" class="button button-primary button-large" id="publish" value="<?php esc_attr_e( 'Add Link' ) ?>" />
     1037    <input name="save" type="submit" class="button button-primary button-large" id="publish" value="<?php esc_attr_e( 'Add Link' ); ?>" />
    9841038<?php } ?>
    9851039</div>
     
    10061060 * @param object $link
    10071061 */
    1008 function link_categories_meta_box($link) {
     1062function link_categories_meta_box( $link ) {
    10091063?>
    10101064<div id="taxonomy-linkcategory" class="categorydiv">
     
    10171071        <ul id="categorychecklist" data-wp-lists="list:category" class="categorychecklist form-no-clear">
    10181072            <?php
    1019             if ( isset($link->link_id) )
    1020                 wp_link_category_checklist($link->link_id);
    1021             else
     1073            if ( isset( $link->link_id ) ) {
     1074                wp_link_category_checklist( $link->link_id );
     1075            } else {
    10221076                wp_link_category_checklist();
     1077            }
    10231078            ?>
    10241079        </ul>
     
    10271082    <div id="categories-pop" class="tabs-panel" style="display: none;">
    10281083        <ul id="categorychecklist-pop" class="categorychecklist form-no-clear">
    1029             <?php wp_popular_terms_checklist('link_category'); ?>
     1084            <?php wp_popular_terms_checklist( 'link_category' ); ?>
    10301085        </ul>
    10311086    </div>
     
    10521107 * @param object $link
    10531108 */
    1054 function link_target_meta_box($link) { ?>
    1055 <fieldset><legend class="screen-reader-text"><span><?php _e('Target') ?></span></legend>
     1109function link_target_meta_box( $link ) {
     1110
     1111?>
     1112<fieldset><legend class="screen-reader-text"><span><?php _e( 'Target' ); ?></span></legend>
    10561113<p><label for="link_target_blank" class="selectit">
    1057 <input id="link_target_blank" type="radio" name="link_target" value="_blank" <?php echo ( isset( $link->link_target ) && ($link->link_target == '_blank') ? 'checked="checked"' : ''); ?> />
    1058 <?php _e('<code>_blank</code> &mdash; new window or tab.'); ?></label></p>
     1114<input id="link_target_blank" type="radio" name="link_target" value="_blank" <?php echo ( isset( $link->link_target ) && ( $link->link_target == '_blank' ) ? 'checked="checked"' : '' ); ?> />
     1115<?php _e( '<code>_blank</code> &mdash; new window or tab.' ); ?></label></p>
    10591116<p><label for="link_target_top" class="selectit">
    1060 <input id="link_target_top" type="radio" name="link_target" value="_top" <?php echo ( isset( $link->link_target ) && ($link->link_target == '_top') ? 'checked="checked"' : ''); ?> />
    1061 <?php _e('<code>_top</code> &mdash; current window or tab, with no frames.'); ?></label></p>
     1117<input id="link_target_top" type="radio" name="link_target" value="_top" <?php echo ( isset( $link->link_target ) && ( $link->link_target == '_top' ) ? 'checked="checked"' : '' ); ?> />
     1118<?php _e( '<code>_top</code> &mdash; current window or tab, with no frames.' ); ?></label></p>
    10621119<p><label for="link_target_none" class="selectit">
    1063 <input id="link_target_none" type="radio" name="link_target" value="" <?php echo ( isset( $link->link_target ) && ($link->link_target == '') ? 'checked="checked"' : ''); ?> />
    1064 <?php _e('<code>_none</code> &mdash; same window or tab.'); ?></label></p>
     1120<input id="link_target_none" type="radio" name="link_target" value="" <?php echo ( isset( $link->link_target ) && ( $link->link_target == '' ) ? 'checked="checked"' : '' ); ?> />
     1121<?php _e( '<code>_none</code> &mdash; same window or tab.' ); ?></label></p>
    10651122</fieldset>
    1066 <p><?php _e('Choose the target frame for your link.'); ?></p>
     1123<p><?php _e( 'Choose the target frame for your link.' ); ?></p>
    10671124<?php
    10681125}
     
    10871144
    10881145    $link_rel = isset( $link->link_rel ) ? $link->link_rel : ''; // In PHP 5.3: $link_rel = $link->link_rel ?: '';
    1089     $rels = preg_split('/\s+/', $link_rel);
    1090 
    1091     if ('' != $value && in_array($value, $rels) ) {
     1146    $rels     = preg_split( '/\s+/', $link_rel );
     1147
     1148    if ( '' != $value && in_array( $value, $rels ) ) {
    10921149        echo ' checked="checked"';
    10931150    }
    10941151
    1095     if ('' == $value) {
    1096         if ('family' == $class && strpos($link_rel, 'child') === false && strpos($link_rel, 'parent') === false && strpos($link_rel, 'sibling') === false && strpos($link_rel, 'spouse') === false && strpos($link_rel, 'kin') === false) echo ' checked="checked"';
    1097         if ('friendship' == $class && strpos($link_rel, 'friend') === false && strpos($link_rel, 'acquaintance') === false && strpos($link_rel, 'contact') === false) echo ' checked="checked"';
    1098         if ('geographical' == $class && strpos($link_rel, 'co-resident') === false && strpos($link_rel, 'neighbor') === false) echo ' checked="checked"';
    1099         if ('identity' == $class && in_array('me', $rels) ) echo ' checked="checked"';
     1152    if ( '' == $value ) {
     1153        if ( 'family' == $class && strpos( $link_rel, 'child' ) === false && strpos( $link_rel, 'parent' ) === false && strpos( $link_rel, 'sibling' ) === false && strpos( $link_rel, 'spouse' ) === false && strpos( $link_rel, 'kin' ) === false ) {
     1154            echo ' checked="checked"';
     1155        }
     1156        if ( 'friendship' == $class && strpos( $link_rel, 'friend' ) === false && strpos( $link_rel, 'acquaintance' ) === false && strpos( $link_rel, 'contact' ) === false ) {
     1157            echo ' checked="checked"';
     1158        }
     1159        if ( 'geographical' == $class && strpos( $link_rel, 'co-resident' ) === false && strpos( $link_rel, 'neighbor' ) === false ) {
     1160            echo ' checked="checked"';
     1161        }
     1162        if ( 'identity' == $class && in_array( 'me', $rels ) ) {
     1163            echo ' checked="checked"';
     1164        }
    11001165    }
    11011166}
     
    11081173 * @param object $link
    11091174 */
    1110 function link_xfn_meta_box($link) {
     1175function link_xfn_meta_box( $link ) {
    11111176?>
    11121177<table class="links-table">
    11131178    <tr>
    1114         <th scope="row"><label for="link_rel"><?php /* translators: xfn: http://gmpg.org/xfn/ */ _e('rel:') ?></label></th>
    1115         <td><input type="text" name="link_rel" id="link_rel" value="<?php echo ( isset( $link->link_rel ) ? esc_attr($link->link_rel) : ''); ?>" /></td>
     1179        <th scope="row"><label for="link_rel"><?php /* translators: xfn: http://gmpg.org/xfn/ */ _e( 'rel:' ); ?></label></th>
     1180        <td><input type="text" name="link_rel" id="link_rel" value="<?php echo ( isset( $link->link_rel ) ? esc_attr( $link->link_rel ) : '' ); ?>" /></td>
    11161181    </tr>
    11171182    <tr>
    1118         <th scope="row"><?php /* translators: xfn: http://gmpg.org/xfn/ */ _e('identity') ?></th>
    1119         <td><fieldset><legend class="screen-reader-text"><span><?php /* translators: xfn: http://gmpg.org/xfn/ */ _e('identity') ?></span></legend>
     1183        <th scope="row"><?php /* translators: xfn: http://gmpg.org/xfn/ */ _e( 'identity' ); ?></th>
     1184        <td><fieldset><legend class="screen-reader-text"><span><?php /* translators: xfn: http://gmpg.org/xfn/ */ _e( 'identity' ); ?></span></legend>
    11201185            <label for="me">
    1121             <input type="checkbox" name="identity" value="me" id="me" <?php xfn_check('identity', 'me'); ?> />
    1122             <?php _e('another web address of mine') ?></label>
     1186            <input type="checkbox" name="identity" value="me" id="me" <?php xfn_check( 'identity', 'me' ); ?> />
     1187            <?php _e( 'another web address of mine' ); ?></label>
    11231188        </fieldset></td>
    11241189    </tr>
    11251190    <tr>
    1126         <th scope="row"><?php /* translators: xfn: http://gmpg.org/xfn/ */ _e('friendship') ?></th>
    1127         <td><fieldset><legend class="screen-reader-text"><span><?php /* translators: xfn: http://gmpg.org/xfn/ */ _e('friendship') ?></span></legend>
     1191        <th scope="row"><?php /* translators: xfn: http://gmpg.org/xfn/ */ _e( 'friendship' ); ?></th>
     1192        <td><fieldset><legend class="screen-reader-text"><span><?php /* translators: xfn: http://gmpg.org/xfn/ */ _e( 'friendship' ); ?></span></legend>
    11281193            <label for="contact">
    1129             <input class="valinp" type="radio" name="friendship" value="contact" id="contact" <?php xfn_check('friendship', 'contact'); ?> />&nbsp;<?php /* translators: xfn: http://gmpg.org/xfn/ */ _e('contact') ?>
     1194            <input class="valinp" type="radio" name="friendship" value="contact" id="contact" <?php xfn_check( 'friendship', 'contact' ); ?> />&nbsp;<?php /* translators: xfn: http://gmpg.org/xfn/ */ _e( 'contact' ); ?>
    11301195            </label>
    11311196            <label for="acquaintance">
    1132             <input class="valinp" type="radio" name="friendship" value="acquaintance" id="acquaintance" <?php xfn_check('friendship', 'acquaintance'); ?> />&nbsp;<?php /* translators: xfn: http://gmpg.org/xfn/ */ _e('acquaintance') ?>
     1197            <input class="valinp" type="radio" name="friendship" value="acquaintance" id="acquaintance" <?php xfn_check( 'friendship', 'acquaintance' ); ?> />&nbsp;<?php /* translators: xfn: http://gmpg.org/xfn/ */ _e( 'acquaintance' ); ?>
    11331198            </label>
    11341199            <label for="friend">
    1135             <input class="valinp" type="radio" name="friendship" value="friend" id="friend" <?php xfn_check('friendship', 'friend'); ?> />&nbsp;<?php /* translators: xfn: http://gmpg.org/xfn/ */ _e('friend') ?>
     1200            <input class="valinp" type="radio" name="friendship" value="friend" id="friend" <?php xfn_check( 'friendship', 'friend' ); ?> />&nbsp;<?php /* translators: xfn: http://gmpg.org/xfn/ */ _e( 'friend' ); ?>
    11361201            </label>
    11371202            <label for="friendship">
    1138             <input name="friendship" type="radio" class="valinp" value="" id="friendship" <?php xfn_check('friendship'); ?> />&nbsp;<?php /* translators: xfn: http://gmpg.org/xfn/ */ _e('none') ?>
     1203            <input name="friendship" type="radio" class="valinp" value="" id="friendship" <?php xfn_check( 'friendship' ); ?> />&nbsp;<?php /* translators: xfn: http://gmpg.org/xfn/ */ _e( 'none' ); ?>
    11391204            </label>
    11401205        </fieldset></td>
    11411206    </tr>
    11421207    <tr>
    1143         <th scope="row"> <?php /* translators: xfn: http://gmpg.org/xfn/ */ _e('physical') ?> </th>
    1144         <td><fieldset><legend class="screen-reader-text"><span><?php /* translators: xfn: http://gmpg.org/xfn/ */ _e('physical') ?></span></legend>
     1208        <th scope="row"> <?php /* translators: xfn: http://gmpg.org/xfn/ */ _e( 'physical' ); ?> </th>
     1209        <td><fieldset><legend class="screen-reader-text"><span><?php /* translators: xfn: http://gmpg.org/xfn/ */ _e( 'physical' ); ?></span></legend>
    11451210            <label for="met">
    1146             <input class="valinp" type="checkbox" name="physical" value="met" id="met" <?php xfn_check('physical', 'met'); ?> />&nbsp;<?php /* translators: xfn: http://gmpg.org/xfn/ */ _e('met') ?>
     1211            <input class="valinp" type="checkbox" name="physical" value="met" id="met" <?php xfn_check( 'physical', 'met' ); ?> />&nbsp;<?php /* translators: xfn: http://gmpg.org/xfn/ */ _e( 'met' ); ?>
    11471212            </label>
    11481213        </fieldset></td>
    11491214    </tr>
    11501215    <tr>
    1151         <th scope="row"> <?php /* translators: xfn: http://gmpg.org/xfn/ */ _e('professional') ?> </th>
    1152         <td><fieldset><legend class="screen-reader-text"><span><?php /* translators: xfn: http://gmpg.org/xfn/ */ _e('professional') ?></span></legend>
     1216        <th scope="row"> <?php /* translators: xfn: http://gmpg.org/xfn/ */ _e( 'professional' ); ?> </th>
     1217        <td><fieldset><legend class="screen-reader-text"><span><?php /* translators: xfn: http://gmpg.org/xfn/ */ _e( 'professional' ); ?></span></legend>
    11531218            <label for="co-worker">
    1154             <input class="valinp" type="checkbox" name="professional" value="co-worker" id="co-worker" <?php xfn_check('professional', 'co-worker'); ?> />&nbsp;<?php /* translators: xfn: http://gmpg.org/xfn/ */ _e('co-worker') ?>
     1219            <input class="valinp" type="checkbox" name="professional" value="co-worker" id="co-worker" <?php xfn_check( 'professional', 'co-worker' ); ?> />&nbsp;<?php /* translators: xfn: http://gmpg.org/xfn/ */ _e( 'co-worker' ); ?>
    11551220            </label>
    11561221            <label for="colleague">
    1157             <input class="valinp" type="checkbox" name="professional" value="colleague" id="colleague" <?php xfn_check('professional', 'colleague'); ?> />&nbsp;<?php /* translators: xfn: http://gmpg.org/xfn/ */ _e('colleague') ?>
     1222            <input class="valinp" type="checkbox" name="professional" value="colleague" id="colleague" <?php xfn_check( 'professional', 'colleague' ); ?> />&nbsp;<?php /* translators: xfn: http://gmpg.org/xfn/ */ _e( 'colleague' ); ?>
    11581223            </label>
    11591224        </fieldset></td>
    11601225    </tr>
    11611226    <tr>
    1162         <th scope="row"><?php /* translators: xfn: http://gmpg.org/xfn/ */ _e('geographical') ?></th>
    1163         <td><fieldset><legend class="screen-reader-text"><span> <?php /* translators: xfn: http://gmpg.org/xfn/ */ _e('geographical') ?> </span></legend>
     1227        <th scope="row"><?php /* translators: xfn: http://gmpg.org/xfn/ */ _e( 'geographical' ); ?></th>
     1228        <td><fieldset><legend class="screen-reader-text"><span> <?php /* translators: xfn: http://gmpg.org/xfn/ */ _e( 'geographical' ); ?> </span></legend>
    11641229            <label for="co-resident">
    1165             <input class="valinp" type="radio" name="geographical" value="co-resident" id="co-resident" <?php xfn_check('geographical', 'co-resident'); ?> />&nbsp;<?php /* translators: xfn: http://gmpg.org/xfn/ */ _e('co-resident') ?>
     1230            <input class="valinp" type="radio" name="geographical" value="co-resident" id="co-resident" <?php xfn_check( 'geographical', 'co-resident' ); ?> />&nbsp;<?php /* translators: xfn: http://gmpg.org/xfn/ */ _e( 'co-resident' ); ?>
    11661231            </label>
    11671232            <label for="neighbor">
    1168             <input class="valinp" type="radio" name="geographical" value="neighbor" id="neighbor" <?php xfn_check('geographical', 'neighbor'); ?> />&nbsp;<?php /* translators: xfn: http://gmpg.org/xfn/ */ _e('neighbor') ?>
     1233            <input class="valinp" type="radio" name="geographical" value="neighbor" id="neighbor" <?php xfn_check( 'geographical', 'neighbor' ); ?> />&nbsp;<?php /* translators: xfn: http://gmpg.org/xfn/ */ _e( 'neighbor' ); ?>
    11691234            </label>
    11701235            <label for="geographical">
    1171             <input class="valinp" type="radio" name="geographical" value="" id="geographical" <?php xfn_check('geographical'); ?> />&nbsp;<?php /* translators: xfn: http://gmpg.org/xfn/ */ _e('none') ?>
     1236            <input class="valinp" type="radio" name="geographical" value="" id="geographical" <?php xfn_check( 'geographical' ); ?> />&nbsp;<?php /* translators: xfn: http://gmpg.org/xfn/ */ _e( 'none' ); ?>
    11721237            </label>
    11731238        </fieldset></td>
    11741239    </tr>
    11751240    <tr>
    1176         <th scope="row"><?php /* translators: xfn: http://gmpg.org/xfn/ */ _e('family') ?></th>
    1177         <td><fieldset><legend class="screen-reader-text"><span> <?php /* translators: xfn: http://gmpg.org/xfn/ */ _e('family') ?> </span></legend>
     1241        <th scope="row"><?php /* translators: xfn: http://gmpg.org/xfn/ */ _e( 'family' ); ?></th>
     1242        <td><fieldset><legend class="screen-reader-text"><span> <?php /* translators: xfn: http://gmpg.org/xfn/ */ _e( 'family' ); ?> </span></legend>
    11781243            <label for="child">
    1179             <input class="valinp" type="radio" name="family" value="child" id="child" <?php xfn_check('family', 'child'); ?> />&nbsp;<?php /* translators: xfn: http://gmpg.org/xfn/ */ _e('child') ?>
     1244            <input class="valinp" type="radio" name="family" value="child" id="child" <?php xfn_check( 'family', 'child' ); ?> />&nbsp;<?php /* translators: xfn: http://gmpg.org/xfn/ */ _e( 'child' ); ?>
    11801245            </label>
    11811246            <label for="kin">
    1182             <input class="valinp" type="radio" name="family" value="kin" id="kin" <?php xfn_check('family', 'kin'); ?> />&nbsp;<?php /* translators: xfn: http://gmpg.org/xfn/ */ _e('kin') ?>
     1247            <input class="valinp" type="radio" name="family" value="kin" id="kin" <?php xfn_check( 'family', 'kin' ); ?> />&nbsp;<?php /* translators: xfn: http://gmpg.org/xfn/ */ _e( 'kin' ); ?>
    11831248            </label>
    11841249            <label for="parent">
    1185             <input class="valinp" type="radio" name="family" value="parent" id="parent" <?php xfn_check('family', 'parent'); ?> />&nbsp;<?php /* translators: xfn: http://gmpg.org/xfn/ */ _e('parent') ?>
     1250            <input class="valinp" type="radio" name="family" value="parent" id="parent" <?php xfn_check( 'family', 'parent' ); ?> />&nbsp;<?php /* translators: xfn: http://gmpg.org/xfn/ */ _e( 'parent' ); ?>
    11861251            </label>
    11871252            <label for="sibling">
    1188             <input class="valinp" type="radio" name="family" value="sibling" id="sibling" <?php xfn_check('family', 'sibling'); ?> />&nbsp;<?php /* translators: xfn: http://gmpg.org/xfn/ */ _e('sibling') ?>
     1253            <input class="valinp" type="radio" name="family" value="sibling" id="sibling" <?php xfn_check( 'family', 'sibling' ); ?> />&nbsp;<?php /* translators: xfn: http://gmpg.org/xfn/ */ _e( 'sibling' ); ?>
    11891254            </label>
    11901255            <label for="spouse">
    1191             <input class="valinp" type="radio" name="family" value="spouse" id="spouse" <?php xfn_check('family', 'spouse'); ?> />&nbsp;<?php /* translators: xfn: http://gmpg.org/xfn/ */ _e('spouse') ?>
     1256            <input class="valinp" type="radio" name="family" value="spouse" id="spouse" <?php xfn_check( 'family', 'spouse' ); ?> />&nbsp;<?php /* translators: xfn: http://gmpg.org/xfn/ */ _e( 'spouse' ); ?>
    11921257            </label>
    11931258            <label for="family">
    1194             <input class="valinp" type="radio" name="family" value="" id="family" <?php xfn_check('family'); ?> />&nbsp;<?php /* translators: xfn: http://gmpg.org/xfn/ */ _e('none') ?>
     1259            <input class="valinp" type="radio" name="family" value="" id="family" <?php xfn_check( 'family' ); ?> />&nbsp;<?php /* translators: xfn: http://gmpg.org/xfn/ */ _e( 'none' ); ?>
    11951260            </label>
    11961261        </fieldset></td>
    11971262    </tr>
    11981263    <tr>
    1199         <th scope="row"><?php /* translators: xfn: http://gmpg.org/xfn/ */ _e('romantic') ?></th>
    1200         <td><fieldset><legend class="screen-reader-text"><span> <?php /* translators: xfn: http://gmpg.org/xfn/ */ _e('romantic') ?> </span></legend>
     1264        <th scope="row"><?php /* translators: xfn: http://gmpg.org/xfn/ */ _e( 'romantic' ); ?></th>
     1265        <td><fieldset><legend class="screen-reader-text"><span> <?php /* translators: xfn: http://gmpg.org/xfn/ */ _e( 'romantic' ); ?> </span></legend>
    12011266            <label for="muse">
    1202             <input class="valinp" type="checkbox" name="romantic" value="muse" id="muse" <?php xfn_check('romantic', 'muse'); ?> />&nbsp;<?php /* translators: xfn: http://gmpg.org/xfn/ */ _e('muse') ?>
     1267            <input class="valinp" type="checkbox" name="romantic" value="muse" id="muse" <?php xfn_check( 'romantic', 'muse' ); ?> />&nbsp;<?php /* translators: xfn: http://gmpg.org/xfn/ */ _e( 'muse' ); ?>
    12031268            </label>
    12041269            <label for="crush">
    1205             <input class="valinp" type="checkbox" name="romantic" value="crush" id="crush" <?php xfn_check('romantic', 'crush'); ?> />&nbsp;<?php /* translators: xfn: http://gmpg.org/xfn/ */ _e('crush') ?>
     1270            <input class="valinp" type="checkbox" name="romantic" value="crush" id="crush" <?php xfn_check( 'romantic', 'crush' ); ?> />&nbsp;<?php /* translators: xfn: http://gmpg.org/xfn/ */ _e( 'crush' ); ?>
    12061271            </label>
    12071272            <label for="date">
    1208             <input class="valinp" type="checkbox" name="romantic" value="date" id="date" <?php xfn_check('romantic', 'date'); ?> />&nbsp;<?php /* translators: xfn: http://gmpg.org/xfn/ */ _e('date') ?>
     1273            <input class="valinp" type="checkbox" name="romantic" value="date" id="date" <?php xfn_check( 'romantic', 'date' ); ?> />&nbsp;<?php /* translators: xfn: http://gmpg.org/xfn/ */ _e( 'date' ); ?>
    12091274            </label>
    12101275            <label for="romantic">
    1211             <input class="valinp" type="checkbox" name="romantic" value="sweetheart" id="romantic" <?php xfn_check('romantic', 'sweetheart'); ?> />&nbsp;<?php /* translators: xfn: http://gmpg.org/xfn/ */ _e('sweetheart') ?>
     1276            <input class="valinp" type="checkbox" name="romantic" value="sweetheart" id="romantic" <?php xfn_check( 'romantic', 'sweetheart' ); ?> />&nbsp;<?php /* translators: xfn: http://gmpg.org/xfn/ */ _e( 'sweetheart' ); ?>
    12121277            </label>
    12131278        </fieldset></td>
     
    12151280
    12161281</table>
    1217 <p><?php _e('If the link is to a person, you can specify your relationship with them using the above form. If you would like to learn more about the idea check out <a href="http://gmpg.org/xfn/">XFN</a>.'); ?></p>
     1282<p><?php _e( 'If the link is to a person, you can specify your relationship with them using the above form. If you would like to learn more about the idea check out <a href="http://gmpg.org/xfn/">XFN</a>.' ); ?></p>
    12181283<?php
    12191284}
     
    12261291 * @param object $link
    12271292 */
    1228 function link_advanced_meta_box($link) {
     1293function link_advanced_meta_box( $link ) {
    12291294?>
    12301295<table class="links-table" cellpadding="0">
    12311296    <tr>
    1232         <th scope="row"><label for="link_image"><?php _e('Image Address') ?></label></th>
    1233         <td><input type="text" name="link_image" class="code" id="link_image" maxlength="255" value="<?php echo ( isset( $link->link_image ) ? esc_attr($link->link_image) : ''); ?>" /></td>
     1297        <th scope="row"><label for="link_image"><?php _e( 'Image Address' ); ?></label></th>
     1298        <td><input type="text" name="link_image" class="code" id="link_image" maxlength="255" value="<?php echo ( isset( $link->link_image ) ? esc_attr( $link->link_image ) : '' ); ?>" /></td>
    12341299    </tr>
    12351300    <tr>
    1236         <th scope="row"><label for="rss_uri"><?php _e('RSS Address') ?></label></th>
    1237         <td><input name="link_rss" class="code" type="text" id="rss_uri" maxlength="255" value="<?php echo ( isset( $link->link_rss ) ? esc_attr($link->link_rss) : ''); ?>" /></td>
     1301        <th scope="row"><label for="rss_uri"><?php _e( 'RSS Address' ); ?></label></th>
     1302        <td><input name="link_rss" class="code" type="text" id="rss_uri" maxlength="255" value="<?php echo ( isset( $link->link_rss ) ? esc_attr( $link->link_rss ) : '' ); ?>" /></td>
    12381303    </tr>
    12391304    <tr>
    1240         <th scope="row"><label for="link_notes"><?php _e('Notes') ?></label></th>
    1241         <td><textarea name="link_notes" id="link_notes" rows="10"><?php echo ( isset( $link->link_notes ) ? $link->link_notes : ''); // textarea_escaped ?></textarea></td>
     1305        <th scope="row"><label for="link_notes"><?php _e( 'Notes' ); ?></label></th>
     1306        <td><textarea name="link_notes" id="link_notes" rows="10"><?php echo ( isset( $link->link_notes ) ? $link->link_notes : '' ); // textarea_escaped ?></textarea></td>
    12421307    </tr>
    12431308    <tr>
    1244         <th scope="row"><label for="link_rating"><?php _e('Rating') ?></label></th>
     1309        <th scope="row"><label for="link_rating"><?php _e( 'Rating' ); ?></label></th>
    12451310        <td><select name="link_rating" id="link_rating" size="1">
    12461311        <?php
    1247             for ( $r = 0; $r <= 10; $r++ ) {
    1248                 echo '<option value="' . $r . '"';
    1249                 if ( isset($link->link_rating) && $link->link_rating == $r )
    1250                     echo ' selected="selected"';
    1251                 echo('>' . $r . '</option>');
     1312        for ( $r = 0; $r <= 10; $r++ ) {
     1313            echo '<option value="' . $r . '"';
     1314            if ( isset( $link->link_rating ) && $link->link_rating == $r ) {
     1315                echo ' selected="selected"';
    12521316            }
    1253         ?></select>&nbsp;<?php _e('(Leave at 0 for no rating.)') ?>
     1317            echo( '>' . $r . '</option>' );
     1318        }
     1319        ?>
     1320        </select>&nbsp;<?php _e( '(Leave at 0 for no rating.)' ); ?>
    12541321        </td>
    12551322    </tr>
     
    12831350    }
    12841351
    1285     foreach ( wp_get_attachment_id3_keys( $post, 'edit' ) as $key => $label ) : ?>
     1352    foreach ( wp_get_attachment_id3_keys( $post, 'edit' ) as $key => $label ) :
     1353    ?>
    12861354    <p>
    1287         <label for="title"><?php echo $label ?></label><br />
    1288         <input type="text" name="id3_<?php echo esc_attr( $key ) ?>" id="id3_<?php echo esc_attr( $key ) ?>" class="large-text" value="<?php
    1289             if ( ! empty( $meta[ $key ] ) ) {
    1290                 echo esc_attr( $meta[ $key ] );
    1291             }
    1292         ?>" />
     1355        <label for="title"><?php echo $label; ?></label><br />
     1356        <input type="text" name="id3_<?php echo esc_attr( $key ); ?>" id="id3_<?php echo esc_attr( $key ); ?>" class="large-text" value="
     1357                                                <?php
     1358                                                if ( ! empty( $meta[ $key ] ) ) {
     1359                                                    echo esc_attr( $meta[ $key ] );
     1360                                                }
     1361        ?>
     1362        " />
    12931363    </p>
    12941364    <?php
Note: See TracChangeset for help on using the changeset viewer.