Changeset 13086 for trunk/wp-admin/admin-ajax.php
- Timestamp:
- 02/13/2010 05:40:47 AM (16 years ago)
- File:
-
- 1 edited
-
trunk/wp-admin/admin-ajax.php (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-admin/admin-ajax.php
r13046 r13086 539 539 $tax = get_taxonomy($taxonomy); 540 540 541 $x = new WP_Ajax_Response(); 542 541 543 if ( !current_user_can( $tax->edit_cap ) ) 542 544 die('-1'); … … 545 547 546 548 if ( !$tag || is_wp_error($tag) || (!$tag = get_term( $tag['term_id'], $taxonomy )) ) { 547 echo '<div class="error"><p>' . __('An error has occured. Please reload the page and try again.') . '</p></div>'; 548 exit; 549 $message = __('An error has occured. Please reload the page and try again.'); 550 if ( is_wp_error($tag) && $tag->get_error_message() ) 551 $message = $tag->get_error_message(); 552 553 $x->add( array( 554 'what' => 'taxonomy', 555 'data' => new WP_Error('error', $message ) 556 ) ); 557 $x->send(); 549 558 } 550 559 551 560 $level = 0; 552 561 $tag_full_name = false; 562 $tag_full_name = $tag->name; 553 563 if ( is_taxonomy_hierarchical($taxonomy) ) { 554 $tag_full_name = $tag->name;555 564 $_tag = $tag; 556 while ( $_tag->parent ) {565 while ( $_tag->parent ) { 557 566 $_tag = get_term( $_tag->parent, $taxonomy ); 558 567 $tag_full_name = $_tag->name . ' — ' . $tag_full_name; 559 568 $level++; 560 569 } 561 $tag_full_name = esc_attr($tag_full_name); 562 } 563 echo _tag_row( $tag, $level, $tag_full_name, $taxonomy ); 564 exit; 570 } 571 if ( is_taxonomy_hierarchical($taxonomy) ) 572 $noparents = _tag_row( $tag, $level, $taxonomy ); 573 $tag->name = $tag_full_name; 574 $parents = _tag_row( $tag, 0, $taxonomy); 575 576 $x->add( array( 577 'what' => 'taxonomy', 578 'supplemental' => compact('parents', 'noparents') 579 ) ); 580 $x->add( array( 581 'what' => 'term', 582 'position' => $level, 583 'supplemental' => get_term( $tag->term_id, $taxonomy, ARRAY_A ) //Refetch as $tag has been contaminated by the full name. 584 ) ); 585 $x->send(); 565 586 break; 566 587 case 'get-tagcloud' :
Note: See TracChangeset
for help on using the changeset viewer.