mirror of
https://github.com/WordPress/WordPress.git
synced 2025-01-03 06:57:35 +01:00
Disable trash for attachments for now pending improvements in 3.0, fixes #11149
git-svn-id: http://svn.automattic.com/wordpress/trunk@12377 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
a8686bb67c
commit
d4d309a1c6
@ -94,9 +94,9 @@ foreach ($posts_columns as $column_name => $column_display_name ) {
|
||||
if ( current_user_can('delete_post', $post->ID) ) {
|
||||
if ( $is_trash )
|
||||
$actions['untrash'] = "<a class='submitdelete' href='" . wp_nonce_url("post.php?action=untrash&post=$post->ID", 'untrash-post_' . $post->ID) . "'>" . __('Restore') . "</a>";
|
||||
elseif ( EMPTY_TRASH_DAYS )
|
||||
elseif ( EMPTY_TRASH_DAYS && MEDIA_TRASH )
|
||||
$actions['trash'] = "<a class='submitdelete' href='" . wp_nonce_url("post.php?action=trash&post=$post->ID", 'trash-post_' . $post->ID) . "'>" . __('Trash') . "</a>";
|
||||
if ( $is_trash || !EMPTY_TRASH_DAYS )
|
||||
if ( $is_trash || !EMPTY_TRASH_DAYS || !MEDIA_TRASH )
|
||||
$actions['delete'] = "<a class='submitdelete' href='" . wp_nonce_url("post.php?action=delete&post=$post->ID", 'delete-post_' . $post->ID) . "'>" . __('Delete Permanently') . "</a>";
|
||||
}
|
||||
if ( !$is_trash )
|
||||
|
@ -1230,10 +1230,13 @@ function get_media_item( $attachment_id, $args = null ) {
|
||||
if ( $send )
|
||||
$send = "<input type='submit' class='button' name='send[$attachment_id]' value='" . esc_attr__( 'Insert into Post' ) . "' />";
|
||||
if ( $delete && current_user_can('delete_post', $attachment_id) ) {
|
||||
if ( !EMPTY_TRASH_DAYS )
|
||||
if ( !EMPTY_TRASH_DAYS ) {
|
||||
$delete = "<a href=\"" . wp_nonce_url("post.php?action=delete&post=$attachment_id", 'delete-post_' . $attachment_id) . "\" id=\"del[$attachment_id]\" class=\"delete\">" . __('Delete Permanently') . "</a>";
|
||||
else
|
||||
} elseif ( !MEDIA_TRASH ) {
|
||||
$delete = "<a href=\"#\" class=\"del-link\" onclick=\"document.getElementById('del_attachment_$attachment_id').style.display='block';return false;\">" . __('Delete') . "</a> <div id=\"del_attachment_$attachment_id\" class=\"del-attachment\" style=\"display:none;\">" . sprintf(__("You are about to delete <strong>%s</strong>."), $filename) . " <a href=\"" . wp_nonce_url("post.php?action=delete&post=$attachment_id", 'delete-post_' . $attachment_id) . "\" id=\"del[$attachment_id]\" class=\"button\">" . __('Continue') . "</a> <a href=\"#\" class=\"button\" onclick=\"this.parentNode.style.display='none';return false;\">" . __('Cancel') . "</a></div>";
|
||||
} else {
|
||||
$delete = "<a href=\"" . wp_nonce_url("post.php?action=trash&post=$attachment_id", 'trash-post_' . $attachment_id) . "\" id=\"del[$attachment_id]\" class=\"delete\">" . __('Move to Trash') . "</a> <a href=\"" . wp_nonce_url("post.php?action=untrash&post=$attachment_id", 'untrash-post_' . $attachment_id) . "\" id=\"undo[$attachment_id]\" class=\"undo hidden\">" . __('Undo') . "</a>";
|
||||
}
|
||||
} else {
|
||||
$delete = '';
|
||||
}
|
||||
|
@ -231,11 +231,13 @@ case 'delete':
|
||||
if ( !current_user_can('delete_post', $post_id) )
|
||||
wp_die( __('You are not allowed to delete this post.') );
|
||||
|
||||
$force = !EMPTY_TRASH_DAYS;
|
||||
if ( $post->post_type == 'attachment' ) {
|
||||
if ( ! wp_delete_attachment($post_id) )
|
||||
$force = ( $force || !MEDIA_TRASH );
|
||||
if ( ! wp_delete_attachment($post_id, $force) )
|
||||
wp_die( __('Error in deleting...') );
|
||||
} else {
|
||||
if ( !wp_delete_post($post_id) )
|
||||
if ( !wp_delete_post($post_id, $force) )
|
||||
wp_die( __('Error in deleting...') );
|
||||
}
|
||||
|
||||
|
@ -243,7 +243,7 @@ foreach ( $post_mime_types as $mime_type => $label ) {
|
||||
$type_links[] = "<li><a href='upload.php?post_mime_type=$mime_type'$class>" . sprintf( _n( $label[2][0], $label[2][1], $num_posts[$mime_type] ), number_format_i18n( $num_posts[$mime_type] )) . '</a>';
|
||||
}
|
||||
$type_links[] = '<li><a href="upload.php?detached=1"' . ( isset($_GET['detached']) ? ' class="current"' : '' ) . '>' . __('Unattached') . '</a>';
|
||||
if ( EMPTY_TRASH_DAYS )
|
||||
if ( EMPTY_TRASH_DAYS && ( MEDIA_TRASH || !empty($_num_posts['trash']) ) )
|
||||
$type_links[] = '<li><a href="upload.php?status=trash"' . ( (isset($_GET['status']) && $_GET['status'] == 'trash' ) ? ' class="current"' : '') . '>' . sprintf( _nx( 'Trash <span class="count">(%s)</span>', 'Trash <span class="count">(%s)</span>', $_num_posts['trash'], 'uploaded files' ), number_format_i18n( $_num_posts['trash'] ) ) . '</a>';
|
||||
|
||||
echo implode( " |</li>\n", $type_links) . '</li>';
|
||||
@ -288,7 +288,7 @@ if ( $page_links ) : ?>
|
||||
<option value="-1" selected="selected"><?php _e('Bulk Actions'); ?></option>
|
||||
<?php if ( $is_trash ) { ?>
|
||||
<option value="untrash"><?php _e('Restore'); ?></option>
|
||||
<?php } if ( $is_trash || !EMPTY_TRASH_DAYS ) { ?>
|
||||
<?php } if ( $is_trash || !EMPTY_TRASH_DAYS || !MEDIA_TRASH ) { ?>
|
||||
<option value="delete"><?php _e('Delete Permanently'); ?></option>
|
||||
<?php } else { ?>
|
||||
<option value="trash"><?php _e('Move to Trash'); ?></option>
|
||||
@ -392,7 +392,7 @@ foreach ($arc_result as $arc_row) {
|
||||
if ( current_user_can('edit_post', $post->ID) )
|
||||
$actions['edit'] = '<a href="' . get_edit_post_link($post->ID, true) . '">' . __('Edit') . '</a>';
|
||||
if ( current_user_can('delete_post', $post->ID) )
|
||||
if ( EMPTY_TRASH_DAYS )
|
||||
if ( EMPTY_TRASH_DAYS && MEDIA_TRASH )
|
||||
$actions['trash'] = "<a class='submitdelete' href='" . wp_nonce_url("post.php?action=trash&post=$post->ID", 'trash-post_' . $post->ID) . "'>" . __('Trash') . "</a>";
|
||||
else
|
||||
$actions['delete'] = "<a class='submitdelete' href='" . wp_nonce_url("post.php?action=delete&post=$post->ID", 'delete-post_' . $post->ID) . "'>" . __('Delete Permanently') . "</a>";
|
||||
@ -454,7 +454,7 @@ if ( $page_links )
|
||||
<option value="-1" selected="selected"><?php _e('Bulk Actions'); ?></option>
|
||||
<?php if ($is_trash) { ?>
|
||||
<option value="untrash"><?php _e('Restore'); ?></option>
|
||||
<?php } if ( $is_trash || !EMPTY_TRASH_DAYS ) { ?>
|
||||
<?php } if ( $is_trash || !EMPTY_TRASH_DAYS || !MEDIA_TRASH ) { ?>
|
||||
<option value="delete"><?php _e('Delete Permanently'); ?></option>
|
||||
<?php } else { ?>
|
||||
<option value="trash"><?php _e('Move to Trash'); ?></option>
|
||||
|
File diff suppressed because one or more lines are too long
@ -3619,3 +3619,7 @@ span.imgedit-scale-warn {
|
||||
border-spacing: 3px;
|
||||
padding: 3px;
|
||||
}
|
||||
|
||||
.describe .del-link {
|
||||
padding-left: 5px;
|
||||
}
|
||||
|
@ -224,6 +224,12 @@ if ( defined('WP_DEBUG') && WP_DEBUG == true ) {
|
||||
if ( defined('WP_CACHE') && WP_CACHE )
|
||||
@include WP_CONTENT_DIR . '/advanced-cache.php';
|
||||
|
||||
/**
|
||||
* Private
|
||||
*/
|
||||
if ( !defined('MEDIA_TRASH') )
|
||||
define('MEDIA_TRASH', false);
|
||||
|
||||
/**
|
||||
* Stores the location of the WordPress directory of functions, classes, and core content.
|
||||
*
|
||||
|
Loading…
Reference in New Issue
Block a user