WordPress.org

Make WordPress Core


Ignore:
Timestamp:
11/23/2017 04:08:42 AM (2 years ago)
Author:
pento
Message:

General: Reformat inline if () statements inside HTML tags.

This pattern occurs a handful of times across the codebase:

<div class="foo<?php if ( $bar ) { echo ' baz'; } ?>">

Unfortunately, it doesn't really play nicely with phpcbf, so all instances need to be removed in preperation for auto code formatting.

See #41057.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-admin/edit-tag-form.php

    r41618 r42217  
    114114 */
    115115do_action( "{$taxonomy}_term_edit_form_top", $tag, $taxonomy );
     116
     117$tag_name_value = '';
     118if ( isset( $tag->name ) ) {
     119    $tag_name_value = esc_attr( $tag->name );
     120}
    116121?>
    117122    <table class="form-table">
    118123        <tr class="form-field form-required term-name-wrap">
    119124            <th scope="row"><label for="name"><?php _ex( 'Name', 'term name' ); ?></label></th>
    120             <td><input name="name" id="name" type="text" value="<?php if ( isset( $tag->name ) ) echo esc_attr($tag->name); ?>" size="40" aria-required="true" />
     125            <td><input name="name" id="name" type="text" value="<?php echo $tag_name_value; ?>" size="40" aria-required="true" />
    121126            <p class="description"><?php _e('The name is how it appears on your site.'); ?></p></td>
    122127        </tr>
Note: See TracChangeset for help on using the changeset viewer.