Changeset 11741
- Timestamp:
- 07/24/2009 07:23:11 AM (16 years ago)
- Location:
- trunk
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-admin/edit-comments.php
r11731 r11741 251 251 <option value="unapprove"><?php _e('Unapprove'); ?></option> 252 252 <?php endif; ?> 253 <?php if ( 'a pproved' != $comment_status ): ?>253 <?php if ( 'all' == $comment_status || 'moderated' == $comment_status || 'spam' == $comment_status ): ?> 254 254 <option value="approve"><?php _e('Approve'); ?></option> 255 255 <?php endif; ?> 256 <?php if ( ' spam' != $comment_status ): ?>256 <?php if ( 'all' == $comment_status || 'approved' == $comment_status || 'moderated' == $comment_status ): ?> 257 257 <option value="markspam"><?php _e('Mark as Spam'); ?></option> 258 <?php endif; ?> 259 <?php if ( 'deleted' == $comment_status ): ?> 260 <option value="unapprove"><?php _e('Return to Pending'); ?></option> 258 261 <?php endif; ?> 259 262 <?php if ( 'deleted' == $comment_status || 'spam' == $comment_status ): ?> 260 263 <option value="destroy"><?php _e('Delete Permanently'); ?></option> 261 264 <?php else: ?> 262 <option value="delete"><?php _e(' Delete'); ?></option>265 <option value="delete"><?php _e('Move to Trash'); ?></option> 263 266 <?php endif; ?> 264 267 </select> … … 287 290 <?php } 288 291 289 if ( 'spam' == $comment_status || 'deleted' == $comment_status) {292 if ( ( 'spam' == $comment_status || 'deleted' == $comment_status) && current_user_can ('moderate_comments') ) { 290 293 wp_nonce_field('bulk-destroy', '_destroy_nonce'); 291 if ( current_user_can ('moderate_comments')) { ?>294 if ( 'spam' == $comment_status ) { ?> 292 295 <input type="submit" name="destroy_all" id="destroy_all" value="<?php esc_attr_e('Permanently Delete All'); ?>" class="button-secondary apply" /> 296 <?php } elseif ( 'deleted' == $comment_status ) { ?> 297 <input type="submit" name="destroy_all" id="destroy_all" value="<?php esc_attr_e('Empty Trash'); ?>" class="button-primary apply" /> 293 298 <?php } 294 299 } ?> … … 342 347 <option value="unapprove"><?php _e('Unapprove'); ?></option> 343 348 <?php endif; ?> 344 <?php if ( 'a pproved' != $comment_status ): ?>349 <?php if ( 'all' == $comment_status || 'moderated' == $comment_status || 'spam' == $comment_status ): ?> 345 350 <option value="approve"><?php _e('Approve'); ?></option> 346 351 <?php endif; ?> 347 <?php if ( ' spam' != $comment_status ): ?>352 <?php if ( 'all' == $comment_status || 'approved' == $comment_status || 'moderated' == $comment_status ): ?> 348 353 <option value="markspam"><?php _e('Mark as Spam'); ?></option> 354 <?php endif; ?> 355 <?php if ( 'deleted' == $comment_status ): ?> 356 <option value="unapprove"><?php _e('Return to Pending'); ?></option> 349 357 <?php endif; ?> 350 358 <?php if ( 'deleted' == $comment_status || 'spam' == $comment_status ): ?> 351 359 <option value="destroy"><?php _e('Delete Permanently'); ?></option> 352 360 <?php else: ?> 353 <option value="delete"><?php _e(' Delete'); ?></option>361 <option value="delete"><?php _e('Move to Trash'); ?></option> 354 362 <?php endif; ?> 355 363 </select> 356 364 <input type="submit" name="doaction2" id="doaction2" value="<?php esc_attr_e('Apply'); ?>" class="button-secondary apply" /> 357 365 358 <?php if ( 'spam' == $comment_status || 'deleted' == $comment_status ) { ?> 359 <input type="submit" name="destroy_all2" id="destroy_all2" value="<?php esc_attr_e('Permanently Delete All'); ?>" class="button-secondary apply" /> 366 <?php if ( 'spam' == $comment_status ) { ?> 367 <input type="submit" name="destroy_all2" id="destroy_all2" value="<?php esc_attr_e('Empty Quarantine'); ?>" class="button-secondary apply" /> 368 <?php } elseif ( 'deleted' == $comment_status ) { ?> 369 <input type="submit" name="destroy_all2" id="destroy_all2" value="<?php esc_attr_e('Empty Trash'); ?>" class="button-secondary apply" /> 360 370 <?php } ?> 361 371 <?php do_action('manage_comments_nav', $comment_status); ?> -
trunk/wp-admin/includes/dashboard.php
r11708 r11741 540 540 $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>'; 541 541 $actions['edit'] = "<a href='comment.php?action=editcomment&c={$comment->comment_ID}' title='" . __('Edit comment') . "'>". __('Edit') . '</a>'; 542 //$actions['quickedit'] = '<a onclick="commentReply.open(\''.$comment->comment_ID.'\',\''.$comment->comment_post_ID.'\',\'edit\');return false;" class="vim-q" title="'.__('Quick Edit').'" href="#">' . __('Quick Edit') . '</a>';543 542 $actions['reply'] = '<a onclick="commentReply.open(\''.$comment->comment_ID.'\',\''.$comment->comment_post_ID.'\');return false;" class="vim-r hide-if-no-js" title="'.__('Reply to this comment').'" href="#">' . __('Reply') . '</a>'; 544 543 $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>'; 545 $actions['delete'] = "<a href='$delete_url' class='delete:the-comment-list:comment-$comment->comment_ID delete vim-d vim-destructive'>" . __(' Delete') . '</a>';544 $actions['delete'] = "<a href='$delete_url' class='delete:the-comment-list:comment-$comment->comment_ID delete vim-d vim-destructive'>" . __('Move to Trash') . '</a>'; 546 545 547 546 $actions = apply_filters( 'comment_row_actions', $actions, $comment ); -
trunk/wp-admin/includes/template.php
r11731 r11741 2160 2160 } else { 2161 2161 $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>'; 2162 $actions['delete'] = "<a href='$delete_url' class='delete:the-comment-list:comment-$comment->comment_ID delete vim-d vim-destructive'>" . __(' Delete') . '</a>';2162 $actions['delete'] = "<a href='$delete_url' class='delete:the-comment-list:comment-$comment->comment_ID delete vim-d vim-destructive'>" . __('Move to Trash') . '</a>'; 2163 2163 } 2164 2164 -
trunk/wp-includes/comment.php
r11734 r11741 744 744 do_action('delete_comment', $comment_id); 745 745 746 wp_unschedule_comment_de struction($comment_id);746 wp_unschedule_comment_delete($comment_id); 747 747 748 748 $comment = get_comment($comment_id); … … 1038 1038 function wp_set_comment_status($comment_id, $comment_status, $wp_error = false) { 1039 1039 global $wpdb; 1040 wp_unschedule_comment_de struction($comment_id);1040 wp_unschedule_comment_delete($comment_id); 1041 1041 1042 1042 $status = '0'; … … 1059 1059 return wp_delete_comment($comment_id); 1060 1060 $status = 'deleted'; 1061 wp_schedule_comment_de struction($comment_id);1061 wp_schedule_comment_delete($comment_id); 1062 1062 break; 1063 1063 default: … … 1092 1092 * @return void 1093 1093 */ 1094 function wp_schedule_comment_de struction($comment_id) {1095 $to_de stroy = get_option('to_destroy');1096 if ( !is_array($to_destroy))1097 $to_de stroy= array();1094 function wp_schedule_comment_delete($comment_id) { 1095 $to_delete = get_option('wp_scheduled_delete'); 1096 if ( !is_array($to_delete) ) 1097 $to_delete = array(); 1098 1098 1099 $to_de stroy['comments'][$comment_id] = time();1099 $to_delete['comments'][$comment_id] = time(); 1100 1100 1101 update_option(' to_destroy', $to_destroy);1101 update_option('wp_scheduled_delete', $to_delete); 1102 1102 } 1103 1103 … … 1110 1110 * @return void 1111 1111 */ 1112 function wp_unschedule_comment_de struction($comment_id) {1113 $to_de stroy = get_option('to_destroy');1114 if ( !is_array($to_destroy))1112 function wp_unschedule_comment_delete($comment_id) { 1113 $to_delete = get_option('wp_scheduled_delete'); 1114 if ( !is_array($to_delete) ) 1115 1115 return; 1116 1116 1117 unset($to_de stroy['comments'][$comment_id]);1117 unset($to_delete['comments'][$comment_id]); 1118 1118 1119 update_option(' to_destroy', $to_destroy);1119 update_option('wp_scheduled_delete', $to_delete); 1120 1120 } 1121 1121 -
trunk/wp-includes/cron.php
r10969 r11741 395 395 } 396 396 397 ?> 397 add_action( 'wp_scheduled_delete', 'wp_scheduled_delete' ); 398 if ( !wp_next_scheduled('wp_scheduled_delete') && !defined('WP_INSTALLING') ) 399 wp_schedule_event(time(), 'daily', 'wp_scheduled_delete'); -
trunk/wp-includes/functions.php
r11736 r11741 3329 3329 } 3330 3330 3331 3332 3333 3331 /** 3334 3332 * Strip close comment and close php tags from file headers used by WP … … 3340 3338 return trim(preg_replace("/\s*(?:\*\/|\?>).*/", '', $str)); 3341 3339 } 3342 ?> 3340 3341 /** 3342 * Permanently deletes comments that have been scheduled for deleting. 3343 * Will do the same for posts, pages, etc in the future. 3344 * 3345 * @access private 3346 * @since 2.9.0 3347 * 3348 * @return void 3349 */ 3350 function wp_scheduled_delete() { 3351 $to_delete = get_option('wp_scheduled_delete'); 3352 if (!is_array($to_delete)) 3353 return; 3354 3355 if ( !isset($to_delete['comments']) || !is_array($to_delete['comments']) ) 3356 $to_delete['comments'] = array(); 3357 3358 $delete_delay = defined('EMPTY_TRASH_TIMEOUT') ? (int) EMPTY_TRASH_TIMEOUT : (60*60*24*30); 3359 $deletetimestamp = time() - $delete_delay; 3360 foreach ($to_delete['comments'] as $comment_id => $timestamp) { 3361 if ($timestamp < $deletetimestamp) { 3362 wp_delete_comment($comment_id); 3363 unset($to_delete['comments'][$comment_id]); 3364 } 3365 } 3366 3367 update_option('wp_scheduled_delete', $to_delete); 3368 } -
trunk/wp-includes/pluggable.php
r11731 r11741 1768 1768 endif; 1769 1769 1770 /**1771 * Destroys comments which have previously been scheduled for destruction.1772 * Will do the same for posts, pages, etc in the future.1773 *1774 * @access private1775 * @since 2.9.01776 *1777 * @return void1778 */1779 function _scheduled_destruction() {1780 $to_destroy = get_option('to_destroy');1781 if (!is_array($to_destroy))1782 return;1783 1784 $deletetimestamp = time()-(60*60*24*30);1785 foreach ($to_destroy['comments'] as $comment_id => $timestamp) {1786 if ($timestamp < $deletetimestamp) {1787 wp_delete_comment($comment_id);1788 unset($to_destroy['comments'][$comment_id]);1789 }1790 }1791 1792 update_option('to_destroy', $to_destroy);1793 }1794 add_action( '_scheduled_destruction', '_scheduled_destruction' );1795 if ( !wp_next_scheduled('_scheduled_destruction') && !defined('WP_INSTALLING') )1796 wp_schedule_event(time(), 'daily', '_scheduled_destruction');1797 1798
Note: See TracChangeset
for help on using the changeset viewer.