Changeset 21948 for trunk/wp-admin/includes/class-wp-media-list-table.php
- Timestamp:
- 09/21/2012 10:52:54 PM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-admin/includes/class-wp-media-list-table.php
r21944 r21948 133 133 $posts_columns['title'] = _x( 'File', 'column name' ); 134 134 $posts_columns['author'] = __( 'Author' ); 135 //$posts_columns['tags'] = _x( 'Tags', 'column name' ); 135 136 $taxonomies = array(); 137 138 $taxonomies = get_taxonomies_for_attachments( 'objects' ); 139 $taxonomies = wp_filter_object_list( $taxonomies, array( 'show_admin_column' => true ), 'and', 'name' ); 140 141 $taxonomies = apply_filters( 'manage_taxonomies_for_attachment_columns', $taxonomies, 'attachment' ); 142 $taxonomies = array_filter( $taxonomies, 'taxonomy_exists' ); 143 144 foreach ( $taxonomies as $taxonomy ) { 145 if ( 'category' == $taxonomy ) 146 $column_key = 'categories'; 147 elseif ( 'post_tag' == $taxonomy ) 148 $column_key = 'tags'; 149 else 150 $column_key = 'taxonomy-' . $taxonomy; 151 152 $posts_columns[ $column_key ] = get_taxonomy( $taxonomy )->labels->name; 153 } 154 136 155 /* translators: column name */ 137 156 if ( !$this->detached ) { … … 249 268 ?> 250 269 <td <?php echo $attributes ?>><?php the_author() ?></td> 251 <?php252 break;253 254 case 'tags':255 ?>256 <td <?php echo $attributes ?>><?php257 $tags = get_the_tags();258 if ( !empty( $tags ) ) {259 $out = array();260 foreach ( $tags as $c )261 $out[] = "<a href='edit.php?tag=$c->slug'> " . esc_html( sanitize_term_field( 'name', $c->name, $c->term_id, 'post_tag', 'display' ) ) . "</a>";262 echo join( ', ', $out );263 } else {264 _e( 'No Tags' );265 }266 ?>267 </td>268 270 <?php 269 271 break; … … 340 342 341 343 default: 344 if ( 'categories' == $column_name ) 345 $taxonomy = 'category'; 346 if ( 'tags' == $column_name ) 347 $taxonomy = 'post_tag'; 348 elseif ( 0 === strpos( $column_name, 'taxonomy-' ) ) 349 $taxonomy = substr( $column_name, 9 ); 350 else 351 $taxonomy = false; 352 353 if ( $taxonomy ) { 354 $taxonomy_object = get_taxonomy( $taxonomy ); 355 echo '<td ' . $attributes . '>'; 356 if ( $terms = get_the_terms( $post->ID, $taxonomy ) ) { 357 $out = array(); 358 foreach ( $terms as $t ) { 359 $posts_in_term_qv = array(); 360 $posts_in_term_qv['taxonomy'] = $taxonomy; 361 $posts_in_term_qv['term'] = $t->slug; 362 363 $out[] = sprintf( '<a href="%s">%s</a>', 364 esc_url( add_query_arg( $posts_in_term_qv, 'upload.php' ) ), 365 esc_html( sanitize_term_field( 'name', $t->name, $t->term_id, $taxonomy, 'display' ) ) 366 ); 367 } 368 /* translators: used between list items, there is a space after the comma */ 369 echo join( __( ', ' ), $out ); 370 } else { 371 echo '—'; 372 } 373 echo '</td>'; 374 break; 375 } 342 376 ?> 343 377 <td <?php echo $attributes ?>>
Note: See TracChangeset
for help on using the changeset viewer.