Make WordPress Core


Ignore:
Timestamp:
01/28/2013 03:23:01 AM (12 years ago)
Author:
SergeyBiryukov
Message:

Consistently use a helper function instead of directly printing the disabled attribute.

Remove an erroneous esc_attr() call.

fixes #23194.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-admin/includes/meta-boxes.php

    r23083 r23352  
    340340    $tax_name = esc_attr($taxonomy);
    341341    $taxonomy = get_taxonomy($taxonomy);
    342     $disabled = !current_user_can($taxonomy->cap->assign_terms) ? 'disabled="disabled"' : '';
     342    $user_can_assign_terms = current_user_can( $taxonomy->cap->assign_terms );
    343343    $comma = _x( ',', 'tag delimiter' );
    344344?>
     
    347347    <div class="nojs-tags hide-if-js">
    348348    <p><?php echo $taxonomy->labels->add_or_remove_items; ?></p>
    349     <textarea name="<?php echo "tax_input[$tax_name]"; ?>" rows="3" cols="20" class="the-tags" id="tax-input-<?php echo $tax_name; ?>" <?php echo $disabled; ?>><?php echo str_replace( ',', $comma . ' ', get_terms_to_edit( $post->ID, $tax_name ) ); // textarea_escaped by esc_attr() ?></textarea></div>
    350     <?php if ( current_user_can($taxonomy->cap->assign_terms) ) : ?>
     349    <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 ); ?>><?php echo str_replace( ',', $comma . ' ', get_terms_to_edit( $post->ID, $tax_name ) ); // textarea_escaped by esc_attr() ?></textarea></div>
     350    <?php if ( $user_can_assign_terms ) : ?>
    351351    <div class="ajaxtag hide-if-no-js">
    352352        <label class="screen-reader-text" for="new-tag-<?php echo $tax_name; ?>"><?php echo $box['title']; ?></label>
     
    355355        <input type="button" class="button tagadd" value="<?php esc_attr_e('Add'); ?>" /></p>
    356356    </div>
    357     <p class="howto"><?php echo esc_attr( $taxonomy->labels->separate_items_with_commas ); ?></p>
     357    <p class="howto"><?php echo $taxonomy->labels->separate_items_with_commas; ?></p>
    358358    <?php endif; ?>
    359359    </div>
    360360    <div class="tagchecklist"></div>
    361361</div>
    362 <?php if ( current_user_can($taxonomy->cap->assign_terms) ) : ?>
     362<?php if ( $user_can_assign_terms ) : ?>
    363363<p class="hide-if-no-js"><a href="#titlediv" class="tagcloud-link" id="link-<?php echo $tax_name; ?>"><?php echo $taxonomy->labels->choose_from_most_used; ?></a></p>
    364364<?php endif; ?>
Note: See TracChangeset for help on using the changeset viewer.