]> scripts.mit.edu Git - autoinstalls/wordpress.git/blobdiff - wp-admin/includes/class-wp-media-list-table.php
WordPress 3.8.3
[autoinstalls/wordpress.git] / wp-admin / includes / class-wp-media-list-table.php
index 2c2bf7c39b4b5186674414207fb70db74fc35a50..1f0067dd8ae2b16f8c78a564812426f7a74d7021 100644 (file)
@@ -47,8 +47,7 @@ class WP_Media_List_Table extends WP_List_Table {
                $type_links = array();
                $_num_posts = (array) wp_count_attachments();
                $_total_posts = array_sum($_num_posts) - $_num_posts['trash'];
-               if ( !isset( $total_orphans ) )
-                               $total_orphans = $wpdb->get_var( "SELECT COUNT( * ) FROM $wpdb->posts WHERE post_type = 'attachment' AND post_status != 'trash' AND post_parent < 1" );
+               $total_orphans = $wpdb->get_var( "SELECT COUNT( * ) FROM $wpdb->posts WHERE post_type = 'attachment' AND post_status != 'trash' AND post_parent < 1" );
                $matches = wp_match_mime_types(array_keys($post_mime_types), array_keys($_num_posts));
                foreach ( $matches as $type => $reals )
                        foreach ( $reals as $real )
@@ -176,7 +175,7 @@ class WP_Media_List_Table extends WP_List_Table {
        }
 
        function display_rows() {
-               global $post, $id;
+               global $post;
 
                add_filter( 'the_title','esc_html' );
                $alt = '';
@@ -192,7 +191,7 @@ class WP_Media_List_Table extends WP_List_Table {
                        $post_owner = ( get_current_user_id() == $post->post_author ) ? 'self' : 'other';
                        $att_title = _draft_or_post_title();
 ?>
-       <tr id='post-<?php echo $id; ?>' class='<?php echo trim( $alt . ' author-' . $post_owner . ' status-' . $post->post_status ); ?>' valign="top">
+       <tr id='post-<?php echo $post->ID; ?>' class='<?php echo trim( $alt . ' author-' . $post_owner . ' status-' . $post->post_status ); ?>' valign="top">
 <?php
 
 list( $columns, $hidden ) = $this->get_column_info();
@@ -266,7 +265,12 @@ foreach ( $columns as $column_name => $column_display_name ) {
 
        case 'author':
 ?>
-               <td <?php echo $attributes ?>><?php the_author() ?></td>
+               <td <?php echo $attributes ?>><?php
+                       printf( '<a href="%s">%s</a>',
+                               esc_url( add_query_arg( array( 'author' => get_the_author_meta('ID') ), 'upload.php' ) ),
+                               get_the_author()
+                       );
+               ?></td>
 <?php
                break;
 
@@ -297,13 +301,17 @@ foreach ( $columns as $column_name => $column_display_name ) {
                break;
 
        case 'parent':
-               if ( $post->post_parent > 0 ) {
-                       if ( get_post( $post->post_parent ) ) {
-                               $title =_draft_or_post_title( $post->post_parent );
-                       }
+               if ( $post->post_parent > 0 )
+                       $parent = get_post( $post->post_parent );
+               else
+                       $parent = false;
+
+               if ( $parent ) {
+                       $title = _draft_or_post_title( $post->post_parent );
+                       $parent_type = get_post_type_object( $parent->post_type );
 ?>
                        <td <?php echo $attributes ?>><strong>
-                               <?php if( current_user_can( 'edit_post', $post->post_parent ) ) { ?>
+                               <?php if ( current_user_can( 'edit_post', $post->post_parent ) && $parent_type->show_ui ) { ?>
                                        <a href="<?php echo get_edit_post_link( $post->post_parent ); ?>">
                                                <?php echo $title ?></a><?php
                                } else {
@@ -315,7 +323,7 @@ foreach ( $columns as $column_name => $column_display_name ) {
                } else {
 ?>
                        <td <?php echo $attributes ?>><?php _e( '(Unattached)' ); ?><br />
-                       <?php if( $user_can_edit ) {?>
+                       <?php if ( $user_can_edit ) { ?>
                                <a class="hide-if-no-js"
                                        onclick="findPosts.open( 'media[]','<?php echo $post->ID ?>' ); return false;"
                                        href="#the-list">
@@ -375,7 +383,7 @@ foreach ( $columns as $column_name => $column_display_name ) {
                }
 ?>
                <td <?php echo $attributes ?>>
-                       <?php do_action( 'manage_media_custom_column', $column_name, $id ); ?>
+                       <?php do_action( 'manage_media_custom_column', $column_name, $post->ID ); ?>
                </td>
 <?php
                break;