Changeset 11749 for trunk/wp-admin/edit-comments.php
- Timestamp:
- 07/30/2009 01:39:34 PM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-admin/edit-comments.php
r11741 r11749 15 15 $post_id = isset($_REQUEST['p']) ? (int) $_REQUEST['p'] : 0; 16 16 17 if ( isset($_REQUEST['doaction']) || isset($_REQUEST['doaction2']) || isset($_REQUEST['de stroy_all']) || isset($_REQUEST['destroy_all2']) ) {17 if ( isset($_REQUEST['doaction']) || isset($_REQUEST['doaction2']) || isset($_REQUEST['delete_all']) || isset($_REQUEST['delete_all2']) ) { 18 18 check_admin_referer('bulk-comments'); 19 19 20 if ((isset($_REQUEST['de stroy_all']) || isset($_REQUEST['destroy_all2'])) && !empty($_REQUEST['pagegen_timestamp'])) {20 if ((isset($_REQUEST['delete_all']) || isset($_REQUEST['delete_all2'])) && !empty($_REQUEST['pagegen_timestamp'])) { 21 21 $comment_status = $wpdb->escape($_REQUEST['comment_status']); 22 22 $delete_time = $wpdb->escape($_REQUEST['pagegen_timestamp']); 23 23 $comment_ids = $wpdb->get_col( "SELECT comment_ID FROM $wpdb->comments WHERE comment_approved = '$comment_status' AND '$delete_time' > comment_date_gmt" ); 24 $doaction = 'de stroy';24 $doaction = 'delete'; 25 25 } elseif (($_REQUEST['action'] != -1 || $_REQUEST['action2'] != -1) && isset($_REQUEST['delete_comments'])) { 26 26 $comment_ids = $_REQUEST['delete_comments']; … … 28 28 } else wp_redirect($_SERVER['HTTP_REFERER']); 29 29 30 $approved = $unapproved = $spammed = $ deleted = $destroyed = 0;30 $approved = $unapproved = $spammed = $trashed = $untrashed = $deleted = 0; 31 31 32 32 foreach ($comment_ids as $comment_id) { // Check the permissions on each … … 49 49 $spammed++; 50 50 break; 51 case 'trash' : 52 wp_trash_comment($comment_id); 53 $trashed++; 54 break; 55 case 'untrash' : 56 wp_untrash_comment($comment_id); 57 $untrashed++; 58 break; 51 59 case 'delete' : 52 wp_ set_comment_status($comment_id, 'delete');60 wp_delete_comment($comment_id); 53 61 $deleted++; 54 62 break; 55 case 'destroy' :56 wp_set_comment_status($comment_id, 'delete');57 $destroyed++;58 break;59 63 } 60 64 } 61 65 62 $redirect_to = 'edit-comments.php?approved=' . $approved . '&unapproved=' . $unapproved . '&spam=' . $spammed . '& deleted=' . $deleted . '&destroyed=' . $destroyed;66 $redirect_to = 'edit-comments.php?approved=' . $approved . '&unapproved=' . $unapproved . '&spam=' . $spammed . '&trashed=' . $trashed . '&untrashed=' . $untrashed . '&deleted=' . $deleted; 63 67 if ( $post_id ) 64 68 $redirect_to = add_query_arg( 'p', absint( $post_id ), $redirect_to ); … … 87 91 88 92 $comment_status = isset($_REQUEST['comment_status']) ? $_REQUEST['comment_status'] : 'all'; 89 if ( !in_array($comment_status, array('all', 'moderated', 'approved', 'spam', ' deleted')) )93 if ( !in_array($comment_status, array('all', 'moderated', 'approved', 'spam', 'trash')) ) 90 94 $comment_status = 'all'; 91 95 … … 103 107 104 108 <?php 105 if ( isset( $_GET['approved'] ) || isset( $_GET['deleted'] ) || isset( $_GET['destroyed'] ) || isset( $_GET['spam'] ) ) { 106 $approved = isset( $_GET['approved'] ) ? (int) $_GET['approved'] : 0; 107 $deleted = isset( $_GET['deleted'] ) ? (int) $_GET['deleted'] : 0; 108 $destroyed = isset( $_GET['destroyed'] ) ? (int) $_GET['destroyed'] : 0; 109 $spam = isset( $_GET['spam'] ) ? (int) $_GET['spam'] : 0; 110 111 if ( $approved > 0 || $deleted > 0 || $destroyed > 0 || $spam > 0 ) { 109 if ( isset($_GET['approved']) || isset($_GET['deleted']) || isset($_GET['trashed']) || isset($_GET['untrashed']) || isset($_GET['spam']) ) { 110 $approved = isset($_GET['approved']) ? (int) $_GET['approved'] : 0; 111 $deleted = isset($_GET['deleted']) ? (int) $_GET['deleted'] : 0; 112 $trashed = isset($_GET['trashed']) ? (int) $_GET['trashed'] : 0; 113 $untrashed = isset($_GET['untrashed']) ? (int) $_GET['untrashed'] : 0; 114 $spam = isset($_GET['spam']) ? (int) $_GET['spam'] : 0; 115 116 if ( $approved > 0 || $deleted > 0 || $trashed > 0 || $untrashed > 0 || $spam > 0 ) { 112 117 echo '<div id="moderated" class="updated fade"><p>'; 113 118 … … 120 125 echo '<br />'; 121 126 } 127 if ( $trashed > 0 ) { 128 printf( _n( '%s comment moved to the trash', '%s comments moved to the trash', $trashed ), $trashed ); 129 echo '<br />'; 130 } 131 if ( $untrashed > 0 ) { 132 printf( _n( '%s comment removed from the trash', '%s comments removed from the trash', $untrashed ), $untrashed ); 133 echo '<br />'; 134 } 122 135 if ( $deleted > 0 ) { 123 printf( _n( '%s comment deleted', '%s comments deleted', $deleted ), $deleted ); 124 echo '<br />'; 125 } 126 if ( $destroyed > 0 ) { 127 printf( _n( '%s comment permanently deleted', '%s comments permanently deleted', $destroyed ), $destroyed ); 136 printf( _n( '%s comment permanently deleted', '%s comments permanently deleted', $deleted ), $deleted ); 128 137 echo '<br />'; 129 138 } … … 146 155 'approved' => _n_noop('Approved', 'Approved'), // singular not used 147 156 '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>'), 148 ' 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>')157 '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>') 149 158 ); 150 159 $link = 'edit-comments.php'; … … 257 266 <option value="markspam"><?php _e('Mark as Spam'); ?></option> 258 267 <?php endif; ?> 259 <?php if ( ' deleted' == $comment_status ): ?>260 <option value="un approve"><?php _e('Return to Pending'); ?></option>261 <?php endif; ?> 262 <?php if ( ' deleted' == $comment_status || 'spam' == $comment_status ): ?>263 <option value="de stroy"><?php _e('Delete Permanently'); ?></option>268 <?php if ( 'trash' == $comment_status ): ?> 269 <option value="untrash"><?php _e('Restore'); ?></option> 270 <?php endif; ?> 271 <?php if ( 'trash' == $comment_status || 'spam' == $comment_status ): ?> 272 <option value="delete"><?php _e('Delete Permanently'); ?></option> 264 273 <?php else: ?> 265 <option value=" delete"><?php _e('Move to Trash'); ?></option>274 <option value="trash"><?php _e('Move to Trash'); ?></option> 266 275 <?php endif; ?> 267 276 </select> … … 290 299 <?php } 291 300 292 if ( ( 'spam' == $comment_status || ' deleted' == $comment_status) && current_user_can ('moderate_comments') ) {301 if ( ( 'spam' == $comment_status || 'trash' == $comment_status) && current_user_can ('moderate_comments') ) { 293 302 wp_nonce_field('bulk-destroy', '_destroy_nonce'); 294 303 if ( 'spam' == $comment_status ) { ?> 295 <input type="submit" name="de stroy_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="de stroy_all" id="destroy_all" value="<?php esc_attr_e('Empty Trash'); ?>" class="button-primary apply" />304 <input type="submit" name="delete_all" id="delete_all" value="<?php esc_attr_e('Empty Spam'); ?>" class="button-secondary apply" /> 305 <?php } elseif ( 'trash' == $comment_status ) { ?> 306 <input type="submit" name="delete_all" id="delete_all" value="<?php esc_attr_e('Empty Trash'); ?>" class="button-secondary apply" /> 298 307 <?php } 299 308 } ?> … … 353 362 <option value="markspam"><?php _e('Mark as Spam'); ?></option> 354 363 <?php endif; ?> 355 <?php if ( ' deleted' == $comment_status ): ?>356 <option value="un approve"><?php _e('Return to Pending'); ?></option>357 <?php endif; ?> 358 <?php if ( ' deleted' == $comment_status || 'spam' == $comment_status ): ?>359 <option value="de stroy"><?php _e('Delete Permanently'); ?></option>364 <?php if ( 'trash' == $comment_status ): ?> 365 <option value="untrash"><?php _e('Restore'); ?></option> 366 <?php endif; ?> 367 <?php if ( 'trash' == $comment_status || 'spam' == $comment_status ): ?> 368 <option value="delete"><?php _e('Delete Permanently'); ?></option> 360 369 <?php else: ?> 361 <option value=" delete"><?php _e('Move to Trash'); ?></option>370 <option value="trash"><?php _e('Move to Trash'); ?></option> 362 371 <?php endif; ?> 363 372 </select> … … 365 374 366 375 <?php if ( 'spam' == $comment_status ) { ?> 367 <input type="submit" name="de stroy_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="de stroy_all2" id="destroy_all2" value="<?php esc_attr_e('Empty Trash'); ?>" class="button-secondary apply" />376 <input type="submit" name="delete_all2" id="delete_all2" value="<?php esc_attr_e('Empty Spam'); ?>" class="button-secondary apply" /> 377 <?php } elseif ( 'trash' == $comment_status ) { ?> 378 <input type="submit" name="delete_all2" id="delete_all2" value="<?php esc_attr_e('Empty Trash'); ?>" class="button-secondary apply" /> 370 379 <?php } ?> 371 380 <?php do_action('manage_comments_nav', $comment_status); ?>
Note: See TracChangeset
for help on using the changeset viewer.