Changeset 15632
- Timestamp:
- 09/18/2010 07:30:53 PM (14 years ago)
- Location:
- trunk/wp-admin
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-admin/admin-ajax.php
r15630 r15632 560 560 561 561 $level = 0; 562 $tag_full_name = false;563 $tag_full_name = $tag->name;564 562 if ( is_taxonomy_hierarchical($taxonomy) ) { 565 $_tag = $tag; 566 while ( $_tag->parent ) { 567 $_tag = get_term( $_tag->parent, $taxonomy ); 568 $tag_full_name = $_tag->name . ' — ' . $tag_full_name; 569 $level++; 570 } 571 $noparents = $wp_list_table->single_row( $tag, $level, $taxonomy ); 572 } 573 $tag->name = $tag_full_name; 574 $parents = $wp_list_table->single_row( $tag, 0, $taxonomy); 563 $level = count( get_ancestors( $tag->term_id, $taxonomy ) ); 564 ob_start(); 565 $wp_list_table->single_row( $tag, $level ); 566 $noparents = ob_get_clean(); 567 } 568 569 ob_start(); 570 $wp_list_table->single_row( $tag ); 571 $parents = ob_get_clean(); 575 572 576 573 $x->add( array( … … 581 578 'what' => 'term', 582 579 'position' => $level, 583 'supplemental' => get_term( $tag->term_id, $taxonomy, ARRAY_A ) // Refetch as $tag has been contaminated by the full name.580 'supplemental' => $tag 584 581 ) ); 585 582 $x->send(); … … 1228 1225 } 1229 1226 1230 echo $wp_list_table->single_row( $tag , 0, $taxonomy);1227 echo $wp_list_table->single_row( $tag ); 1231 1228 } else { 1232 1229 if ( is_wp_error($updated) && $updated->get_error_message() ) -
trunk/wp-admin/includes/default-list-tables.php
r15630 r15632 1598 1598 } 1599 1599 1600 function single_row( $tag, $level, $taxonomy = 'post_tag' ) { 1601 global $post_type, $current_screen; 1600 function single_row( $tag, $level = 0 ) { 1602 1601 static $row_class = ''; 1603 1602 $row_class = ( $row_class == '' ? ' class="alternate"' : '' ); 1604 1603 1604 $this->level = $level; 1605 1606 echo '<tr id="tag-' . $tag->term_id . '"' . $row_class . '>'; 1607 echo $this->single_row_columns( $tag ); 1608 echo '</tr>'; 1609 } 1610 1611 function column_cb( $tag ) { 1612 global $taxonomy, $tax; 1613 1614 $default_term = get_option( 'default_' . $taxonomy ); 1615 1616 if ( current_user_can( $tax->cap->delete_terms ) && $tag->term_id != $default_term ) 1617 return '<input type="checkbox" name="delete_tags[]" value="' . $tag->term_id . '" />'; 1618 else 1619 return ' '; 1620 } 1621 1622 function column_name( $tag ) { 1623 global $taxonomy, $tax, $post_type; 1624 1625 $default_term = get_option( 'default_' . $taxonomy ); 1626 1627 $pad = str_repeat( '— ', max( 0, $this->level ) ); 1628 $name = apply_filters( 'term_name', $pad . ' ' . $tag->name, $tag ); 1629 $qe_data = get_term( $tag->term_id, $taxonomy, OBJECT, 'edit' ); 1630 $edit_link = "edit-tags.php?action=edit&taxonomy=$taxonomy&post_type=$post_type&tag_ID=$tag->term_id"; 1631 1632 $out = '<strong><a class="row-title" href="' . $edit_link . '" title="' . esc_attr( sprintf( __( 'Edit “%s”' ), $name ) ) . '">' . $name . '</a></strong><br />'; 1633 1634 $actions = array(); 1635 if ( current_user_can( $tax->cap->edit_terms ) ) { 1636 $actions['edit'] = '<a href="' . $edit_link . '">' . __( 'Edit' ) . '</a>'; 1637 $actions['inline hide-if-no-js'] = '<a href="#" class="editinline">' . __( 'Quick Edit' ) . '</a>'; 1638 } 1639 if ( current_user_can( $tax->cap->delete_terms ) && $tag->term_id != $default_term ) 1640 $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>"; 1641 1642 $actions = apply_filters( 'tag_row_actions', $actions, $tag ); 1643 $actions = apply_filters( "${taxonomy}_row_actions", $actions, $tag ); 1644 1645 $out .= $this->row_actions( $actions ); 1646 $out .= '<div class="hidden" id="inline_' . $qe_data->term_id . '">'; 1647 $out .= '<div class="name">' . $qe_data->name . '</div>'; 1648 $out .= '<div class="slug">' . apply_filters( 'editable_slug', $qe_data->slug ) . '</div>'; 1649 $out .= '<div class="parent">' . $qe_data->parent . '</div></div></td>'; 1650 1651 return $out; 1652 } 1653 1654 function column_description( $tag ) { 1655 return $tag->description; 1656 } 1657 1658 function column_slug( $tag ) { 1659 return apply_filters( 'editable_slug', $tag->slug ); 1660 } 1661 1662 function column_posts( $tag ) { 1663 global $taxonomy, $post_type; 1664 1605 1665 $count = number_format_i18n( $tag->count ); 1606 $tax = get_taxonomy( $taxonomy );1607 1666 1608 1667 if ( 'post_tag' == $taxonomy ) { … … 1616 1675 } 1617 1676 1618 $pad = str_repeat( '— ', max( 0, $level ) ); 1619 $name = apply_filters( 'term_name', $pad . ' ' . $tag->name, $tag ); 1620 $qe_data = get_term( $tag->term_id, $taxonomy, object, 'edit' ); 1621 $edit_link = "edit-tags.php?action=edit&taxonomy=$taxonomy&post_type=$post_type&tag_ID=$tag->term_id"; 1622 1623 $out = ''; 1624 $out .= '<tr id="tag-' . $tag->term_id . '"' . $row_class . '>'; 1625 1626 $default_term = get_option( 'default_' . $taxonomy ); 1627 1628 list( $columns, $hidden ) = $this->get_column_headers(); 1629 1630 foreach ( $columns as $column_name => $column_display_name ) { 1631 $class = "class=\"$column_name column-$column_name\""; 1632 1633 $style = ''; 1634 if ( in_array( $column_name, $hidden ) ) 1635 $style = ' style="display:none;"'; 1636 1637 $attributes = "$class$style"; 1638 1639 switch ( $column_name ) { 1640 case 'cb': 1641 if ( current_user_can( $tax->cap->delete_terms ) && $tag->term_id != $default_term ) 1642 $out .= '<th scope="row" class="check-column"> <input type="checkbox" name="delete_tags[]" value="' . $tag->term_id . '" /></th>'; 1643 else 1644 $out .= '<th scope="row" class="check-column"> </th>'; 1645 break; 1646 case 'name': 1647 $out .= '<td ' . $attributes . '><strong><a class="row-title" href="' . $edit_link . '" title="' . esc_attr( sprintf( __( 'Edit “%s”' ), $name ) ) . '">' . $name . '</a></strong><br />'; 1648 1649 $actions = array(); 1650 if ( current_user_can( $tax->cap->edit_terms ) ) { 1651 $actions['edit'] = '<a href="' . $edit_link . '">' . __( 'Edit' ) . '</a>'; 1652 $actions['inline hide-if-no-js'] = '<a href="#" class="editinline">' . __( 'Quick Edit' ) . '</a>'; 1653 } 1654 if ( current_user_can( $tax->cap->delete_terms ) && $tag->term_id != $default_term ) 1655 $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>"; 1656 1657 $actions = apply_filters( 'tag_row_actions', $actions, $tag ); 1658 $actions = apply_filters( "${taxonomy}_row_actions", $actions, $tag ); 1659 1660 $out .= $this->row_actions( $actions ); 1661 $out .= '<div class="hidden" id="inline_' . $qe_data->term_id . '">'; 1662 $out .= '<div class="name">' . $qe_data->name . '</div>'; 1663 $out .= '<div class="slug">' . apply_filters( 'editable_slug', $qe_data->slug ) . '</div>'; 1664 $out .= '<div class="parent">' . $qe_data->parent . '</div></div></td>'; 1665 break; 1666 case 'description': 1667 $out .= "<td $attributes>$tag->description</td>"; 1668 break; 1669 case 'slug': 1670 $out .= "<td $attributes>" . apply_filters( 'editable_slug', $tag->slug ) . "</td>"; 1671 break; 1672 case 'posts': 1673 $attributes = 'class="posts column-posts num"' . $style; 1674 $out .= "<td $attributes><a href='edit.php?$tagsel=$tag->slug&post_type=$post_type'>$count</a></td>"; 1675 break; 1676 case 'links': 1677 $attributes = 'class="links column-links num"' . $style; 1678 $out .= "<td $attributes>$count</td>"; 1679 break; 1680 default: 1681 $out .= "<td $attributes>"; 1682 $out .= apply_filters( "manage_${taxonomy}_custom_column", '', $column_name, $tag->term_id ); 1683 $out .= "</td>"; 1684 } 1685 } 1686 1687 $out .= "</tr>\n"; 1688 1689 return $out; 1677 return "<a href='edit.php?$tagsel=$tag->slug&post_type=$post_type'>$count</a>"; 1678 } 1679 1680 function column_links( $tag ) { 1681 $count = number_format_i18n( $tag->count ); 1682 return $count; 1683 } 1684 1685 function column_default( $tag, $column_name ) { 1686 global $taxonomy; 1687 1688 return apply_filters( "manage_${taxonomy}_custom_column", '', $column_name, $tag->term_id ); 1689 $out .= "</td>"; 1690 1690 } 1691 1691
Note: See TracChangeset
for help on using the changeset viewer.