diff --git a/wp-admin/admin-ajax.php b/wp-admin/admin-ajax.php
index 0e2ba8e52c..063e369151 100644
--- a/wp-admin/admin-ajax.php
+++ b/wp-admin/admin-ajax.php
@@ -192,7 +192,7 @@ case 'delete-comment' : // On success, die with time() instead of 1
die( (string) time() );
$r = wp_set_comment_status( $comment->comment_ID, 'spam' );
} else {
- $r = wp_delete_comment( $comment->comment_ID );
+ $r = wp_set_comment_status( $comment->comment_ID, 'delete' );
}
if ( $r ) // Decide if we need to send back '1' or a more complicated response including page links and comment counts
_wp_ajax_delete_comment_response( $comment->comment_ID );
diff --git a/wp-admin/comment.php b/wp-admin/comment.php
index 94d85cc080..56c948aca6 100644
--- a/wp-admin/comment.php
+++ b/wp-admin/comment.php
@@ -44,6 +44,9 @@ case 'editcomment' :
if ( !current_user_can('edit_post', $comment->comment_post_ID) )
comment_footer_die( __('You are not allowed to edit comments on this post.') );
+ 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.') );
+
$comment = get_comment_to_edit( $comment_id );
include('edit-form-comment.php');
diff --git a/wp-admin/css/colors-classic.css b/wp-admin/css/colors-classic.css
index a6cb4f94a8..3ba935a885 100644
--- a/wp-admin/css/colors-classic.css
+++ b/wp-admin/css/colors-classic.css
@@ -58,7 +58,8 @@ div.dashboard-widget,
border-color: #ccc;
}
-#poststuff .inside label.spam {
+#poststuff .inside label.spam,
+#poststuff .inside label.deleted {
color: red;
}
diff --git a/wp-admin/css/colors-fresh.css b/wp-admin/css/colors-fresh.css
index 7b73e98c00..ba1b4a5c8b 100644
--- a/wp-admin/css/colors-fresh.css
+++ b/wp-admin/css/colors-fresh.css
@@ -58,7 +58,8 @@ div.dashboard-widget,
border-color: #ccc;
}
-#poststuff .inside label.spam {
+#poststuff .inside label.spam,
+#poststuff .inside label.deleted {
color: red;
}
diff --git a/wp-admin/edit-comments.php b/wp-admin/edit-comments.php
index 7df0210332..fe534b40e4 100644
--- a/wp-admin/edit-comments.php
+++ b/wp-admin/edit-comments.php
@@ -14,40 +14,28 @@ enqueue_comment_hotkeys_js();
$post_id = isset($_REQUEST['p']) ? (int) $_REQUEST['p'] : 0;
-if ( ( isset( $_REQUEST['delete_all_spam'] ) || isset( $_REQUEST['delete_all_spam2'] ) ) && !empty( $_REQUEST['pagegen_timestamp'] ) ) {
- check_admin_referer('bulk-spam-delete', '_spam_nonce');
-
- $delete_time = $wpdb->escape( $_REQUEST['pagegen_timestamp'] );
- if ( current_user_can('moderate_comments')) {
- $deleted_spam = $wpdb->query( "DELETE FROM $wpdb->comments WHERE comment_approved = 'spam' AND '$delete_time' > comment_date_gmt" );
- } else {
- $deleted_spam = 0;
- }
- $redirect_to = 'edit-comments.php?comment_status=spam&deleted=' . (int) $deleted_spam;
- if ( $post_id )
- $redirect_to = add_query_arg( 'p', absint( $post_id ), $redirect_to );
- wp_redirect( $redirect_to );
-} elseif ( isset($_REQUEST['delete_comments']) && isset($_REQUEST['action']) && ( -1 != $_REQUEST['action'] || -1 != $_REQUEST['action2'] ) ) {
+if ( isset($_REQUEST['doaction']) || isset($_REQUEST['doaction2']) || isset($_REQUEST['destroy_all']) || isset($_REQUEST['destroy_all2']) ) {
check_admin_referer('bulk-comments');
- $doaction = ( -1 != $_REQUEST['action'] ) ? $_REQUEST['action'] : $_REQUEST['action2'];
-
- $deleted = $approved = $unapproved = $spammed = 0;
- foreach ( (array) $_REQUEST['delete_comments'] as $comment_id) : // Check the permissions on each
- $comment_id = (int) $comment_id;
+
+ if ((isset($_REQUEST['destroy_all']) || isset($_REQUEST['destroy_all2'])) && !empty($_REQUEST['pagegen_timestamp'])) {
+ $comment_status = $wpdb->escape($_REQUEST['comment_status']);
+ $delete_time = $wpdb->escape($_REQUEST['pagegen_timestamp']);
+ $comment_ids = $wpdb->get_col( "SELECT comment_ID FROM $wpdb->comments WHERE comment_approved = '$comment_status' AND '$delete_time' > comment_date_gmt" );
+ $doaction = 'destroy';
+ } elseif (($_REQUEST['action'] != -1 || $_REQUEST['action2'] != -1) && isset($_REQUEST['delete_comments'])) {
+ $comment_ids = $_REQUEST['delete_comments'];
+ $doaction = ($_REQUEST['action'] != -1) ? $_REQUEST['action'] : $_REQUEST['action2'];
+ } else wp_redirect($_SERVER['HTTP_REFERER']);
+
+ $approved = $unapproved = $spammed = $deleted = $destroyed = 0;
+
+ foreach ($comment_ids as $comment_id) { // Check the permissions on each
$_post_id = (int) $wpdb->get_var( $wpdb->prepare( "SELECT comment_post_ID FROM $wpdb->comments WHERE comment_ID = %d", $comment_id) );
if ( !current_user_can('edit_post', $_post_id) )
continue;
switch( $doaction ) {
- case 'markspam' :
- wp_set_comment_status($comment_id, 'spam');
- $spammed++;
- break;
- case 'delete' :
- wp_set_comment_status($comment_id, 'delete');
- $deleted++;
- break;
case 'approve' :
wp_set_comment_status($comment_id, 'approve');
$approved++;
@@ -56,10 +44,22 @@ if ( ( isset( $_REQUEST['delete_all_spam'] ) || isset( $_REQUEST['delete_all_spa
wp_set_comment_status($comment_id, 'hold');
$unapproved++;
break;
+ case 'markspam' :
+ wp_set_comment_status($comment_id, 'spam');
+ $spammed++;
+ break;
+ case 'delete' :
+ wp_set_comment_status($comment_id, 'delete');
+ $deleted++;
+ break;
+ case 'destroy' :
+ wp_set_comment_status($comment_id, 'delete');
+ $destroyed++;
+ break;
}
- endforeach;
+ }
- $redirect_to = 'edit-comments.php?deleted=' . $deleted . '&approved=' . $approved . '&spam=' . $spammed . '&unapproved=' . $unapproved;
+ $redirect_to = 'edit-comments.php?approved=' . $approved . '&unapproved=' . $unapproved . '&spam=' . $spammed . '&deleted=' . $deleted . '&destroyed=' . $destroyed;
if ( $post_id )
$redirect_to = add_query_arg( 'p', absint( $post_id ), $redirect_to );
if ( isset($_REQUEST['apage']) )
@@ -86,7 +86,7 @@ require_once('admin-header.php');
$mode = ( ! isset($_GET['mode']) || empty($_GET['mode']) ) ? 'detail' : esc_attr($_GET['mode']);
$comment_status = isset($_REQUEST['comment_status']) ? $_REQUEST['comment_status'] : 'all';
-if ( !in_array($comment_status, array('all', 'moderated', 'approved', 'spam')) )
+if ( !in_array($comment_status, array('all', 'moderated', 'approved', 'spam', 'deleted')) )
$comment_status = 'all';
$comment_type = !empty($_GET['comment_type']) ? esc_attr($_GET['comment_type']) : '';
@@ -102,26 +102,29 @@ if ( isset($_GET['s']) && $_GET['s'] )
0 || $deleted > 0 || $spam > 0 ) {
+ if ( $approved > 0 || $deleted > 0 || $destroyed > 0 || $spam > 0 ) {
echo '
';
if ( $approved > 0 ) {
printf( _n( '%s comment approved', '%s comments approved', $approved ), $approved );
echo '
';
}
-
+ if ( $spam > 0 ) {
+ printf( _n( '%s comment marked as spam', '%s comments marked as spam', $spam ), $spam );
+ echo '
';
+ }
if ( $deleted > 0 ) {
printf( _n( '%s comment deleted', '%s comments deleted', $deleted ), $deleted );
echo '
';
}
-
- if ( $spam > 0 ) {
- printf( _n( '%s comment marked as spam', '%s comments marked as spam', $spam ), $spam );
+ if ( $destroyed > 0 ) {
+ printf( _n( '%s comment permanently deleted', '%s comments permanently deleted', $destroyed ), $destroyed );
echo '
';
}
@@ -139,9 +142,10 @@ $num_comments = ( $post_id ) ? wp_count_comments( $post_id ) : wp_count_comments
//, number_format_i18n($num_comments->spam) ), "")
$stati = array(
'all' => _n_noop('All', 'All'), // singular not used
- 'moderated' => _n_noop('Pending (%s)', 'Pending (%s)'),
+ 'moderated' => _n_noop('Pending (%s)', 'Pending (%s)'),
'approved' => _n_noop('Approved', 'Approved'), // singular not used
- 'spam' => _n_noop('Spam (%s)', 'Spam (%s)')
+ 'spam' => _n_noop('Spam (%s)', 'Spam (%s)'),
+ 'deleted' => _n_noop('Trash (%s)', 'Trash (%s)')
);
$link = 'edit-comments.php';
if ( !empty($comment_type) && 'all' != $comment_type )
@@ -246,13 +250,17 @@ $page_links = paginate_links( array(
-
+
+
+
+
+
@@ -278,11 +286,11 @@ $page_links = paginate_links( array(
-
-" class="button-secondary apply" />
+
@@ -333,18 +341,22 @@ if ( $page_links )
-
+
+
+
+
+
-
-
+
+
diff --git a/wp-admin/includes/template.php b/wp-admin/includes/template.php
index 56678934a2..876b955270 100644
--- a/wp-admin/includes/template.php
+++ b/wp-admin/includes/template.php
@@ -2009,6 +2009,9 @@ function _wp_get_comment_list( $status = '', $s = false, $start, $num, $post = 0
} elseif ( 'spam' == $status ) {
$approved = "comment_approved = 'spam'";
$total = $count->spam;
+ } elseif ( 'deleted' == $status ) {
+ $approved = "comment_approved = 'deleted'";
+ $total = $count->deleted;
} else {
$approved = "( comment_approved = '0' OR comment_approved = '1' )";
$total = $count->moderated + $count->approved;
@@ -2135,24 +2138,36 @@ function _wp_comment_row( $comment_id, $mode, $comment_status, $checkbox = true,
$actions = array();
if ( $user_can ) {
- $actions['approve'] = "';
- $actions['unapprove'] = "';
- if ( $comment_status && 'all' != $comment_status ) { // not looking at all comments
- if ( 'approved' == $the_comment_status ) {
- $actions['unapprove'] = "';
- unset($actions['approve']);
- } else {
- $actions['approve'] = "';
- unset($actions['unapprove']);
+ if ( 'deleted' == $the_comment_status ) {
+ $actions['unapprove'] = "';
+ $actions['delete'] = "';
+ } else {
+ $actions['approve'] = "';
+ $actions['unapprove'] = "';
+
+ if ( $comment_status && 'all' != $comment_status ) { // not looking at all comments
+ if ( 'approved' == $the_comment_status ) {
+ $actions['unapprove'] = "';
+ unset($actions['approve']);
+ } else {
+ $actions['approve'] = "';
+ unset($actions['unapprove']);
+ }
}
+
+ if ( 'spam' == $the_comment_status ) {
+ $actions['delete'] = "';
+ } else {
+ $actions['spam'] = "';
+ $actions['delete'] = "';
+ }
+
+ $actions['edit'] = "". __('Edit') . '';
+ $actions['quickedit'] = '' . __('Quick Edit') . '';
+
+ if ( 'spam' != $the_comment_status )
+ $actions['reply'] = '' . __('Reply') . '';
}
- if ( 'spam' != $the_comment_status )
- $actions['spam'] = "';
- $actions['delete'] = "';
- $actions['edit'] = "". __('Edit') . '';
- $actions['quickedit'] = '' . __('Quick Edit') . '';
- if ( 'spam' != $the_comment_status )
- $actions['reply'] = '' . __('Reply') . '';
$actions = apply_filters( 'comment_row_actions', $actions, $comment );
diff --git a/wp-admin/js/common.dev.js b/wp-admin/js/common.dev.js
index b95ffc2e48..0d269fe3c6 100644
--- a/wp-admin/js/common.dev.js
+++ b/wp-admin/js/common.dev.js
@@ -156,10 +156,13 @@ jQuery(document).ready( function($) {
// show warnings
$('#doaction, #doaction2').click(function(){
- if ( $('select[name="action"]').val() == 'delete' || $('select[name="action2"]').val() == 'delete' ) {
+ if ( $('select[name="action"]').val() == 'destroy' || $('select[name="action2"]').val() == 'destroy' ) {
return showNotice.warn();
}
});
+ $('#destroy_all, #destroy_all2').click(function(){
+ return showNotice.warn();
+ });
// screen settings tab
$('#show-settings-link').click(function () {
diff --git a/wp-admin/js/common.js b/wp-admin/js/common.js
index fbbcf29452..f7a44db971 100644
--- a/wp-admin/js/common.js
+++ b/wp-admin/js/common.js
@@ -1 +1 @@
-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()=="delete"||d('select[name="action2"]').val()=="delete"){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(01){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 3 )
+ n = n.substr(0, n.length-3)+' '+n.substr(-3);
+ a.html(n);
+ });
+
// XML response
if ( ( 'object' == typeof r ) && lastConfidentTime < settings.parsed.responses[0].supplemental.time ) {
diff --git a/wp-admin/js/edit-comments.js b/wp-admin/js/edit-comments.js
index e6ab98b5ea..a43e82b674 100644
--- a/wp-admin/js/edit-comments.js
+++ b/wp-admin/js/edit-comments.js
@@ -1 +1 @@
-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.spam){return showNotice.warn()?j:false}return j};d=function(j,k,l){if(k3){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)});if(("object"==typeof l)&&f 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]*?>/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);
\ No newline at end of file
+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(k3){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 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]*?>/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);
\ No newline at end of file
diff --git a/wp-admin/wp-admin.css b/wp-admin/wp-admin.css
index 99ad854e12..18263c7bb0 100644
--- a/wp-admin/wp-admin.css
+++ b/wp-admin/wp-admin.css
@@ -444,7 +444,7 @@ a.button-secondary {
display: none;
}
-.unapproved .approve, .spam .approve {
+.unapproved .approve, .spam .approve, .deleted .approve {
display: inline;
}
diff --git a/wp-includes/comment.php b/wp-includes/comment.php
index b4f4125cc8..448ef1769d 100644
--- a/wp-includes/comment.php
+++ b/wp-includes/comment.php
@@ -208,6 +208,8 @@ function get_comments( $args = '' ) {
$approved = "comment_approved = '1'";
elseif ( 'spam' == $status )
$approved = "comment_approved = 'spam'";
+ elseif ( 'deleted' == $status )
+ $approved = "comment_approved = 'deleted'";
else
$approved = "( comment_approved = '0' OR comment_approved = '1' )";
@@ -699,7 +701,7 @@ function wp_count_comments( $post_id = 0 ) {
$count = $wpdb->get_results( "SELECT comment_approved, COUNT( * ) AS num_comments FROM {$wpdb->comments} {$where} GROUP BY comment_approved", ARRAY_A );
$total = 0;
- $approved = array('0' => 'moderated', '1' => 'approved', 'spam' => 'spam');
+ $approved = array('0' => 'moderated', '1' => 'approved', 'spam' => 'spam', 'deleted' => 'deleted');
$known_types = array_keys( $approved );
foreach( (array) $count as $row_num => $row ) {
$total += $row['num_comments'];
@@ -735,8 +737,13 @@ function wp_count_comments( $post_id = 0 ) {
* @return bool False if delete comment query failure, true on success.
*/
function wp_delete_comment($comment_id) {
+ if (wp_get_comment_status($comment_id) != 'deleted' && wp_get_comment_status($comment_id) != 'spam')
+ return wp_set_comment_status($comment_id, 'delete');
+
global $wpdb;
do_action('delete_comment', $comment_id);
+
+ wp_unschedule_comment_destruction($comment_id);
$comment = get_comment($comment_id);
@@ -784,6 +791,8 @@ function wp_get_comment_status($comment_id) {
return 'unapproved';
elseif ( $approved == 'spam' )
return 'spam';
+ elseif ( $approved == 'deleted' )
+ return 'deleted';
else
return false;
}
@@ -1028,7 +1037,8 @@ function wp_new_comment( $commentdata ) {
*/
function wp_set_comment_status($comment_id, $comment_status, $wp_error = false) {
global $wpdb;
-
+ wp_unschedule_comment_destruction($comment_id);
+
$status = '0';
switch ( $comment_status ) {
case 'hold':
@@ -1045,7 +1055,10 @@ function wp_set_comment_status($comment_id, $comment_status, $wp_error = false)
$status = 'spam';
break;
case 'delete':
- return wp_delete_comment($comment_id);
+ 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_destruction($comment_id);
break;
default:
return false;
@@ -1070,6 +1083,42 @@ function wp_set_comment_status($comment_id, $comment_status, $wp_error = false)
return true;
}
+/**
+ * Schedules a comment for destruction in 30 days.
+ *
+ * @since 2.9.0
+ *
+ * @param int $comment_id Comment ID.
+ * @return void
+ */
+function wp_schedule_comment_destruction($comment_id) {
+ $to_destroy = get_option('to_destroy');
+ if (!is_array($to_destroy))
+ $to_destroy = array();
+
+ $to_destroy['comments'][$comment_id] = time();
+
+ update_option('to_destroy', $to_destroy);
+}
+
+/**
+ * Unschedules a comment for destruction.
+ *
+ * @since 2.9.0
+ *
+ * @param int $comment_id Comment ID.
+ * @return void
+ */
+function wp_unschedule_comment_destruction($comment_id) {
+ $to_destroy = get_option('to_destroy');
+ if (!is_array($to_destroy))
+ return;
+
+ unset($to_destroy['comments'][$comment_id]);
+
+ update_option('to_destroy', $to_destroy);
+}
+
/**
* Updates an existing comment in the database.
*
diff --git a/wp-includes/pluggable.php b/wp-includes/pluggable.php
index 128d2dca75..097816e8c5 100644
--- a/wp-includes/pluggable.php
+++ b/wp-includes/pluggable.php
@@ -1767,4 +1767,32 @@ function wp_text_diff( $left_string, $right_string, $args = null ) {
}
endif;
-?>
+/**
+ * Destroys comments which have previously been scheduled for destruction.
+ * Will do the same for posts, pages, etc in the future.
+ *
+ * @access private
+ * @since 2.9.0
+ *
+ * @return void
+ */
+function _scheduled_destruction() {
+ $to_destroy = get_option('to_destroy');
+ if (!is_array($to_destroy))
+ return;
+
+ $deletetimestamp = time()-(60*60*24*30);
+ foreach ($to_destroy['comments'] as $comment_id => $timestamp) {
+ if ($timestamp < $deletetimestamp) {
+ wp_delete_comment($comment_id);
+ unset($to_destroy['comments'][$comment_id]);
+ }
+ }
+
+ update_option('to_destroy', $to_destroy);
+}
+add_action( '_scheduled_destruction', '_scheduled_destruction' );
+if ( !wp_next_scheduled('_scheduled_destruction') && !defined('WP_INSTALLING') )
+ wp_schedule_event(time(), 'daily', '_scheduled_destruction');
+
+
diff --git a/wp-includes/script-loader.php b/wp-includes/script-loader.php
index b343eeaad6..b87ea10109 100644
--- a/wp-includes/script-loader.php
+++ b/wp-includes/script-loader.php
@@ -60,10 +60,10 @@ function wp_default_scripts( &$scripts ) {
$scripts->add( 'utils', "/wp-admin/js/utils$suffix.js", false, '20090102' );
- $scripts->add( 'common', "/wp-admin/js/common$suffix.js", array('jquery', 'hoverIntent', 'utils'), '20090623' );
+ $scripts->add( 'common', "/wp-admin/js/common$suffix.js", array('jquery', 'hoverIntent', 'utils'), '20090720' );
$scripts->add_data( 'common', 'group', 1 );
$scripts->localize( 'common', 'commonL10n', array(
- 'warnDelete' => __("You are about to delete the selected items.\n 'Cancel' to stop, 'OK' to delete."),
+ 'warnDelete' => __("You are about to permanently delete the selected items.\n 'Cancel' to stop, 'OK' to delete."),
'l10n_print_after' => 'try{convertEntities(commonL10n);}catch(e){};'
) );
@@ -245,7 +245,7 @@ function wp_default_scripts( &$scripts ) {
$scripts->add( 'user-profile', "/wp-admin/js/user-profile$suffix.js", array('jquery'), '20090514' );
$scripts->add_data( 'user-profile', 'group', 1 );
- $scripts->add( 'admin-comments', "/wp-admin/js/edit-comments$suffix.js", array('wp-lists', 'jquery-ui-resizable', 'quicktags'), '20090627' );
+ $scripts->add( 'admin-comments', "/wp-admin/js/edit-comments$suffix.js", array('wp-lists', 'jquery-ui-resizable', 'quicktags'), '20090720' );
$scripts->add_data( 'admin-comments', 'group', 1 );
$scripts->localize( 'admin-comments', 'adminCommentsL10n', array(
'hotkeys_highlight_first' => isset($_GET['hotkeys_highlight_first']),
@@ -426,9 +426,9 @@ function wp_default_styles( &$styles ) {
$rtl_styles = array( 'global', 'colors', 'dashboard', 'ie', 'install', 'login', 'media', 'theme-editor', 'upload', 'widgets', 'press-this', 'plugin-install', 'farbtastic' );
// all colors stylesheets need to have the same query strings (cache manifest compat)
- $colors_version = '20090625';
+ $colors_version = '20090720';
- $styles->add( 'wp-admin', '/wp-admin/wp-admin.css', array(), '20090625' );
+ $styles->add( 'wp-admin', '/wp-admin/wp-admin.css', array(), '20090720' );
$styles->add_data( 'wp-admin', 'rtl', '/wp-admin/rtl.css' );
$styles->add( 'ie', '/wp-admin/css/ie.css', array(), '20090630' );