Changeset 14593
- Timestamp:
- 05/13/2010 04:10:17 AM (15 years ago)
- Location:
- trunk
- Files:
-
- 11 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-admin/admin-ajax.php
r14581 r14593 220 220 $taxonomy = get_taxonomy(substr($action, 4)); 221 221 check_ajax_referer( $action ); 222 if ( !current_user_can( $taxonomy-> edit_cap) )222 if ( !current_user_can( $taxonomy->cap->edit_terms ) ) 223 223 die('-1'); 224 224 $names = explode(',', $_POST['new'.$taxonomy->name]); … … 335 335 $tax = get_taxonomy($taxonomy); 336 336 337 if ( !current_user_can( $tax-> delete_cap) )337 if ( !current_user_can( $tax->cap->delete_terms ) ) 338 338 die('-1'); 339 339 … … 567 567 $x = new WP_Ajax_Response(); 568 568 569 if ( !current_user_can( $tax-> edit_cap) )569 if ( !current_user_can( $tax->cap->edit_terms ) ) 570 570 die('-1'); 571 571 … … 1205 1205 $tax = get_taxonomy($taxonomy); 1206 1206 1207 if ( ! current_user_can( $tax-> edit_cap) )1207 if ( ! current_user_can( $tax->cap->edit_terms ) ) 1208 1208 die( __('Cheatin’ uh?') ); 1209 1209 -
trunk/wp-admin/edit-tags.php
r14139 r14593 42 42 check_admin_referer('add-tag'); 43 43 44 if ( !current_user_can($tax-> edit_cap) )44 if ( !current_user_can($tax->cap->edit_terms) ) 45 45 wp_die(__('Cheatin’ uh?')); 46 46 … … 80 80 check_admin_referer('delete-tag_' . $tag_ID); 81 81 82 if ( !current_user_can($tax-> delete_cap) )82 if ( !current_user_can($tax->cap->delete_terms) ) 83 83 wp_die(__('Cheatin’ uh?')); 84 84 … … 94 94 check_admin_referer('bulk-tags'); 95 95 96 if ( !current_user_can($tax-> delete_cap) )96 if ( !current_user_can($tax->cap->delete_terms) ) 97 97 wp_die(__('Cheatin’ uh?')); 98 98 … … 131 131 check_admin_referer('update-tag_' . $tag_ID); 132 132 133 if ( !current_user_can($tax-> edit_cap) )133 if ( !current_user_can($tax->cap->edit_terms) ) 134 134 wp_die(__('Cheatin’ uh?')); 135 135 … … 162 162 163 163 wp_enqueue_script('admin-tags'); 164 if ( current_user_can($tax-> edit_cap) )164 if ( current_user_can($tax->cap->edit_terms) ) 165 165 wp_enqueue_script('inline-edit-tax'); 166 166 … … 319 319 320 320 <?php 321 if ( current_user_can( $tax-> edit_cap) )321 if ( current_user_can( $tax->cap->edit_terms ) ) 322 322 $tag_cloud = wp_tag_cloud( array( 'taxonomy' => $taxonomy, 'echo' => false, 'link' => 'edit' ) ); 323 323 else … … 333 333 endif; 334 334 335 if ( current_user_can($tax-> edit_cap) ) {335 if ( current_user_can($tax->cap->edit_terms) ) { 336 336 if ( 'category' == $taxonomy ) 337 337 do_action('add_category_form_pre', (object)array('parent' => 0) ); // Back compat hook. Deprecated in preference to $taxonomy_pre_add_form -
trunk/wp-admin/includes/meta-boxes.php
r14585 r14593 250 250 $help_cloud = isset( $taxonomy->help_cloud ) ? $taxonomy->help_cloud : __('Choose from the most used tags in %s'); 251 251 252 $disabled = !current_user_can($taxonomy-> assign_cap) ? 'disabled="disabled"' : '';252 $disabled = !current_user_can($taxonomy->cap->assign_terms) ? 'disabled="disabled"' : ''; 253 253 ?> 254 254 <div class="tagsdiv" id="<?php echo $tax_name; ?>"> … … 257 257 <p><?php echo $help_nojs; ?></p> 258 258 <textarea name="<?php echo "tax_input[$tax_name]"; ?>" class="the-tags" id="tax-input[<?php echo $tax_name; ?>]" <?php echo $disabled; ?>><?php echo esc_attr(get_terms_to_edit( $post->ID, $tax_name )); ?></textarea></div> 259 <?php if ( current_user_can($taxonomy-> assign_cap) ) : ?>259 <?php if ( current_user_can($taxonomy->cap->assign_terms) ) : ?> 260 260 <div class="ajaxtag hide-if-no-js"> 261 261 <label class="screen-reader-text" for="new-tag-<?php echo $tax_name; ?>"><?php echo $box['title']; ?></label> … … 269 269 <div class="tagchecklist"></div> 270 270 </div> 271 <?php if ( current_user_can($taxonomy-> assign_cap) ) : ?>271 <?php if ( current_user_can($taxonomy->cap->assign_terms) ) : ?> 272 272 <p class="hide-if-no-js"><a href="#titlediv" class="tagcloud-link" id="link-<?php echo $tax_name; ?>"><?php printf( $help_cloud, $box['title'] ); ?></a></p> 273 273 <?php else : ?> … … 316 316 </ul> 317 317 </div> 318 <?php if ( !current_user_can($tax-> assign_cap) ) : ?>318 <?php if ( !current_user_can($tax->cap->assign_terms) ) : ?> 319 319 <p><em><?php _e('You cannot modify this Taxonomy.'); ?></em></p> 320 320 <?php endif; ?> 321 <?php if ( current_user_can($tax-> edit_cap) ) : ?>321 <?php if ( current_user_can($tax->cap->edit_terms) ) : ?> 322 322 <div id="<?php echo $taxonomy; ?>-adder" class="wp-hidden-children"> 323 323 <h4><a id="<?php echo $taxonomy; ?>-add-toggle" href="#<?php echo $taxonomy; ?>-add" class="hide-if-no-js" tabindex="3"><?php printf( __( '+ Add New %s' ), $tax->singular_label ); ?></a></h4> -
trunk/wp-admin/includes/post.php
r14588 r14593 319 319 foreach ( $tax_names as $tax_name ) { 320 320 $taxonomy_obj = get_taxonomy($tax_name); 321 if( isset( $tax_input[$tax_name]) && current_user_can( $taxonomy_obj-> assign_cap) )321 if( isset( $tax_input[$tax_name]) && current_user_can( $taxonomy_obj->cap->assign_terms ) ) 322 322 $new_terms = $tax_input[$tax_name]; 323 323 else -
trunk/wp-admin/includes/template.php
r14588 r14593 23 23 24 24 $tax = get_taxonomy($taxonomy); 25 if ( ! current_user_can( $tax-> edit_cap) )25 if ( ! current_user_can( $tax->cap->edit_terms ) ) 26 26 return; 27 27 … … 262 262 263 263 $tax = get_taxonomy($taxonomy); 264 $args['disabled'] = !current_user_can($tax-> assign_cap);264 $args['disabled'] = !current_user_can($tax->cap->assign_terms); 265 265 266 266 if ( is_array( $selected_cats ) ) … … 325 325 326 326 $tax = get_taxonomy($taxonomy); 327 if ( ! current_user_can($tax-> assign_cap) )327 if ( ! current_user_can($tax->cap->assign_terms) ) 328 328 $disabled = 'disabled="disabled"'; 329 329 else … … 437 437 switch ($column_name) { 438 438 case 'cb': 439 if ( current_user_can($tax-> delete_cap) && $tag->term_id != $default_term )439 if ( current_user_can($tax->cap->delete_terms) && $tag->term_id != $default_term ) 440 440 $out .= '<th scope="row" class="check-column"> <input type="checkbox" name="delete_tags[]" value="' . $tag->term_id . '" /></th>'; 441 441 else … … 445 445 $out .= '<td ' . $attributes . '><strong><a class="row-title" href="' . $edit_link . '" title="' . esc_attr(sprintf(__('Edit “%s”'), $name)) . '">' . $name . '</a></strong><br />'; 446 446 $actions = array(); 447 if ( current_user_can($tax-> edit_cap) ) {447 if ( current_user_can($tax->cap->edit_terms) ) { 448 448 $actions['edit'] = '<a href="' . $edit_link . '">' . __('Edit') . '</a>'; 449 449 $actions['inline hide-if-no-js'] = '<a href="#" class="editinline">' . __('Quick Edit') . '</a>'; 450 450 } 451 if ( current_user_can($tax-> delete_cap) && $tag->term_id != $default_term )451 if ( current_user_can($tax->cap->delete_terms) && $tag->term_id != $default_term ) 452 452 $actions['delete'] = "<a class='delete-tag' href='" . wp_nonce_url("edit-tags.php?action=delete&taxonomy=$taxonomy&tag_ID=$tag->term_id", 'delete-tag_' . $tag->term_id) . "'>" . __('Delete') . "</a>"; 453 453 -
trunk/wp-admin/menu.php
r14585 r14593 90 90 continue; 91 91 92 $submenu['edit.php'][$i++] = array( esc_attr($tax->label), $tax-> manage_cap, 'edit-tags.php?taxonomy=' . $tax->name );92 $submenu['edit.php'][$i++] = array( esc_attr($tax->label), $tax->cap->manage_terms, 'edit-tags.php?taxonomy=' . $tax->name ); 93 93 } 94 94 unset($tax); … … 139 139 continue; 140 140 141 $submenu["edit.php?post_type=$ptype"][$i++] = array( esc_attr($tax->label), $tax-> manage_cap, "edit-tags.php?taxonomy=$tax->name&post_type=$ptype" );141 $submenu["edit.php?post_type=$ptype"][$i++] = array( esc_attr($tax->label), $tax->cap->manage_terms, "edit-tags.php?taxonomy=$tax->name&post_type=$ptype" ); 142 142 } 143 143 } -
trunk/wp-admin/press-this.php
r14404 r14593 505 505 </div> 506 506 507 <?php if ( !current_user_can($tax-> assign_cap) ) : ?>507 <?php if ( !current_user_can($tax->cap->assign_terms) ) : ?> 508 508 <p><em><?php _e('You cannot modify this Taxonomy.'); ?></em></p> 509 509 <?php endif; ?> 510 <?php if ( current_user_can($tax-> edit_cap) ) : ?>510 <?php if ( current_user_can($tax->cap->edit_terms) ) : ?> 511 511 <div id="category-adder" class="wp-hidden-children"> 512 512 <h4><a id="category-add-toggle" href="#category-add" class="hide-if-no-js" tabindex="3"><?php printf( __( '+ Add New %s' ), $tax->singular_label ); ?></a></h4> -
trunk/wp-admin/tools.php
r14315 r14593 34 34 $tags = get_taxonomy('post_tag'); 35 35 36 if ( current_user_can($cats-> manage_cap) || current_user_can($tags->manage_cap) ) : ?>36 if ( current_user_can($cats->cap->manage_terms) || current_user_can($tags->cap->manage_terms) ) : ?> 37 37 <div class="tool-box"> 38 38 <h3 class="title"><?php _e('Category/Tag Conversion') ?></h3> -
trunk/wp-includes/link-template.php
r14585 r14593 647 647 global $post_type; 648 648 $tax = get_taxonomy($taxonomy); 649 if ( !current_user_can($tax-> edit_cap) )649 if ( !current_user_can($tax->cap->edit_terms) ) 650 650 return; 651 651 … … 669 669 function edit_tag_link( $link = '', $before = '', $after = '', $tag = null ) { 670 670 $tax = get_taxonomy('post_tag'); 671 if ( !current_user_can($tax-> edit_cap) )671 if ( !current_user_can($tax->cap->edit_terms) ) 672 672 return; 673 673 -
trunk/wp-includes/post.php
r14589 r14593 2330 2330 if ( is_array($tags) ) // array = hierarchical, string = non-hierarchical. 2331 2331 $tags = array_filter($tags); 2332 if ( current_user_can($taxonomy_obj-> assign_cap) )2332 if ( current_user_can($taxonomy_obj->cap->assign_terms) ) 2333 2333 wp_set_post_terms( $post_ID, $tags, $taxonomy ); 2334 2334 } -
trunk/wp-includes/taxonomy.php
r14563 r14593 257 257 'label' => null, 258 258 'show_tagcloud' => null, 259 '_builtin' => false 259 '_builtin' => false, 260 'capabilities' => array(), 260 261 ); 261 262 $args = wp_parse_args($args, $defaults); … … 286 287 $args['label'] = $taxonomy; 287 288 288 foreach ( array('manage_cap', 'edit_cap', 'delete_cap') as $cap ) { 289 if ( empty($args[$cap]) ) 290 $args[$cap] = 'manage_categories'; 291 } 292 if ( empty($args['assign_cap']) ) 293 $args['assign_cap'] = 'edit_posts'; 289 $default_caps = array( 290 'manage_terms' => 'manage_categories', 291 'edit_terms' => 'manage_categories', 292 'delete_terms' => 'manage_categories', 293 'assign_terms' => 'edit_posts', 294 ); 295 $args['cap'] = (object) array_merge( $default_caps, $args['capabilities'] ); 296 unset( $args['capabilities'] ); 294 297 295 298 if ( empty($args['singular_label']) )
Note: See TracChangeset
for help on using the changeset viewer.