Ticket #11260: 11260.diff
File 11260.diff, 28.2 KB (added by , 15 years ago) |
---|
-
wp-includes/post.php
1183 1183 1184 1184 do_action('delete_post', $postid); 1185 1185 1186 delete_post_meta($postid,'_wp_ trash_meta_status');1186 delete_post_meta($postid,'_wp_previous_status'); 1187 1187 delete_post_meta($postid,'_wp_trash_meta_time'); 1188 1188 1189 1189 /** @todo delete for pluggable post taxonomies too */ … … 1281 1281 1282 1282 do_action('trash_post', $post_id); 1283 1283 1284 add_post_meta($post_id,'_wp_ trash_meta_status', $post['post_status']);1284 add_post_meta($post_id,'_wp_previous_status', $post['post_status']); 1285 1285 add_post_meta($post_id,'_wp_trash_meta_time', time()); 1286 1286 1287 1287 $post['post_status'] = 'trash'; … … 1313 1313 1314 1314 do_action('untrash_post', $post_id); 1315 1315 1316 $post_status = get_post_meta($post_id, '_wp_ trash_meta_status', true);1316 $post_status = get_post_meta($post_id, '_wp_previous_status', true); 1317 1317 1318 1318 $post['post_status'] = $post_status; 1319 1319 1320 delete_post_meta($post_id, '_wp_ trash_meta_status');1320 delete_post_meta($post_id, '_wp_previous_status'); 1321 1321 delete_post_meta($post_id, '_wp_trash_meta_time'); 1322 1322 1323 1323 wp_insert_post($post); … … 2840 2840 if ( !$force_delete && 'trash' != $post->post_status ) 2841 2841 return wp_trash_post( $post_id ); 2842 2842 2843 delete_post_meta($post_id, '_wp_ trash_meta_status');2843 delete_post_meta($post_id, '_wp_previous_status'); 2844 2844 delete_post_meta($post_id, '_wp_trash_meta_time'); 2845 2845 2846 2846 $meta = wp_get_attachment_metadata( $post_id ); -
wp-includes/comment.php
823 823 824 824 do_action('delete_comment', $comment_id); 825 825 826 delete_comment_meta($comment_id,'_wp_ trash_meta_status');826 delete_comment_meta($comment_id,'_wp_previous_status'); 827 827 delete_comment_meta($comment_id,'_wp_trash_meta_time'); 828 828 829 829 if ( ! $wpdb->query( $wpdb->prepare("DELETE FROM $wpdb->comments WHERE comment_ID = %d LIMIT 1", $comment_id) ) ) … … 866 866 867 867 do_action('trash_comment', $comment_id); 868 868 869 add_comment_meta($comment_id, '_wp_ trash_meta_status', $comment->comment_approved);869 add_comment_meta($comment_id, '_wp_previous_status', $comment->comment_approved); 870 870 add_comment_meta($comment_id, '_wp_trash_meta_time', time() ); 871 871 872 872 wp_set_comment_status($comment_id, 'trash'); … … 880 880 * Removes a comment from the Trash 881 881 * 882 882 * @since 2.9.0 883 * @uses do_action() on 'untrash_comment' before un deletion884 * @uses do_action() on 'untrashed_comment' after un deletion883 * @uses do_action() on 'untrash_comment' before untrashing 884 * @uses do_action() on 'untrashed_comment' after untrashing 885 885 * 886 886 * @param int $comment_id Comment ID. 887 887 * @return mixed False on failure … … 894 894 895 895 $comment = array('comment_ID'=>$comment_id); 896 896 897 $status = get_comment_meta($comment_id, '_wp_ trash_meta_status', true);897 $status = get_comment_meta($comment_id, '_wp_previous_status', true); 898 898 if ( empty($status) ) 899 899 $status = '0'; 900 900 901 901 $comment['comment_approved'] = $status; 902 902 903 903 delete_comment_meta($comment_id, '_wp_trash_meta_time'); 904 delete_comment_meta($comment_id, '_wp_ trash_meta_status');904 delete_comment_meta($comment_id, '_wp_previous_status'); 905 905 906 906 wp_update_comment($comment); 907 907 … … 911 911 } 912 912 913 913 /** 914 * Marks a comment as Spam 915 * 916 * @since 2.9.0 917 * @uses do_action() on 'spam_comment' before spamming 918 * @uses do_action() on 'spammed_comment' after spamming 919 * 920 * @param int $comment_id Comment ID. 921 * @return mixed False on failure 922 */ 923 function wp_spam_comment($comment_id) { 924 if ( !$comment = get_comment($comment_id) ) 925 return false; 926 927 do_action('spam_comment', $comment_id); 928 929 add_comment_meta($comment_id, '_wp_previous_status', $comment->comment_approved); 930 wp_set_comment_status($comment_id, 'spam'); 931 932 do_action('spammed_comment', $comment_id); 933 934 return true; 935 } 936 937 /** 938 * Removes a comment from the Spam 939 * 940 * @since 2.9.0 941 * @uses do_action() on 'unspam_comment' before unspamming 942 * @uses do_action() on 'unspammed_comment' after unspamming 943 * 944 * @param int $comment_id Comment ID. 945 * @return mixed False on failure 946 */ 947 function wp_unspam_comment($comment_id) { 948 if ( ! (int)$comment_id ) 949 return false; 950 951 do_action('unspam_comment', $comment_id); 952 953 $comment = array('comment_ID'=>$comment_id); 954 955 $status = get_comment_meta($comment_id, '_wp_previous_status', true); 956 if ( empty($status) ) 957 $status = '0'; 958 959 $comment['comment_approved'] = $status; 960 961 delete_comment_meta($comment_id, '_wp_previous_status'); 962 963 wp_update_comment($comment); 964 965 do_action('unspammed_comment', $comment_id); 966 967 return true; 968 } 969 970 /** 914 971 * The status of a comment by ID. 915 972 * 916 973 * @since 1.0.0 -
wp-includes/capabilities.php
795 795 if ( 'publish' == $post->post_status ) { 796 796 $caps[] = 'delete_published_posts'; 797 797 } elseif ( 'trash' == $post->post_status ) { 798 if ('publish' == get_post_meta($post->ID, '_wp_ trash_meta_status', true) )798 if ('publish' == get_post_meta($post->ID, '_wp_previous_status', true) ) 799 799 $caps[] = 'delete_published_posts'; 800 800 } else { 801 801 // If the post is draft... … … 823 823 if ( $page->post_status == 'publish' ) { 824 824 $caps[] = 'delete_published_pages'; 825 825 } elseif ( 'trash' == $page->post_status ) { 826 if ('publish' == get_post_meta($page->ID, '_wp_ trash_meta_status', true) )826 if ('publish' == get_post_meta($page->ID, '_wp_previous_status', true) ) 827 827 $caps[] = 'delete_published_pages'; 828 828 } else { 829 829 // If the page is draft... … … 857 857 if ( 'publish' == $post->post_status ) { 858 858 $caps[] = 'edit_published_posts'; 859 859 } elseif ( 'trash' == $post->post_status ) { 860 if ('publish' == get_post_meta($post->ID, '_wp_ trash_meta_status', true) )860 if ('publish' == get_post_meta($post->ID, '_wp_previous_status', true) ) 861 861 $caps[] = 'edit_published_posts'; 862 862 } else { 863 863 // If the post is draft... … … 885 885 if ( 'publish' == $page->post_status ) { 886 886 $caps[] = 'edit_published_pages'; 887 887 } elseif ( 'trash' == $page->post_status ) { 888 if ('publish' == get_post_meta($page->ID, '_wp_ trash_meta_status', true) )888 if ('publish' == get_post_meta($page->ID, '_wp_previous_status', true) ) 889 889 $caps[] = 'edit_published_pages'; 890 890 } else { 891 891 // If the page is draft... -
wp-admin/edit-comments.php
28 28 } elseif (($_REQUEST['action'] != -1 || $_REQUEST['action2'] != -1) && isset($_REQUEST['delete_comments'])) { 29 29 $comment_ids = $_REQUEST['delete_comments']; 30 30 $doaction = ($_REQUEST['action'] != -1) ? $_REQUEST['action'] : $_REQUEST['action2']; 31 } elseif ($_REQUEST[' action'] == 'untrash' && isset($_REQUEST['ids'])) {31 } elseif ($_REQUEST['doaction'] == 'undo' && isset($_REQUEST['ids'])) { 32 32 $comment_ids = explode(',', $_REQUEST['ids']); 33 $doaction = 'untrash';33 $doaction = $_REQUEST['action']; 34 34 } else wp_redirect($_SERVER['HTTP_REFERER']); 35 35 36 $approved = $unapproved = $spammed = $ trashed = $untrashed = $deleted = 0;36 $approved = $unapproved = $spammed = $unspammed = $trashed = $untrashed = $deleted = 0; 37 37 38 38 foreach ($comment_ids as $comment_id) { // Check the permissions on each 39 39 $_post_id = (int) $wpdb->get_var( $wpdb->prepare( "SELECT comment_post_ID FROM $wpdb->comments WHERE comment_ID = %d", $comment_id) ); … … 50 50 wp_set_comment_status($comment_id, 'hold'); 51 51 $unapproved++; 52 52 break; 53 case ' markspam' :54 wp_s et_comment_status($comment_id, 'spam');53 case 'spam' : 54 wp_spam_comment($comment_id); 55 55 $spammed++; 56 56 break; 57 case 'unspam' : 58 wp_unspam_comment($comment_id); 59 $unspammed++; 60 break; 57 61 case 'trash' : 58 62 wp_trash_comment($comment_id); 59 63 $trashed++; … … 68 72 break; 69 73 } 70 74 } 75 76 $redirect_to = 'edit-comments.php'; 77 78 if ( $approved ) $redirect_to = add_query_arg( 'approved', $approved, $redirect_to ); 79 if ( $unapproved ) $redirect_to = add_query_arg( 'unapproved', $unapproved, $redirect_to ); 80 if ( $spammed ) $redirect_to = add_query_arg( 'spammed', $spammed, $redirect_to ); 81 if ( $unspammed ) $redirect_to = add_query_arg( 'unspammed', $unspammed, $redirect_to ); 82 if ( $trashed ) $redirect_to = add_query_arg( 'trashed', $trashed, $redirect_to ); 83 if ( $untrashed ) $redirect_to = add_query_arg( 'untrashed', $untrashed, $redirect_to ); 84 if ( $deleted ) $redirect_to = add_query_arg( 'deleted', $deleted, $redirect_to ); 85 86 if ( $trashed || $spammed ) $redirect_to = add_query_arg( 'ids', join(',', $comment_ids), $redirect_to ); 71 87 72 $redirect_to = 'edit-comments.php?approved=' . $approved . '&unapproved=' . $unapproved . '&spam=' . $spammed . '&trashed=' . $trashed . '&untrashed=' . $untrashed . '&deleted=' . $deleted . '&ids=' . join(',', $comment_ids);73 88 if ( $post_id ) 74 89 $redirect_to = add_query_arg( 'p', absint( $post_id ), $redirect_to ); 75 90 if ( isset($_REQUEST['apage']) ) … … 112 127 </h2> 113 128 114 129 <?php 115 if ( isset($_GET['approved']) || isset($_GET['deleted']) || isset($_GET['trashed']) || isset($_GET['untrashed']) || isset($_GET['spam ']) ) {130 if ( isset($_GET['approved']) || isset($_GET['deleted']) || isset($_GET['trashed']) || isset($_GET['untrashed']) || isset($_GET['spammed']) || isset($_GET['unspammed']) ) { 116 131 $approved = isset($_GET['approved']) ? (int) $_GET['approved'] : 0; 117 132 $deleted = isset($_GET['deleted']) ? (int) $_GET['deleted'] : 0; 118 133 $trashed = isset($_GET['trashed']) ? (int) $_GET['trashed'] : 0; 119 134 $untrashed = isset($_GET['untrashed']) ? (int) $_GET['untrashed'] : 0; 120 $spam = isset($_GET['spam']) ? (int) $_GET['spam'] : 0; 135 $spammed = isset($_GET['spammed']) ? (int) $_GET['spammed'] : 0; 136 $unspammed = isset($_GET['unspammed']) ? (int) $_GET['unspammed'] : 0; 121 137 122 if ( $approved > 0 || $deleted > 0 || $trashed > 0 || $untrashed > 0 || $spam > 0 ) {138 if ( $approved > 0 || $deleted > 0 || $trashed > 0 || $untrashed > 0 || $spammed > 0 || $unspammed > 0 ) { 123 139 echo '<div id="moderated" class="updated fade"><p>'; 124 140 125 141 if ( $approved > 0 ) { 126 142 printf( _n( '%s comment approved', '%s comments approved', $approved ), $approved ); 127 143 echo '<br />'; 128 144 } 129 if ( $spam > 0 ) { 130 printf( _n( '%s comment marked as spam', '%s comments marked as spam', $spam ), $spam ); 145 if ( $spammed > 0 ) { 146 printf( _n( '%s comment marked as spam.', '%s comments marked as spam.', $spammed ), $spammed ); 147 $ids = isset($_GET['ids']) ? $_GET['ids'] : 0; 148 echo ' <a href="' . esc_url( wp_nonce_url( "edit-comments.php?doaction=undo&action=unspam&ids=$ids", "bulk-comments" ) ) . '">' . __('Undo?') . '</a><br />'; 149 } 150 if ( $unspammed > 0 ) { 151 printf( _n( '%s comment restored from the spam', '%s comments restored from the spam', $unspammed ), $unspammed ); 131 152 echo '<br />'; 132 153 } 133 154 if ( $trashed > 0 ) { … … 275 296 <option value="approve"><?php _e('Approve'); ?></option> 276 297 <?php endif; ?> 277 298 <?php if ( 'all' == $comment_status || 'approved' == $comment_status || 'moderated' == $comment_status ): ?> 278 <option value=" markspam"><?php _e('Mark as Spam'); ?></option>299 <option value="spam"><?php _e('Mark as Spam'); ?></option> 279 300 <?php endif; ?> 280 301 <?php if ( 'trash' == $comment_status ): ?> 281 302 <option value="untrash"><?php _e('Restore'); ?></option> 303 <?php elseif ( 'spam' == $comment_status ): ?> 304 <option value="unspam"><?php _e('Not Spam'); ?></option> 282 305 <?php endif; ?> 283 306 <?php if ( 'trash' == $comment_status || 'spam' == $comment_status || !EMPTY_TRASH_DAYS ): ?> 284 307 <option value="delete"><?php _e('Delete Permanently'); ?></option> … … 371 394 <option value="approve"><?php _e('Approve'); ?></option> 372 395 <?php endif; ?> 373 396 <?php if ( 'all' == $comment_status || 'approved' == $comment_status || 'moderated' == $comment_status ): ?> 374 <option value=" markspam"><?php _e('Mark as Spam'); ?></option>397 <option value="spam"><?php _e('Mark as Spam'); ?></option> 375 398 <?php endif; ?> 376 399 <?php if ( 'trash' == $comment_status ): ?> 377 400 <option value="untrash"><?php _e('Restore'); ?></option> 378 401 <?php endif; ?> 379 402 <?php if ( 'trash' == $comment_status || 'spam' == $comment_status || !EMPTY_TRASH_DAYS ): ?> 380 403 <option value="delete"><?php _e('Delete Permanently'); ?></option> 404 <?php elseif ( 'spam' == $comment_status ): ?> 405 <option value="unspam"><?php _e('Not Spam'); ?></option> 381 406 <?php else: ?> 382 407 <option value="trash"><?php _e('Move to Trash'); ?></option> 383 408 <?php endif; ?> -
wp-admin/admin-ajax.php
209 209 $status = wp_get_comment_status( $comment->comment_ID ); 210 210 211 211 if ( isset($_POST['trash']) && 1 == $_POST['trash'] ) { 212 if ( 'trash' == $status ) 213 die( (string) time() ); 212 if ( 'trash' == $status ) die( (string) time() ); 214 213 $r = wp_trash_comment( $comment->comment_ID ); 215 214 } elseif ( isset($_POST['untrash']) && 1 == $_POST['untrash'] ) { 216 if ( 'trash' != $status ) 217 die( (string) time() ); 215 if ( 'trash' != $status ) die( (string) time() ); 218 216 $r = wp_untrash_comment( $comment->comment_ID ); 219 217 } elseif ( isset($_POST['spam']) && 1 == $_POST['spam'] ) { 220 if ( 'spam' == $status ) 221 die( (string) time() ); 222 $r = wp_set_comment_status( $comment->comment_ID, 'spam' ); 218 if ( 'spam' == $status ) die( (string) time() ); 219 $r = wp_spam_comment( $comment->comment_ID ); 220 } elseif ( isset($_POST['unspam']) && 1 == $_POST['unspam'] ) { 221 if ( 'spam' != $status ) die( (string) time() ); 222 $r = wp_unspam_comment( $comment->comment_ID ); 223 223 } elseif ( isset($_POST['delete']) && 1 == $_POST['delete'] ) { 224 224 $r = wp_delete_comment( $comment->comment_ID ); 225 225 } else { -
wp-admin/includes/template.php
2114 2114 $del_nonce = esc_html( '_wpnonce=' . wp_create_nonce( "delete-comment_$comment->comment_ID" ) ); 2115 2115 $approve_nonce = esc_html( '_wpnonce=' . wp_create_nonce( "approve-comment_$comment->comment_ID" ) ); 2116 2116 2117 $delete_url = esc_url( "comment.php?action=deletecomment&p=$post->ID&c=$comment->comment_ID&$del_nonce" );2118 2117 $approve_url = esc_url( "comment.php?action=approvecomment&p=$post->ID&c=$comment->comment_ID&$approve_nonce" ); 2119 2118 $unapprove_url = esc_url( "comment.php?action=unapprovecomment&p=$post->ID&c=$comment->comment_ID&$approve_nonce" ); 2120 $spam_url = esc_url( "comment.php?action=deletecomment&dt=spam&p=$post->ID&c=$comment->comment_ID&$del_nonce" ); 2119 $spam_url = esc_url( "comment.php?action=spamcomment&p=$post->ID&c=$comment->comment_ID&$del_nonce" ); 2120 $unspam_url = esc_url( "comment.php?action=unspamcomment&p=$post->ID&c=$comment->comment_ID&$del_nonce" ); 2121 2121 $trash_url = esc_url( "comment.php?action=trashcomment&p=$post->ID&c=$comment->comment_ID&$del_nonce" ); 2122 2122 $untrash_url = esc_url( "comment.php?action=untrashcomment&p=$post->ID&c=$comment->comment_ID&$del_nonce" ); 2123 $delete_url = esc_url( "comment.php?action=deletecomment&p=$post->ID&c=$comment->comment_ID&$del_nonce" ); 2123 2124 } 2124 2125 2125 2126 echo "<tr id='comment-$comment->comment_ID' class='$the_comment_status'>"; … … 2160 2161 $actions = array(); 2161 2162 2162 2163 if ( $user_can ) { 2163 if ( 'trash' == $the_comment_status ) { 2164 if ( $comment_status && 'all' != $comment_status ) { // not looking at all comments 2165 if ( 'approved' == $the_comment_status ) 2166 $actions['unapprove'] = "<a href='$unapprove_url' class='delete:the-comment-list:comment-$comment->comment_ID:e7e7d3:action=dim-comment&new=unapproved vim-u vim-destructive' title='" . __( 'Unapprove this comment' ) . "'>" . __( 'Unapprove' ) . '</a>'; 2167 else if ( 'unapproved' == $the_comment_status ) 2168 $actions['approve'] = "<a href='$approve_url' class='delete:the-comment-list:comment-$comment->comment_ID:e7e7d3:action=dim-comment&new=approved vim-a vim-destructive' title='" . __( 'Approve this comment' ) . "'>" . __( 'Approve' ) . '</a>'; 2169 } else { 2170 $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>'; 2171 $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>'; 2172 } 2173 2174 if ( 'spam' != $the_comment_status && 'trash' != $the_comment_status ) { 2175 $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>'; 2176 } elseif ( 'spam' == $the_comment_status ) { 2177 $actions['unspam'] = "<a href='$untrash_url' class='delete:the-comment-list:comment-$comment->comment_ID:ABF888:unspam=1 vim-z vim-destructive'>" . __( 'Not Spam' ) . '</a>'; 2178 } elseif ( 'trash' == $the_comment_status ) { 2164 2179 $actions['untrash'] = "<a href='$untrash_url' class='delete:the-comment-list:comment-$comment->comment_ID:ABF888:untrash=1 vim-z vim-destructive'>" . __( 'Restore' ) . '</a>'; 2180 } 2181 2182 if ( 'spam' == $the_comment_status || 'trash' == $the_comment_status || !EMPTY_TRASH_DAYS ) { 2165 2183 $actions['delete'] = "<a href='$delete_url' class='delete:the-comment-list:comment-$comment->comment_ID::delete=1 delete vim-d vim-destructive'>" . __('Delete Permanently') . '</a>'; 2166 2184 } else { 2167 $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>'; 2168 $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>'; 2169 2170 if ( $comment_status && 'all' != $comment_status ) { // not looking at all comments 2171 if ( 'approved' == $the_comment_status ) { 2172 $actions['unapprove'] = "<a href='$unapprove_url' class='delete:the-comment-list:comment-$comment->comment_ID:e7e7d3:action=dim-comment&new=unapproved vim-u vim-destructive' title='" . __( 'Unapprove this comment' ) . "'>" . __( 'Unapprove' ) . '</a>'; 2173 unset($actions['approve']); 2174 } else { 2175 $actions['approve'] = "<a href='$approve_url' class='delete:the-comment-list:comment-$comment->comment_ID:e7e7d3:action=dim-comment&new=approved vim-a vim-destructive' title='" . __( 'Approve this comment' ) . "'>" . __( 'Approve' ) . '</a>'; 2176 unset($actions['unapprove']); 2177 } 2178 } 2179 2180 if ( 'spam' != $the_comment_status ) { 2181 $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>'; 2182 } 2183 if ( 'spam' == $the_comment_status || !EMPTY_TRASH_DAYS ) { 2184 $actions['delete'] = "<a href='$delete_url' class='delete:the-comment-list:comment-$comment->comment_ID::delete=1 delete vim-d vim-destructive'>" . __('Delete Permanently') . '</a>'; 2185 } else { 2186 $actions['trash'] = "<a href='$trash_url' class='delete:the-comment-list:comment-$comment->comment_ID::trash=1 delete vim-d vim-destructive' title='" . __( 'Move this comment to the trash' ) . "'>" . _x('Trash', 'verb') . '</a>'; 2187 } 2188 2185 $actions['trash'] = "<a href='$trash_url' class='delete:the-comment-list:comment-$comment->comment_ID::trash=1 delete vim-d vim-destructive' title='" . __( 'Move this comment to the trash' ) . "'>" . _x('Trash', 'verb') . '</a>'; 2186 } 2187 2188 if ( 'trash' != $the_comment_status ) { 2189 2189 $actions['edit'] = "<a href='comment.php?action=editcomment&c={$comment->comment_ID}' title='" . __('Edit comment') . "'>". __('Edit') . '</a>'; 2190 2190 $actions['quickedit'] = '<a onclick="commentReply.open(\''.$comment->comment_ID.'\',\''.$post->ID.'\',\'edit\');return false;" class="vim-q" title="'.__('Quick Edit').'" href="#">' . __('Quick Edit') . '</a>'; 2191 2192 2191 if ( 'spam' != $the_comment_status ) 2193 2192 $actions['reply'] = '<a onclick="commentReply.open(\''.$comment->comment_ID.'\',\''.$post->ID.'\');return false;" class="vim-r" title="'.__('Reply to this comment').'" href="#">' . __('Reply') . '</a>'; 2194 2193 } … … 2204 2203 // Reply and quickedit need a hide-if-no-js span when not added with ajax 2205 2204 if ( ('reply' == $action || 'quickedit' == $action) && ! $from_ajax ) 2206 2205 $action .= ' hide-if-no-js'; 2207 elseif ( $action == 'untrash' && $the_comment_status == 'trash') {2208 if ('1' == get_comment_meta($comment_id, '_wp_ trash_meta_status', true))2206 elseif (($action == 'untrash' && $the_comment_status == 'trash') || ($action == 'unspam' && $the_comment_status == 'spam')) { 2207 if ('1' == get_comment_meta($comment_id, '_wp_previous_status', true)) 2209 2208 $action .= ' approve'; 2210 2209 else 2211 2210 $action .= ' unapprove'; … … 2371 2370 */ 2372 2371 function wp_comment_trashnotice() { 2373 2372 ?> 2374 <div class="hidden" id=" undo-holder">2375 <div class="trash-undo-inside"><?php _e('Comment by'); ?> <strong></strong> <?php _e('moved to the trash.'); ?> <span class="untrash"><a class="undo-trash"href="#"><?php _e('Undo'); ?></a></span></div>2373 <div class="hidden" id="trash-undo-holder"> 2374 <div class="trash-undo-inside"><?php printf(__('Comment by %s moved to the trash.'), '<strong></strong>'); ?> <span class="undo untrash"><a href="#"><?php _e('Undo'); ?></a></span></div> 2376 2375 </div> 2376 <div class="hidden" id="spam-undo-holder"> 2377 <div class="spam-undo-inside"><?php printf(__('Comment by %s marked as spam.'), '<strong></strong>'); ?> <span class="undo unspam"><a href="#"><?php _e('Undo'); ?></a></span></div> 2378 </div> 2377 2379 <?php 2378 2380 } 2379 2381 -
wp-admin/js/edit-comments.dev.js
38 38 settings.data._per_page = perPageInput.val() || 0; 39 39 settings.data._page = pageInput.val() || 0; 40 40 settings.data._url = document.location.href; 41 42 var action; 43 if ( cl.indexOf(':trash=1') != -1 ) 44 action = 'trash'; 45 else if ( cl.indexOf(':spam=1') != -1 ) 46 action = 'spam'; 41 47 42 if ( cl.indexOf(':trash=1') != -1) {48 if ( action == 'trash' || action == 'spam' ) { 43 49 id = cl.replace(/.*?comment-([0-9]+).*/, '$1'); 44 50 el = $('#comment-' + id); 45 note = $('# undo-holder').html();51 note = $('#'+action+'-undo-holder').html(); 46 52 47 53 if ( el.siblings('#replyrow').length && commentReply.cid == id ) 48 54 commentReply.close(); … … 50 56 if ( el.is('tr') ) { 51 57 n = el.children(':visible').length; 52 58 author = $('.author strong', el).text(); 53 h = $('<tr id=" trashundo-' + id + '" class="trash-undo" style="display:none;"><td colspan="' + n + '">' + note + '</td></tr>');59 h = $('<tr id="undo-' + id + '" class="undo un' + action + '" style="display:none;"><td colspan="' + n + '">' + note + '</td></tr>'); 54 60 } else { 55 61 author = $('.comment-author', el).text(); 56 h = $('<div id=" trashundo-' + id + '" style="display:none;" class="trash-undo">' + note + '</div>');62 h = $('<div id="undo-' + id + '" style="display:none;" class="undo un' + action + '">' + note + '</div>'); 57 63 } 58 64 59 65 el.before(h); 60 66 61 $('strong', '# trashundo-' + id).text(author + ' ');62 a = $(' a.undo-trash', '#trashundo-' + id);63 a.attr('href', 'comment.php?action=un trashcomment&c=' + id + '&_ajax_nonce=' + settings.data._ajax_nonce);64 a.attr('className', 'delete:the-comment-list:comment-' + id + '::un trash=1 vim-z vim-destructive');65 $('.avatar', el).clone().prependTo('# trashundo-' + id + ' .trash-undo-inside');67 $('strong', '#undo-' + id).text(author + ' '); 68 a = $('.undo a', '#undo-' + id); 69 a.attr('href', 'comment.php?action=un' + action + 'comment&c=' + id + '&_wpnonce=' + settings.data._ajax_nonce); 70 a.attr('className', 'delete:the-comment-list:comment-' + id + '::un' + action + '=1 vim-z vim-destructive'); 71 $('.avatar', el).clone().prependTo('#undo-' + id + ' .' + action + '-undo-inside'); 66 72 67 73 a.click(function(){ 68 74 list.wpList.del(this); 69 $('# trashundo-' + id).fadeOut(300, function(){75 $('#undo-' + id).fadeOut(300, function(){ 70 76 $(this).remove(); 71 77 $('#comment-' + id).css('backgroundColor', '').fadeIn(300, function(){ $(this).show() }); 72 78 }); … … 135 141 136 142 // In admin-ajax.php, we send back the unix time stamp instead of 1 on success 137 143 delAfter = function( r, settings ) { 138 var total, pageLinks, N, untrash = $(settings.target).parent().is('span.untrash'), spam, trash;144 var total, pageLinks, N, untrash = $(settings.target).parent().is('span.untrash'), unspam = $(settings.target).parent().is('span.unspam'), spam, trash; 139 145 140 146 function getUpdate(s) { 141 147 if ( $(settings.target).parent().is('span.' + s) ) … … 150 156 151 157 if ( untrash ) 152 158 trash = -1; 159 if ( unspam ) 160 spam = -1; 153 161 154 162 $('span.pending-count').each( function() { 155 163 var a = $(this), n = getCount(a), unapproved = $('#' + settings.element).is('.unapproved'); 156 164 157 if ( $(settings.target).parent().is('span.unapprove') || ( untrash&& unapproved ) ) { // we "deleted" an approved comment from the approved list by clicking "Unapprove"165 if ( $(settings.target).parent().is('span.unapprove') || ( (untrash||unspam) && unapproved ) ) { // we "deleted" an approved comment from the approved list by clicking "Unapprove" 158 166 n = n + 1; 159 167 } else if ( unapproved ) { // we deleted a formerly unapproved comment 160 168 n = n - 1; … … 212 220 .bind('wpListDelEnd', function(e, s){ 213 221 var id = s.element.replace(/[^0-9]+/g, ''); 214 222 215 if ( s.target.className.indexOf(':trash=1') != -1 )216 $('# trashundo-' + id).fadeIn(300, function(){ $(this).show() });223 if ( s.target.className.indexOf(':trash=1') != -1 || s.target.className.indexOf(':spam=1') != -1 ) 224 $('#undo-' + id).fadeIn(300, function(){ $(this).show() }); 217 225 }); 218 226 }; 219 227 -
wp-admin/comment.php
168 168 169 169 case 'trashcomment' : 170 170 case 'untrashcomment' : 171 case 'spamcomment' : 172 case 'unspamcomment' : 171 173 $comment_id = absint( $_REQUEST['c'] ); 172 174 $noredir = isset($_REQUEST['noredir']); 173 175 … … 185 187 else 186 188 $redir = admin_url('edit-comments.php'); 187 189 188 $redir = remove_query_arg( array(' trashed', 'untrashed', 'deleted', 'ids'), $redir );190 $redir = remove_query_arg( array('spammed', 'unspammed', 'trashed', 'untrashed', 'deleted', 'ids'), $redir ); 189 191 190 if ( $action == 'trashcomment' ) { 191 wp_trash_comment($comment_id); 192 $redir = add_query_arg( array('trashed' => '1', 'ids' => $comment_id), $redir ); 193 } else { 194 wp_untrash_comment($comment_id); 195 $redir = add_query_arg( array('untrashed' => '1'), $redir ); 192 switch ( $action ) { 193 case 'trashcomment' : 194 wp_trash_comment($comment_id); 195 $redir = add_query_arg( array('trashed' => '1', 'ids' => $comment_id), $redir ); 196 break; 197 case 'untrashcomment' : 198 wp_untrash_comment($comment_id); 199 $redir = add_query_arg( array('untrashed' => '1'), $redir ); 200 break; 201 case 'spamcomment' : 202 wp_spam_comment($comment_id); 203 $redir = add_query_arg( array('spammed' => '1', 'ids' => $comment_id), $redir ); 204 break; 205 case 'unspamcomment' : 206 wp_unspam_comment($comment_id); 207 $redir = add_query_arg( array('unspammed' => '1'), $redir ); 208 break; 196 209 } 197 210 198 211 wp_redirect( $redir ); -
wp-admin/wp-admin.dev.css
3524 3524 font-size: 11px; 3525 3525 } 3526 3526 3527 .trash-undo-inside { 3527 .trash-undo-inside, 3528 .spam-undo-inside { 3528 3529 margin: 1px 8px 1px 0; 3529 3530 line-height: 16px; 3530 3531 } 3531 3532 3533 .spam-undo-inside .avatar, 3532 3534 .trash-undo-inside .avatar { 3533 3535 height: 20px; 3534 3536 width: 20px;