<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" /><style type="text/css"><!--
#msg dl { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; }
#msg dl a { font-weight: bold}
#msg dl a:link { color:#fc3; }
#msg dl a:active { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre, #msg p { overflow: auto; background: #ffc; border: 1px #fc0 solid; padding: 6px; }
#msg ul { overflow: auto; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<title>[11749] trunk: Trash status updates for posts, pages,
comments and attachments, props caesarsgrunt, see #4529</title>
</head>
<body>
<div id="msg">
<dl>
<dt>Revision</dt> <dd><a href="http://trac.wordpress.org/changeset/11749">11749</a></dd>
<dt>Author</dt> <dd>azaozz</dd>
<dt>Date</dt> <dd>2009-07-30 13:39:34 +0000 (Thu, 30 Jul 2009)</dd>
</dl>
<h3>Log Message</h3>
<pre>Trash status updates for posts, pages, comments and attachments, props caesarsgrunt, see <a href="http://trac.wordpress.org/ticket/4529">#4529</a></pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkwpadminadminajaxphp">trunk/wp-admin/admin-ajax.php</a></li>
<li><a href="#trunkwpadmincommentphp">trunk/wp-admin/comment.php</a></li>
<li><a href="#trunkwpadmineditattachmentrowsphp">trunk/wp-admin/edit-attachment-rows.php</a></li>
<li><a href="#trunkwpadmineditcommentsphp">trunk/wp-admin/edit-comments.php</a></li>
<li><a href="#trunkwpadmineditformadvancedphp">trunk/wp-admin/edit-form-advanced.php</a></li>
<li><a href="#trunkwpadmineditformcommentphp">trunk/wp-admin/edit-form-comment.php</a></li>
<li><a href="#trunkwpadmineditpageformphp">trunk/wp-admin/edit-page-form.php</a></li>
<li><a href="#trunkwpadmineditpagesphp">trunk/wp-admin/edit-pages.php</a></li>
<li><a href="#trunkwpadmineditphp">trunk/wp-admin/edit.php</a></li>
<li><a href="#trunkwpadminincludesdashboardphp">trunk/wp-admin/includes/dashboard.php</a></li>
<li><a href="#trunkwpadminincludesmediaphp">trunk/wp-admin/includes/media.php</a></li>
<li><a href="#trunkwpadminincludespostphp">trunk/wp-admin/includes/post.php</a></li>
<li><a href="#trunkwpadminincludestemplatephp">trunk/wp-admin/includes/template.php</a></li>
<li><a href="#trunkwpadminjscommondevjs">trunk/wp-admin/js/common.dev.js</a></li>
<li><a href="#trunkwpadminjscommonjs">trunk/wp-admin/js/common.js</a></li>
<li><a href="#trunkwpadminjseditcommentsdevjs">trunk/wp-admin/js/edit-comments.dev.js</a></li>
<li><a href="#trunkwpadminjseditcommentsjs">trunk/wp-admin/js/edit-comments.js</a></li>
<li><a href="#trunkwpadminmediaphp">trunk/wp-admin/media.php</a></li>
<li><a href="#trunkwpadminpagephp">trunk/wp-admin/page.php</a></li>
<li><a href="#trunkwpadminpostphp">trunk/wp-admin/post.php</a></li>
<li><a href="#trunkwpadminuploadphp">trunk/wp-admin/upload.php</a></li>
<li><a href="#trunkwpadminwpadmincss">trunk/wp-admin/wp-admin.css</a></li>
<li><a href="#trunkwpappphp">trunk/wp-app.php</a></li>
<li><a href="#trunkwpincludescommentphp">trunk/wp-includes/comment.php</a></li>
<li><a href="#trunkwpincludesfunctionsphp">trunk/wp-includes/functions.php</a></li>
<li><a href="#trunkwpincludespostphp">trunk/wp-includes/post.php</a></li>
<li><a href="#trunkwpincludesqueryphp">trunk/wp-includes/query.php</a></li>
<li><a href="#trunkwpincludesscriptloaderphp">trunk/wp-includes/script-loader.php</a></li>
<li><a href="#trunkwpsettingsphp">trunk/wp-settings.php</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkwpadminadminajaxphp"></a>
<div class="modfile"><h4>Modified: trunk/wp-admin/admin-ajax.php (11748 => 11749)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-admin/admin-ajax.php        2009-07-27 23:28:13 UTC (rev 11748)
+++ trunk/wp-admin/admin-ajax.php        2009-07-30 13:39:34 UTC (rev 11749)
</span><span class="lines">@@ -181,18 +181,27 @@
</span><span class="cx"> $id = isset($_POST['id'])? (int) $_POST['id'] : 0;
</span><span class="cx"> switch ( $action = $_POST['action'] ) :
</span><span class="cx"> case 'delete-comment' : // On success, die with time() instead of 1
</span><del>-        check_ajax_referer( "delete-comment_$id" );
</del><span class="cx">         if ( !$comment = get_comment( $id ) )
</span><span class="cx">                 die( (string) time() );
</span><span class="cx">         if ( !current_user_can( 'edit_post', $comment->comment_post_ID ) )
</span><span class="cx">                 die('-1');
</span><span class="cx">
</span><del>-        if ( isset($_POST['spam']) && 1 == $_POST['spam'] ) {
</del><ins>+        if ( isset($_POST['trash']) && 1 == $_POST['trash'] ) {
+                check_ajax_referer( "trash-comment_$id" );
+                if ( 'trash' == wp_get_comment_status( $comment->comment_ID ) )
+                        die( (string) time() );
+                $r = wp_trash_comment( $comment->comment_ID );
+        } elseif ( isset($_POST['untrash']) && 1 == $_POST['untrash'] ) {
+                check_ajax_referer( "untrash-comment_$id" );
+                $r = wp_untrash_comment( $comment->comment_ID );
+        } elseif ( isset($_POST['spam']) && 1 == $_POST['spam'] ) {
+                check_ajax_referer( "delete-comment_$id" );
</ins><span class="cx">                 if ( 'spam' == wp_get_comment_status( $comment->comment_ID ) )
</span><span class="cx">                         die( (string) time() );
</span><span class="cx">                 $r = wp_set_comment_status( $comment->comment_ID, 'spam' );
</span><span class="cx">         } else {
</span><del>-                $r = wp_set_comment_status( $comment->comment_ID, 'delete' );
</del><ins>+                check_ajax_referer( "delete-comment_$id" );
+                $r = wp_delete_comment( $comment->comment_ID );
</ins><span class="cx">         }
</span><span class="cx">         if ( $r ) // Decide if we need to send back '1' or a more complicated response including page links and comment counts
</span><span class="cx">                 _wp_ajax_delete_comment_response( $comment->comment_ID );
</span></span></pre></div>
<a id="trunkwpadmincommentphp"></a>
<div class="modfile"><h4>Modified: trunk/wp-admin/comment.php (11748 => 11749)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-admin/comment.php        2009-07-27 23:28:13 UTC (rev 11748)
+++ trunk/wp-admin/comment.php        2009-07-30 13:39:34 UTC (rev 11749)
</span><span class="lines">@@ -44,8 +44,8 @@
</span><span class="cx">         if ( !current_user_can('edit_post', $comment->comment_post_ID) )
</span><span class="cx">                 comment_footer_die( __('You are not allowed to edit comments on this post.') );
</span><span class="cx">
</span><del>-        if ( 'deleted' == $comment->comment_status )
-                comment_footer_die( __('This comment has been deleted. Please move it out of the Trash if you want to edit it.') );
</del><ins>+        if ( 'trash' == $comment->comment_status )
+                comment_footer_die( __('This comment is in the Trash. Please move it out of the Trash if you want to edit it.') );
</ins><span class="cx">         
</span><span class="cx">         $comment = get_comment_to_edit( $comment_id );
</span><span class="cx">
</span><span class="lines">@@ -166,6 +166,35 @@
</span><span class="cx">         die;
</span><span class="cx">         break;
</span><span class="cx">
</span><ins>+case 'trashcomment' :
+case 'untrashcomment' :
+        $comment_id = absint( $_REQUEST['c'] );
+        $noredir = isset($_REQUEST['noredir']);
+        
+        if (!$comment = get_comment($comment_id))
+                comment_footer_die( __('Oops, no comment with this ID.') . sprintf(' <a href="%s">'.__('Go back').'</a>!', 'edit-comments.php') );
+        if (!current_user_can('edit_post', $comment->comment_post_ID ))
+                comment_footer_die( __('You are not allowed to edit comments on this post.') );
+        
+        if ($action == 'trashcomment') {
+                check_admin_referer( 'trash-comment_' . $comment_id );
+                wp_trash_comment($comment_id);
+        }
+        else {
+                check_admin_referer( 'untrash-comment_' . $comment_id );
+                wp_untrash_comment($comment_id);
+        }
+        
+        if ('' != wp_get_referer() && false == $noredir && false === strpos(wp_get_referer(), 'comment.php' ))
+                wp_redirect( wp_get_referer() );
+        else if ('' != wp_get_original_referer() && false == $noredir)
+                wp_redirect(wp_get_original_referer());
+        else
+                wp_redirect(admin_url('edit-comments.php'));
+
+        die;
+        break;
+
</ins><span class="cx"> case 'unapprovecomment' :
</span><span class="cx">         $comment_id = absint( $_GET['c'] );
</span><span class="cx">         check_admin_referer( 'unapprove-comment_' . $comment_id );
</span></span></pre></div>
<a id="trunkwpadmineditattachmentrowsphp"></a>
<div class="modfile"><h4>Modified: trunk/wp-admin/edit-attachment-rows.php (11748 => 11749)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-admin/edit-attachment-rows.php        2009-07-27 23:28:13 UTC (rev 11748)
+++ trunk/wp-admin/edit-attachment-rows.php        2009-07-30 13:39:34 UTC (rev 11749)
</span><span class="lines">@@ -28,12 +28,18 @@
</span><span class="cx"> $alt = '';
</span><span class="cx"> $posts_columns = get_column_headers('upload');
</span><span class="cx"> $hidden = get_hidden_columns('upload');
</span><del>-while (have_posts()) : the_post();
</del><ins>+
+while ( have_posts() ) : the_post();
+
+if ( $is_trash && $post->post_status != 'trash' )
+        continue;
+elseif ( !$is_trash && $post->post_status == 'trash' )
+        continue;
+
</ins><span class="cx"> $alt = ( 'alternate' == $alt ) ? '' : 'alternate';
</span><span class="cx"> global $current_user;
</span><span class="cx"> $post_owner = ( $current_user->ID == $post->post_author ? 'self' : 'other' );
</span><span class="cx"> $att_title = _draft_or_post_title();
</span><del>-
</del><span class="cx"> ?>
</span><span class="cx">         <tr id='post-<?php echo $id; ?>' class='<?php echo trim( $alt . ' author-' . $post_owner . ' status-' . $post->post_status ); ?>' valign="top">
</span><span class="cx">
</span><span class="lines">@@ -60,13 +66,15 @@
</span><span class="cx">                 ?>
</span><span class="cx">                 <td <?php echo $attributes ?>><?php
</span><span class="cx">                         if ( $thumb = wp_get_attachment_image( $post->ID, array(80, 60), true ) ) {
</span><ins>+                                if ( $is_trash ) echo $thumb;
+                                else {
</ins><span class="cx"> ?>
</span><del>-
</del><span class="cx">                                 <a href="media.php?action=edit&amp;attachment_id=<?php the_ID(); ?>" title="<?php echo esc_attr(sprintf(__('Edit &#8220;%s&#8221;'), $att_title)); ?>">
</span><span class="cx">                                         <?php echo $thumb; ?>
</span><span class="cx">                                 </a>
</span><span class="cx">
</span><span class="cx"> <?php                        }
</span><ins>+                        }
</ins><span class="cx">                 ?></td>
</span><span class="cx">                 <?php
</span><span class="cx">                 // TODO
</span><span class="lines">@@ -74,16 +82,21 @@
</span><span class="cx">
</span><span class="cx">         case 'media':
</span><span class="cx">                 ?>
</span><del>-                <td <?php echo $attributes ?>><strong><a href="<?php echo get_edit_post_link( $post->ID ); ?>" title="<?php echo esc_attr(sprintf(__('Edit &#8220;%s&#8221;'), $att_title)); ?>"><?php echo $att_title; ?></a></strong><br />
</del><ins>+                <td <?php echo $attributes ?>><strong><?php if ( $is_trash ) echo $att_title; else { ?><a href="<?php echo get_edit_post_link( $post->ID ); ?>" title="<?php echo esc_attr(sprintf(__('Edit &#8220;%s&#8221;'), $att_title)); ?>"><?php echo $att_title; ?></a><?php } ?></strong><br />
</ins><span class="cx">                 <?php echo strtoupper(preg_replace('/^.*?\.(\w+)$/', '$1', get_attached_file($post->ID))); ?>
</span><span class="cx">                 <p>
</span><span class="cx">                 <?php
</span><span class="cx">                 $actions = array();
</span><del>-                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) )
-                        $actions['delete'] = "<a class='submitdelete' href='" . wp_nonce_url("post.php?action=delete&amp;post=$post->ID", 'delete-post_' . $post->ID) . "' onclick=\"if ( confirm('" . esc_js(sprintf( ('draft' == $post->post_status) ? __("You are about to delete this attachment '%s'\n 'Cancel' to stop, 'OK' to delete.") : __("You are about to delete this attachment '%s'\n 'Cancel' to stop, 'OK' to delete."), $post->post_title )) . "') ) { return true;}return false;\">" . __('Delete') . "</a>";
-                $actions['view'] = '<a href="' . get_permalink($post->ID) . '" title="' . esc_attr(sprintf(__('View &#8220;%s&#8221;'), $title)) . '" rel="permalink">' . __('View') . '</a>';
</del><ins>+                if ( $is_trash && current_user_can('delete_post', $post->ID) ) {
+                        $actions['untrash'] = "<a class='submitdelete' href='" . wp_nonce_url("post.php?action=untrash&amp;post=$post->ID", 'untrash-post_' . $post->ID) . "'>" . __('Restore') . "</a>";
+                        $actions['delete'] = "<a class='submitdelete' href='" . wp_nonce_url("post.php?action=delete&amp;post=$post->ID", 'delete-post_' . $post->ID) . "'>" . __('Delete Permanently') . "</a>";
+                } else {
+                        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) )
+                                $actions['trash'] = "<a class='submitdelete' href='" . wp_nonce_url("post.php?action=trash&amp;post=$post->ID", 'trash-post_' . $post->ID) . "'>" . __('Trash') . "</a>";
+                        $actions['view'] = '<a href="' . get_permalink($post->ID) . '" title="' . esc_attr(sprintf(__('View &#8220;%s&#8221;'), $title)) . '" rel="permalink">' . __('View') . '</a>';
+                }
</ins><span class="cx">                 $action_count = count($actions);
</span><span class="cx">                 $i = 0;
</span><span class="cx">                 echo '<div class="row-actions">';
</span></span></pre></div>
<a id="trunkwpadmineditcommentsphp"></a>
<div class="modfile"><h4>Modified: trunk/wp-admin/edit-comments.php (11748 => 11749)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-admin/edit-comments.php        2009-07-27 23:28:13 UTC (rev 11748)
+++ trunk/wp-admin/edit-comments.php        2009-07-30 13:39:34 UTC (rev 11749)
</span><span class="lines">@@ -14,20 +14,20 @@
</span><span class="cx">
</span><span class="cx"> $post_id = isset($_REQUEST['p']) ? (int) $_REQUEST['p'] : 0;
</span><span class="cx">
</span><del>-if ( isset($_REQUEST['doaction']) || isset($_REQUEST['doaction2']) || isset($_REQUEST['destroy_all']) || isset($_REQUEST['destroy_all2']) ) {
</del><ins>+if ( isset($_REQUEST['doaction']) || isset($_REQUEST['doaction2']) || isset($_REQUEST['delete_all']) || isset($_REQUEST['delete_all2']) ) {
</ins><span class="cx">         check_admin_referer('bulk-comments');
</span><span class="cx">         
</span><del>-        if ((isset($_REQUEST['destroy_all']) || isset($_REQUEST['destroy_all2'])) && !empty($_REQUEST['pagegen_timestamp'])) {
</del><ins>+        if ((isset($_REQUEST['delete_all']) || isset($_REQUEST['delete_all2'])) && !empty($_REQUEST['pagegen_timestamp'])) {
</ins><span class="cx">                 $comment_status = $wpdb->escape($_REQUEST['comment_status']);
</span><span class="cx">                 $delete_time = $wpdb->escape($_REQUEST['pagegen_timestamp']);
</span><span class="cx">                 $comment_ids = $wpdb->get_col( "SELECT comment_ID FROM $wpdb->comments WHERE comment_approved = '$comment_status' AND '$delete_time' > comment_date_gmt" );
</span><del>-                $doaction = 'destroy';
</del><ins>+                $doaction = 'delete';
</ins><span class="cx">         } elseif (($_REQUEST['action'] != -1 || $_REQUEST['action2'] != -1) && isset($_REQUEST['delete_comments'])) {
</span><span class="cx">                 $comment_ids = $_REQUEST['delete_comments'];
</span><span class="cx">                 $doaction = ($_REQUEST['action'] != -1) ? $_REQUEST['action'] : $_REQUEST['action2'];
</span><span class="cx">         } else wp_redirect($_SERVER['HTTP_REFERER']);
</span><span class="cx">         
</span><del>-        $approved = $unapproved = $spammed = $deleted = $destroyed = 0;
</del><ins>+        $approved = $unapproved = $spammed = $trashed = $untrashed = $deleted = 0;
</ins><span class="cx">         
</span><span class="cx">         foreach ($comment_ids as $comment_id) { // Check the permissions on each
</span><span class="cx">                 $_post_id = (int) $wpdb->get_var( $wpdb->prepare( "SELECT comment_post_ID FROM $wpdb->comments WHERE comment_ID = %d", $comment_id) );
</span><span class="lines">@@ -48,18 +48,22 @@
</span><span class="cx">                                 wp_set_comment_status($comment_id, 'spam');
</span><span class="cx">                                 $spammed++;
</span><span class="cx">                                 break;
</span><ins>+                        case 'trash' :
+                                wp_trash_comment($comment_id);
+                                $trashed++;
+                                break;
+                        case 'untrash' :
+                                wp_untrash_comment($comment_id);
+                                $untrashed++;
+                                break;
</ins><span class="cx">                         case 'delete' :
</span><del>-                                wp_set_comment_status($comment_id, 'delete');
</del><ins>+                                wp_delete_comment($comment_id);
</ins><span class="cx">                                 $deleted++;
</span><span class="cx">                                 break;
</span><del>-                        case 'destroy' :
-                                wp_set_comment_status($comment_id, 'delete');
-                                $destroyed++;
-                                break;
</del><span class="cx">                 }
</span><span class="cx">         }
</span><span class="cx">
</span><del>-        $redirect_to = 'edit-comments.php?approved=' . $approved . '&unapproved=' . $unapproved . '&spam=' . $spammed . '&deleted=' . $deleted . '&destroyed=' . $destroyed;
</del><ins>+        $redirect_to = 'edit-comments.php?approved=' . $approved . '&unapproved=' . $unapproved . '&spam=' . $spammed . '&trashed=' . $trashed . '&untrashed=' . $untrashed . '&deleted=' . $deleted;
</ins><span class="cx">         if ( $post_id )
</span><span class="cx">                 $redirect_to = add_query_arg( 'p', absint( $post_id ), $redirect_to );
</span><span class="cx">         if ( isset($_REQUEST['apage']) )
</span><span class="lines">@@ -86,7 +90,7 @@
</span><span class="cx"> $mode = ( ! isset($_GET['mode']) || empty($_GET['mode']) ) ? 'detail' : esc_attr($_GET['mode']);
</span><span class="cx">
</span><span class="cx"> $comment_status = isset($_REQUEST['comment_status']) ? $_REQUEST['comment_status'] : 'all';
</span><del>-if ( !in_array($comment_status, array('all', 'moderated', 'approved', 'spam', 'deleted')) )
</del><ins>+if ( !in_array($comment_status, array('all', 'moderated', 'approved', 'spam', 'trash')) )
</ins><span class="cx">         $comment_status = 'all';
</span><span class="cx">
</span><span class="cx"> $comment_type = !empty($_GET['comment_type']) ? esc_attr($_GET['comment_type']) : '';
</span><span class="lines">@@ -102,13 +106,14 @@
</span><span class="cx"> </h2>
</span><span class="cx">
</span><span class="cx"> <?php
</span><del>-if ( isset( $_GET['approved'] ) || isset( $_GET['deleted'] ) || isset( $_GET['destroyed'] ) || isset( $_GET['spam'] ) ) {
-        $approved = isset( $_GET['approved'] ) ? (int) $_GET['approved'] : 0;
-        $deleted = isset( $_GET['deleted'] ) ? (int) $_GET['deleted'] : 0;
-        $destroyed = isset( $_GET['destroyed'] ) ? (int) $_GET['destroyed'] : 0;
-        $spam = isset( $_GET['spam'] ) ? (int) $_GET['spam'] : 0;
</del><ins>+if ( isset($_GET['approved']) || isset($_GET['deleted']) || isset($_GET['trashed']) || isset($_GET['untrashed']) || isset($_GET['spam']) ) {
+        $approved = isset($_GET['approved']) ? (int) $_GET['approved'] : 0;
+        $deleted = isset($_GET['deleted']) ? (int) $_GET['deleted'] : 0;
+        $trashed = isset($_GET['trashed']) ? (int) $_GET['trashed'] : 0;
+        $untrashed = isset($_GET['untrashed']) ? (int) $_GET['untrashed'] : 0;
+        $spam = isset($_GET['spam']) ? (int) $_GET['spam'] : 0;
</ins><span class="cx">
</span><del>-        if ( $approved > 0 || $deleted > 0 || $destroyed > 0 || $spam > 0 ) {
</del><ins>+        if ( $approved > 0 || $deleted > 0 || $trashed > 0 || $untrashed > 0 || $spam > 0 ) {
</ins><span class="cx">                 echo '<div id="moderated" class="updated fade"><p>';
</span><span class="cx">
</span><span class="cx">                 if ( $approved > 0 ) {
</span><span class="lines">@@ -119,14 +124,18 @@
</span><span class="cx">                         printf( _n( '%s comment marked as spam', '%s comments marked as spam', $spam ), $spam );
</span><span class="cx">                         echo '<br />';
</span><span class="cx">                 }
</span><del>-                if ( $deleted > 0 ) {
-                        printf( _n( '%s comment deleted', '%s comments deleted', $deleted ), $deleted );
</del><ins>+                if ( $trashed > 0 ) {
+                        printf( _n( '%s comment moved to the trash', '%s comments moved to the trash', $trashed ), $trashed );
</ins><span class="cx">                         echo '<br />';
</span><span class="cx">                 }
</span><del>-                if ( $destroyed > 0 ) {
-                        printf( _n( '%s comment permanently deleted', '%s comments permanently deleted', $destroyed ), $destroyed );
</del><ins>+                if ( $untrashed > 0 ) {
+                        printf( _n( '%s comment removed from the trash', '%s comments removed from the trash', $untrashed ), $untrashed );
</ins><span class="cx">                         echo '<br />';
</span><span class="cx">                 }
</span><ins>+                if ( $deleted > 0 ) {
+                        printf( _n( '%s comment permanently deleted', '%s comments permanently deleted', $deleted ), $deleted );
+                        echo '<br />';
+                }
</ins><span class="cx">
</span><span class="cx">                 echo '</p></div>';
</span><span class="cx">         }
</span><span class="lines">@@ -145,7 +154,7 @@
</span><span class="cx">                 'moderated' => _n_noop('Pending <span class="count">(<span class="pending-count">%s</span>)</span>', 'Pending <span class="count">(<span class="pending-count">%s</span>)</span>'),
</span><span class="cx">                 'approved' => _n_noop('Approved', 'Approved'), // singular not used
</span><span class="cx">                 'spam' => _n_noop('Spam <span class="count">(<span class="spam-count">%s</span>)</span>', 'Spam <span class="count">(<span class="spam-count">%s</span>)</span>'),
</span><del>-                'deleted' => _n_noop('Trash <span class="count">(<span class="deleted-count">%s</span>)</span>', 'Trash <span class="count">(<span class="deleted-count">%s</span>)</span>')
</del><ins>+                'trash' => _n_noop('Trash <span class="count">(<span class="trash-count">%s</span>)</span>', 'Trash <span class="count">(<span class="trash-count">%s</span>)</span>')
</ins><span class="cx">         );
</span><span class="cx"> $link = 'edit-comments.php';
</span><span class="cx"> if ( !empty($comment_type) && 'all' != $comment_type )
</span><span class="lines">@@ -256,13 +265,13 @@
</span><span class="cx"> <?php if ( 'all' == $comment_status || 'approved' == $comment_status || 'moderated' == $comment_status ): ?>
</span><span class="cx"> <option value="markspam"><?php _e('Mark as Spam'); ?></option>
</span><span class="cx"> <?php endif; ?>
</span><del>-<?php if ( 'deleted' == $comment_status ): ?>
-<option value="unapprove"><?php _e('Return to Pending'); ?></option>
</del><ins>+<?php if ( 'trash' == $comment_status ): ?>
+<option value="untrash"><?php _e('Restore'); ?></option>
</ins><span class="cx"> <?php endif; ?>
</span><del>-<?php if ( 'deleted' == $comment_status || 'spam' == $comment_status ): ?>
-<option value="destroy"><?php _e('Delete Permanently'); ?></option>
</del><ins>+<?php if ( 'trash' == $comment_status || 'spam' == $comment_status ): ?>
+<option value="delete"><?php _e('Delete Permanently'); ?></option>
</ins><span class="cx"> <?php else: ?>
</span><del>-<option value="delete"><?php _e('Move to Trash'); ?></option>
</del><ins>+<option value="trash"><?php _e('Move to Trash'); ?></option>
</ins><span class="cx"> <?php endif; ?>
</span><span class="cx"> </select>
</span><span class="cx"> <input type="submit" name="doaction" id="doaction" value="<?php esc_attr_e('Apply'); ?>" class="button-secondary apply" />
</span><span class="lines">@@ -289,12 +298,12 @@
</span><span class="cx">         <input type="hidden" name="apage" value="<?php echo esc_attr( absint( $_GET['apage'] ) ); ?>" />
</span><span class="cx"> <?php }
</span><span class="cx">
</span><del>-if ( ( 'spam' == $comment_status || 'deleted' == $comment_status) && current_user_can ('moderate_comments') ) {
</del><ins>+if ( ( 'spam' == $comment_status || 'trash' == $comment_status) && current_user_can ('moderate_comments') ) {
</ins><span class="cx">         wp_nonce_field('bulk-destroy', '_destroy_nonce');
</span><span class="cx"> if ( 'spam' == $comment_status ) { ?>
</span><del>-                <input type="submit" name="destroy_all" id="destroy_all" value="<?php esc_attr_e('Permanently Delete All'); ?>" class="button-secondary apply" />
-<?php } elseif ( 'deleted' == $comment_status ) { ?>
-                <input type="submit" name="destroy_all" id="destroy_all" value="<?php esc_attr_e('Empty Trash'); ?>" class="button-primary apply" />
</del><ins>+                <input type="submit" name="delete_all" id="delete_all" value="<?php esc_attr_e('Empty Spam'); ?>" class="button-secondary apply" />
+<?php } elseif ( 'trash' == $comment_status ) { ?>
+                <input type="submit" name="delete_all" id="delete_all" value="<?php esc_attr_e('Empty Trash'); ?>" class="button-secondary apply" />
</ins><span class="cx"> <?php }
</span><span class="cx"> } ?>
</span><span class="cx"> <?php do_action('manage_comments_nav', $comment_status); ?>
</span><span class="lines">@@ -352,21 +361,21 @@
</span><span class="cx"> <?php if ( 'all' == $comment_status || 'approved' == $comment_status || 'moderated' == $comment_status ): ?>
</span><span class="cx"> <option value="markspam"><?php _e('Mark as Spam'); ?></option>
</span><span class="cx"> <?php endif; ?>
</span><del>-<?php if ( 'deleted' == $comment_status ): ?>
-<option value="unapprove"><?php _e('Return to Pending'); ?></option>
</del><ins>+<?php if ( 'trash' == $comment_status ): ?>
+<option value="untrash"><?php _e('Restore'); ?></option>
</ins><span class="cx"> <?php endif; ?>
</span><del>-<?php if ( 'deleted' == $comment_status || 'spam' == $comment_status ): ?>
-<option value="destroy"><?php _e('Delete Permanently'); ?></option>
</del><ins>+<?php if ( 'trash' == $comment_status || 'spam' == $comment_status ): ?>
+<option value="delete"><?php _e('Delete Permanently'); ?></option>
</ins><span class="cx"> <?php else: ?>
</span><del>-<option value="delete"><?php _e('Move to Trash'); ?></option>
</del><ins>+<option value="trash"><?php _e('Move to Trash'); ?></option>
</ins><span class="cx"> <?php endif; ?>
</span><span class="cx"> </select>
</span><span class="cx"> <input type="submit" name="doaction2" id="doaction2" value="<?php esc_attr_e('Apply'); ?>" class="button-secondary apply" />
</span><span class="cx">
</span><span class="cx"> <?php if ( 'spam' == $comment_status ) { ?>
</span><del>-<input type="submit" name="destroy_all2" id="destroy_all2" value="<?php esc_attr_e('Empty Quarantine'); ?>" class="button-secondary apply" />
-<?php } elseif ( 'deleted' == $comment_status ) { ?>
-<input type="submit" name="destroy_all2" id="destroy_all2" value="<?php esc_attr_e('Empty Trash'); ?>" class="button-secondary apply" />
</del><ins>+<input type="submit" name="delete_all2" id="delete_all2" value="<?php esc_attr_e('Empty Spam'); ?>" class="button-secondary apply" />
+<?php } elseif ( 'trash' == $comment_status ) { ?>
+<input type="submit" name="delete_all2" id="delete_all2" value="<?php esc_attr_e('Empty Trash'); ?>" class="button-secondary apply" />
</ins><span class="cx"> <?php } ?>
</span><span class="cx"> <?php do_action('manage_comments_nav', $comment_status); ?>
</span><span class="cx"> </div>
</span></span></pre></div>
<a id="trunkwpadmineditformadvancedphp"></a>
<div class="modfile"><h4>Modified: trunk/wp-admin/edit-form-advanced.php (11748 => 11749)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-admin/edit-form-advanced.php        2009-07-27 23:28:13 UTC (rev 11748)
+++ trunk/wp-admin/edit-form-advanced.php        2009-07-30 13:39:34 UTC (rev 11749)
</span><span class="lines">@@ -229,7 +229,7 @@
</span><span class="cx"> <div id="delete-action">
</span><span class="cx"> <?php
</span><span class="cx"> if ( ( 'edit' == $action ) && current_user_can('delete_post', $post->ID) ) { ?>
</span><del>-<a class="submitdelete deletion" href="<?php echo wp_nonce_url("post.php?action=delete&amp;post=$post->ID", 'delete-post_' . $post->ID); ?>" onclick="if ( confirm('<?php echo esc_js(sprintf( ('draft' == $post->post_status) ? __("You are about to delete this draft '%s'\n 'Cancel' to stop, 'OK' to delete.") : __("You are about to delete this post '%s'\n 'Cancel' to stop, 'OK' to delete."), $post->post_title )); ?>') ) {return true;}return false;"><?php _e('Delete'); ?></a>
</del><ins>+<a class="submitdelete deletion" href="<?php echo wp_nonce_url("post.php?action=trash&amp;post=$post->ID", 'trash-post_' . $post->ID); ?>"><?php _e('Move to Trash'); ?></a>
</ins><span class="cx"> <?php } ?>
</span><span class="cx"> </div>
</span><span class="cx">
</span></span></pre></div>
<a id="trunkwpadmineditformcommentphp"></a>
<div class="modfile"><h4>Modified: trunk/wp-admin/edit-form-comment.php (11748 => 11749)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-admin/edit-form-comment.php        2009-07-27 23:28:13 UTC (rev 11748)
+++ trunk/wp-admin/edit-form-comment.php        2009-07-30 13:39:34 UTC (rev 11749)
</span><span class="lines">@@ -64,7 +64,7 @@
</span><span class="cx">
</span><span class="cx"> <div id="major-publishing-actions">
</span><span class="cx"> <div id="delete-action">
</span><del>-<?php echo "<a class='submitdelete deletion' href='" . wp_nonce_url("comment.php?action=deletecomment&amp;c=$comment->comment_ID&amp;_wp_original_http_referer=" . urlencode(wp_get_referer()), 'delete-comment_' . $comment->comment_ID) . "' onclick=\"if ( confirm('" . esc_js(__("You are about to delete this comment. \n 'Cancel' to stop, 'OK' to delete.")) . "') ){return true;}return false;\">" . __('Delete') . "</a>\n"; ?>
</del><ins>+<?php echo "<a class='submitdelete deletion' href='" . wp_nonce_url("comment.php?action=deletecomment&amp;c=$comment->comment_ID&amp;_wp_original_http_referer=" . urlencode(wp_get_referer()), 'delete-comment_' . $comment->comment_ID) . "'>" . __('Move to Trash') . "</a>\n"; ?>
</ins><span class="cx"> </div>
</span><span class="cx"> <div id="publishing-action">
</span><span class="cx"> <input type="submit" name="save" value="<?php esc_attr_e('Update Comment'); ?>" tabindex="4" class="button-primary" />
</span></span></pre></div>
<a id="trunkwpadmineditpageformphp"></a>
<div class="modfile"><h4>Modified: trunk/wp-admin/edit-page-form.php (11748 => 11749)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-admin/edit-page-form.php        2009-07-27 23:28:13 UTC (rev 11748)
+++ trunk/wp-admin/edit-page-form.php        2009-07-30 13:39:34 UTC (rev 11749)
</span><span class="lines">@@ -216,7 +216,7 @@
</span><span class="cx"> <div id="delete-action">
</span><span class="cx"> <?php
</span><span class="cx"> if ( ( 'edit' == $action ) && current_user_can('delete_page', $post->ID) ) { ?>
</span><del>-<a class="submitdelete deletion" href="<?php echo wp_nonce_url("page.php?action=delete&amp;post=$post->ID", 'delete-page_' . $post->ID); ?>" onclick="if ( confirm('<?php echo esc_js(sprintf( ('draft' == $post->post_status) ? __("You are about to delete this draft '%s'\n 'Cancel' to stop, 'OK' to delete.") : __("You are about to delete this page '%s'\n 'Cancel' to stop, 'OK' to delete."), $post->post_title )); ?>') ) {return true;}return false;"><?php _e('Delete'); ?></a>
</del><ins>+<a class="submitdelete deletion" href="<?php echo wp_nonce_url("page.php?action=trash&amp;post=$post->ID", 'trash-page_' . $post->ID); ?>"><?php _e('Move to Trash'); ?></a>
</ins><span class="cx"> <?php } ?>
</span><span class="cx"> </div>
</span><span class="cx">
</span></span></pre></div>
<a id="trunkwpadmineditpagesphp"></a>
<div class="modfile"><h4>Modified: trunk/wp-admin/edit-pages.php (11748 => 11749)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-admin/edit-pages.php        2009-07-27 23:28:13 UTC (rev 11748)
+++ trunk/wp-admin/edit-pages.php        2009-07-30 13:39:34 UTC (rev 11749)
</span><span class="lines">@@ -10,45 +10,71 @@
</span><span class="cx"> require_once('admin.php');
</span><span class="cx">
</span><span class="cx"> // Handle bulk actions
</span><del>-if ( isset($_GET['action']) && ( -1 != $_GET['action'] || -1 != $_GET['action2'] ) ) {
-        $doaction = ( -1 != $_GET['action'] ) ? $_GET['action'] : $_GET['action2'];
</del><ins>+if ( isset($_GET['doaction']) || isset($_GET['doaction2']) || isset($_GET['delete_all']) || isset($_GET['delete_all2']) ) {
+        check_admin_referer('bulk-pages');
+        
+        if (isset($_GET['delete_all']) || isset($_GET['delete_all2'])) {
+                $post_status = $wpdb->escape($_GET['post_status']);
+                $post_ids = $wpdb->get_col( "SELECT ID FROM $wpdb->posts WHERE post_type='page' AND post_status = '$post_status'" );
+                $doaction = 'delete';
+        } elseif (($_GET['action'] != -1 || $_GET['action2'] != -1) && isset($_GET['post'])) {
+                $post_ids = $_GET['post'];
+                $doaction = ($_GET['action'] != -1) ? $_GET['action'] : $_GET['action2'];
+        } else wp_redirect($_SERVER['HTTP_REFERER']);
</ins><span class="cx">
</span><span class="cx">         switch ( $doaction ) {
</span><del>-                case 'delete':
-                        if ( isset($_GET['post']) && ! isset($_GET['bulk_edit']) && (isset($_GET['doaction']) || isset($_GET['doaction2'])) ) {
-                                check_admin_referer('bulk-pages');
-                                $deleted = 0;
-                                foreach( (array) $_GET['post'] as $post_id_del ) {
-                                        $post_del = & get_post($post_id_del);
</del><ins>+                case 'trash':
+                        $trashed = 0;
+                        foreach( (array) $post_ids as $post_id ) {
+                                if ( !current_user_can('delete_page', $post_id) )
+                                        wp_die( __('You are not allowed to move this page to the trash.') );
</ins><span class="cx">
</span><del>-                                        if ( !current_user_can('delete_page', $post_id_del) )
-                                                wp_die( __('You are not allowed to delete this page.') );
</del><ins>+                                if ( !wp_trash_post($post_id) )
+                                        wp_die( __('Error in moving to trash...') );
+                                
+                                $trashed++;
+                        }
+                        break;
+                case 'untrash':
+                        $untrashed = 0;
+                        foreach( (array) $post_ids as $post_id ) {
+                                if ( !current_user_can('delete_page', $post_id) )
+                                        wp_die( __('You are not allowed to remove this page from the trash.') );
</ins><span class="cx">
</span><del>-                                        if ( $post_del->post_type == 'attachment' ) {
-                                                if ( ! wp_delete_attachment($post_id_del) )
-                                                        wp_die( __('Error in deleting...') );
-                                        } else {
-                                                if ( !wp_delete_post($post_id_del) )
-                                                        wp_die( __('Error in deleting...') );
-                                        }
-                                        $deleted++;
-                                }
</del><ins>+                                if ( !wp_untrash_post($post_id) )
+                                        wp_die( __('Error in removing from trash...') );
+                                
+                                $untrashed++;
</ins><span class="cx">                         }
</span><span class="cx">                         break;
</span><del>-                case 'edit':
-                        if ( isset($_GET['post']) && isset($_GET['bulk_edit']) ) {
-                                check_admin_referer('bulk-pages');
</del><ins>+                case 'delete':
+                        $deleted = 0;
+                        foreach( (array) $post_ids as $post_id_del ) {
+                                $post_del = & get_post($post_id_del);
</ins><span class="cx">
</span><del>-                                if ( -1 == $_GET['_status'] ) {
-                                        $_GET['post_status'] = null;
-                                        unset($_GET['_status'], $_GET['post_status']);
</del><ins>+                                if ( !current_user_can('delete_page', $post_id_del) )
+                                        wp_die( __('You are not allowed to delete this page.') );
+
+                                if ( $post_del->post_type == 'attachment' ) {
+                                        if ( ! wp_delete_attachment($post_id_del) )
+                                                wp_die( __('Error in deleting...') );
</ins><span class="cx">                                 } else {
</span><del>-                                        $_GET['post_status'] = $_GET['_status'];
</del><ins>+                                        if ( !wp_delete_post($post_id_del) )
+                                                wp_die( __('Error in deleting...') );
</ins><span class="cx">                                 }
</span><del>-
-                                $done = bulk_edit_posts($_GET);
</del><ins>+                                $deleted++;
</ins><span class="cx">                         }
</span><span class="cx">                         break;
</span><ins>+                case 'edit':
+                        if ( -1 == $_GET['_status'] ) {
+                                $_GET['post_status'] = null;
+                                unset($_GET['_status'], $_GET['post_status']);
+                        } else {
+                                $_GET['post_status'] = $_GET['_status'];
+                        }
+
+                        $done = bulk_edit_posts($_GET);
+                        break;
</ins><span class="cx">         }
</span><span class="cx">
</span><span class="cx">         $sendback = wp_get_referer();
</span><span class="lines">@@ -62,6 +88,10 @@
</span><span class="cx">         }
</span><span class="cx">         if ( isset($deleted) )
</span><span class="cx">                 $sendback = add_query_arg('deleted', $deleted, $sendback);
</span><ins>+        elseif ( isset($trashed) )
+                $sendback = add_query_arg('trashed', $trashed, $sendback);
+        elseif ( isset($untrashed) )
+                $sendback = add_query_arg('untrashed', $untrashed, $sendback);
</ins><span class="cx">         wp_redirect($sendback);
</span><span class="cx">         exit();
</span><span class="cx"> } elseif ( isset($_GET['_wp_http_referer']) && ! empty($_GET['_wp_http_referer']) ) {
</span><span class="lines">@@ -79,7 +109,8 @@
</span><span class="cx">                 'future' => array(_x('Scheduled', 'page'), __('Scheduled pages'), _nx_noop('Scheduled <span class="count">(%s)</span>', 'Scheduled <span class="count">(%s)</span>', 'page')),
</span><span class="cx">                 'pending' => array(_x('Pending Review', 'page'), __('Pending pages'), _nx_noop('Pending Review <span class="count">(%s)</span>', 'Pending Review <span class="count">(%s)</span>', 'page')),
</span><span class="cx">                 'draft' => array(_x('Draft', 'page'), _x('Drafts', 'manage posts header'), _nx_noop('Draft <span class="count">(%s)</span>', 'Drafts <span class="count">(%s)</span>', 'page')),
</span><del>-                'private' => array(_x('Private', 'page'), __('Private pages'), _nx_noop('Private <span class="count">(%s)</span>', 'Private <span class="count">(%s)</span>', 'page'))
</del><ins>+                'private' => array(_x('Private', 'page'), __('Private pages'), _nx_noop('Private <span class="count">(%s)</span>', 'Private <span class="count">(%s)</span>', 'page')),
+                'trash' => array(_x('Trash', 'page'), __('Trash pages'), _nx_noop('Trash <span class="count">(%s)</span>', 'Trash <span class="count">(%s)</span>', 'page'))
</ins><span class="cx">         );
</span><span class="cx">
</span><span class="cx"> $post_stati = apply_filters('page_stati', $post_stati);
</span><span class="lines">@@ -111,28 +142,33 @@
</span><span class="cx">         printf( '<span class="subtitle">' . __('Search results for &#8220;%s&#8221;') . '</span>', esc_html( get_search_query() ) ); ?>
</span><span class="cx"> </h2>
</span><span class="cx">
</span><del>-<?php if ( isset($_GET['locked']) || isset($_GET['skipped']) || isset($_GET['updated']) || isset($_GET['deleted']) ) { ?>
</del><ins>+<?php if ( isset($_GET['locked']) || isset($_GET['skipped']) || isset($_GET['updated']) || isset($_GET['deleted']) || isset($_GET['trashed']) || isset($_GET['untrashed']) ) { ?>
</ins><span class="cx"> <div id="message" class="updated fade"><p>
</span><span class="cx"> <?php if ( isset($_GET['updated']) && (int) $_GET['updated'] ) {
</span><span class="cx">         printf( _n( '%s page updated.', '%s pages updated.', $_GET['updated'] ), number_format_i18n( $_GET['updated'] ) );
</span><span class="cx">         unset($_GET['updated']);
</span><span class="cx"> }
</span><del>-
</del><span class="cx"> if ( isset($_GET['skipped']) && (int) $_GET['skipped'] ) {
</span><span class="cx">         printf( _n( '%s page not updated, invalid parent page specified.', '%s pages not updated, invalid parent page specified.', $_GET['skipped'] ), number_format_i18n( $_GET['skipped'] ) );
</span><span class="cx">         unset($_GET['skipped']);
</span><span class="cx"> }
</span><del>-
</del><span class="cx"> if ( isset($_GET['locked']) && (int) $_GET['locked'] ) {
</span><span class="cx">         printf( _n( '%s page not updated, somebody is editing it.', '%s pages not updated, somebody is editing them.', $_GET['locked'] ), number_format_i18n( $_GET['skipped'] ) );
</span><span class="cx">         unset($_GET['locked']);
</span><span class="cx"> }
</span><del>-
</del><span class="cx"> if ( isset($_GET['deleted']) && (int) $_GET['deleted'] ) {
</span><del>-        printf( _n( 'Page deleted.', '%s pages deleted.', $_GET['deleted'] ), number_format_i18n( $_GET['deleted'] ) );
</del><ins>+        printf( _n( 'Page permanently deleted.', '%s pages permanently deleted.', $_GET['deleted'] ), number_format_i18n( $_GET['deleted'] ) );
</ins><span class="cx">         unset($_GET['deleted']);
</span><span class="cx"> }
</span><del>-$_SERVER['REQUEST_URI'] = remove_query_arg( array('locked', 'skipped', 'updated', 'deleted'), $_SERVER['REQUEST_URI'] );
</del><ins>+if ( isset($_GET['trashed']) && (int) $_GET['trashed'] ) {
+        printf( _n( 'Page moved to the trash.', '%s pages moved to the trash.', $_GET['trashed'] ), number_format_i18n( $_GET['trashed'] ) );
+        unset($_GET['trashed']);
+}
+if ( isset($_GET['untrashed']) && (int) $_GET['untrashed'] ) {
+        printf( _n( 'Page removed from the trash.', '%s pages removed from the trash.', $_GET['untrashed'] ), number_format_i18n( $_GET['untrashed'] ) );
+        unset($_GET['untrashed']);
+}
+$_SERVER['REQUEST_URI'] = remove_query_arg( array('locked', 'skipped', 'updated', 'deleted', 'trashed', 'untrashed'), $_SERVER['REQUEST_URI'] );
</ins><span class="cx"> ?>
</span><span class="cx"> </p></div>
</span><span class="cx"> <?php } ?>
</span><span class="lines">@@ -150,7 +186,7 @@
</span><span class="cx"> if ( empty($locked_post_status) ) :
</span><span class="cx"> $status_links = array();
</span><span class="cx"> $num_posts = wp_count_posts('page', 'readable');
</span><del>-$total_posts = array_sum( (array) $num_posts );
</del><ins>+$total_posts = array_sum( (array) $num_posts ) - $num_posts->trash;
</ins><span class="cx"> $class = empty($_GET['post_status']) ? ' class="current"' : '';
</span><span class="cx"> $status_links[] = "<li><a href='edit-pages.php'$class>" . sprintf( _nx( 'All <span class="count">(%s)</span>', 'All <span class="count">(%s)</span>', $total_posts, 'pages' ), number_format_i18n( $total_posts ) ) . '</a>';
</span><span class="cx"> foreach ( $post_stati as $status => $label ) {
</span><span class="lines">@@ -212,11 +248,19 @@
</span><span class="cx"> <div class="alignleft actions">
</span><span class="cx"> <select name="action">
</span><span class="cx"> <option value="-1" selected="selected"><?php _e('Bulk Actions'); ?></option>
</span><ins>+<?php if ($_GET['post_status'] == 'trash') { ?>
+<option value="untrash"><?php _e('Restore'); ?></option>
+<option value="delete"><?php _e('Delete Permanently'); ?></option>
+<?php } else { ?>
</ins><span class="cx"> <option value="edit"><?php _e('Edit'); ?></option>
</span><del>-<option value="delete"><?php _e('Delete'); ?></option>
</del><ins>+<option value="trash"><?php _e('Move to Trash'); ?></option>
+<?php } ?>
</ins><span class="cx"> </select>
</span><span class="cx"> <input type="submit" value="<?php esc_attr_e('Apply'); ?>" name="doaction" id="doaction" class="button-secondary action" />
</span><span class="cx"> <?php wp_nonce_field('bulk-pages'); ?>
</span><ins>+<?php if ($_GET['post_status'] == 'trash') { ?>
+<input type="submit" name="delete_all" id="delete_all" value="<?php esc_attr_e('Empty Trash'); ?>" class="button-secondary apply" />
+<?php } ?>
</ins><span class="cx"> </div>
</span><span class="cx">
</span><span class="cx"> <br class="clear" />
</span><span class="lines">@@ -251,10 +295,18 @@
</span><span class="cx"> <div class="alignleft actions">
</span><span class="cx"> <select name="action2">
</span><span class="cx"> <option value="-1" selected="selected"><?php _e('Bulk Actions'); ?></option>
</span><ins>+<?php if ($_GET['post_status'] == 'trash') { ?>
+<option value="untrash"><?php _e('Restore'); ?></option>
+<option value="delete"><?php _e('Delete Permanently'); ?></option>
+<?php } else { ?>
</ins><span class="cx"> <option value="edit"><?php _e('Edit'); ?></option>
</span><del>-<option value="delete"><?php _e('Delete'); ?></option>
</del><ins>+<option value="trash"><?php _e('Move to Trash'); ?></option>
+<?php } ?>
</ins><span class="cx"> </select>
</span><span class="cx"> <input type="submit" value="<?php esc_attr_e('Apply'); ?>" name="doaction2" id="doaction2" class="button-secondary action" />
</span><ins>+<?php if ($_GET['post_status'] == 'trash') { ?>
+<input type="submit" name="delete_all2" id="delete_all2" value="<?php esc_attr_e('Empty Trash'); ?>" class="button-secondary apply" />
+<?php } ?>
</ins><span class="cx"> </div>
</span><span class="cx">
</span><span class="cx"> <br class="clear" />
</span></span></pre></div>
<a id="trunkwpadmineditphp"></a>
<div class="modfile"><h4>Modified: trunk/wp-admin/edit.php (11748 => 11749)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-admin/edit.php        2009-07-27 23:28:13 UTC (rev 11748)
+++ trunk/wp-admin/edit.php        2009-07-30 13:39:34 UTC (rev 11749)
</span><span class="lines">@@ -18,45 +18,75 @@
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> // Handle bulk actions
</span><del>-if ( isset($_GET['action']) && ( -1 != $_GET['action'] || -1 != $_GET['action2'] ) ) {
-        $doaction = ( -1 != $_GET['action'] ) ? $_GET['action'] : $_GET['action2'];
-
</del><ins>+if ( isset($_GET['doaction']) || isset($_GET['doaction2']) || isset($_GET['delete_all']) || isset($_GET['delete_all2']) ) {
+        check_admin_referer('bulk-posts');
+        
+        if (isset($_GET['delete_all']) || isset($_GET['delete_all2'])) {
+                $post_status = $wpdb->escape($_GET['post_status']);
+                $post_ids = $wpdb->get_col( "SELECT ID FROM $wpdb->posts WHERE post_type='post' AND post_status = '$post_status'" );
+                $doaction = 'delete';
+        } elseif (($_GET['action'] != -1 || $_GET['action2'] != -1) && isset($_GET['post'])) {
+                $post_ids = $_GET['post'];
+                $doaction = ($_GET['action'] != -1) ? $_GET['action'] : $_GET['action2'];
+        } else wp_redirect($_SERVER['HTTP_REFERER']);
+        
</ins><span class="cx">         switch ( $doaction ) {
</span><del>-                case 'delete':
-                        if ( isset($_GET['post']) && ! isset($_GET['bulk_edit']) && (isset($_GET['doaction']) || isset($_GET['doaction2'])) ) {
-                                check_admin_referer('bulk-posts');
-                                $deleted = 0;
-                                foreach( (array) $_GET['post'] as $post_id_del ) {
-                                        $post_del = & get_post($post_id_del);
</del><ins>+                case 'trash':
+                        $trashed = 0;
+                        foreach( (array) $post_ids as $post_id ) {
+                                $post_del = & get_post($post_id);
</ins><span class="cx">
</span><del>-                                        if ( !current_user_can('delete_post', $post_id_del) )
-                                                wp_die( __('You are not allowed to delete this post.') );
</del><ins>+                                if ( !current_user_can('delete_post', $post_id_del) )
+                                        wp_die( __('You are not allowed to move this post to the trash.') );
</ins><span class="cx">
</span><del>-                                        if ( $post_del->post_type == 'attachment' ) {
-                                                if ( ! wp_delete_attachment($post_id_del) )
-                                                        wp_die( __('Error in deleting...') );
-                                        } else {
-                                                if ( !wp_delete_post($post_id_del) )
-                                                        wp_die( __('Error in deleting...') );
-                                        }
-                                        $deleted++;
-                                }
</del><ins>+                                if ( !wp_trash_post($post_id) )
+                                        wp_die( __('Error in moving to trash...') );
+                                
+                                $trashed++;
</ins><span class="cx">                         }
</span><span class="cx">                         break;
</span><del>-                case 'edit':
-                        if ( isset($_GET['post']) && isset($_GET['bulk_edit']) ) {
-                                check_admin_referer('bulk-posts');
</del><ins>+                case 'untrash':
+                        $untrashed = 0;
+                        foreach( (array) $post_ids as $post_id ) {
+                                $post_del = & get_post($post_id);
</ins><span class="cx">
</span><del>-                                if ( -1 == $_GET['_status'] ) {
-                                        $_GET['post_status'] = null;
-                                        unset($_GET['_status'], $_GET['post_status']);
</del><ins>+                                if ( !current_user_can('delete_post', $post_id_del) )
+                                        wp_die( __('You are not allowed to remove this post from the trash.') );
+
+                                if ( !wp_untrash_post($post_id) )
+                                        wp_die( __('Error in removing from trash...') );
+                                
+                                $untrashed++;
+                        }
+                        break;
+                case 'delete':
+                        $deleted = 0;
+                        foreach( (array) $post_ids as $post_id_del ) {
+                                $post_del = & get_post($post_id_del);
+
+                                if ( !current_user_can('delete_post', $post_id_del) )
+                                        wp_die( __('You are not allowed to delete this post.') );
+
+                                if ( $post_del->post_type == 'attachment' ) {
+                                        if ( ! wp_delete_attachment($post_id_del) )
+                                                wp_die( __('Error in deleting...') );
</ins><span class="cx">                                 } else {
</span><del>-                                        $_GET['post_status'] = $_GET['_status'];
</del><ins>+                                        if ( !wp_delete_post($post_id_del) )
+                                                wp_die( __('Error in deleting...') );
</ins><span class="cx">                                 }
</span><del>-
-                                $done = bulk_edit_posts($_GET);
</del><ins>+                                $deleted++;
</ins><span class="cx">                         }
</span><span class="cx">                         break;
</span><ins>+                case 'edit':
+                        if ( -1 == $_GET['_status'] ) {
+                                $_GET['post_status'] = null;
+                                unset($_GET['_status'], $_GET['post_status']);
+                        } else {
+                                $_GET['post_status'] = $_GET['_status'];
+                        }
+
+                        $done = bulk_edit_posts($_GET);
+                        break;
</ins><span class="cx">         }
</span><span class="cx">
</span><span class="cx">         $sendback = wp_get_referer();
</span><span class="lines">@@ -70,6 +100,10 @@
</span><span class="cx">         }
</span><span class="cx">         if ( isset($deleted) )
</span><span class="cx">                 $sendback = add_query_arg('deleted', $deleted, $sendback);
</span><ins>+        elseif ( isset($trashed) )
+                $sendback = add_query_arg('trashed', $trashed, $sendback);
+        elseif ( isset($untrashed) )
+                $sendback = add_query_arg('untrashed', $untrashed, $sendback);
</ins><span class="cx">         wp_redirect($sendback);
</span><span class="cx">         exit();
</span><span class="cx"> } elseif ( isset($_GET['_wp_http_referer']) && ! empty($_GET['_wp_http_referer']) ) {
</span><span class="lines">@@ -107,7 +141,7 @@
</span><span class="cx"> <?php $_SERVER['REQUEST_URI'] = remove_query_arg(array('posted'), $_SERVER['REQUEST_URI']);
</span><span class="cx"> endif; ?>
</span><span class="cx">
</span><del>-<?php if ( isset($_GET['locked']) || isset($_GET['skipped']) || isset($_GET['updated']) || isset($_GET['deleted']) ) { ?>
</del><ins>+<?php if ( isset($_GET['locked']) || isset($_GET['skipped']) || isset($_GET['updated']) || isset($_GET['deleted']) || isset($_GET['trashed']) || isset($_GET['untrashed']) ) { ?>
</ins><span class="cx"> <div id="message" class="updated fade"><p>
</span><span class="cx"> <?php if ( isset($_GET['updated']) && (int) $_GET['updated'] ) {
</span><span class="cx">         printf( _n( '%s post updated.', '%s posts updated.', $_GET['updated'] ), number_format_i18n( $_GET['updated'] ) );
</span><span class="lines">@@ -123,10 +157,20 @@
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> if ( isset($_GET['deleted']) && (int) $_GET['deleted'] ) {
</span><del>-        printf( _n( 'Post deleted.', '%s posts deleted.', $_GET['deleted'] ), number_format_i18n( $_GET['deleted'] ) );
</del><ins>+        printf( _n( 'Post permanently deleted.', '%s posts permanently deleted.', $_GET['deleted'] ), number_format_i18n( $_GET['deleted'] ) );
</ins><span class="cx">         unset($_GET['deleted']);
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+if ( isset($_GET['trashed']) && (int) $_GET['trashed'] ) {
+        printf( _n( 'Post moved to the trash.', '%s posts moved to the trash.', $_GET['trashed'] ), number_format_i18n( $_GET['trashed'] ) );
+        unset($_GET['deleted']);
+}
+
+if ( isset($_GET['untrashed']) && (int) $_GET['untrashed'] ) {
+        printf( _n( 'Post removed from the trash.', '%s posts removed from the trash.', $_GET['untrashed'] ), number_format_i18n( $_GET['untrashed'] ) );
+        unset($_GET['undeleted']);
+}
+
</ins><span class="cx"> $_SERVER['REQUEST_URI'] = remove_query_arg( array('locked', 'skipped', 'updated', 'deleted'), $_SERVER['REQUEST_URI'] );
</span><span class="cx"> ?>
</span><span class="cx"> </p></div>
</span><span class="lines">@@ -139,7 +183,7 @@
</span><span class="cx"> if ( empty($locked_post_status) ) :
</span><span class="cx"> $status_links = array();
</span><span class="cx"> $num_posts = wp_count_posts( 'post', 'readable' );
</span><del>-$total_posts = array_sum( (array) $num_posts );
</del><ins>+$total_posts = array_sum( (array) $num_posts ) - $num_posts->trash;
</ins><span class="cx"> $class = empty( $_GET['post_status'] ) ? ' class="current"' : '';
</span><span class="cx"> $status_links[] = "<li><a href='edit.php' $class>" . sprintf( _nx( 'All <span class="count">(%s)</span>', 'All <span class="count">(%s)</span>', $total_posts, 'posts' ), number_format_i18n( $total_posts ) ) . '</a>';
</span><span class="cx">
</span><span class="lines">@@ -190,8 +234,13 @@
</span><span class="cx"> <div class="alignleft actions">
</span><span class="cx"> <select name="action">
</span><span class="cx"> <option value="-1" selected="selected"><?php _e('Bulk Actions'); ?></option>
</span><ins>+<?php if ($_GET['post_status'] == 'trash') { ?>
+<option value="untrash"><?php _e('Restore'); ?></option>
+<option value="delete"><?php _e('Delete Permanently'); ?></option>
+<?php } else { ?>
</ins><span class="cx"> <option value="edit"><?php _e('Edit'); ?></option>
</span><del>-<option value="delete"><?php _e('Delete'); ?></option>
</del><ins>+<option value="trash"><?php _e('Move to Trash'); ?></option>
+<?php } ?>
</ins><span class="cx"> </select>
</span><span class="cx"> <input type="submit" value="<?php esc_attr_e('Apply'); ?>" name="doaction" id="doaction" class="button-secondary action" />
</span><span class="cx"> <?php wp_nonce_field('bulk-posts'); ?>
</span><span class="lines">@@ -235,7 +284,8 @@
</span><span class="cx"> do_action('restrict_manage_posts');
</span><span class="cx"> ?>
</span><span class="cx"> <input type="submit" id="post-query-submit" value="<?php esc_attr_e('Filter'); ?>" class="button-secondary" />
</span><del>-
</del><ins>+<?php } if ( $_GET['post_status'] == 'trash' ) { ?>
+<input type="submit" name="delete_all" id="delete_all" value="<?php esc_attr_e('Empty Trash'); ?>" class="button-secondary apply" />
</ins><span class="cx"> <?php } ?>
</span><span class="cx"> </div>
</span><span class="cx">
</span><span class="lines">@@ -270,10 +320,18 @@
</span><span class="cx"> <div class="alignleft actions">
</span><span class="cx"> <select name="action2">
</span><span class="cx"> <option value="-1" selected="selected"><?php _e('Bulk Actions'); ?></option>
</span><ins>+<?php if ( $_GET['post_status'] == 'trash' ) { ?>
+<option value="untrash"><?php _e('Restore'); ?></option>
+<option value="delete"><?php _e('Delete Permanently'); ?></option>
+<?php } else { ?>
</ins><span class="cx"> <option value="edit"><?php _e('Edit'); ?></option>
</span><del>-<option value="delete"><?php _e('Delete'); ?></option>
</del><ins>+<option value="trash"><?php _e('Move to Trash'); ?></option>
+<?php } ?>
</ins><span class="cx"> </select>
</span><span class="cx"> <input type="submit" value="<?php esc_attr_e('Apply'); ?>" name="doaction2" id="doaction2" class="button-secondary action" />
</span><ins>+<?php if ( $_GET['post_status'] == 'trash' ) { ?>
+<input type="submit" name="delete_all2" id="delete_all2" value="<?php esc_attr_e('Empty Trash'); ?>" class="button-secondary apply" />
+<?php } ?>
</ins><span class="cx"> <br class="clear" />
</span><span class="cx"> </div>
</span><span class="cx"> <br class="clear" />
</span></span></pre></div>
<a id="trunkwpadminincludesdashboardphp"></a>
<div class="modfile"><h4>Modified: trunk/wp-admin/includes/dashboard.php (11748 => 11749)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-admin/includes/dashboard.php        2009-07-27 23:28:13 UTC (rev 11748)
+++ trunk/wp-admin/includes/dashboard.php        2009-07-30 13:39:34 UTC (rev 11749)
</span><span class="lines">@@ -480,7 +480,7 @@
</span><span class="cx">         $comments = array();
</span><span class="cx">         $start = 0;
</span><span class="cx">
</span><del>-        while ( count( $comments ) < 5 && $possible = $wpdb->get_results( "SELECT * FROM $wpdb->comments ORDER BY comment_date_gmt DESC LIMIT $start, 50" ) ) {
</del><ins>+        while ( count( $comments ) < 5 && $possible = $wpdb->get_results( "SELECT * FROM $wpdb->comments c LEFT JOIN $wpdb->posts p ON c.comment_post_ID = p.ID WHERE p.post_status != 'trash' ORDER BY c.comment_date_gmt DESC LIMIT $start, 50" ) ) {
</ins><span class="cx">
</span><span class="cx">                 foreach ( $possible as $comment ) {
</span><span class="cx">                         if ( count( $comments ) >= 5 )
</span></span></pre></div>
<a id="trunkwpadminincludesmediaphp"></a>
<div class="modfile"><h4>Modified: trunk/wp-admin/includes/media.php (11748 => 11749)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-admin/includes/media.php        2009-07-27 23:28:13 UTC (rev 11748)
+++ trunk/wp-admin/includes/media.php        2009-07-30 13:39:34 UTC (rev 11749)
</span><span class="lines">@@ -1166,15 +1166,13 @@
</span><span class="cx">                 'extra_rows' => array(),
</span><span class="cx">         );
</span><span class="cx">
</span><del>-        $delete_href = wp_nonce_url("post.php?action=delete-post&amp;post=$attachment_id", 'delete-post_' . $attachment_id);
</del><ins>+        $delete_href = wp_nonce_url("post.php?action=trash&amp;post=$attachment_id", 'delete-post_' . $attachment_id);
</ins><span class="cx">         if ( $send )
</span><span class="cx">                 $send = "<input type='submit' class='button' name='send[$attachment_id]' value='" . esc_attr__( 'Insert into Post' ) . "' />";
</span><span class="cx">         if ( $delete )
</span><del>-                $delete = "<a href=\"#\" class=\"del-link\" onclick=\"document.getElementById('del_attachment_$attachment_id').style.display='block';return false;\">" . __('Delete') . "</a>";
</del><ins>+                $delete = "<a href=\"$delete_href\" id=\"del[$attachment_id]\" class=\"delete\">" . __('Move to Trash') . "</a>";
</ins><span class="cx">         if ( ( $send || $delete ) && !isset($form_fields['buttons']) )
</span><del>-                $form_fields['buttons'] = array('tr' => "\t\t<tr class='submit'><td></td><td class='savesend'>$send $delete
-                <div id=\"del_attachment_$attachment_id\" class=\"del-attachment\" style=\"display:none;\">" . sprintf(__("You are about to delete <strong>%s</strong>."), $filename) . " <a href=\"$delete_href\" id=\"del[$attachment_id]\" class=\"delete\">" . __('Continue') . "</a>
-                <a href=\"#\" class=\"del-link\" onclick=\"this.parentNode.style.display='none';return false;\">" . __('Cancel') . "</a></div></td></tr>\n");
</del><ins>+                $form_fields['buttons'] = array('tr' => "\t\t<tr class='submit'><td></td><td class='savesend'>$send $delete</td></tr>\n");
</ins><span class="cx">
</span><span class="cx">         $hidden_fields = array();
</span><span class="cx">
</span></span></pre></div>
<a id="trunkwpadminincludespostphp"></a>
<div class="modfile"><h4>Modified: trunk/wp-admin/includes/post.php (11748 => 11749)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-admin/includes/post.php        2009-07-27 23:28:13 UTC (rev 11748)
+++ trunk/wp-admin/includes/post.php        2009-07-30 13:39:34 UTC (rev 11749)
</span><span class="lines">@@ -795,6 +795,7 @@
</span><span class="cx">                                 'pending' => array(_x('Pending Review', 'post'), __('Pending posts'), _n_noop('Pending Review <span class="count">(%s)</span>', 'Pending Review <span class="count">(%s)</span>')),
</span><span class="cx">                                 'draft' => array(_x('Draft', 'post'), _x('Drafts', 'manage posts header'), _n_noop('Draft <span class="count">(%s)</span>', 'Drafts <span class="count">(%s)</span>')),
</span><span class="cx">                                 'private' => array(_x('Private', 'post'), __('Private posts'), _n_noop('Private <span class="count">(%s)</span>', 'Private <span class="count">(%s)</span>')),
</span><ins>+                                'trash' => array(_x('Trash', 'post'), __('Trash posts'), _n_noop('Trash <span class="count">(%s)</span>', 'Trash <span class="count">(%s)</span>')),
</ins><span class="cx">                         );
</span><span class="cx">
</span><span class="cx">         $post_stati = apply_filters('post_stati', $post_stati);
</span><span class="lines">@@ -858,7 +859,7 @@
</span><span class="cx">         $q['m'] = isset( $q['m'] ) ? (int) $q['m'] : 0;
</span><span class="cx">         $q['cat'] = isset( $q['cat'] ) ? (int) $q['cat'] : 0;
</span><span class="cx">         $q['post_type'] = 'attachment';
</span><del>-        $q['post_status'] = 'any';
</del><ins>+        $q['post_status'] = isset( $q['status'] ) && 'trash' == $q['status'] ? 'trash' : 'any';
</ins><span class="cx">         $media_per_page = get_user_option('upload_per_page');
</span><span class="cx">         if ( empty($media_per_page) )
</span><span class="cx">                 $media_per_page = 20;
</span></span></pre></div>
<a id="trunkwpadminincludestemplatephp"></a>
<div class="modfile"><h4>Modified: trunk/wp-admin/includes/template.php (11748 => 11749)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-admin/includes/template.php        2009-07-27 23:28:13 UTC (rev 11748)
+++ trunk/wp-admin/includes/template.php        2009-07-30 13:39:34 UTC (rev 11749)
</span><span class="lines">@@ -1433,24 +1433,29 @@
</span><span class="cx">                 case 'title':
</span><span class="cx">                         $attributes = 'class="post-title column-title"' . $style;
</span><span class="cx">                 ?>
</span><del>-                <td <?php echo $attributes ?>><strong><?php if ( current_user_can( 'edit_post', $post->ID ) ) { ?><a class="row-title" href="<?php echo $edit_link; ?>" title="<?php echo esc_attr(sprintf(__('Edit &#8220;%s&#8221;'), $title)); ?>"><?php echo $title ?></a><?php } else { echo $title; }; _post_states($post); ?></strong>
</del><ins>+                <td <?php echo $attributes ?>><strong><?php if ( current_user_can('edit_post', $post->ID) && $post->post_status != 'trash' ) { ?><a class="row-title" href="<?php echo $edit_link; ?>" title="<?php echo esc_attr(sprintf(__('Edit &#8220;%s&#8221;'), $title)); ?>"><?php echo $title ?></a><?php } else { echo $title; }; _post_states($post); ?></strong>
</ins><span class="cx">                 <?php
</span><span class="cx">                         if ( 'excerpt' == $mode )
</span><span class="cx">                                 the_excerpt();
</span><span class="cx">
</span><span class="cx">                         $actions = array();
</span><del>-                        if ( current_user_can('edit_post', $post->ID) ) {
-                                $actions['edit'] = '<a href="' . get_edit_post_link($post->ID, true) . '" title="' . esc_attr(__('Edit this post')) . '">' . __('Edit') . '</a>';
-                                $actions['inline hide-if-no-js'] = '<a href="#" class="editinline" title="' . esc_attr(__('Edit this post inline')) . '">' . __('Quick&nbsp;Edit') . '</a>';
-                        }
-                        if ( current_user_can('delete_post', $post->ID) ) {
-                                $actions['delete'] = "<a class='submitdelete' title='" . esc_attr(__('Delete this post')) . "' href='" . wp_nonce_url("post.php?action=delete&amp;post=$post->ID", 'delete-post_' . $post->ID) . "' onclick=\"if ( confirm('" . esc_js(sprintf( ('draft' == $post->post_status) ? __("You are about to delete this draft '%s'\n 'Cancel' to stop, 'OK' to delete.") : __("You are about to delete this post '%s'\n 'Cancel' to stop, 'OK' to delete."), $post->post_title )) . "') ) { return true;}return false;\">" . __('Delete') . "</a>";
-                        }
-                        if ( in_array($post->post_status, array('pending', 'draft')) ) {
-                                if ( current_user_can('edit_post', $post->ID) )
-                                        $actions['view'] = '<a href="' . get_permalink($post->ID) . '" title="' . esc_attr(sprintf(__('Preview &#8220;%s&#8221;'), $title)) . '" rel="permalink">' . __('Preview') . '</a>';
</del><ins>+                        if ( 'trash' == $post->post_status && current_user_can('delete_post', $post->ID) ) {
+                                $actions['untrash'] = "<a title='" . esc_attr(__('Remove this post from the Trash')) . "' href='" . wp_nonce_url("post.php?action=untrash&amp;post=$post->ID", 'untrash-post_' . $post->ID) . "'>" . __('Restore') . "</a>";
+                                $actions['delete'] = "<a class='submitdelete' title='" . esc_attr(__('Delete this post permanently')) . "' href='" . wp_nonce_url("post.php?action=delete&amp;post=$post->ID", 'delete-post_' . $post->ID) . "'>" . __('Delete Permanently') . "</a>";
</ins><span class="cx">                         } else {
</span><del>-                                $actions['view'] = '<a href="' . get_permalink($post->ID) . '" title="' . esc_attr(sprintf(__('View &#8220;%s&#8221;'), $title)) . '" rel="permalink">' . __('View') . '</a>';
</del><ins>+                                if ( current_user_can('edit_post', $post->ID) ) {
+                                        $actions['edit'] = '<a href="' . get_edit_post_link($post->ID, true) . '" title="' . esc_attr(__('Edit this post')) . '">' . __('Edit') . '</a>';
+                                        $actions['inline hide-if-no-js'] = '<a href="#" class="editinline" title="' . esc_attr(__('Edit this post inline')) . '">' . __('Quick&nbsp;Edit') . '</a>';
+                                }
+                                if ( current_user_can('delete_post', $post->ID) ) {
+                                        $actions['trash'] = "<a class='submitdelete' title='" . esc_attr(__('Move this post to the Trash')) . "' href='" . wp_nonce_url("post.php?action=trash&amp;post=$post->ID", 'trash-post_' . $post->ID) . "'>" . __('Trash') . "</a>";
+                                }
+                                if ( in_array($post->post_status, array('pending', 'draft')) ) {
+                                        if ( current_user_can('edit_post', $post->ID) )
+                                                $actions['view'] = '<a href="' . get_permalink($post->ID) . '" title="' . esc_attr(sprintf(__('Preview &#8220;%s&#8221;'), $title)) . '" rel="permalink">' . __('Preview') . '</a>';
+                                } else {
+                                        $actions['view'] = '<a href="' . get_permalink($post->ID) . '" title="' . esc_attr(sprintf(__('View &#8220;%s&#8221;'), $title)) . '" rel="permalink">' . __('View') . '</a>';
+                                }
</ins><span class="cx">                         }
</span><span class="cx">                         $actions = apply_filters('post_row_actions', $actions, $post);
</span><span class="cx">                         $action_count = count($actions);
</span><span class="lines">@@ -1651,21 +1656,26 @@
</span><span class="cx">                 $attributes = 'class="post-title page-title column-title"' . $style;
</span><span class="cx">                 $edit_link = get_edit_post_link( $page->ID );
</span><span class="cx">                 ?>
</span><del>-                <td <?php echo $attributes ?>><strong><?php if ( current_user_can( 'edit_page', $page->ID ) ) { ?><a class="row-title" href="<?php echo $edit_link; ?>" title="<?php echo esc_attr(sprintf(__('Edit &#8220;%s&#8221;'), $title)); ?>"><?php echo $pad; echo $title ?></a><?php } else { echo $pad; echo $title; }; _post_states($page); echo isset($parent_name) ? ' | ' . __('Parent Page: ') . esc_html($parent_name) : ''; ?></strong>
</del><ins>+                <td <?php echo $attributes ?>><strong><?php if ( current_user_can('edit_page', $page->ID) && $post->post_status != 'trash' ) { ?><a class="row-title" href="<?php echo $edit_link; ?>" title="<?php echo esc_attr(sprintf(__('Edit &#8220;%s&#8221;'), $title)); ?>"><?php echo $pad; echo $title ?></a><?php } else { echo $pad; echo $title; }; _post_states($page); echo isset($parent_name) ? ' | ' . __('Parent Page: ') . esc_html($parent_name) : ''; ?></strong>
</ins><span class="cx">                 <?php
</span><span class="cx">                 $actions = array();
</span><del>-                if ( current_user_can('edit_page', $page->ID) ) {
-                        $actions['edit'] = '<a href="' . $edit_link . '" title="' . esc_attr(__('Edit this page')) . '">' . __('Edit') . '</a>';
-                        $actions['inline'] = '<a href="#" class="editinline">' . __('Quick&nbsp;Edit') . '</a>';
-                }
-                if ( current_user_can('delete_page', $page->ID) ) {
-                        $actions['delete'] = "<a class='submitdelete' title='" . esc_attr(__('Delete this page')) . "' href='" . wp_nonce_url("page.php?action=delete&amp;post=$page->ID", 'delete-page_' . $page->ID) . "' onclick=\"if ( confirm('" . esc_js(sprintf( ('draft' == $page->post_status) ? __("You are about to delete this draft '%s'\n 'Cancel' to stop, 'OK' to delete.") : __("You are about to delete this page '%s'\n 'Cancel' to stop, 'OK' to delete."), $page->post_title )) . "') ) { return true;}return false;\">" . __('Delete') . "</a>";
-                }
-                if ( in_array($post->post_status, array('pending', 'draft')) ) {
-                        if ( current_user_can('edit_page', $page->ID) )
-                                $actions['view'] = '<a href="' . get_permalink($page->ID) . '" title="' . esc_attr(sprintf(__('Preview &#8220;%s&#8221;'), $title)) . '" rel="permalink">' . __('Preview') . '</a>';
</del><ins>+                if ($post->post_status == 'trash' && current_user_can('delete_page', $page->ID)) {
+                        $actions['untrash'] = "<a title='" . esc_attr(__('Remove this page from the Trash')) . "' href='" . wp_nonce_url("page.php?action=untrash&amp;post=$page->ID", 'untrash-page_' . $page->ID) . "'>" . __('Restore') . "</a>";
+                        $actions['delete'] = "<a class='submitdelete' title='" . esc_attr(__('Delete this page permanently')) . "' href='" . wp_nonce_url("page.php?action=delete&amp;post=$page->ID", 'delete-page_' . $page->ID) . "'>" . __('Delete Permanently') . "</a>";
</ins><span class="cx">                 } else {
</span><del>-                        $actions['view'] = '<a href="' . get_permalink($page->ID) . '" title="' . esc_attr(sprintf(__('View &#8220;%s&#8221;'), $title)) . '" rel="permalink">' . __('View') . '</a>';
</del><ins>+                        if ( current_user_can('edit_page', $page->ID) ) {
+                                $actions['edit'] = '<a href="' . $edit_link . '" title="' . esc_attr(__('Edit this page')) . '">' . __('Edit') . '</a>';
+                                $actions['inline'] = '<a href="#" class="editinline">' . __('Quick&nbsp;Edit') . '</a>';
+                        }
+                        if ( current_user_can('delete_page', $page->ID) ) {
+                                $actions['trash'] = "<a class='submitdelete' title='" . esc_attr(__('Move this page to the Trash')) . "' href='" . wp_nonce_url("page.php?action=trash&amp;post=$page->ID", 'trash-page_' . $page->ID) . "'>" . __('Trash') . "</a>";
+                        }
+                        if ( in_array($post->post_status, array('pending', 'draft')) ) {
+                                if ( current_user_can('edit_page', $page->ID) )
+                                        $actions['view'] = '<a href="' . get_permalink($page->ID) . '" title="' . esc_attr(sprintf(__('Preview &#8220;%s&#8221;'), $title)) . '" rel="permalink">' . __('Preview') . '</a>';
+                        } else {
+                                $actions['view'] = '<a href="' . get_permalink($page->ID) . '" title="' . esc_attr(sprintf(__('View &#8220;%s&#8221;'), $title)) . '" rel="permalink">' . __('View') . '</a>';
+                        }
</ins><span class="cx">                 }
</span><span class="cx">                 $actions = apply_filters('page_row_actions', $actions, $page);
</span><span class="cx">                 $action_count = count($actions);
</span><span class="lines">@@ -1981,7 +1991,7 @@
</span><span class="cx"> *
</span><span class="cx"> * @since unknown
</span><span class="cx"> *
</span><del>- * @param string $status Comment status (approved, spam, deleted, etc)
</del><ins>+ * @param string $status Comment status (approved, spam, trash, etc)
</ins><span class="cx"> * @param string $s Term to search for
</span><span class="cx"> * @param int $start Offset to start at for pagination
</span><span class="cx"> * @param int $num Maximum number of comments to return
</span><span class="lines">@@ -1999,62 +2009,63 @@
</span><span class="cx">         $index = '';
</span><span class="cx">
</span><span class="cx">         if ( 'moderated' == $status ) {
</span><del>-                $approved = "comment_approved = '0'";
</del><ins>+                $approved = "c.comment_approved = '0'";
</ins><span class="cx">                 $total = $count->moderated;
</span><span class="cx">         } elseif ( 'approved' == $status ) {
</span><del>-                $approved = "comment_approved = '1'";
</del><ins>+                $approved = "c.comment_approved = '1'";
</ins><span class="cx">                 $total = $count->approved;
</span><span class="cx">         } elseif ( 'spam' == $status ) {
</span><del>-                $approved = "comment_approved = 'spam'";
</del><ins>+                $approved = "c.comment_approved = 'spam'";
</ins><span class="cx">                 $total = $count->spam;
</span><del>-        } elseif ( 'deleted' == $status ) {
-                $approved = "comment_approved = 'deleted'";
-                $total = $count->deleted;
</del><ins>+        } elseif ( 'trash' == $status ) {
+                $approved = "c.comment_approved = 'trash'";
+                $total = $count->trash;
</ins><span class="cx">         } else {
</span><del>-                $approved = "( comment_approved = '0' OR comment_approved = '1' )";
</del><ins>+                $approved = "( c.comment_approved = '0' OR c.comment_approved = '1' )";
</ins><span class="cx">                 $total = $count->moderated + $count->approved;
</span><del>-                $index = 'USE INDEX (comment_date_gmt)';
</del><ins>+                $index = 'USE INDEX (c.comment_date_gmt)';
</ins><span class="cx">         }
</span><span class="cx">
</span><span class="cx">         if ( $post ) {
</span><span class="cx">                 $total = '';
</span><del>-                $post = " AND comment_post_ID = '$post'";
-                $orderby = "ORDER BY comment_date_gmt ASC LIMIT $start, $num";
</del><ins>+                $post = " AND c.comment_post_ID = '$post'";
+                $orderby = "ORDER BY c.comment_date_gmt ASC LIMIT $start, $num";
</ins><span class="cx">         } else {
</span><span class="cx">                 $post = '';
</span><del>-                $orderby = "ORDER BY comment_date_gmt DESC LIMIT $start, $num";
</del><ins>+                $orderby = "ORDER BY c.comment_date_gmt DESC LIMIT $start, $num";
</ins><span class="cx">         }
</span><span class="cx">
</span><span class="cx">         if ( 'comment' == $type )
</span><del>-                $typesql = "AND comment_type = ''";
</del><ins>+                $typesql = "AND c.comment_type = ''";
</ins><span class="cx">         elseif ( 'pings' == $type )
</span><del>-                $typesql = "AND ( comment_type = 'pingback' OR comment_type = 'trackback' )";
</del><ins>+                $typesql = "AND ( c.comment_type = 'pingback' OR c.comment_type = 'trackback' )";
</ins><span class="cx">         elseif ( !empty($type) )
</span><del>-                $typesql = $wpdb->prepare("AND comment_type = %s", $type);
</del><ins>+                $typesql = $wpdb->prepare("AND c.comment_type = %s", $type);
</ins><span class="cx">         else
</span><span class="cx">                 $typesql = '';
</span><span class="cx">
</span><span class="cx">         if ( !empty($type) )
</span><span class="cx">                 $total = '';
</span><span class="cx">
</span><ins>+        $query = "FROM $wpdb->comments c LEFT JOIN $wpdb->posts p ON c.comment_post_ID = p.ID WHERE p.post_status != 'trash' ";
</ins><span class="cx">         if ( $s ) {
</span><span class="cx">                 $total = '';
</span><span class="cx">                 $s = $wpdb->escape($s);
</span><del>-                $query = "FROM $wpdb->comments WHERE
-                        (comment_author LIKE '%$s%' OR
-                        comment_author_email LIKE '%$s%' OR
-                        comment_author_url LIKE ('%$s%') OR
-                        comment_author_IP LIKE ('%$s%') OR
-                        comment_content LIKE ('%$s%') ) AND
</del><ins>+                $query .= "AND
+                        (c.comment_author LIKE '%$s%' OR
+                        c.comment_author_email LIKE '%$s%' OR
+                        c.comment_author_url LIKE ('%$s%') OR
+                        c.comment_author_IP LIKE ('%$s%') OR
+                        c.comment_content LIKE ('%$s%') ) AND
</ins><span class="cx">                         $approved
</span><span class="cx">                         $typesql";
</span><span class="cx">         } else {
</span><del>-                $query = "FROM $wpdb->comments $index WHERE $approved $post $typesql";
</del><ins>+                $query .= "AND $approved $post $typesql";
</ins><span class="cx">         }
</span><del>-
</del><ins>+        
</ins><span class="cx">         $comments = $wpdb->get_results("SELECT * $query $orderby");
</span><span class="cx">         if ( '' === $total )
</span><del>-                $total = $wpdb->get_var("SELECT COUNT(comment_ID) $query");
</del><ins>+                $total = $wpdb->get_var("SELECT COUNT(c.comment_ID) $query");
</ins><span class="cx">
</span><span class="cx">         update_comment_cache($comments);
</span><span class="cx">
</span><span class="lines">@@ -2095,6 +2106,8 @@
</span><span class="cx">         $approve_url = esc_url( wp_nonce_url( "comment.php?action=approvecomment&p=$post->ID&c=$comment->comment_ID", "approve-comment_$comment->comment_ID" ) );
</span><span class="cx">         $unapprove_url = esc_url( wp_nonce_url( "comment.php?action=unapprovecomment&p=$post->ID&c=$comment->comment_ID", "unapprove-comment_$comment->comment_ID" ) );
</span><span class="cx">         $spam_url = esc_url( wp_nonce_url( "comment.php?action=deletecomment&dt=spam&p=$post->ID&c=$comment->comment_ID", "delete-comment_$comment->comment_ID" ) );
</span><ins>+        $trash_url = esc_url( wp_nonce_url( "comment.php?action=trashcomment&p=$post->ID&c=$comment->comment_ID", "trash-comment_$comment->comment_ID" ) );
+        $untrash_url = esc_url( wp_nonce_url( "comment.php?action=untrashcomment&p=$post->ID&c=$comment->comment_ID", "untrash-comment_$comment->comment_ID" ) );
</ins><span class="cx">
</span><span class="cx">         echo "<tr id='comment-$comment->comment_ID' class='$the_comment_status'>";
</span><span class="cx">         $columns = get_column_headers('edit-comments');
</span><span class="lines">@@ -2134,9 +2147,9 @@
</span><span class="cx">                                 $actions = array();
</span><span class="cx">
</span><span class="cx">                                 if ( $user_can ) {
</span><del>-                                        if ( 'deleted' == $the_comment_status ) {
-                                                $actions['unapprove'] = "<a href='$unapprove_url' class='delete:the-comment-list:comment-$comment->comment_ID:e7e7d3:action=dim-comment&amp;new=unapproved vim-u vim-destructive' title='" . __( 'Return this comment to Unapproved status' ) . "'>" . __( 'Return to Pending' ) . '</a>';
-                                                $actions['delete'] = "<a href='$delete_url' class='delete:the-comment-list:comment-$comment->comment_ID::deleted=1 delete vim-d vim-destructive'>" . __('Delete Permanently') . '</a>';
</del><ins>+                                        if ( 'trash' == $the_comment_status ) {
+                                                $actions['untrash'] = "<a href='$untrash_url' class='delete:the-comment-list:comment-$comment->comment_ID::untrash=1 vim-t vim-destructive''>" . __( 'Restore' ) . '</a>';
+                                                $actions['delete'] = "<a href='$delete_url' class='delete:the-comment-list:comment-$comment->comment_ID delete vim-d vim-destructive'>" . __('Delete Permanently') . '</a>';
</ins><span class="cx">                                         } else {
</span><span class="cx">                                                 $actions['approve'] = "<a href='$approve_url' class='dim:the-comment-list:comment-$comment->comment_ID:unapproved:e7e7d3:e7e7d3:new=approved vim-a' title='" . __( 'Approve this comment' ) . "'>" . __( 'Approve' ) . '</a>';
</span><span class="cx">                                                 $actions['unapprove'] = "<a href='$unapprove_url' class='dim:the-comment-list:comment-$comment->comment_ID:unapproved:e7e7d3:e7e7d3:new=unapproved vim-u' title='" . __( 'Unapprove this comment' ) . "'>" . __( 'Unapprove' ) . '</a>';
</span><span class="lines">@@ -2152,10 +2165,10 @@
</span><span class="cx">                                                 }
</span><span class="cx">
</span><span class="cx">                                                 if ( 'spam' == $the_comment_status ) {
</span><del>-                                                        $actions['delete'] = "<a href='$delete_url' class='delete:the-comment-list:comment-$comment->comment_ID::deleted=1 delete vim-d vim-destructive'>" . __('Delete Permanently') . '</a>';
</del><ins>+                                                        $actions['delete'] = "<a href='$delete_url' class='delete:the-comment-list:comment-$comment->comment_ID delete vim-d vim-destructive'>" . __('Delete Permanently') . '</a>';
</ins><span class="cx">                                                 } else {
</span><span class="cx">                                                         $actions['spam'] = "<a href='$spam_url' class='delete:the-comment-list:comment-$comment->comment_ID::spam=1 vim-s vim-destructive' title='" . __( 'Mark this comment as spam' ) . "'>" . /* translators: mark as spam link */ _x( 'Spam', 'verb' ) . '</a>';
</span><del>-                                                        $actions['delete'] = "<a href='$delete_url' class='delete:the-comment-list:comment-$comment->comment_ID delete vim-d vim-destructive'>" . __('Move to Trash') . '</a>';
</del><ins>+                                                        $actions['trash'] = "<a href='$trash_url' class='delete:the-comment-list:comment-$comment->comment_ID::trash=1 delete vim-t vim-destructive'>" . __('Trash') . '</a>';
</ins><span class="cx">                                                 }
</span><span class="cx">
</span><span class="cx">                                                 $actions['edit'] = "<a href='comment.php?action=editcomment&amp;c={$comment->comment_ID}' title='" . __('Edit comment') . "'>". __('Edit') . '</a>';
</span><span class="lines">@@ -2176,6 +2189,15 @@
</span><span class="cx">                                                 // Reply and quickedit need a hide-if-no-js span when not added with ajax
</span><span class="cx">                                                 if ( ('reply' == $action || 'quickedit' == $action) && ! $from_ajax )
</span><span class="cx">                                                         $action .= ' hide-if-no-js';
</span><ins>+                                                elseif ($action == 'untrash' && $the_comment_status == 'trash') {
+                                                        $trash_meta = get_option('wp_trash_meta');
+                                                        if (is_array($trash_meta) && isset($trash_meta['comments'][$comment_id]['status'])) {
+                                                                if ($trash_meta['comments'][$comment_id]['status'] == '1')
+                                                                        $action .= ' approve';
+                                                                else
+                                                                        $action .= ' unapprove';
+                                                        }
+                                                }
</ins><span class="cx">
</span><span class="cx">                                                 echo "<span class='$action'>$sep$link</span>";
</span><span class="cx">                                         }
</span></span></pre></div>
<a id="trunkwpadminjscommondevjs"></a>
<div class="modfile"><h4>Modified: trunk/wp-admin/js/common.dev.js (11748 => 11749)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-admin/js/common.dev.js        2009-07-27 23:28:13 UTC (rev 11748)
+++ trunk/wp-admin/js/common.dev.js        2009-07-30 13:39:34 UTC (rev 11749)
</span><span class="lines">@@ -154,16 +154,6 @@
</span><span class="cx">         $('div.wrap h2 ~ div.updated, div.wrap h2 ~ div.error').addClass('below-h2');
</span><span class="cx">         $('div.updated, div.error').not('.below-h2').insertAfter('div.wrap h2:first');
</span><span class="cx">
</span><del>-        // show warnings
-        $('#doaction, #doaction2').click(function(){
-                if ( $('select[name="action"]').val() == 'destroy' || $('select[name="action2"]').val() == 'destroy' ) {
-                        return showNotice.warn();
-                }
-        });
-        $('#destroy_all, #destroy_all2').click(function(){
-                return showNotice.warn();
-        });
-
</del><span class="cx">         // screen settings tab
</span><span class="cx">         $('#show-settings-link').click(function () {
</span><span class="cx">                 if ( ! $('#screen-options-wrap').hasClass('screen-options-open') ) {
</span></span></pre></div>
<a id="trunkwpadminjscommonjs"></a>
<div class="modfile"><h4>Modified: trunk/wp-admin/js/common.js (11748 => 11749)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-admin/js/common.js        2009-07-27 23:28:13 UTC (rev 11748)
+++ trunk/wp-admin/js/common.js        2009-07-30 13:39:34 UTC (rev 11749)
</span><span class="lines">@@ -1 +1 @@
</span><del>-var showNotice,adminMenu,columns,validateForm;(function(a){adminMenu={init:function(){a("#adminmenu div.wp-menu-toggle").each(function(){if(a(this).siblings(".wp-submenu").length){a(this).click(function(){adminMenu.toggle(a(this).siblings(".wp-submenu"))})}else{a(this).hide()}});this.favorites();a("a.separator").click(function(){if(a("body").hasClass("folded")){adminMenu.fold(1);deleteUserSetting("mfold")}else{adminMenu.fold();setUserSetting("mfold","f")}return false});if(a("body").hasClass("folded")){this.fold()}this.restoreMenuState()},restoreMenuState:function(){a("#adminmenu li.wp-has-submenu").each(function(c,d){var b=getUserSetting("m"+c);if(a(d).hasClass("wp-has-current-submenu")){return true}if("o"==b){a(d).addClass("wp-menu-open")}else{if("c"==b){a(d).removeClass("wp-menu-open")}}})},toggle:function(b){b.slideToggle(150,function(){b.css("display","")}).parent().toggleClass("wp-menu-open");a("#adminmenu li.wp-has-submenu").each(function(d,f){var c=a(f).hasClass("wp-menu-open")?"o":"c";setUserSetting("m"+d,c)});return false},fold:function(b){if(b){a("body").removeClass("folded");a("#adminmenu li.wp-has-submenu").unbind()}else{a("body").addClass("folded");a("#adminmenu li.wp-has-submenu").hoverIntent({over:function(j){var d,c,g,k,i;d=a(this).find(".wp-submenu");c=d.parent().offset().top+d.height()+1;g=a("#wpwrap").height();k=60+c-g;i=a(window).height()+a("body").scrollTop()-15;if(i<(c-k)){k=c-i}if(k>1){d.css({marginTop:"-"+k+"px"})}else{if(d.css("marginTop")){d.css({marginTop:""})}}d.addClass("sub-open")},out:function(){a(this).find(".wp-submenu").removeClass("sub-open").css({marginTop:""})},timeout:220,sensitivity:8,interval:100})}},favorites:function(){a("#favorite-inside").width(a("#favorite-actions").width()-4);a("#favorite-toggle, #favorite-inside").bind("mouseenter",function(){a("#favorite-inside").removeClass("slideUp").addClass("slideDown");setTimeout(function(){if(a("#favorite-inside").hasClass("slideDown")){a("#favorite-inside").slideDown(100);a("#favorite-first").addClass("slide-down")}},200)});a("#favorite-toggle, #favorite-inside").bind("mouseleave",function(){a("#favorite-inside").removeClass("slideDown").addClass("slideUp");setTimeout(function(){if(a("#favorite-inside").hasClass("slideUp")){a("#favorite-inside").slideUp(100,function(){a("#favorite-first").removeClass("slide-down")})}},300)})}};a(document).ready(function(){adminMenu.init()});columns={init:function(){a(".hide-column-tog").click(function(){var c=a(this).val(),b=a(this).attr("checked");if(b){a(".column-"+c).show()}else{a(".column-"+c).hide()}columns.save_manage_columns_state()})},save_manage_columns_state:function(){var b=a(".manage-column").filter(":hidden").map(function(){return this.id}).get().join(",");a.post(ajaxurl,{action:"hidden-columns",hidden:b,screenoptionnonce:a("#screenoptionnonce").val(),page:pagenow})}};a(document).ready(function(){columns.init()});validateForm=function(b){return !a(b).find(".form-required").filter(function(){return a("input:visible",this).val()==""}).addClass("form-invalid").change(function(){a(this).removeClass("form-invalid")}).size()}})(jQuery);showNotice={warn:function(){var a=commonL10n.warnDelete||"";if(confirm(a)){return true}return false},note:function(a){alert(a)}};jQuery(document).ready(function(d){var f=false,a,e,c,b;d(".fade").animate({backgroundColor:"#ffffe0"},300).animate({backgroundColor:"#fffbcc"},300).animate({backgroundColor:"#ffffe0"},300).animate({backgroundColor:"#fffbcc"},300);d("div.wrap h2 ~ div.updated, div.wrap h2 ~ div.error").addClass("below-h2");d("div.updated, div.error").not(".below-h2").insertAfter("div.wrap h2:first");d("#doaction, #doaction2").click(function(){if(d('select[name="action"]').val()=="destroy"||d('select[name="action2"]').val()=="destroy"){return showNotice.warn()}});d("#destroy_all, #destroy_all2").click(function(){return showNotice.warn()});d("#show-settings-link").click(function(){if(!d("#screen-options-wrap").hasClass("screen-options-open")){d("#contextual-help-link-wrap").css("visibility","hidden")}d("#screen-options-wrap").slideToggle("fast",function(){if(d(this).hasClass("screen-options-open")){d("#show-settings-link").css({backgroundImage:'url("images/screen-options-right.gif")'});d("#contextual-help-link-wrap").css("visibility","");d(this).removeClass("screen-options-open")}else{d("#show-settings-link").css({backgroundImage:'url("images/screen-options-right-up.gif")'});d(this).addClass("screen-options-open")}});return false});d("#contextual-help-link").click(function(){if(!d("#contextual-help-wrap").hasClass("contextual-help-open")){d("#screen-options-link-wrap").css("visibility","hidden")}d("#contextual-help-wrap").slideToggle("fast",function(){if(d(this).hasClass("contextual-help-open")){d("#contextual-help-link").css({backgroundImage:'url("images/screen-options-right.gif")'});d("#screen-options-link-wrap").css("visibility","");d(this).removeClass("contextual-help-open")}else{d("#contextual-help-link").css({backgroundImage:'url("images/screen-options-right-up.gif")'});d(this).addClass("contextual-help-open")}});return false});d("#contextual-help-link-wrap, #screen-options-link-wrap").show();d("table:visible tbody .check-column :checkbox").click(function(g){if("undefined"==g.shiftKey){return true}if(g.shiftKey){if(!f){return true}a=d(f).parents("form:first").find(":checkbox");e=a.index(f);c=a.index(this);b=d(this).attr("checked");if(0<e&&0<c&&e!=c){a.slice(e,c).attr("checked",function(){if(d(this).parents("tr").is(":visible")){return b?"checked":""}return""})}}f=this;return true});d("thead :checkbox, tfoot :checkbox").click(function(i){var j=d(this).attr("checked"),h="undefined"==typeof toggleWithKeyboard?false:toggleWithKeyboard,g=i.shiftKey||h;d(this).parents("form:first").find("table tbody:visible").find(".check-column :checkbox").attr("checked",function(){if(d(this).parents("tr").is(":hidden")){return""}if(g){return d(this).attr("checked")?"":"checked"}else{if(j){return"checked"}}return""});d(this).parents("form:first").find("table thead:visible, table tfoot:visible").find(".check-column :checkbox").attr("checked",function(){if(g){return""}else{if(j){return"checked"}}return""})});d("#default-password-nag-no").click(function(){setUserSetting("default_password_nag","hide");d("div.default-password-nag").hide();return false})});jQuery(document).ready(function(b){var a=b(".turbo-nag");if(!a.length||("undefined"!=typeof(google)&&google.gears)){return}if("undefined"!=typeof GearsFactory){return}else{try{if(("undefined"!=typeof window.ActiveXObject&&ActiveXObject("Gears.Factory"))||("undefined"!=typeof navigator.mimeTypes&&navigator.mimeTypes["application/x-googlegears"])){return}}catch(c){}}a.show()});
</del><span class="cx">\ No newline at end of file
</span><ins>+var showNotice,adminMenu,columns,validateForm;(function(a){adminMenu={init:function(){a("#adminmenu div.wp-menu-toggle").each(function(){if(a(this).siblings(".wp-submenu").length){a(this).click(function(){adminMenu.toggle(a(this).siblings(".wp-submenu"))})}else{a(this).hide()}});this.favorites();a("a.separator").click(function(){if(a("body").hasClass("folded")){adminMenu.fold(1);deleteUserSetting("mfold")}else{adminMenu.fold();setUserSetting("mfold","f")}return false});if(a("body").hasClass("folded")){this.fold()}this.restoreMenuState()},restoreMenuState:function(){a("#adminmenu li.wp-has-submenu").each(function(c,d){var b=getUserSetting("m"+c);if(a(d).hasClass("wp-has-current-submenu")){return true}if("o"==b){a(d).addClass("wp-menu-open")}else{if("c"==b){a(d).removeClass("wp-menu-open")}}})},toggle:function(b){b.slideToggle(150,function(){b.css("display","")}).parent().toggleClass("wp-menu-open");a("#adminmenu li.wp-has-submenu").each(function(d,f){var c=a(f).hasClass("wp-menu-open")?"o":"c";setUserSetting("m"+d,c)});return false},fold:function(b){if(b){a("body").removeClass("folded");a("#adminmenu li.wp-has-submenu").unbind()}else{a("body").addClass("folded");a("#adminmenu li.wp-has-submenu").hoverIntent({over:function(j){var d,c,g,k,i;d=a(this).find(".wp-submenu");c=d.parent().offset().top+d.height()+1;g=a("#wpwrap").height();k=60+c-g;i=a(window).height()+a("body").scrollTop()-15;if(i<(c-k)){k=c-i}if(k>1){d.css({marginTop:"-"+k+"px"})}else{if(d.css("marginTop")){d.css({marginTop:""})}}d.addClass("sub-open")},out:function(){a(this).find(".wp-submenu").removeClass("sub-open").css({marginTop:""})},timeout:220,sensitivity:8,interval:100})}},favorites:function(){a("#favorite-inside").width(a("#favorite-actions").width()-4);a("#favorite-toggle, #favorite-inside").bind("mouseenter",function(){a("#favorite-inside").removeClass("slideUp").addClass("slideDown");setTimeout(function(){if(a("#favorite-inside").hasClass("slideDown")){a("#favorite-inside").slideDown(100);a("#favorite-first").addClass("slide-down")}},200)});a("#favorite-toggle, #favorite-inside").bind("mouseleave",function(){a("#favorite-inside").removeClass("slideDown").addClass("slideUp");setTimeout(function(){if(a("#favorite-inside").hasClass("slideUp")){a("#favorite-inside").slideUp(100,function(){a("#favorite-first").removeClass("slide-down")})}},300)})}};a(document).ready(function(){adminMenu.init()});columns={init:function(){a(".hide-column-tog").click(function(){var c=a(this).val(),b=a(this).attr("checked");if(b){a(".column-"+c).show()}else{a(".column-"+c).hide()}columns.save_manage_columns_state()})},save_manage_columns_state:function(){var b=a(".manage-column").filter(":hidden").map(function(){return this.id}).get().join(",");a.post(ajaxurl,{action:"hidden-columns",hidden:b,screenoptionnonce:a("#screenoptionnonce").val(),page:pagenow})}};a(document).ready(function(){columns.init()});validateForm=function(b){return !a(b).find(".form-required").filter(function(){return a("input:visible",this).val()==""}).addClass("form-invalid").change(function(){a(this).removeClass("form-invalid")}).size()}})(jQuery);showNotice={warn:function(){var a=commonL10n.warnDelete||"";if(confirm(a)){return true}return false},note:function(a){alert(a)}};jQuery(document).ready(function(d){var f=false,a,e,c,b;d(".fade").animate({backgroundColor:"#ffffe0"},300).animate({backgroundColor:"#fffbcc"},300).animate({backgroundColor:"#ffffe0"},300).animate({backgroundColor:"#fffbcc"},300);d("div.wrap h2 ~ div.updated, div.wrap h2 ~ div.error").addClass("below-h2");d("div.updated, div.error").not(".below-h2").insertAfter("div.wrap h2:first");d("#show-settings-link").click(function(){if(!d("#screen-options-wrap").hasClass("screen-options-open")){d("#contextual-help-link-wrap").css("visibility","hidden")}d("#screen-options-wrap").slideToggle("fast",function(){if(d(this).hasClass("screen-options-open")){d("#show-settings-link").css({backgroundImage:'url("images/screen-options-right.gif")'});d("#contextual-help-link-wrap").css("visibility","");d(this).removeClass("screen-options-open")}else{d("#show-settings-link").css({backgroundImage:'url("images/screen-options-right-up.gif")'});d(this).addClass("screen-options-open")}});return false});d("#contextual-help-link").click(function(){if(!d("#contextual-help-wrap").hasClass("contextual-help-open")){d("#screen-options-link-wrap").css("visibility","hidden")}d("#contextual-help-wrap").slideToggle("fast",function(){if(d(this).hasClass("contextual-help-open")){d("#contextual-help-link").css({backgroundImage:'url("images/screen-options-right.gif")'});d("#screen-options-link-wrap").css("visibility","");d(this).removeClass("contextual-help-open")}else{d("#contextual-help-link").css({backgroundImage:'url("images/screen-options-right-up.gif")'});d(this).addClass("contextual-help-open")}});return false});d("#contextual-help-link-wrap, #screen-options-link-wrap").show();d("table:visible tbody .check-column :checkbox").click(function(g){if("undefined"==g.shiftKey){return true}if(g.shiftKey){if(!f){return true}a=d(f).parents("form:first").find(":checkbox");e=a.index(f);c=a.index(this);b=d(this).attr("checked");if(0<e&&0<c&&e!=c){a.slice(e,c).attr("checked",function(){if(d(this).parents("tr").is(":visible")){return b?"checked":""}return""})}}f=this;return true});d("thead :checkbox, tfoot :checkbox").click(function(i){var j=d(this).attr("checked"),h="undefined"==typeof toggleWithKeyboard?false:toggleWithKeyboard,g=i.shiftKey||h;d(this).parents("form:first").find("table tbody:visible").find(".check-column :checkbox").attr("checked",function(){if(d(this).parents("tr").is(":hidden")){return""}if(g){return d(this).attr("checked")?"":"checked"}else{if(j){return"checked"}}return""});d(this).parents("form:first").find("table thead:visible, table tfoot:visible").find(".check-column :checkbox").attr("checked",function(){if(g){return""}else{if(j){return"checked"}}return""})});d("#default-password-nag-no").click(function(){setUserSetting("default_password_nag","hide");d("div.default-password-nag").hide();return false})});jQuery(document).ready(function(b){var a=b(".turbo-nag");if(!a.length||("undefined"!=typeof(google)&&google.gears)){return}if("undefined"!=typeof GearsFactory){return}else{try{if(("undefined"!=typeof window.ActiveXObject&&ActiveXObject("Gears.Factory"))||("undefined"!=typeof navigator.mimeTypes&&navigator.mimeTypes["application/x-googlegears"])){return}}catch(c){}}a.show()});
</ins><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="trunkwpadminjseditcommentsdevjs"></a>
<div class="modfile"><h4>Modified: trunk/wp-admin/js/edit-comments.dev.js (11748 => 11749)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-admin/js/edit-comments.dev.js        2009-07-27 23:28:13 UTC (rev 11748)
+++ trunk/wp-admin/js/edit-comments.dev.js        2009-07-30 13:39:34 UTC (rev 11749)
</span><span class="lines">@@ -38,9 +38,6 @@
</span><span class="cx">                 settings.data._page = pageInput.val();
</span><span class="cx">                 settings.data._url = document.location.href;
</span><span class="cx">
</span><del>-                if ( 'undefined' != showNotice && settings.data.action && settings.data.action == 'delete-comment' && settings.data.deleted)
-                        return showNotice.warn() ? settings : false;
-
</del><span class="cx">                 return settings;
</span><span class="cx">         };
</span><span class="cx">
</span><span class="lines">@@ -101,17 +98,15 @@
</span><span class="cx">                         a.html(n);
</span><span class="cx">                 });
</span><span class="cx">
</span><del>-                $('span.deleted-count').each( function() {
</del><ins>+                $('span.trash-count').each( function() {
</ins><span class="cx">                         var a = $(this), n;
</span><span class="cx">                         n = a.html().replace(/[ ,.]+/g, '');
</span><span class="cx">                         n = parseInt(n,10);
</span><span class="cx">                         if ( isNaN(n) ) return;
</span><del>-                        if ( $(settings.target).parents( 'span.delete' ).size() && $('#' + settings.element).is('.deleted,.spam') ) { // we destroyed a deleted or spam comment
-                                n--;
-                        } else if ( $(settings.target).parents( 'span.delete' ).size() ) { // we deleted a comment
-                                n++;
-                        } else if ( $('#' + settings.element).is('.deleted') ) { // we approved or spammed a deleted comment
-                                n--;
</del><ins>+                        if ( $(settings.target).parents( 'span.trash' ).size() ) { // we trashed a comment
+                                n = n + 1;
+                        } else if ( $('#' + settings.element).is('.trash') ) { // we deleted or untrashed a trash comment
+                                n = n - 1;
</ins><span class="cx">                         }
</span><span class="cx">                         if ( n < 0 ) { n = 0; }
</span><span class="cx">                         n = n.toString();
</span></span></pre></div>
<a id="trunkwpadminjseditcommentsjs"></a>
<div class="modfile"><h4>Modified: trunk/wp-admin/js/edit-comments.js (11748 => 11749)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-admin/js/edit-comments.js        2009-07-27 23:28:13 UTC (rev 11748)
+++ trunk/wp-admin/js/edit-comments.js        2009-07-30 13:39:34 UTC (rev 11749)
</span><span class="lines">@@ -1 +1 @@
</span><del>-var theList,theExtraList,toggleWithKeyboard=false;(function(a){setCommentsList=function(){var g,i,h,f=0,c,e,d,b;g=a('#comments-form .tablenav :input[name="_total"]');i=a('#comments-form .tablenav :input[name="_per_page"]');h=a('#comments-form .tablenav :input[name="_page"]');c=function(k,j){var l=a("#"+j.element);if(l.is(".unapproved")){l.find("div.comment_status").html("0")}else{l.find("div.comment_status").html("1")}a("span.pending-count").each(function(){var m=a(this),o;o=m.html().replace(/[ ,.]+/g,"");o=parseInt(o,10);if(isNaN(o)){return}o=o+(a("#"+j.element).is("."+j.dimClass)?1:-1);if(o<0){o=0}m.parents("#awaiting-mod")[0==o?"addClass":"removeClass"]("count-0");o=o.toString();if(o.length>3){o=o.substr(0,o.length-3)+" "+o.substr(-3)}m.html(o)})};e=function(j){j.data._total=g.val();j.data._per_page=i.val();j.data._page=h.val();j.data._url=document.location.href;if("undefined"!=showNotice&&j.data.action&&j.data.action=="delete-comment"&&j.data.deleted){return showNotice.warn()?j:false}return j};d=function(j,k,l){if(k<f){return}g.val(j.toString());if(l){f=k}a("span.total-type-count").each(function(){var m=a(this),o;o=g.val().toString();if(o.length>3){o=o.substr(0,o.length-3)+" "+o.substr(-3)}m.html(o)})};b=function(l,j){a("span.pending-count").each(function(){var m=a(this),o;o=m.html().replace(/[ ,.]+/g,"");o=parseInt(o,10);if(isNaN(o)){return}if(a("#"+j.element).is(".unapproved")){o=o-1}else{if(a(j.target).parents("span.unapprove").size()){o=o+1}}if(o<0){o=0}m.parents("#awaiting-mod")[0==o?"addClass":"removeClass"]("count-0");o=o.toString();if(o.length>3){o=o.substr(0,o.length-3)+" "+o.substr(-3)}m.html(o)});a("span.spam-count").each(function(){var m=a(this),o;o=m.html().replace(/[ ,.]+/g,"");o=parseInt(o,10);if(isNaN(o)){return}if(a(j.target).parents("span.spam").size()){o=o+1}else{if(a("#"+j.element).is(".spam")){o=o-1}}if(o<0){o=0}o=o.toString();if(o.length>3){o=o.substr(0,o.length-3)+" "+o.substr(-3)}m.html(o)});a("span.deleted-count").each(function(){var m=a(this),o;o=m.html().replace(/[ ,.]+/g,"");o=parseInt(o,10);if(isNaN(o)){return}if(a(j.target).parents("span.delete").size()&&a("#"+j.element).is(".deleted,.spam")){o--}else{if(a(j.target).parents("span.delete").size()){o++}else{if(a("#"+j.element).is(".deleted")){o--}}}if(o<0){o=0}o=o.toString();if(o.length>3){o=o.substr(0,o.length-3)+" "+o.substr(-3)}m.html(o)});if(("object"==typeof l)&&f<j.parsed.responses[0].supplemental.time){d(j.parsed.responses[0].supplemental.total,j.parsed.responses[0].supplemental.time,true);if(a.trim(j.parsed.responses[0].supplemental.pageLinks)){a(".tablenav-pages").find(".page-numbers").remove().end().append(a(j.parsed.responses[0].supplemental.pageLinks))}else{if("undefined"!=typeof j.parsed.responses[0].supplemental.pageLinks){a(".tablenav-pages").find(".page-numbers").remove()}}}else{var k=parseInt(g.val(),10);if(k--<0){k=0}d(k,l,false)}if(theExtraList.size()==0||theExtraList.children().size()==0){return}theList.get(0).wpList.add(theExtraList.children(":eq(0)").remove().clone());a("#get-extra-comments").submit()};theExtraList=a("#the-extra-comment-list").wpList({alt:"",delColor:"none",addColor:"none"});theList=a("#the-comment-list").wpList({alt:"",delBefore:e,dimAfter:c,delAfter:b,addColor:"none"})};commentReply={init:function(){var b=a("#replyrow");a("a.cancel",b).click(function(){return commentReply.revert()});a("a.save",b).click(function(){return commentReply.send()});a("input#author, input#author-email, input#author-url",b).keypress(function(c){if(c.which==13){commentReply.send();c.preventDefault();return false}});a("#the-comment-list .column-comment > p").dblclick(function(){commentReply.toggle(a(this).parent())});a("#doaction, #doaction2, #post-query-submit").click(function(c){if(a("#the-comment-list #replyrow").length>0){commentReply.close()}});this.comments_listing=a('#comments-form > input[name="comment_status"]').val()||""},addEvents:function(b){b.each(function(){a(this).find(".column-comment > p").dblclick(function(){commentReply.toggle(a(this).parent())})})},toggle:function(b){if(a(b).css("display")!="none"){a(b).find("a.vim-q").click()}},revert:function(){if(a("#the-comment-list #replyrow").length<1){return false}a("#replyrow").fadeOut("fast",function(){commentReply.close()});return false},close:function(){a(this.o).fadeIn("fast").css("backgroundColor","");a("#com-reply").append(a("#replyrow"));a("#replycontent").val("");a("#edithead input").val("");a("#replysubmit .error").html("").hide();a("#replysubmit .waiting").hide();if(a.browser.msie){a("#replycontainer, #replycontent").css("height","120px")}else{a("#replycontainer").resizable("destroy").css("height","120px")}},open:function(i,g,c){var e=this,d,b,f;e.close();e.o="#comment-"+i;a("#replyrow td").attr("colspan",a(".widefat thead th:visible").length);d=a("#replyrow"),rowData=a("#inline-"+i);b=e.act=(c=="edit")?"edit-comment":"replyto-comment";a("#action",d).val(b);a("#comment_post_ID",d).val(g);a("#comment_ID",d).val(i);if(c=="edit"){a("#author",d).val(a("div.author",rowData).text());a("#author-email",d).val(a("div.author-email",rowData).text());a("#author-url",d).val(a("div.author-url",rowData).text());a("#status",d).val(a("div.comment_status",rowData).text());a("#replycontent",d).val(a("textarea.comment",rowData).val());a("#edithead, #savebtn",d).show();a("#replyhead, #replybtn",d).hide();f=a(e.o).height();if(f>220){if(a.browser.msie){a("#replycontainer, #replycontent",d).height(f-105)}else{a("#replycontainer",d).height(f-105)}}a(e.o).after(d.hide()).fadeOut("fast",function(){a("#replyrow").fadeIn("fast")})}else{a("#edithead, #savebtn",d).hide();a("#replyhead, #replybtn",d).show();a(e.o).after(d);a("#replyrow").hide().fadeIn("fast")}if(!a.browser.msie){a("#replycontainer").resizable({handles:"s",axis:"y",minHeight:80,stop:function(){a("#replycontainer").width("auto")}})}setTimeout(function(){var l,j,m,h,k;l=a("#replyrow").offset().top;j=l+a("#replyrow").height();m=window.pageYOffset||document.documentElement.scrollTop;h=document.documentElement.clientHeight||self.innerHeight||0;k=m+h;if(k-20<j){window.scroll(0,j-h+35)}else{if(l-20<m){window.scroll(0,l-35)}}a("#replycontent").focus().keyup(function(n){if(n.which==27){commentReply.revert()}})},600);return false},send:function(){var b={};a("#replysubmit .waiting").show();a("#replyrow input").each(function(){b[a(this).attr("name")]=a(this).val()});b.content=a("#replycontent").val();b.id=b.comment_post_ID;b.comments_listing=this.comments_listing;a.ajax({type:"POST",url:wpListL10n.url,data:b,success:function(c){commentReply.show(c)},error:function(c){commentReply.error(c)}});return false},show:function(b){var e,g,f,d;if(typeof(b)=="string"){this.error({responseText:b});return false}e=wpAjax.parseAjaxResponse(b);if(e.errors){this.error({responseText:wpAjax.broken});return false}if("edit-comment"==this.act){a(this.o).remove()}e=e.responses[0];g=e.data;a(g).hide();a("#replyrow").after(g);this.o=f="#comment-"+e.id;this.revert();this.addEvents(a(f));d=a(f).hasClass("unapproved")?"#ffffe0":"#fff";a(f).animate({backgroundColor:"#CCEEBB"},600).animate({backgroundColor:d},600);a.fn.wpList.process(a(f))},error:function(b){var c=b.statusText;a("#replysubmit .waiting").hide();if(b.responseText){c=b.responseText.replace(/<.[^<>]*?>/g,"")}if(c){a("#replysubmit .error").html(c).show()}}};a(document).ready(function(){var e,b,c,d;setCommentsList();commentReply.init();a("span.delete a.delete").click(function(){return false});if(typeof QTags!="undefined"){ed_reply=new QTags("ed_reply","replycontent","replycontainer","more")}if(typeof a.table_hotkeys!="undefined"){e=function(f){return function(){var h,g;h="next"==f?"first":"last";g=a("."+f+".page-numbers");if(g.length){window.location=g[0].href.replace(/\&hotkeys_highlight_(first|last)=1/g,"")+"&hotkeys_highlight_"+h+"=1"}}};b=function(g,f){window.location=a("span.edit a",f).attr("href")};c=function(){toggleWithKeyboard=true;a("#comments-form thead #cb input:checkbox").click().attr("checked","");toggleWithKeyboard=false};d=function(f){return function(h,g){a("option[value="+f+"]").attr("selected","selected");a("form#comments-form")[0].submit()}};a.table_hotkeys(a("table.widefat"),["a","u","s","d","r","q",["e",b],["shift+a",d("approve")],["shift+s",d("markspam")],["shift+d",d("delete")],["shift+x",c],["shift+u",d("unapprove")]],{highlight_first:adminCommentsL10n.hotkeys_highlight_first,highlight_last:adminCommentsL10n.hotkeys_highlight_last,prev_page_link_cb:e("prev"),next_page_link_cb:e("next")})}})})(jQuery);
</del><span class="cx">\ No newline at end of file
</span><ins>+var theList,theExtraList,toggleWithKeyboard=false;(function(a){setCommentsList=function(){var g,i,h,f=0,c,e,d,b;g=a('#comments-form .tablenav :input[name="_total"]');i=a('#comments-form .tablenav :input[name="_per_page"]');h=a('#comments-form .tablenav :input[name="_page"]');c=function(k,j){var l=a("#"+j.element);if(l.is(".unapproved")){l.find("div.comment_status").html("0")}else{l.find("div.comment_status").html("1")}a("span.pending-count").each(function(){var m=a(this),o;o=m.html().replace(/[ ,.]+/g,"");o=parseInt(o,10);if(isNaN(o)){return}o=o+(a("#"+j.element).is("."+j.dimClass)?1:-1);if(o<0){o=0}m.parents("#awaiting-mod")[0==o?"addClass":"removeClass"]("count-0");o=o.toString();if(o.length>3){o=o.substr(0,o.length-3)+" "+o.substr(-3)}m.html(o)})};e=function(j){j.data._total=g.val();j.data._per_page=i.val();j.data._page=h.val();j.data._url=document.location.href;return j};d=function(j,k,l){if(k<f){return}g.val(j.toString());if(l){f=k}a("span.total-type-count").each(function(){var m=a(this),o;o=g.val().toString();if(o.length>3){o=o.substr(0,o.length-3)+" "+o.substr(-3)}m.html(o)})};b=function(l,j){a("span.pending-count").each(function(){var m=a(this),o;o=m.html().replace(/[ ,.]+/g,"");o=parseInt(o,10);if(isNaN(o)){return}if(a("#"+j.element).is(".unapproved")){o=o-1}else{if(a(j.target).parents("span.unapprove").size()){o=o+1}}if(o<0){o=0}m.parents("#awaiting-mod")[0==o?"addClass":"removeClass"]("count-0");o=o.toString();if(o.length>3){o=o.substr(0,o.length-3)+" "+o.substr(-3)}m.html(o)});a("span.spam-count").each(function(){var m=a(this),o;o=m.html().replace(/[ ,.]+/g,"");o=parseInt(o,10);if(isNaN(o)){return}if(a(j.target).parents("span.spam").size()){o=o+1}else{if(a("#"+j.element).is(".spam")){o=o-1}}if(o<0){o=0}o=o.toString();if(o.length>3){o=o.substr(0,o.length-3)+" "+o.substr(-3)}m.html(o)});a("span.trash-count").each(function(){var m=a(this),o;o=m.html().replace(/[ ,.]+/g,"");o=parseInt(o,10);if(isNaN(o)){return}if(a(j.target).parents("span.trash").size()){o=o+1}else{if(a("#"+j.element).is(".trash")){o=o-1}}if(o<0){o=0}o=o.toString();if(o.length>3){o=o.substr(0,o.length-3)+" "+o.substr(-3)}m.html(o)});if(("object"==typeof l)&&f<j.parsed.responses[0].supplemental.time){d(j.parsed.responses[0].supplemental.total,j.parsed.responses[0].supplemental.time,true);if(a.trim(j.parsed.responses[0].supplemental.pageLinks)){a(".tablenav-pages").find(".page-numbers").remove().end().append(a(j.parsed.responses[0].supplemental.pageLinks))}else{if("undefined"!=typeof j.parsed.responses[0].supplemental.pageLinks){a(".tablenav-pages").find(".page-numbers").remove()}}}else{var k=parseInt(g.val(),10);if(k--<0){k=0}d(k,l,false)}if(theExtraList.size()==0||theExtraList.children().size()==0){return}theList.get(0).wpList.add(theExtraList.children(":eq(0)").remove().clone());a("#get-extra-comments").submit()};theExtraList=a("#the-extra-comment-list").wpList({alt:"",delColor:"none",addColor:"none"});theList=a("#the-comment-list").wpList({alt:"",delBefore:e,dimAfter:c,delAfter:b,addColor:"none"})};commentReply={init:function(){var b=a("#replyrow");a("a.cancel",b).click(function(){return commentReply.revert()});a("a.save",b).click(function(){return commentReply.send()});a("input#author, input#author-email, input#author-url",b).keypress(function(c){if(c.which==13){commentReply.send();c.preventDefault();return false}});a("#the-comment-list .column-comment > p").dblclick(function(){commentReply.toggle(a(this).parent())});a("#doaction, #doaction2, #post-query-submit").click(function(c){if(a("#the-comment-list #replyrow").length>0){commentReply.close()}});this.comments_listing=a('#comments-form > input[name="comment_status"]').val()||""},addEvents:function(b){b.each(function(){a(this).find(".column-comment > p").dblclick(function(){commentReply.toggle(a(this).parent())})})},toggle:function(b){if(a(b).css("display")!="none"){a(b).find("a.vim-q").click()}},revert:function(){if(a("#the-comment-list #replyrow").length<1){return false}a("#replyrow").fadeOut("fast",function(){commentReply.close()});return false},close:function(){a(this.o).fadeIn("fast").css("backgroundColor","");a("#com-reply").append(a("#replyrow"));a("#replycontent").val("");a("#edithead input").val("");a("#replysubmit .error").html("").hide();a("#replysubmit .waiting").hide();if(a.browser.msie){a("#replycontainer, #replycontent").css("height","120px")}else{a("#replycontainer").resizable("destroy").css("height","120px")}},open:function(i,g,c){var e=this,d,b,f;e.close();e.o="#comment-"+i;a("#replyrow td").attr("colspan",a(".widefat thead th:visible").length);d=a("#replyrow"),rowData=a("#inline-"+i);b=e.act=(c=="edit")?"edit-comment":"replyto-comment";a("#action",d).val(b);a("#comment_post_ID",d).val(g);a("#comment_ID",d).val(i);if(c=="edit"){a("#author",d).val(a("div.author",rowData).text());a("#author-email",d).val(a("div.author-email",rowData).text());a("#author-url",d).val(a("div.author-url",rowData).text());a("#status",d).val(a("div.comment_status",rowData).text());a("#replycontent",d).val(a("textarea.comment",rowData).val());a("#edithead, #savebtn",d).show();a("#replyhead, #replybtn",d).hide();f=a(e.o).height();if(f>220){if(a.browser.msie){a("#replycontainer, #replycontent",d).height(f-105)}else{a("#replycontainer",d).height(f-105)}}a(e.o).after(d.hide()).fadeOut("fast",function(){a("#replyrow").fadeIn("fast")})}else{a("#edithead, #savebtn",d).hide();a("#replyhead, #replybtn",d).show();a(e.o).after(d);a("#replyrow").hide().fadeIn("fast")}if(!a.browser.msie){a("#replycontainer").resizable({handles:"s",axis:"y",minHeight:80,stop:function(){a("#replycontainer").width("auto")}})}setTimeout(function(){var l,j,m,h,k;l=a("#replyrow").offset().top;j=l+a("#replyrow").height();m=window.pageYOffset||document.documentElement.scrollTop;h=document.documentElement.clientHeight||self.innerHeight||0;k=m+h;if(k-20<j){window.scroll(0,j-h+35)}else{if(l-20<m){window.scroll(0,l-35)}}a("#replycontent").focus().keyup(function(n){if(n.which==27){commentReply.revert()}})},600);return false},send:function(){var b={};a("#replysubmit .waiting").show();a("#replyrow input").each(function(){b[a(this).attr("name")]=a(this).val()});b.content=a("#replycontent").val();b.id=b.comment_post_ID;b.comments_listing=this.comments_listing;a.ajax({type:"POST",url:wpListL10n.url,data:b,success:function(c){commentReply.show(c)},error:function(c){commentReply.error(c)}});return false},show:function(b){var e,g,f,d;if(typeof(b)=="string"){this.error({responseText:b});return false}e=wpAjax.parseAjaxResponse(b);if(e.errors){this.error({responseText:wpAjax.broken});return false}if("edit-comment"==this.act){a(this.o).remove()}e=e.responses[0];g=e.data;a(g).hide();a("#replyrow").after(g);this.o=f="#comment-"+e.id;this.revert();this.addEvents(a(f));d=a(f).hasClass("unapproved")?"#ffffe0":"#fff";a(f).animate({backgroundColor:"#CCEEBB"},600).animate({backgroundColor:d},600);a.fn.wpList.process(a(f))},error:function(b){var c=b.statusText;a("#replysubmit .waiting").hide();if(b.responseText){c=b.responseText.replace(/<.[^<>]*?>/g,"")}if(c){a("#replysubmit .error").html(c).show()}}};a(document).ready(function(){var e,b,c,d;setCommentsList();commentReply.init();a("span.delete a.delete").click(function(){return false});if(typeof QTags!="undefined"){ed_reply=new QTags("ed_reply","replycontent","replycontainer","more")}if(typeof a.table_hotkeys!="undefined"){e=function(f){return function(){var h,g;h="next"==f?"first":"last";g=a("."+f+".page-numbers");if(g.length){window.location=g[0].href.replace(/\&hotkeys_highlight_(first|last)=1/g,"")+"&hotkeys_highlight_"+h+"=1"}}};b=function(g,f){window.location=a("span.edit a",f).attr("href")};c=function(){toggleWithKeyboard=true;a("#comments-form thead #cb input:checkbox").click().attr("checked","");toggleWithKeyboard=false};d=function(f){return function(h,g){a("option[value="+f+"]").attr("selected","selected");a("form#comments-form")[0].submit()}};a.table_hotkeys(a("table.widefat"),["a","u","s","d","r","q",["e",b],["shift+a",d("approve")],["shift+s",d("markspam")],["shift+d",d("delete")],["shift+x",c],["shift+u",d("unapprove")]],{highlight_first:adminCommentsL10n.hotkeys_highlight_first,highlight_last:adminCommentsL10n.hotkeys_highlight_last,prev_page_link_cb:e("prev"),next_page_link_cb:e("next")})}})})(jQuery);
</ins><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="trunkwpadminmediaphp"></a>
<div class="modfile"><h4>Modified: trunk/wp-admin/media.php (11748 => 11749)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-admin/media.php        2009-07-27 23:28:13 UTC (rev 11748)
+++ trunk/wp-admin/media.php        2009-07-30 13:39:34 UTC (rev 11749)
</span><span class="lines">@@ -58,6 +58,9 @@
</span><span class="cx">
</span><span class="cx">         $att = get_post($att_id);
</span><span class="cx">
</span><ins>+        if ( empty($att->ID) ) wp_die( __('You attempted to edit an attachment that doesn&#8217;t exist. Perhaps it was deleted?') );
+        if ( $att->post_status == 'trash' ) wp_die( __('You can&#8217;t edit this attachment because it is in the Trash. Please move it out of the Trash and try again.') );
+        
</ins><span class="cx">         add_filter('attachment_fields_to_edit', 'media_single_attachment_fields_to_edit', 10, 2);
</span><span class="cx">
</span><span class="cx">         wp_enqueue_script( 'wp-ajax-response' );
</span></span></pre></div>
<a id="trunkwpadminpagephp"></a>
<div class="modfile"><h4>Modified: trunk/wp-admin/page.php (11748 => 11749)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-admin/page.php        2009-07-27 23:28:13 UTC (rev 11748)
+++ trunk/wp-admin/page.php        2009-07-30 13:39:34 UTC (rev 11749)
</span><span class="lines">@@ -83,6 +83,7 @@
</span><span class="cx">         $post = get_post_to_edit($page_ID);
</span><span class="cx">
</span><span class="cx">         if ( empty($post->ID) ) wp_die( __('You attempted to edit a page that doesn&#8217;t exist. Perhaps it was deleted?') );
</span><ins>+        if ( $post->post_status == 'trash' ) wp_die( __('You can&#8217;t edit this page because it is in the Trash. Please move it out of the Trash and try again.') );
</ins><span class="cx">
</span><span class="cx">         if ( 'page' != $post->post_type ) {
</span><span class="cx">                 wp_redirect( get_edit_post_link( $post_ID, 'url' ) );
</span><span class="lines">@@ -140,6 +141,46 @@
</span><span class="cx">         exit();
</span><span class="cx">         break;
</span><span class="cx">
</span><ins>+case 'trash':
+        $post_id = (isset($_GET['post'])) ? intval($_GET['post']) : intval($_POST['post_ID']);
+        check_admin_referer('trash-page_' . $post_id);
+
+        $post = & get_post($post_id);
+
+        if ( !current_user_can('delete_page', $page_id) )
+                wp_die( __('You are not allowed to move this page to the trash.') );
+
+        if ( !wp_trash_post($post_id) )
+                wp_die( __('Error in removing from trash...') );
+
+        $sendback = wp_get_referer();
+        if (strpos($sendback, 'page.php') !== false) $sendback = admin_url('edit-pages.php?trashed=1');
+        elseif (strpos($sendback, 'attachments.php') !== false) $sendback = admin_url('attachments.php');
+        else $sendback = add_query_arg('trashed', 1, $sendback);
+        wp_redirect($sendback);
+        exit();
+        break;
+
+case 'untrash':
+        $post_id = (isset($_GET['post'])) ? intval($_GET['post']) : intval($_POST['post_ID']);
+        check_admin_referer('untrash-page_' . $post_id);
+
+        $post = & get_post($post_id);
+
+        if ( !current_user_can('delete_page', $page_id) )
+                wp_die( __('You are not allowed to remove this page form the trash.') );
+
+        if ( !wp_untrash_post($post_id) )
+                wp_die( __('Error in removing from trash...') );
+
+        $sendback = wp_get_referer();
+        if (strpos($sendback, 'page.php') !== false) $sendback = admin_url('edit-pages.php?untrashed=1');
+        elseif (strpos($sendback, 'attachments.php') !== false) $sendback = admin_url('attachments.php');
+        else $sendback = add_query_arg('untrashed', 1, $sendback);
+        wp_redirect($sendback);
+        exit();
+        break;
+
</ins><span class="cx"> case 'delete':
</span><span class="cx">         $page_id = (isset($_GET['post'])) ? intval($_GET['post']) : intval($_POST['post_ID']);
</span><span class="cx">         check_admin_referer('delete-page_' . $page_id);
</span></span></pre></div>
<a id="trunkwpadminpostphp"></a>
<div class="modfile"><h4>Modified: trunk/wp-admin/post.php (11748 => 11749)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-admin/post.php        2009-07-27 23:28:13 UTC (rev 11748)
+++ trunk/wp-admin/post.php        2009-07-30 13:39:34 UTC (rev 11749)
</span><span class="lines">@@ -116,6 +116,7 @@
</span><span class="cx">         $post = get_post($post_ID);
</span><span class="cx">
</span><span class="cx">         if ( empty($post->ID) ) wp_die( __('You attempted to edit a post that doesn&#8217;t exist. Perhaps it was deleted?') );
</span><ins>+        if ( $post->post_status == 'trash' ) wp_die( __('You can&#8217;t edit this post because it is in the Trash. Please move it out of the Trash and try again.') );
</ins><span class="cx">
</span><span class="cx">         if ( 'post' != $post->post_type ) {
</span><span class="cx">                 wp_redirect( get_edit_post_link( $post->ID, 'url' ) );
</span><span class="lines">@@ -181,6 +182,46 @@
</span><span class="cx">         exit();
</span><span class="cx">         break;
</span><span class="cx">
</span><ins>+case 'trash':
+        $post_id = (isset($_GET['post'])) ? intval($_GET['post']) : intval($_POST['post_ID']);
+        check_admin_referer('trash-post_' . $post_id);
+
+        $post = & get_post($post_id);
+
+        if ( !current_user_can('delete_post', $post_id) )
+                wp_die( __('You are not allowed to move this post to the trash.') );
+
+        if ( ! wp_trash_post($post_id) )
+                wp_die( __('Error in moving to trash...') );
+
+        $sendback = wp_get_referer();
+        if (strpos($sendback, 'post.php') !== false) $sendback = admin_url('edit.php?trashed=1');
+        elseif (strpos($sendback, 'attachments.php') !== false) $sendback = admin_url('attachments.php');
+        else $sendback = add_query_arg('trashed', 1, $sendback);
+        wp_redirect($sendback);
+        exit();
+        break;
+
+case 'untrash':
+        $post_id = (isset($_GET['post'])) ? intval($_GET['post']) : intval($_POST['post_ID']);
+        check_admin_referer('untrash-post_' . $post_id);
+
+        $post = & get_post($post_id);
+
+        if ( !current_user_can('delete_post', $post_id) )
+                wp_die( __('You are not allowed to remove this post from the trash.') );
+
+        if ( ! wp_untrash_post($post_id) )
+                wp_die( __('Error in removing from trash...') );
+
+        $sendback = wp_get_referer();
+        if (strpos($sendback, 'post.php') !== false) $sendback = admin_url('edit.php?untrashed=1');
+        elseif (strpos($sendback, 'attachments.php') !== false) $sendback = admin_url('attachments.php');
+        else $sendback = add_query_arg('untrashed', 1, $sendback);
+        wp_redirect($sendback);
+        exit();
+        break;
+
</ins><span class="cx"> case 'delete':
</span><span class="cx">         $post_id = (isset($_GET['post'])) ? intval($_GET['post']) : intval($_POST['post_ID']);
</span><span class="cx">         check_admin_referer('delete-post_' . $post_id);
</span></span></pre></div>
<a id="trunkwpadminuploadphp"></a>
<div class="modfile"><h4>Modified: trunk/wp-admin/upload.php (11748 => 11749)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-admin/upload.php        2009-07-27 23:28:13 UTC (rev 11748)
+++ trunk/wp-admin/upload.php        2009-07-30 13:39:34 UTC (rev 11749)
</span><span class="lines">@@ -67,33 +67,60 @@
</span><span class="cx">                 exit;
</span><span class="cx">         }
</span><span class="cx">
</span><del>-} elseif ( isset($_GET['action']) && isset($_GET['media']) && ( -1 != $_GET['action'] || -1 != $_GET['action2'] ) ) {
</del><ins>+} elseif ( isset($_GET['doaction']) || isset($_GET['doaction2']) || isset($_GET['delete_all']) || isset($_GET['delete_all2']) ) {
</ins><span class="cx">         check_admin_referer('bulk-media');
</span><del>-        $doaction = ( -1 != $_GET['action'] ) ? $_GET['action'] : $_GET['action2'];
</del><ins>+        
+        if ( isset($_GET['delete_all']) || isset($_GET['delete_all2']) ) {
+                $post_ids = $wpdb->get_col( "SELECT ID FROM $wpdb->posts WHERE post_type='attachment' AND post_status = 'trash'" );
+                $doaction = 'delete';
+        } elseif ( ($_GET['action'] != -1 || $_GET['action2'] != -1) && isset($_GET['media']) ) {
+                $post_ids = $_GET['media'];
+                $doaction = ($_GET['action'] != -1) ? $_GET['action'] : $_GET['action2'];
+        } else
+                wp_redirect($_SERVER['HTTP_REFERER']);
+        
+        $location = 'upload.php';
+        if ( $referer = wp_get_referer() ) {
+                if ( false !== strpos($referer, 'upload.php') )
+                        $location = $referer;
+        }
</ins><span class="cx">
</span><del>-        if ( 'delete' == $doaction ) {
-                foreach( (array) $_GET['media'] as $post_id_del ) {
-                        $post_del = & get_post($post_id_del);
-
-                        if ( !current_user_can('delete_post', $post_id_del) )
-                                wp_die( __('You are not allowed to delete this post.') );
-
-                        if ( $post_del->post_type == 'attachment' )
-                                if ( ! wp_delete_attachment($post_id_del) )
</del><ins>+        switch ( $doaction ) {
+                case 'trash':
+                        foreach( (array) $post_ids as $post_id ) {
+                                if ( !current_user_can('delete_post', $post_id) )
+                                        wp_die( __('You are not allowed to move this post to the trash.') );
+                                
+                                if ( !wp_trash_post($post_id) )
+                                        wp_die( __('Error in moving to trash...') );
+                        }
+                        $location = add_query_arg('message', 4, $location);
+                        break;
+                case 'untrash':
+                        foreach( (array) $post_ids as $post_id ) {
+                                if ( !current_user_can('delete_post', $post_id) )
+                                        wp_die( __('You are not allowed to remove this post from the trash.') );
+                                
+                                if ( !wp_untrash_post($post_id) )
+                                        wp_die( __('Error in restoring from trash...') );
+                        }
+                        $location = add_query_arg('message', 5, $location);
+                        break;
+                case 'delete':
+                        foreach( (array) $post_ids as $post_id_del ) {
+                                if ( !current_user_can('delete_post', $post_id_del) )
+                                        wp_die( __('You are not allowed to delete this post.') );
+        
+                                if ( !wp_delete_attachment($post_id_del) )
</ins><span class="cx">                                         wp_die( __('Error in deleting...') );
</span><del>-                }
</del><ins>+                        }
+                        $location = add_query_arg('message', 2, $location);
+                        break;
+        }
</ins><span class="cx">
</span><del>-                $location = 'upload.php';
-                if ( $referer = wp_get_referer() ) {
-                        if ( false !== strpos($referer, 'upload.php') )
-                                $location = $referer;
-                }
-
-                $location = add_query_arg('message', 2, $location);
-                $location = remove_query_arg('posted', $location);
-                wp_redirect($location);
-                exit;
-        }
</del><ins>+        $location = remove_query_arg('posted', $location);
+        wp_redirect($location);
+        exit;
</ins><span class="cx"> } elseif ( isset($_GET['_wp_http_referer']) && ! empty($_GET['_wp_http_referer']) ) {
</span><span class="cx">          wp_redirect( remove_query_arg( array('_wp_http_referer', '_wpnonce'), stripslashes($_SERVER['REQUEST_URI']) ) );
</span><span class="cx">          exit;
</span><span class="lines">@@ -115,7 +142,7 @@
</span><span class="cx">                 $orphans = $wpdb->get_results( "SELECT * FROM $wpdb->posts WHERE post_type = 'attachment' AND ID IN ($lost) LIMIT $start, 50" );
</span><span class="cx">         } else {
</span><span class="cx">                 $start = ( $_GET['paged'] - 1 ) * 25;
</span><del>-                $orphans = $wpdb->get_results( "SELECT SQL_CALC_FOUND_ROWS * FROM $wpdb->posts WHERE post_type = 'attachment' AND post_parent < 1 LIMIT $start, 25" );
</del><ins>+                $orphans = $wpdb->get_results( "SELECT SQL_CALC_FOUND_ROWS * FROM $wpdb->posts WHERE post_type = 'attachment' AND post_status != 'trash' AND post_parent < 1 LIMIT $start, 25" );
</ins><span class="cx">                 $page_links_total = ceil($wpdb->get_var( "SELECT FOUND_ROWS()" ) / 25);
</span><span class="cx">         }
</span><span class="cx">
</span><span class="lines">@@ -135,6 +162,8 @@
</span><span class="cx">         list($post_mime_types, $avail_post_mime_types) = wp_edit_attachments_query();
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+$is_trash = ( isset($_GET['status']) && $_GET['status'] == 'trash' );
+
</ins><span class="cx"> wp_enqueue_script('media');
</span><span class="cx"> require_once('admin-header.php'); ?>
</span><span class="cx">
</span><span class="lines">@@ -153,6 +182,8 @@
</span><span class="cx"> $messages[1] = __('Media attachment updated.');
</span><span class="cx"> $messages[2] = __('Media deleted.');
</span><span class="cx"> $messages[3] = __('Error saving media attachment.');
</span><ins>+$messages[4] = __('Media moved to Trash.');
+$messages[5] = __('Media removed from Trash.');
</ins><span class="cx">
</span><span class="cx"> if ( isset($_GET['message']) && (int) $_GET['message'] ) {
</span><span class="cx">         $message = $messages[$_GET['message']];
</span><span class="lines">@@ -180,13 +211,13 @@
</span><span class="cx"> <?php
</span><span class="cx"> $type_links = array();
</span><span class="cx"> $_num_posts = (array) wp_count_attachments();
</span><del>-$_total_posts = array_sum( $_num_posts );
</del><ins>+$_total_posts = array_sum($_num_posts) - $_num_posts['trash'];
</ins><span class="cx"> $matches = wp_match_mime_types(array_keys($post_mime_types), array_keys($_num_posts));
</span><span class="cx"> foreach ( $matches as $type => $reals )
</span><span class="cx">         foreach ( $reals as $real )
</span><span class="cx">                 $num_posts[$type] = ( isset( $num_posts[$type] ) ) ? $num_posts[$type] + $_num_posts[$real] : $_num_posts[$real];
</span><span class="cx">
</span><del>-$class = empty($_GET['post_mime_type']) && ! isset($_GET['detached']) ? ' class="current"' : '';
</del><ins>+$class = ( empty($_GET['post_mime_type']) && !isset($_GET['detached']) && !isset($_GET['status']) ) ? ' class="current"' : '';
</ins><span class="cx"> $type_links[] = "<li><a href='upload.php'$class>" . sprintf( _nx( 'All <span class="count">(%s)</span>', 'All <span class="count">(%s)</span>', $_total_posts, 'uploaded files' ), number_format_i18n( $_total_posts ) ) . '</a>';
</span><span class="cx"> foreach ( $post_mime_types as $mime_type => $label ) {
</span><span class="cx">         $class = '';
</span><span class="lines">@@ -199,8 +230,8 @@
</span><span class="cx">
</span><span class="cx">         $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>';
</span><span class="cx"> }
</span><del>-$class = isset($_GET['detached']) ? ' class="current"' : '';
-$type_links[] = '<li><a href="upload.php?detached=1"' . $class . '>' . __('Unattached') . '</a>';
</del><ins>+$type_links[] = '<li><a href="upload.php?detached=1"' . ( isset($_GET['detached']) ? ' class="current"' : '' ) . '>' . __('Unattached') . '</a>';
+$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>';
</ins><span class="cx">
</span><span class="cx"> echo implode( " |</li>\n", $type_links) . '</li>';
</span><span class="cx"> unset($type_links);
</span><span class="lines">@@ -242,8 +273,12 @@
</span><span class="cx"> <div class="alignleft actions">
</span><span class="cx"> <select name="action" class="select-action">
</span><span class="cx"> <option value="-1" selected="selected"><?php _e('Bulk Actions'); ?></option>
</span><del>-<option value="delete"><?php _e('Delete'); ?></option>
-<?php if ( isset($orphans) ) { ?>
</del><ins>+<?php if ( $is_trash ) { ?>
+<option value="untrash"><?php _e('Restore'); ?></option>
+<option value="delete"><?php _e('Delete Permanently'); ?></option>
+<?php } else { ?>
+<option value="trash"><?php _e('Move to Trash'); ?></option>
+<?php } if ( isset($orphans) ) { ?>
</ins><span class="cx"> <option value="attach"><?php _e('Attach to a post'); ?></option>
</span><span class="cx"> <?php } ?>
</span><span class="cx"> </select>
</span><span class="lines">@@ -251,7 +286,7 @@
</span><span class="cx"> <?php wp_nonce_field('bulk-media'); ?>
</span><span class="cx">
</span><span class="cx"> <?php
</span><del>-if ( ! is_singular() && ! isset($_GET['detached']) ) {
</del><ins>+if ( !is_singular() && !isset($_GET['detached']) && !$is_trash ) {
</ins><span class="cx">         $arc_query = "SELECT DISTINCT YEAR(post_date) AS yyear, MONTH(post_date) AS mmonth FROM $wpdb->posts WHERE post_type = 'attachment' ORDER BY post_date DESC";
</span><span class="cx">
</span><span class="cx">         $arc_result = $wpdb->get_results( $arc_query );
</span><span class="lines">@@ -286,6 +321,8 @@
</span><span class="cx">
</span><span class="cx"> <?php if ( isset($_GET['detached']) ) { ?>
</span><span class="cx">         <input type="submit" id="find_detached" name="find_detached" value="<?php esc_attr_e('Scan for lost attachments'); ?>" class="button-secondary" />
</span><ins>+<?php } elseif ( isset($_GET['status']) && $_GET['status'] == 'trash' ) { ?>
+        <input type="submit" id="delete_all" name="delete_all" value="<?php esc_attr_e('Empty Trash'); ?>" class="button-secondary apply" />
</ins><span class="cx"> <?php } ?>
</span><span class="cx">
</span><span class="cx"> </div>
</span><span class="lines">@@ -341,7 +378,7 @@
</span><span class="cx">                 if ( current_user_can('edit_post', $post->ID) )
</span><span class="cx">                         $actions['edit'] = '<a href="' . get_edit_post_link($post->ID, true) . '">' . __('Edit') . '</a>';
</span><span class="cx">                 if ( current_user_can('delete_post', $post->ID) )
</span><del>-                        $actions['delete'] = "<a class='submitdelete' href='" . wp_nonce_url("post.php?action=delete&amp;post=$post->ID", 'delete-post_' . $post->ID) . "' onclick=\"if ( confirm('" . esc_js(sprintf( ('draft' == $post->post_status) ? __("You are about to delete this attachment '%s'\n 'Cancel' to stop, 'OK' to delete.") : __("You are about to delete this attachment '%s'\n 'Cancel' to stop, 'OK' to delete."), $post->post_title )) . "') ) { return true;}return false;\">" . __('Delete') . "</a>";
</del><ins>+                        $actions['trash'] = "<a class='submitdelete' href='" . wp_nonce_url("post.php?action=trash&amp;post=$post->ID", 'trash-post_' . $post->ID) . "'>" . __('Trash') . "</a>";
</ins><span class="cx">                 $actions['view'] = '<a href="' . get_permalink($post->ID) . '" title="' . esc_attr(sprintf(__('View &#8220;%s&#8221;'), $title)) . '" rel="permalink">' . __('View') . '</a>';
</span><span class="cx">                 if ( current_user_can('edit_post', $post->ID) )
</span><span class="cx">                         $actions['attach'] = '<a href="#the-list" onclick="findPosts.open(\'media[]\',\''.$post->ID.'\');return false;">'.__('Attach').'</a>';
</span><span class="lines">@@ -398,12 +435,20 @@
</span><span class="cx"> <div class="alignleft actions">
</span><span class="cx"> <select name="action2" class="select-action">
</span><span class="cx"> <option value="-1" selected="selected"><?php _e('Bulk Actions'); ?></option>
</span><del>-<option value="delete"><?php _e('Delete'); ?></option>
-<?php if ( isset($orphans) ) { ?>
</del><ins>+<?php if ($is_trash) { ?>
+<option value="untrash"><?php _e('Restore'); ?></option>
+<option value="delete"><?php _e('Delete Permanently'); ?></option>
+<?php } else { ?>
+<option value="trash"><?php _e('Move to Trash'); ?></option>
+<?php } if (isset($orphans)) { ?>
</ins><span class="cx"> <option value="attach"><?php _e('Attach to a post'); ?></option>
</span><span class="cx"> <?php } ?>
</span><span class="cx"> </select>
</span><span class="cx"> <input type="submit" value="<?php esc_attr_e('Apply'); ?>" name="doaction2" id="doaction2" class="button-secondary action" />
</span><ins>+
+<?php if ( isset($_GET['status']) && $_GET['status'] == 'trash' ) { ?>
+        <input type="submit" id="delete_all2" name="delete_all2" value="<?php esc_attr_e('Empty Trash'); ?>" class="button-secondary apply" />
+<?php } ?>
</ins><span class="cx"> </div>
</span><span class="cx">
</span><span class="cx"> <br class="clear" />
</span></span></pre></div>
<a id="trunkwpadminwpadmincss"></a>
<div class="modfile"><h4>Modified: trunk/wp-admin/wp-admin.css (11748 => 11749)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-admin/wp-admin.css        2009-07-27 23:28:13 UTC (rev 11748)
+++ trunk/wp-admin/wp-admin.css        2009-07-30 13:39:34 UTC (rev 11749)
</span><span class="lines">@@ -409,7 +409,8 @@
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> #doaction,
</span><del>-#doaction2 {
</del><ins>+#doaction2,
+#post-query-submit {
</ins><span class="cx">         margin-right: 8px;
</span><span class="cx"> }
</span><span class="cx">
</span><span class="lines">@@ -444,7 +445,9 @@
</span><span class="cx">         display: none;
</span><span class="cx"> }
</span><span class="cx">
</span><del>-.unapproved .approve, .spam .approve, .deleted .approve {
</del><ins>+.unapproved .approve,
+.spam .approve,
+.trash .approve {
</ins><span class="cx">         display: inline;
</span><span class="cx"> }
</span><span class="cx">
</span></span></pre></div>
<a id="trunkwpappphp"></a>
<div class="modfile"><h4>Modified: trunk/wp-app.php (11748 => 11749)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-app.php        2009-07-27 23:28:13 UTC (rev 11748)
+++ trunk/wp-app.php        2009-07-30 13:39:34 UTC (rev 11749)
</span><span class="lines">@@ -1231,7 +1231,7 @@
</span><span class="cx">                 log_app('Status','204: No Content');
</span><span class="cx">                 header('Content-Type: text/plain');
</span><span class="cx">                 status_header('204');
</span><del>-                echo "Deleted.";
</del><ins>+                echo "Moved to Trash.";
</ins><span class="cx">                 exit;
</span><span class="cx">         }
</span><span class="cx">
</span></span></pre></div>
<a id="trunkwpincludescommentphp"></a>
<div class="modfile"><h4>Modified: trunk/wp-includes/comment.php (11748 => 11749)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-includes/comment.php        2009-07-27 23:28:13 UTC (rev 11748)
+++ trunk/wp-includes/comment.php        2009-07-30 13:39:34 UTC (rev 11749)
</span><span class="lines">@@ -208,8 +208,8 @@
</span><span class="cx">                 $approved = "comment_approved = '1'";
</span><span class="cx">         elseif ( 'spam' == $status )
</span><span class="cx">                 $approved = "comment_approved = 'spam'";
</span><del>-        elseif ( 'deleted' == $status )
-                $approved = "comment_approved = 'deleted'";
</del><ins>+        elseif ( 'trash' == $status )
+                $approved = "comment_approved = 'trash'";
</ins><span class="cx">         else
</span><span class="cx">                 $approved = "( comment_approved = '0' OR comment_approved = '1' )";
</span><span class="cx">
</span><span class="lines">@@ -694,14 +694,15 @@
</span><span class="cx">         if ( false !== $count )
</span><span class="cx">                 return $count;
</span><span class="cx">
</span><del>-        $where = '';
</del><ins>+        $where = 'WHERE ';
</ins><span class="cx">         if( $post_id > 0 )
</span><del>-                $where = $wpdb->prepare( "WHERE comment_post_ID = %d", $post_id );
</del><ins>+                $where .= $wpdb->prepare( "c.comment_post_ID = %d AND ", $post_id );
+        $where .= "p.post_status <> 'trash'";
</ins><span class="cx">
</span><del>-        $count = $wpdb->get_results( "SELECT comment_approved, COUNT( * ) AS num_comments FROM {$wpdb->comments} {$where} GROUP BY comment_approved", ARRAY_A );
</del><ins>+        $count = $wpdb->get_results( "SELECT comment_approved, COUNT( * ) AS num_comments FROM {$wpdb->comments} c LEFT JOIN {$wpdb->posts} p ON c.comment_post_ID = p.ID {$where} GROUP BY comment_approved", ARRAY_A );
</ins><span class="cx">
</span><span class="cx">         $total = 0;
</span><del>-        $approved = array('0' => 'moderated', '1' => 'approved', 'spam' => 'spam', 'deleted' => 'deleted');
</del><ins>+        $approved = array('0' => 'moderated', '1' => 'approved', 'spam' => 'spam', 'trash' => 'trash');
</ins><span class="cx">         $known_types = array_keys( $approved );
</span><span class="cx">         foreach( (array) $count as $row_num => $row ) {
</span><span class="cx">                 $total += $row['num_comments'];
</span><span class="lines">@@ -737,16 +738,21 @@
</span><span class="cx"> * @return bool False if delete comment query failure, true on success.
</span><span class="cx"> */
</span><span class="cx"> function wp_delete_comment($comment_id) {
</span><del>-        if (wp_get_comment_status($comment_id) != 'deleted' && wp_get_comment_status($comment_id) != 'spam')
-                return wp_set_comment_status($comment_id, 'delete');
</del><ins>+        global $wpdb;
+        if (!$comment = get_comment($comment_id))
+                return false;
+
+        if (wp_get_comment_status($comment_id) != 'trash' && wp_get_comment_status($comment_id) != 'spam' && EMPTY_TRASH_DAYS > 0)
+                return wp_trash_comment($comment_id);
</ins><span class="cx">         
</span><del>-        global $wpdb;
</del><span class="cx">         do_action('delete_comment', $comment_id);
</span><span class="cx">         
</span><del>-        wp_unschedule_comment_delete($comment_id);
</del><ins>+        $trash_meta = get_option('wp_trash_meta');
+        if (is_array($trash_meta) && isset($trash_meta['comments'][$comment_id])) {
+                unset($trash_meta['comments'][$comment_id]);
+                update_option('wp_trash_meta', $trash_meta);
+        }
</ins><span class="cx">
</span><del>-        $comment = get_comment($comment_id);
-
</del><span class="cx">         if ( ! $wpdb->query( $wpdb->prepare("DELETE FROM $wpdb->comments WHERE comment_ID = %d LIMIT 1", $comment_id) ) )
</span><span class="cx">                 return false;
</span><span class="cx">
</span><span class="lines">@@ -769,12 +775,72 @@
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> /**
</span><ins>+ * Moves a comment to the Trash
+ *
+ * @since 2.9.0
+ * @uses do_action() on 'trash_comment' before trashing
+ * @uses do_action() on 'trashed_comment' after trashing
+ *
+ * @param int $comment_id Comment ID.
+ * @return mixed False on failure
+ */
+function wp_trash_comment($comment_id = 0) {
+        if (EMPTY_TRASH_DAYS == 0)
+                return wp_delete_comment($comment_id);
+
+        if (!$comment = get_comment($comment_id))
+                return false;
+
+        do_action('trash_comment', $comment_id);
+
+        $trash_meta = get_option('wp_trash_meta', array());
+        $trash_meta['comments'][$comment_id]['status'] = $comment->comment_approved;
+        $trash_meta['comments'][$comment_id]['time'] = time();
+        update_option('wp_trash_meta', $trash_meta);
+
+        wp_set_comment_status($comment_id, 'trash');
+
+        do_action('trashed_comment', $comment_id);
+
+        return true;
+}
+
+/**
+ * Removes a comment from the Trash
+ *
+ * @since 2.9.0
+ * @uses do_action() on 'untrash_comment' before undeletion
+ * @uses do_action() on 'untrashed_comment' after undeletion
+ *
+ * @param int $comment_id Comment ID.
+ * @return mixed False on failure
+ */
+function wp_untrash_comment($comment_id = 0) {
+        do_action('untrash_comment', $comment_id);
+
+        $comment = array('comment_ID'=>$comment_id, 'comment_approved'=>'0');
+
+        $trash_meta = get_option('wp_trash_meta');
+        if (is_array($trash_meta) && isset($trash_meta['comments'][$comment_id])) {
+                $comment['comment_approved'] = $trash_meta['comments'][$comment_id]['status'];
+                unset($trash_meta['comments'][$comment_id]);
+                update_option('wp_trash_meta', $trash_meta);
+        }
+
+        wp_update_comment($comment);
+
+        do_action('untrashed_comment', $comment_id);
+
+        return true;
+}
+
+/**
</ins><span class="cx"> * The status of a comment by ID.
</span><span class="cx"> *
</span><span class="cx"> * @since 1.0.0
</span><span class="cx"> *
</span><span class="cx"> * @param int $comment_id Comment ID
</span><del>- * @return string|bool Status might be 'deleted', 'approved', 'unapproved', 'spam'. False on failure.
</del><ins>+ * @return string|bool Status might be 'trash', 'approved', 'unapproved', 'spam'. False on failure.
</ins><span class="cx"> */
</span><span class="cx"> function wp_get_comment_status($comment_id) {
</span><span class="cx">         $comment = get_comment($comment_id);
</span><span class="lines">@@ -784,15 +850,15 @@
</span><span class="cx">         $approved = $comment->comment_approved;
</span><span class="cx">
</span><span class="cx">         if ( $approved == NULL )
</span><del>-                return 'deleted';
</del><ins>+                return false;
</ins><span class="cx">         elseif ( $approved == '1' )
</span><span class="cx">                 return 'approved';
</span><span class="cx">         elseif ( $approved == '0' )
</span><span class="cx">                 return 'unapproved';
</span><span class="cx">         elseif ( $approved == 'spam' )
</span><span class="cx">                 return 'spam';
</span><del>-        elseif ( $approved == 'deleted' )
-                return 'deleted';
</del><ins>+        elseif ( $approved == 'trash' )
+                return 'trash';
</ins><span class="cx">         else
</span><span class="cx">                 return false;
</span><span class="cx"> }
</span><span class="lines">@@ -1037,8 +1103,7 @@
</span><span class="cx"> */
</span><span class="cx"> function wp_set_comment_status($comment_id, $comment_status, $wp_error = false) {
</span><span class="cx">         global $wpdb;
</span><del>-        wp_unschedule_comment_delete($comment_id);
-        
</del><ins>+                
</ins><span class="cx">         $status = '0';
</span><span class="cx">         switch ( $comment_status ) {
</span><span class="cx">                 case 'hold':
</span><span class="lines">@@ -1054,11 +1119,8 @@
</span><span class="cx">                 case 'spam':
</span><span class="cx">                         $status = 'spam';
</span><span class="cx">                         break;
</span><del>-                case 'delete':
-                        if (wp_get_comment_status($comment_id) == 'deleted' || wp_get_comment_status($comment_id) == 'spam')
-                                return wp_delete_comment($comment_id);
-                        $status = 'deleted';
-                        wp_schedule_comment_delete($comment_id);
</del><ins>+                case 'trash':
+                        $status = 'trash';
</ins><span class="cx">                         break;
</span><span class="cx">                 default:
</span><span class="cx">                         return false;
</span><span class="lines">@@ -1084,42 +1146,6 @@
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> /**
</span><del>- * Schedules a comment for destruction in 30 days.
- *
- * @since 2.9.0
- *
- * @param int $comment_id Comment ID.
- * @return void
- */
-function wp_schedule_comment_delete($comment_id) {
-        $to_delete = get_option('wp_scheduled_delete');
-        if ( !is_array($to_delete) )
-                $to_delete = array();
-        
-        $to_delete['comments'][$comment_id] = time();
-        
-        update_option('wp_scheduled_delete', $to_delete);
-}
-
-/**
- * Unschedules a comment for destruction.
- *
- * @since 2.9.0
- *
- * @param int $comment_id Comment ID.
- * @return void
- */
-function wp_unschedule_comment_delete($comment_id) {
-        $to_delete = get_option('wp_scheduled_delete');
-        if ( !is_array($to_delete) )
-                return;
-        
-        unset($to_delete['comments'][$comment_id]);
-        
-        update_option('wp_scheduled_delete', $to_delete);
-}
-
-/**
</del><span class="cx"> * Updates an existing comment in the database.
</span><span class="cx"> *
</span><span class="cx"> * Filters the comment and makes sure certain fields are valid before updating.
</span></span></pre></div>
<a id="trunkwpincludesfunctionsphp"></a>
<div class="modfile"><h4>Modified: trunk/wp-includes/functions.php (11748 => 11749)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-includes/functions.php        2009-07-27 23:28:13 UTC (rev 11748)
+++ trunk/wp-includes/functions.php        2009-07-30 13:39:34 UTC (rev 11749)
</span><span class="lines">@@ -3339,30 +3339,31 @@
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> /**
</span><del>- * Permanently deletes comments that have been scheduled for deleting.
- * Will do the same for posts, pages, etc in the future.
</del><ins>+ * Permanently deletes posts, pages, attachments, and comments which have been in the trash for EMPTY_TRASH_DAYS.
</ins><span class="cx"> *
</span><del>- * @access private
</del><span class="cx"> * @since 2.9.0
</span><span class="cx"> *
</span><span class="cx"> * @return void
</span><span class="cx"> */
</span><span class="cx"> function wp_scheduled_delete() {
</span><del>-        $to_delete = get_option('wp_scheduled_delete');
-        if (!is_array($to_delete))
</del><ins>+        $trash_meta = get_option('wp_trash_meta');
+        if ( !is_array($trash_meta) )
</ins><span class="cx">                 return;
</span><span class="cx">
</span><del>-        if ( !isset($to_delete['comments']) || !is_array($to_delete['comments']) )
-                $to_delete['comments'] = array();
</del><ins>+        $delete_timestamp = time() - (60*60*24*EMPTY_TRASH_DAYS);
</ins><span class="cx">
</span><del>-        $delete_delay = defined('EMPTY_TRASH_TIMEOUT') ? (int) EMPTY_TRASH_TIMEOUT : (60*60*24*30);
-        $deletetimestamp = time() - $delete_delay;
-        foreach ($to_delete['comments'] as $comment_id => $timestamp) {
-                if ($timestamp < $deletetimestamp) {
-                        wp_delete_comment($comment_id);
-                        unset($to_delete['comments'][$comment_id]);
</del><ins>+        foreach ( $trash_meta['comments'] as $id => $meta ) {
+                if ( $meta['time'] < $delete_timestamp ) {
+                        wp_delete_comment($id);
+                        unset($trash_meta['comments'][$id]);
</ins><span class="cx">                 }
</span><span class="cx">         }
</span><ins>+        foreach ( $trash_meta['posts'] as $id => $meta ) {
+                if ( $meta['time'] < $delete_timestamp ) {
+                        wp_delete_post($id);
+                        unset($to_delete['posts'][$id]);
+                }
+        }
</ins><span class="cx">
</span><span class="cx">         update_option('wp_scheduled_delete', $to_delete);
</span><span class="cx"> }
</span></span></pre></div>
<a id="trunkwpincludespostphp"></a>
<div class="modfile"><h4>Modified: trunk/wp-includes/post.php (11748 => 11749)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-includes/post.php        2009-07-27 23:28:13 UTC (rev 11748)
+++ trunk/wp-includes/post.php        2009-07-30 13:39:34 UTC (rev 11749)
</span><span class="lines">@@ -998,7 +998,7 @@
</span><span class="cx">
</span><span class="cx">         $count = $wpdb->get_results( $wpdb->prepare( $query, $type ), ARRAY_A );
</span><span class="cx">
</span><del>-        $stats = array( 'publish' => 0, 'private' => 0, 'draft' => 0, 'pending' => 0, 'future' => 0 );
</del><ins>+        $stats = array( 'publish' => 0, 'private' => 0, 'draft' => 0, 'pending' => 0, 'future' => 0, 'trash' => 0 );
</ins><span class="cx">         foreach( (array) $count as $row_num => $row ) {
</span><span class="cx">                 $stats[$row['post_status']] = $row['num_posts'];
</span><span class="cx">         }
</span><span class="lines">@@ -1027,12 +1027,13 @@
</span><span class="cx">         global $wpdb;
</span><span class="cx">
</span><span class="cx">         $and = wp_post_mime_type_where( $mime_type );
</span><del>-        $count = $wpdb->get_results( "SELECT post_mime_type, COUNT( * ) AS num_posts FROM $wpdb->posts WHERE post_type = 'attachment' $and GROUP BY post_mime_type", ARRAY_A );
</del><ins>+        $count = $wpdb->get_results( "SELECT post_mime_type, COUNT( * ) AS num_posts FROM $wpdb->posts WHERE post_type = 'attachment' AND post_status != 'trash' $and GROUP BY post_mime_type", ARRAY_A );
</ins><span class="cx">
</span><span class="cx">         $stats = array( );
</span><span class="cx">         foreach( (array) $count as $row ) {
</span><span class="cx">                 $stats[$row['post_mime_type']] = $row['num_posts'];
</span><span class="cx">         }
</span><ins>+        $stats['trash'] = $wpdb->get_var( "SELECT COUNT( * ) FROM $wpdb->posts WHERE post_type = 'attachment' AND post_status = 'trash' $and");
</ins><span class="cx">
</span><span class="cx">         return (object) $stats;
</span><span class="cx"> }
</span><span class="lines">@@ -1140,10 +1141,19 @@
</span><span class="cx">         if ( !$post = $wpdb->get_row($wpdb->prepare("SELECT * FROM $wpdb->posts WHERE ID = %d", $postid)) )
</span><span class="cx">                 return $post;
</span><span class="cx">
</span><del>-        if ( 'attachment' == $post->post_type )
</del><ins>+        if ( ($post->post_type == 'post' || $post->post_type == 'page') && get_post_status($postid) != 'trash' && EMPTY_TRASH_DAYS > 0 )
+                return wp_trash_post($postid);
+                
+        if ( $post->post_type == 'attachment' )
</ins><span class="cx">                 return wp_delete_attachment($postid);
</span><span class="cx">
</span><span class="cx">         do_action('delete_post', $postid);
</span><ins>+        
+        $trash_meta = get_option('wp_trash_meta');
+        if ( is_array($trash_meta) && isset($trash_meta['posts'][$postid]) ) {
+                unset($trash_meta['posts'][$postid]);
+                update_option('wp_trash_meta', $trash_meta);
+        }
</ins><span class="cx">
</span><span class="cx">         /** @todo delete for pluggable post taxonomies too */
</span><span class="cx">         wp_delete_object_term_relationships($postid, array('category', 'post_tag'));
</span><span class="lines">@@ -1205,6 +1215,72 @@
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> /**
</span><ins>+ * Moves a post or page to the Trash
+ *
+ * @since 2.9.0
+ * @uses do_action() on 'trash_post' before trashing
+ * @uses do_action() on 'trashed_post' after trashing
+ *
+ * @param int $postid Post ID.
+ * @return mixed False on failure
+ */
+function wp_trash_post($postid = 0) {
+        if ( EMPTY_TRASH_DAYS == 0 )
+                return wp_delete_post($postid);
+
+        if ( !$post = wp_get_single_post($postid, ARRAY_A) )
+                return $post;
+
+        do_action('trash_post', $postid);
+
+        $trash_meta = get_option('wp_trash_meta');
+        if ( !is_array($trash_meta) )
+                $trash_meta = array();
+        $trash_meta['posts'][$postid]['status'] = $post['post_status'];
+        $trash_meta['posts'][$postid]['time'] = time();
+        update_option('wp_trash_meta', $trash_meta);
+
+        $post['post_status'] = 'trash';
+        wp_insert_post($post);
+
+        do_action('trashed_post', $postid);
+
+        return $post;
+}
+
+/**
+ * Removes a post or page from the Trash
+ *
+ * @since 2.9.0
+ * @uses do_action() on 'untrash_post' before undeletion
+ * @uses do_action() on 'untrashed_post' after undeletion
+ *
+ * @param int $postid Post ID.
+ * @return mixed False on failure
+ */
+function wp_untrash_post($postid = 0) {
+        if (!$post = wp_get_single_post($postid, ARRAY_A))
+                return $post;
+
+        do_action('untrash_post', $postid);
+        
+        $post['post_status'] = 'draft';
+        
+        $trash_meta = get_option('wp_trash_meta');
+        if (is_array($trash_meta) && isset($trash_meta['posts'][$postid])) {
+                $post['post_status'] = $trash_meta['posts'][$postid]['status'];
+                unset($trash_meta['posts'][$postid]);
+                update_option('wp_trash_meta', $trash_meta);
+        }
+        
+        wp_insert_post($post);
+        
+        do_action('untrashed_post', $postid);
+
+        return $post;
+}
+
+/**
</ins><span class="cx"> * Retrieve the list of categories for a post.
</span><span class="cx"> *
</span><span class="cx"> * Compatibility layer for themes and plugins. Also an easy layer of abstraction
</span><span class="lines">@@ -2586,7 +2662,16 @@
</span><span class="cx">
</span><span class="cx">         if ( 'attachment' != $post->post_type )
</span><span class="cx">                 return false;
</span><ins>+        
+        if ( 'trash' != $post->post_status )
+                return wp_trash_post($postid);
</ins><span class="cx">
</span><ins>+        $trash_meta = get_option('wp_trash_meta');
+        if ( is_array($trash_meta) && isset($trash_meta['posts'][$postid]) ) {
+                unset($trash_meta['posts'][$postid]);
+                update_option('wp_trash_meta', $trash_meta);
+        }
+
</ins><span class="cx">         $meta = wp_get_attachment_metadata( $postid );
</span><span class="cx">         $file = get_attached_file( $postid );
</span><span class="cx">
</span></span></pre></div>
<a id="trunkwpincludesqueryphp"></a>
<div class="modfile"><h4>Modified: trunk/wp-includes/query.php (11748 => 11749)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-includes/query.php        2009-07-27 23:28:13 UTC (rev 11748)
+++ trunk/wp-includes/query.php        2009-07-30 13:39:34 UTC (rev 11749)
</span><span class="lines">@@ -2099,6 +2099,8 @@
</span><span class="cx">                                 $p_status[] = "$wpdb->posts.post_status = 'private'";
</span><span class="cx">                         if ( in_array( 'publish', $q_status ) )
</span><span class="cx">                                 $r_status[] = "$wpdb->posts.post_status = 'publish'";
</span><ins>+                        if ( in_array( 'trash', $q_status ) )
+                                $r_status[] = "$wpdb->posts.post_status = 'trash'";
</ins><span class="cx">
</span><span class="cx">                         if ( empty($q['perm'] ) || 'readable' != $q['perm'] ) {
</span><span class="cx">                                 $r_status = array_merge($r_status, $p_status);
</span></span></pre></div>
<a id="trunkwpincludesscriptloaderphp"></a>
<div class="modfile"><h4>Modified: trunk/wp-includes/script-loader.php (11748 => 11749)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-includes/script-loader.php        2009-07-27 23:28:13 UTC (rev 11748)
+++ trunk/wp-includes/script-loader.php        2009-07-30 13:39:34 UTC (rev 11749)
</span><span class="lines">@@ -60,7 +60,7 @@
</span><span class="cx">
</span><span class="cx">         $scripts->add( 'utils', "/wp-admin/js/utils$suffix.js", false, '20090102' );
</span><span class="cx">
</span><del>-        $scripts->add( 'common', "/wp-admin/js/common$suffix.js", array('jquery', 'hoverIntent', 'utils'), '20090720' );
</del><ins>+        $scripts->add( 'common', "/wp-admin/js/common$suffix.js", array('jquery', 'hoverIntent', 'utils'), '20090730' );
</ins><span class="cx">         $scripts->add_data( 'common', 'group', 1 );
</span><span class="cx">         $scripts->localize( 'common', 'commonL10n', array(
</span><span class="cx">                 'warnDelete' => __("You are about to permanently delete the selected items.\n 'Cancel' to stop, 'OK' to delete."),
</span><span class="lines">@@ -204,7 +204,7 @@
</span><span class="cx">                         'upload_stopped' => __('Upload stopped.'),
</span><span class="cx">                         'dismiss' => __('Dismiss'),
</span><span class="cx">                         'crunching' => __('Crunching&hellip;'),
</span><del>-                        'deleted' => __('Deleted'),
</del><ins>+                        'deleted' => __('Moved to Trash'),
</ins><span class="cx">                         'l10n_print_after' => 'try{convertEntities(swfuploadL10n);}catch(e){};'
</span><span class="cx">         ) );
</span><span class="cx">
</span><span class="lines">@@ -248,7 +248,7 @@
</span><span class="cx">                 $scripts->add( 'user-profile', "/wp-admin/js/user-profile$suffix.js", array('jquery'), '20090514' );
</span><span class="cx">                 $scripts->add_data( 'user-profile', 'group', 1 );
</span><span class="cx">
</span><del>-                $scripts->add( 'admin-comments', "/wp-admin/js/edit-comments$suffix.js", array('wp-lists', 'jquery-ui-resizable', 'quicktags'), '20090720' );
</del><ins>+                $scripts->add( 'admin-comments', "/wp-admin/js/edit-comments$suffix.js", array('wp-lists', 'jquery-ui-resizable', 'quicktags'), '20090730' );
</ins><span class="cx">                 $scripts->add_data( 'admin-comments', 'group', 1 );
</span><span class="cx">                 $scripts->localize( 'admin-comments', 'adminCommentsL10n', array(
</span><span class="cx">                         'hotkeys_highlight_first' => isset($_GET['hotkeys_highlight_first']),
</span></span></pre></div>
<a id="trunkwpsettingsphp"></a>
<div class="modfile"><h4>Modified: trunk/wp-settings.php (11748 => 11749)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-settings.php        2009-07-27 23:28:13 UTC (rev 11748)
+++ trunk/wp-settings.php        2009-07-30 13:39:34 UTC (rev 11749)
</span><span class="lines">@@ -534,6 +534,12 @@
</span><span class="cx"> if ( !defined( 'AUTOSAVE_INTERVAL' ) )
</span><span class="cx">         define( 'AUTOSAVE_INTERVAL', 60 );
</span><span class="cx">
</span><ins>+/**
+ * It is possible to define this in wp-config.php
+ * @since 2.9.0
+ */
+if ( !defined( 'EMPTY_TRASH_DAYS' ) )
+        define( 'EMPTY_TRASH_DAYS', 30 );
</ins><span class="cx">
</span><span class="cx"> require (ABSPATH . WPINC . '/vars.php');
</span><span class="cx">
</span></span></pre>
</div>
</div>
</body>
</html>