Ticket #22400: 22400.meta-boxes.php.diff
File 22400.meta-boxes.php.diff, 8.4 KB (added by , 11 years ago) |
---|
-
wp-admin/includes/meta-boxes.php
360 360 $args = array(); 361 361 else 362 362 $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"' : ''; 367 368 $comma = _x( ',', 'tag delimiter' ); 368 369 ?> 369 370 <div class="tagsdiv" id="<?php echo $tax_name; ?>"> 370 371 <div class="jaxtag"> 371 372 <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> 373 374 <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) ) : ?> 375 376 <div class="ajaxtag hide-if-no-js"> 376 377 <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> 378 379 <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="" /> 379 380 <input type="button" class="button tagadd" value="<?php esc_attr_e('Add'); ?>" /></p> 380 381 </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> 382 383 <?php endif; ?> 383 384 </div> 384 385 <div class="tagchecklist"></div> 385 386 </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> 388 389 <?php endif; ?> 389 390 <?php 390 391 } … … 402 403 $args = array(); 403 404 else 404 405 $args = $box['args']; 405 extract( wp_parse_args($args, $defaults), EXTR_SKIP );406 $tax = get_taxonomy($taxonomy);407 406 407 $args = wp_parse_args( $args, $defaults ); 408 409 $tax = get_taxonomy( $args['taxonomy']); 410 408 411 ?> 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> 413 416 </ul> 414 417 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'] ); ?> 418 421 </ul> 419 422 </div> 420 423 421 <div id="<?php echo $ taxonomy; ?>-all" class="tabs-panel">424 <div id="<?php echo $args['taxonomy']; ?>-all" class="tabs-panel"> 422 425 <?php 423 $name = ( $ taxonomy == 'category' ) ? 'post_category' : 'tax_input[' . $taxonomy. ']';426 $name = ( $args['taxonomy'] == 'category' ) ? 'post_category' : 'tax_input[' . $args['taxonomy'] . ']'; 424 427 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. 425 428 ?> 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 ) ) ?> 428 431 </ul> 429 432 </div> 430 433 <?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"> 432 435 <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"> 434 437 <?php 435 438 /* translators: %s: add new taxonomy label */ 436 439 printf( __( '+ %s' ), $tax->labels->add_new_item ); 437 440 ?> 438 441 </a> 439 442 </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"> 444 447 <?php echo $tax->labels->parent_item_colon; ?> 445 448 </label> 446 <?php wp_dropdown_categories( array( 'taxonomy' => $ taxonomy, 'hide_empty' => 0, 'name' => 'new'.$taxonomy.'_parent', 'orderby' => 'name', 'hierarchical' => 1, 'show_option_none' => '— ' . $tax->labels->parent_item . ' —' ) ); ?>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' => '— ' . $tax->labels->parent_item . ' —' ) ); ?> 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> 450 453 </p> 451 454 </div> 452 455 <?php endif; ?>