Make WordPress Core

Ticket #23194: 23194.patch

File 23194.patch, 3.6 KB (added by SergeyBiryukov, 12 years ago)
  • wp-admin/includes/meta-boxes.php

     
    339339        extract( wp_parse_args($args, $defaults), EXTR_SKIP );
    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?>
    345345<div class="tagsdiv" id="<?php echo $tax_name; ?>">
    346346        <div class="jaxtag">
    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>
    353353                <div class="taghint"><?php echo $taxonomy->labels->add_new_item; ?></div>
    354354                <p><input type="text" id="new-tag-<?php echo $tax_name; ?>" name="newtag[<?php echo $tax_name; ?>]" class="newtag form-input-tip" size="16" autocomplete="off" value="" />
    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; ?>
    365365<?php
  • wp-admin/includes/template.php

     
    176176        $terms = get_terms( $taxonomy, array( 'orderby' => 'count', 'order' => 'DESC', 'number' => $number, 'hierarchical' => false ) );
    177177
    178178        $tax = get_taxonomy($taxonomy);
    179         if ( ! current_user_can($tax->cap->assign_terms) )
    180                 $disabled = 'disabled="disabled"';
    181         else
    182                 $disabled = '';
    183179
    184180        $popular_ids = array();
    185181        foreach ( (array) $terms as $term ) {
     
    192188
    193189                <li id="<?php echo $id; ?>" class="popular-category">
    194190                        <label class="selectit">
    195                         <input id="in-<?php echo $id; ?>" type="checkbox" <?php echo $checked; ?> value="<?php echo (int) $term->term_id; ?>" <?php echo $disabled ?>/>
     191                        <input id="in-<?php echo $id; ?>" type="checkbox" <?php echo $checked; ?> value="<?php echo (int) $term->term_id; ?>" <?php disabled( ! current_user_can( $tax->cap->assign_terms ) ); ?> />
    196192                                <?php echo esc_html( apply_filters( 'the_category', $term->name ) ); ?>
    197193                        </label>
    198194                </li>