Changeset 39979
- Timestamp:
- 01/26/2017 02:11:38 PM (9 years ago)
- File:
-
- 1 edited
-
branches/3.9/src/wp-admin/press-this.php (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
branches/3.9/src/wp-admin/press-this.php
r30440 r39979 33 33 wp_die(__('You are not allowed to edit this post.')); 34 34 35 $post['post_category'] = isset($_POST['post_category']) ? $_POST['post_category'] : ''; 36 $post['tax_input'] = isset($_POST['tax_input']) ? $_POST['tax_input'] : ''; 35 // Only accept categories if the user actually can assign 36 $category_tax = get_taxonomy( 'category' ); 37 if ( current_user_can( $category_tax->cap->assign_terms ) ) { 38 $post['post_category'] = ( ! empty( $_POST['post_category'] ) ) ? $_POST['post_category'] : array(); 39 } 40 41 // Only accept taxonomies if the user can actually assign 42 if ( ! empty( $_POST['tax_input'] ) ) { 43 $tax_input = $_POST['tax_input']; 44 foreach ( $tax_input as $tax => $_ti ) { 45 $tax_object = get_taxonomy( $tax ); 46 if ( ! $tax_object || ! current_user_can( $tax_object->cap->assign_terms ) ) { 47 unset( $tax_input[ $tax ] ); 48 } 49 } 50 51 $post['tax_input'] = $tax_input; 52 } 53 37 54 $post['post_title'] = isset($_POST['title']) ? $_POST['title'] : ''; 38 55 $content = isset($_POST['content']) ? $_POST['content'] : ''; … … 513 530 </div> 514 531 515 <?php $tax = get_taxonomy( 'category' ); ?> 516 <div id="categorydiv" class="postbox"> 517 <div class="handlediv" title="<?php esc_attr_e( 'Click to toggle' ); ?>"><br /></div> 518 <h3 class="hndle"><?php _e('Categories') ?></h3> 519 <div class="inside"> 520 <div id="taxonomy-category" class="categorydiv"> 521 522 <ul id="category-tabs" class="category-tabs"> 523 <li class="tabs"><a href="#category-all"><?php echo $tax->labels->all_items; ?></a></li> 524 <li class="hide-if-no-js"><a href="#category-pop"><?php _e( 'Most Used' ); ?></a></li> 525 </ul> 526 527 <div id="category-pop" class="tabs-panel" style="display: none;"> 528 <ul id="categorychecklist-pop" class="categorychecklist form-no-clear" > 529 <?php $popular_ids = wp_popular_terms_checklist( 'category' ); ?> 532 <?php 533 534 $tax = get_taxonomy( 'category' ); 535 if ( current_user_can( $tax->cap->assign_terms ) ) : 536 ?> 537 <div id="categorydiv" class="postbox"> 538 <div class="handlediv" title="<?php esc_attr_e( 'Click to toggle' ); ?>"><br /></div> 539 <h3 class="hndle"><?php _e('Categories') ?></h3> 540 <div class="inside"> 541 <div id="taxonomy-category" class="categorydiv"> 542 543 <ul id="category-tabs" class="category-tabs"> 544 <li class="tabs"><a href="#category-all"><?php echo $tax->labels->all_items; ?></a></li> 545 <li class="hide-if-no-js"><a href="#category-pop"><?php _e( 'Most Used' ); ?></a></li> 530 546 </ul> 547 548 <div id="category-pop" class="tabs-panel" style="display: none;"> 549 <ul id="categorychecklist-pop" class="categorychecklist form-no-clear" > 550 <?php $popular_ids = wp_popular_terms_checklist( 'category' ); ?> 551 </ul> 552 </div> 553 554 <div id="category-all" class="tabs-panel"> 555 <ul id="categorychecklist" data-wp-lists="list:category" class="categorychecklist form-no-clear"> 556 <?php wp_terms_checklist($post_ID, array( 'taxonomy' => 'category', 'popular_cats' => $popular_ids ) ) ?> 557 </ul> 558 </div> 559 560 <?php if ( current_user_can($tax->cap->edit_terms) ) : ?> 561 <div id="category-adder" class="wp-hidden-children"> 562 <h4> 563 <a id="category-add-toggle" href="#category-add" class="hide-if-no-js"> 564 <?php printf( __( '+ %s' ), $tax->labels->add_new_item ); ?> 565 </a> 566 </h4> 567 <p id="category-add" class="category-add wp-hidden-child"> 568 <label class="screen-reader-text" for="newcategory"><?php echo $tax->labels->add_new_item; ?></label> 569 <input type="text" name="newcategory" id="newcategory" class="form-required form-input-tip" value="<?php echo esc_attr( $tax->labels->new_item_name ); ?>" aria-required="true"/> 570 <label class="screen-reader-text" for="newcategory_parent"> 571 <?php echo $tax->labels->parent_item_colon; ?> 572 </label> 573 <?php wp_dropdown_categories( array( 'taxonomy' => 'category', 'hide_empty' => 0, 'name' => 'newcategory_parent', 'orderby' => 'name', 'hierarchical' => 1, 'show_option_none' => '— ' . $tax->labels->parent_item . ' —' ) ); ?> 574 <input type="button" id="category-add-submit" data-wp-lists="add:categorychecklist:category-add" class="button category-add-submit" value="<?php echo esc_attr( $tax->labels->add_new_item ); ?>" /> 575 <?php wp_nonce_field( 'add-category', '_ajax_nonce-add-category', false ); ?> 576 <span id="category-ajax-response"></span> 577 </p> 578 </div> 579 <?php endif; ?> 531 580 </div> 532 533 <div id="category-all" class="tabs-panel">534 <ul id="categorychecklist" data-wp-lists="list:category" class="categorychecklist form-no-clear">535 <?php wp_terms_checklist($post_ID, array( 'taxonomy' => 'category', 'popular_cats' => $popular_ids ) ) ?>536 </ul>537 581 </div> 538 539 <?php if ( !current_user_can($tax->cap->assign_terms) ) : ?> 540 <p><em><?php _e('You cannot modify this Taxonomy.'); ?></em></p> 541 <?php endif; ?> 542 <?php if ( current_user_can($tax->cap->edit_terms) ) : ?> 543 <div id="category-adder" class="wp-hidden-children"> 544 <h4> 545 <a id="category-add-toggle" href="#category-add" class="hide-if-no-js"> 546 <?php printf( __( '+ %s' ), $tax->labels->add_new_item ); ?> 547 </a> 548 </h4> 549 <p id="category-add" class="category-add wp-hidden-child"> 550 <label class="screen-reader-text" for="newcategory"><?php echo $tax->labels->add_new_item; ?></label> 551 <input type="text" name="newcategory" id="newcategory" class="form-required form-input-tip" value="<?php echo esc_attr( $tax->labels->new_item_name ); ?>" aria-required="true"/> 552 <label class="screen-reader-text" for="newcategory_parent"> 553 <?php echo $tax->labels->parent_item_colon; ?> 554 </label> 555 <?php wp_dropdown_categories( array( 'taxonomy' => 'category', 'hide_empty' => 0, 'name' => 'newcategory_parent', 'orderby' => 'name', 'hierarchical' => 1, 'show_option_none' => '— ' . $tax->labels->parent_item . ' —' ) ); ?> 556 <input type="button" id="category-add-submit" data-wp-lists="add:categorychecklist:category-add" class="button category-add-submit" value="<?php echo esc_attr( $tax->labels->add_new_item ); ?>" /> 557 <?php wp_nonce_field( 'add-category', '_ajax_nonce-add-category', false ); ?> 558 <span id="category-ajax-response"></span> 559 </p> 582 </div> 583 <?php endif; 584 585 $tax = get_taxonomy( 'post_tag' ); 586 if ( current_user_can( $tax->cap->assign_terms ) ) : 587 ?> 588 <div id="tagsdiv-post_tag" class="postbox"> 589 <div class="handlediv" title="<?php esc_attr_e( 'Click to toggle' ); ?>"><br /></div> 590 <h3><span><?php _e('Tags'); ?></span></h3> 591 <div class="inside"> 592 <div class="tagsdiv" id="post_tag"> 593 <div class="jaxtag"> 594 <label class="screen-reader-text" for="newtag"><?php _e('Tags'); ?></label> 595 <input type="hidden" name="tax_input[post_tag]" class="the-tags" id="tax-input[post_tag]" value="" /> 596 <div class="ajaxtag"> 597 <input type="text" name="newtag[post_tag]" class="newtag form-input-tip" size="16" autocomplete="off" value="" /> 598 <input type="button" class="button tagadd" value="<?php esc_attr_e('Add'); ?>" /> 599 </div> 600 </div> 601 <div class="tagchecklist"></div> 560 602 </div> 561 <?php endif; ?> 603 <p class="tagcloud-link"><a href="#titlediv" class="tagcloud-link" id="link-post_tag"><?php _e('Choose from the most used tags'); ?></a></p> 604 </div> 562 605 </div> 563 </div> 564 </div> 565 566 <div id="tagsdiv-post_tag" class="postbox"> 567 <div class="handlediv" title="<?php esc_attr_e( 'Click to toggle' ); ?>"><br /></div> 568 <h3><span><?php _e('Tags'); ?></span></h3> 569 <div class="inside"> 570 <div class="tagsdiv" id="post_tag"> 571 <div class="jaxtag"> 572 <label class="screen-reader-text" for="newtag"><?php _e('Tags'); ?></label> 573 <input type="hidden" name="tax_input[post_tag]" class="the-tags" id="tax-input[post_tag]" value="" /> 574 <div class="ajaxtag"> 575 <input type="text" name="newtag[post_tag]" class="newtag form-input-tip" size="16" autocomplete="off" value="" /> 576 <input type="button" class="button tagadd" value="<?php esc_attr_e('Add'); ?>" /> 577 </div> 578 </div> 579 <div class="tagchecklist"></div> 580 </div> 581 <p class="tagcloud-link"><a href="#titlediv" class="tagcloud-link" id="link-post_tag"><?php _e('Choose from the most used tags'); ?></a></p> 582 </div> 583 </div> 606 <?php endif; ?> 584 607 </div> 585 608 </div>
Note: See TracChangeset
for help on using the changeset viewer.