Make WordPress Core

Ticket #22400: 22400.meta-boxes.php.diff

File 22400.meta-boxes.php.diff, 8.4 KB (added by MikeHansenMe, 11 years ago)

meda-boxes.php

  • wp-admin/includes/meta-boxes.php

     
    360360                $args = array();
    361361        else
    362362                $args = $box['args'];
    363         extract( wp_parse_args($args, $defaults), EXTR_SKIP );
    364         $tax_name = esc_attr($taxonomy);
    365         $taxonomy = get_taxonomy($taxonomy);
    366         $disabled = !current_user_can($taxonomy->cap->assign_terms) ? 'disabled="disabled"' : '';
     363       
     364        $args = wp_parse_args( $args, $defaults );
     365        $tax_name = esc_attr( $args['taxonomy'] );
     366        $args['taxonomy'] = get_taxonomy( $args['taxonomy'] );
     367        $disabled = !current_user_can( $args['taxonomy']->cap->assign_terms ) ? 'disabled="disabled"' : '';
    367368        $comma = _x( ',', 'tag delimiter' );
    368369?>
    369370<div class="tagsdiv" id="<?php echo $tax_name; ?>">
    370371        <div class="jaxtag">
    371372        <div class="nojs-tags hide-if-js">
    372         <p><?php echo $taxonomy->labels->add_or_remove_items; ?></p>
     373        <p><?php echo $args['taxonomy']->labels->add_or_remove_items; ?></p>
    373374        <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>
    374         <?php if ( current_user_can($taxonomy->cap->assign_terms) ) : ?>
     375        <?php if ( current_user_can($args['taxonomy']->cap->assign_terms) ) : ?>
    375376        <div class="ajaxtag hide-if-no-js">
    376377                <label class="screen-reader-text" for="new-tag-<?php echo $tax_name; ?>"><?php echo $box['title']; ?></label>
    377                 <div class="taghint"><?php echo $taxonomy->labels->add_new_item; ?></div>
     378                <div class="taghint"><?php echo $args['taxonomy']->labels->add_new_item; ?></div>
    378379                <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="" />
    379380                <input type="button" class="button tagadd" value="<?php esc_attr_e('Add'); ?>" /></p>
    380381        </div>
    381         <p class="howto"><?php echo esc_attr( $taxonomy->labels->separate_items_with_commas ); ?></p>
     382        <p class="howto"><?php echo esc_attr( $args['taxonomy']->labels->separate_items_with_commas ); ?></p>
    382383        <?php endif; ?>
    383384        </div>
    384385        <div class="tagchecklist"></div>
    385386</div>
    386 <?php if ( current_user_can($taxonomy->cap->assign_terms) ) : ?>
    387 <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>
     387<?php if ( current_user_can($args['taxonomy']->cap->assign_terms) ) : ?>
     388<p class="hide-if-no-js"><a href="#titlediv" class="tagcloud-link" id="link-<?php echo $tax_name; ?>"><?php echo $args['taxonomy']->labels->choose_from_most_used; ?></a></p>
    388389<?php endif; ?>
    389390<?php
    390391}
     
    402403                $args = array();
    403404        else
    404405                $args = $box['args'];
    405         extract( wp_parse_args($args, $defaults), EXTR_SKIP );
    406         $tax = get_taxonomy($taxonomy);
    407406
     407        $args = wp_parse_args( $args, $defaults );
     408       
     409        $tax = get_taxonomy( $args['taxonomy']);
     410
    408411        ?>
    409         <div id="taxonomy-<?php echo $taxonomy; ?>" class="categorydiv">
    410                 <ul id="<?php echo $taxonomy; ?>-tabs" class="category-tabs">
    411                         <li class="tabs"><a href="#<?php echo $taxonomy; ?>-all"><?php echo $tax->labels->all_items; ?></a></li>
    412                         <li class="hide-if-no-js"><a href="#<?php echo $taxonomy; ?>-pop"><?php _e( 'Most Used' ); ?></a></li>
     412        <div id="taxonomy-<?php echo $args['taxonomy']; ?>" class="categorydiv">
     413                <ul id="<?php echo $args['taxonomy']; ?>-tabs" class="category-tabs">
     414                        <li class="tabs"><a href="#<?php echo $args['taxonomy']; ?>-all"><?php echo $tax->labels->all_items; ?></a></li>
     415                        <li class="hide-if-no-js"><a href="#<?php echo $args['taxonomy']; ?>-pop"><?php _e( 'Most Used' ); ?></a></li>
    413416                </ul>
    414417
    415                 <div id="<?php echo $taxonomy; ?>-pop" class="tabs-panel" style="display: none;">
    416                         <ul id="<?php echo $taxonomy; ?>checklist-pop" class="categorychecklist form-no-clear" >
    417                                 <?php $popular_ids = wp_popular_terms_checklist($taxonomy); ?>
     418                <div id="<?php echo $args['taxonomy']; ?>-pop" class="tabs-panel" style="display: none;">
     419                        <ul id="<?php echo $args['taxonomy']; ?>checklist-pop" class="categorychecklist form-no-clear" >
     420                                <?php $popular_ids = wp_popular_terms_checklist( $args['taxonomy'] ); ?>
    418421                        </ul>
    419422                </div>
    420423
    421                 <div id="<?php echo $taxonomy; ?>-all" class="tabs-panel">
     424                <div id="<?php echo $args['taxonomy']; ?>-all" class="tabs-panel">
    422425                        <?php
    423             $name = ( $taxonomy == 'category' ) ? 'post_category' : 'tax_input[' . $taxonomy . ']';
     426            $name = ( $args['taxonomy'] == 'category' ) ? 'post_category' : 'tax_input[' . $args['taxonomy'] . ']';
    424427            echo "<input type='hidden' name='{$name}[]' value='0' />"; // Allows for an empty term set to be sent. 0 is an invalid Term ID and will be ignored by empty() checks.
    425428            ?>
    426                         <ul id="<?php echo $taxonomy; ?>checklist" data-wp-lists="list:<?php echo $taxonomy?>" class="categorychecklist form-no-clear">
    427                                 <?php wp_terms_checklist($post->ID, array( 'taxonomy' => $taxonomy, 'popular_cats' => $popular_ids ) ) ?>
     429                        <ul id="<?php echo $args['taxonomy']; ?>checklist" data-wp-lists="list:<?php echo $taxonomy?>" class="categorychecklist form-no-clear">
     430                                <?php wp_terms_checklist( $post->ID, array( 'taxonomy' => $args['taxonomy'], 'popular_cats' => $popular_ids ) ) ?>
    428431                        </ul>
    429432                </div>
    430433        <?php if ( current_user_can($tax->cap->edit_terms) ) : ?>
    431                         <div id="<?php echo $taxonomy; ?>-adder" class="wp-hidden-children">
     434                        <div id="<?php echo $args['taxonomy']; ?>-adder" class="wp-hidden-children">
    432435                                <h4>
    433                                         <a id="<?php echo $taxonomy; ?>-add-toggle" href="#<?php echo $taxonomy; ?>-add" class="hide-if-no-js">
     436                                        <a id="<?php echo $args['taxonomy']; ?>-add-toggle" href="#<?php echo $args['taxonomy']; ?>-add" class="hide-if-no-js">
    434437                                                <?php
    435438                                                        /* translators: %s: add new taxonomy label */
    436439                                                        printf( __( '+ %s' ), $tax->labels->add_new_item );
    437440                                                ?>
    438441                                        </a>
    439442                                </h4>
    440                                 <p id="<?php echo $taxonomy; ?>-add" class="category-add wp-hidden-child">
    441                                         <label class="screen-reader-text" for="new<?php echo $taxonomy; ?>"><?php echo $tax->labels->add_new_item; ?></label>
    442                                         <input type="text" name="new<?php echo $taxonomy; ?>" id="new<?php echo $taxonomy; ?>" class="form-required form-input-tip" value="<?php echo esc_attr( $tax->labels->new_item_name ); ?>" aria-required="true"/>
    443                                         <label class="screen-reader-text" for="new<?php echo $taxonomy; ?>_parent">
     443                                <p id="<?php echo $args['taxonomy']; ?>-add" class="category-add wp-hidden-child">
     444                                        <label class="screen-reader-text" for="new<?php echo $args['taxonomy']; ?>"><?php echo $tax->labels->add_new_item; ?></label>
     445                                        <input type="text" name="new<?php echo $args['taxonomy']; ?>" id="new<?php echo $args['taxonomy']; ?>" class="form-required form-input-tip" value="<?php echo esc_attr( $tax->labels->new_item_name ); ?>" aria-required="true"/>
     446                                        <label class="screen-reader-text" for="new<?php echo $args['taxonomy']; ?>_parent">
    444447                                                <?php echo $tax->labels->parent_item_colon; ?>
    445448                                        </label>
    446                                         <?php wp_dropdown_categories( array( 'taxonomy' => $taxonomy, 'hide_empty' => 0, 'name' => 'new'.$taxonomy.'_parent', 'orderby' => 'name', 'hierarchical' => 1, 'show_option_none' => '&mdash; ' . $tax->labels->parent_item . ' &mdash;' ) ); ?>
    447                                         <input type="button" id="<?php echo $taxonomy; ?>-add-submit" data-wp-lists="add:<?php echo $taxonomy ?>checklist:<?php echo $taxonomy ?>-add" class="button category-add-submit" value="<?php echo esc_attr( $tax->labels->add_new_item ); ?>" />
    448                                         <?php wp_nonce_field( 'add-'.$taxonomy, '_ajax_nonce-add-'.$taxonomy, false ); ?>
    449                                         <span id="<?php echo $taxonomy; ?>-ajax-response"></span>
     449                                        <?php wp_dropdown_categories( array( 'taxonomy' => $args['taxonomy'], 'hide_empty' => 0, 'name' => 'new'.$args['taxonomy'].'_parent', 'orderby' => 'name', 'hierarchical' => 1, 'show_option_none' => '&mdash; ' . $tax->labels->parent_item . ' &mdash;' ) ); ?>
     450                                        <input type="button" id="<?php echo $args['taxonomy']; ?>-add-submit" data-wp-lists="add:<?php echo $args['taxonomy'] ?>checklist:<?php echo $args['taxonomy'] ?>-add" class="button category-add-submit" value="<?php echo esc_attr( $tax->labels->add_new_item ); ?>" />
     451                                        <?php wp_nonce_field( 'add-'.$args['taxonomy'], '_ajax_nonce-add-'.$args['taxonomy'], false ); ?>
     452                                        <span id="<?php echo $args['taxonomy']; ?>-ajax-response"></span>
    450453                                </p>
    451454                        </div>
    452455                <?php endif; ?>