Ticket #21240: 21240.6.diff
File 21240.6.diff, 6.3 KB (added by , 13 years ago) |
---|
-
wp-admin/includes/class-wp-posts-list-table.php
269 269 if ( post_type_supports( $post_type, 'author' ) ) 270 270 $posts_columns['author'] = __( 'Author' ); 271 271 272 if ( empty( $post_type ) || is_object_in_taxonomy( $post_type, 'category' ) ) 272 $this->taxonomy_columns = array(); 273 274 if ( empty( $post_type ) || is_object_in_taxonomy( $post_type, 'category' ) ) { 273 275 $posts_columns['categories'] = __( 'Categories' ); 276 $this->taxonomy_columns[] = 'categories'; 277 } 274 278 275 if ( empty( $post_type ) || is_object_in_taxonomy( $post_type, 'post_tag' ) ) 279 if ( empty( $post_type ) || is_object_in_taxonomy( $post_type, 'post_tag' ) ) { 276 280 $posts_columns['tags'] = __( 'Tags' ); 281 $this->taxonomy_columns[] = 'tags'; 282 } 277 283 284 $post_type_object = get_post_type_object( $post_type ); 285 $registered_taxonomies = get_object_taxonomies( $post_type ); 286 287 if ( $post_type_object->show_taxonomy_columns && is_array( $post_type_object->show_taxonomy_columns ) ) 288 $taxonomies = $post_type_object->show_taxonomy_columns; 289 elseif ( $post_type_object->show_taxonomy_columns ) 290 $taxonomies = $registered_taxonomies; 291 else 292 $taxonomies = array(); 293 294 $custom_taxonomies = array_diff( $taxonomies, array( 'category', 'post_tag' ) ); 295 $this->taxonomy_columns = array_merge( $this->taxonomy_columns, $custom_taxonomies ); 296 $this->taxonomy_columns = apply_filters( 'show_taxonomy_columns', $this->taxonomy_columns, $post_type ); 297 298 foreach ( $this->taxonomy_columns as $taxonomy ) { 299 if ( ! in_array( $taxonomy, $registered_taxonomies ) ) 300 continue; 301 302 $taxonomy_object = get_taxonomy( $taxonomy ); 303 $posts_columns[ $taxonomy ] = $taxonomy_object->labels->name; 304 } 305 278 306 $post_status = !empty( $_REQUEST['post_status'] ) ? $_REQUEST['post_status'] : 'all'; 279 307 if ( post_type_supports( $post_type, 'comments' ) && !in_array( $post_status, array( 'pending', 'draft', 'future' ) ) ) 280 308 $posts_columns['comments'] = '<span class="vers"><img alt="' . esc_attr__( 'Comments' ) . '" src="' . esc_url( admin_url( 'images/comment-grey-bubble.png' ) ) . '" /></span>'; … … 529 557 } 530 558 else { 531 559 $attributes = 'class="post-title page-title column-title"' . $style; 532 560 533 561 $pad = str_repeat( '— ', $level ); 534 562 ?> 535 563 <td <?php echo $attributes ?>><strong><?php if ( $can_edit_post && $post->post_status != 'trash' ) { ?><a class="row-title" href="<?php echo $edit_link; ?>" title="<?php echo esc_attr( sprintf( __( 'Edit “%s”' ), $title ) ); ?>"><?php echo $pad; echo $title ?></a><?php } else { echo $pad; echo $title; }; _post_states( $post ); ?></strong> … … 603 631 echo '</td>'; 604 632 break; 605 633 606 case 'categories': 607 ?> 608 <td <?php echo $attributes ?>><?php 609 $categories = get_the_category(); 610 if ( !empty( $categories ) ) { 611 $out = array(); 612 foreach ( $categories as $c ) { 613 $out[] = sprintf( '<a href="%s">%s</a>', 614 esc_url( add_query_arg( array( 'post_type' => $post->post_type, 'category_name' => $c->slug ), 'edit.php' ) ), 615 esc_html( sanitize_term_field( 'name', $c->name, $c->term_id, 'category', 'display' ) ) 616 ); 617 } 618 /* translators: used between list items, there is a space after the comma */ 619 echo join( __( ', ' ), $out ); 620 } else { 621 _e( 'Uncategorized' ); 622 } 623 ?></td> 624 <?php 625 break; 634 case ( in_array( $column_name, $this->taxonomy_columns ) ) : 635 $taxonomy = $column_name; 636 if ( 'categories' == $column_name ) 637 $taxonomy = 'category'; 638 elseif ( 'tags' == $column_name ) 639 $taxonomy = 'post_tag'; 626 640 627 case 'tags':641 $taxonomy_object = get_taxonomy( $taxonomy ); 628 642 ?> 629 643 <td <?php echo $attributes ?>><?php 630 $t ags = get_the_tags( $post->ID);631 if ( !empty( $t ags ) ) {644 $terms = get_the_terms( $post->ID, $taxonomy ); 645 if ( !empty( $terms ) ) { 632 646 $out = array(); 633 foreach ( $t ags as $c) {647 foreach ( $terms as $t ) { 634 648 $out[] = sprintf( '<a href="%s">%s</a>', 635 esc_url( add_query_arg( array( 'post_type' => $post->post_type, 'tag' => $c->slug ), 'edit.php' ) ),636 esc_html( sanitize_term_field( 'name', $ c->name, $c->term_id, 'tag', 'display' ) )649 esc_url( add_query_arg( array( 'post_type' => $post->post_type, $taxonomy_object->query_var => $t->slug ), 'edit.php' ) ), 650 esc_html( sanitize_term_field( 'name', $t->name, $t->term_id, $taxonomy, 'display' ) ) 637 651 ); 638 652 } 639 653 /* translators: used between list items, there is a space after the comma */ 640 654 echo join( __( ', ' ), $out ); 641 655 } else { 642 _e( 'No Tags' );656 echo $taxonomy_object->labels->no_items; 643 657 } 644 658 ?></td> 645 659 <?php … … 679 693 ?></td> 680 694 <?php 681 695 break; 696 } 682 697 } 683 }684 698 ?> 685 699 </tr> 686 700 <?php -
wp-includes/post.php
980 980 '_builtin' => false, '_edit_link' => 'post.php?post=%d', 'hierarchical' => false, 981 981 'public' => false, 'rewrite' => true, 'has_archive' => false, 'query_var' => true, 982 982 'supports' => array(), 'register_meta_box_cb' => null, 983 'taxonomies' => array(), 'show_ui' => null, 'menu_position' => null, 'menu_icon' => null, 983 'taxonomies' => array(), 'show_taxonomy_columns' => false, 984 'show_ui' => null, 'menu_position' => null, 'menu_icon' => null, 984 985 'can_export' => true, 985 986 'show_in_nav_menus' => null, 'show_in_menu' => null, 'show_in_admin_bar' => null, 986 987 'delete_with_user' => null, -
wp-includes/taxonomy.php
416 416 'search_items' => array( __( 'Search Tags' ), __( 'Search Categories' ) ), 417 417 'popular_items' => array( __( 'Popular Tags' ), null ), 418 418 'all_items' => array( __( 'All Tags' ), __( 'All Categories' ) ), 419 'no_items' => array( __( 'No Tags' ), __( 'No Categories' ) ), 419 420 'parent_item' => array( null, __( 'Parent Category' ) ), 420 421 'parent_item_colon' => array( null, __( 'Parent Category:' ) ), 421 422 'edit_item' => array( __( 'Edit Tag' ), __( 'Edit Category' ) ),