From 49ea9b06efe194319be09f16f107d5faf695ba82 Mon Sep 17 00:00:00 2001
From: scribu
Date: Sat, 6 Nov 2010 23:00:17 +0000
Subject: [PATCH] WP_Media_List_Table: merge display_rows() and
display_orphans(). See #14579
git-svn-id: https://develop.svn.wordpress.org/trunk@16229 602fd350-edb4-49c9-b593-d223f7449a82
---
.../includes/class-wp-media-list-table.php | 110 ++++--------------
1 file changed, 25 insertions(+), 85 deletions(-)
diff --git a/wp-admin/includes/class-wp-media-list-table.php b/wp-admin/includes/class-wp-media-list-table.php
index f81165513b..63d72bc37b 100644
--- a/wp-admin/includes/class-wp-media-list-table.php
+++ b/wp-admin/includes/class-wp-media-list-table.php
@@ -168,11 +168,6 @@ class WP_Media_List_Table extends WP_List_Table {
function display_rows() {
global $post, $id;
- if ( $this->detached ) {
- $this->display_orphans();
- return;
- }
-
add_filter( 'the_title','esc_html' );
$alt = '';
@@ -239,25 +234,7 @@ foreach ( $columns as $column_name => $column_display_name ) {
?>
ID ) && !$this->is_trash )
- $actions['edit'] = '
- |
- ID ) ) { ?>
-
-
- |
-
-
- ID, array( 80, 60 ), true ) ) {
- printf( $edit_link, $thumb );
- } ?>
- |
-
-
-
-ID ), $matches ) )
- echo esc_html( strtoupper( $matches[1] ) );
- else
- echo strtoupper( str_replace( 'image/', '', get_post_mime_type() ) );
-?>
-detached ) {
if ( current_user_can( 'edit_post', $post->ID ) )
$actions['edit'] = '' . __( 'Edit' ) . '';
if ( current_user_can( 'delete_post', $post->ID ) )
@@ -408,35 +354,29 @@ foreach ( $columns as $column_name => $column_display_name ) {
$actions['view'] = '' . __( 'View' ) . '';
if ( current_user_can( 'edit_post', $post->ID ) )
$actions['attach'] = ''.__( 'Attach' ).'';
- $actions = apply_filters( 'media_row_actions', $actions, $post );
-
- echo $this->row_actions( $actions );
-?>
- |
-
- post_author ); echo $author->display_name; ?>
- |
-post_date && 'date' == $column_name ) {
- $t_time = $h_time = __( 'Unpublished' );
- } else {
- $t_time = get_the_time( __( 'Y/m/d g:i:s A' ) );
- $m_time = $post->post_date;
- $time = get_post_time( 'G', true );
- if ( ( abs( $t_diff = time() - $time ) ) < 86400 ) {
- if ( $t_diff < 0 )
- $h_time = sprintf( __( '%s from now' ), human_time_diff( $time ) );
- else
- $h_time = sprintf( __( '%s ago' ), human_time_diff( $time ) );
- } else {
- $h_time = mysql2date( __( 'Y/m/d' ), $m_time );
+ }
+ else {
+ if ( current_user_can( 'edit_post', $post->ID ) && !$this->is_trash )
+ $actions['edit'] = '' . __( 'Edit' ) . '';
+ if ( current_user_can( 'delete_post', $post->ID ) ) {
+ if ( $this->is_trash )
+ $actions['untrash'] = "ID ) . "'>" . __( 'Restore' ) . "";
+ elseif ( EMPTY_TRASH_DAYS && MEDIA_TRASH )
+ $actions['trash'] = "ID ) . "'>" . __( 'Trash' ) . "";
+ if ( $this->is_trash || !EMPTY_TRASH_DAYS || !MEDIA_TRASH ) {
+ $delete_ays = ( !$this->is_trash && !MEDIA_TRASH ) ? " onclick='return showNotice.warn();'" : '';
+ $actions['delete'] = "ID ) . "'>" . __( 'Delete Permanently' ) . "";
+ }
+ }
+ if ( !$this->is_trash ) {
+ $title =_draft_or_post_title( $post->post_parent );
+ $actions['view'] = '' . __( 'View' ) . '';
}
}
-?>
- |
-
-detached );
+
+ return $actions;
}
}