X-Git-Url: https://scripts.mit.edu/gitweb/autoinstalls/wordpress.git/blobdiff_plain/022dfbbbe3215917d84708eb09acca93b21ae9e0..2394dc71e94f8323dc422e89f9841959de78d328:/wp-admin/edit-comments.php?mode=edit diff --git a/wp-admin/edit-comments.php b/wp-admin/edit-comments.php index ab0f0a8e..224d3674 100644 --- a/wp-admin/edit-comments.php +++ b/wp-admin/edit-comments.php @@ -1,175 +1,257 @@ +$wp_list_table = _get_list_table('WP_Comments_List_Table'); +$pagenum = $wp_list_table->get_pagenum(); + +$doaction = $wp_list_table->current_action(); + +if ( $doaction ) { + check_admin_referer( 'bulk-comments' ); + + if ( 'delete_all' == $doaction && !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 = 'delete'; + } elseif ( isset( $_REQUEST['delete_comments'] ) ) { + $comment_ids = $_REQUEST['delete_comments']; + $doaction = ( $_REQUEST['action'] != -1 ) ? $_REQUEST['action'] : $_REQUEST['action2']; + } elseif ( isset( $_REQUEST['ids'] ) ) { + $comment_ids = array_map( 'absint', explode( ',', $_REQUEST['ids'] ) ); + } elseif ( wp_get_referer() ) { + wp_safe_redirect( wp_get_referer() ); + exit; + } + + $approved = $unapproved = $spammed = $unspammed = $trashed = $untrashed = $deleted = 0; + + $redirect_to = remove_query_arg( array( 'trashed', 'untrashed', 'deleted', 'spammed', 'unspammed', 'approved', 'unapproved', 'ids' ), wp_get_referer() ); + $redirect_to = add_query_arg( 'paged', $pagenum, $redirect_to ); - + +$wp_list_table->prepare_items(); + +wp_enqueue_script('admin-comments'); +enqueue_comment_hotkeys_js(); + +if ( $post_id ) + $title = sprintf(__('Comments on “%s”'), wp_html_excerpt(_draft_or_post_title($post_id), 50)); +else + $title = __('Comments'); + +add_screen_option( 'per_page', array('label' => _x( 'Comments', 'comments per page (screen options)' )) ); + +get_current_screen()->add_help_tab( array( +'id' => 'overview', +'title' => __('Overview'), +'content' => + '
' . __( 'You can manage comments made on your site similar to the way you manage posts and other content. This screen is customizable in the same ways as other management screens, and you can act on comments using the on-hover action links or the Bulk Actions.' ) . '
' +) ); +get_current_screen()->add_help_tab( array( +'id' => 'moderating-comments', +'title' => __('Moderating Comments'), +'content' => + '' . __( 'For more information:' ) . '
' . + '' . __( 'Documentation on Comments' ) . '
' . + '' . __( 'Documentation on Comment Spam' ) . '
' . + '' . __( 'Documentation on Keyboard Shortcuts' ) . '
' . + '' . __( 'Support Forums' ) . '
' +); + +require_once('./admin-header.php'); +?> +" . sprintf(__('%s comments deleted.'), $i) . "
' . $error_msg . '
comment_author_email) { ?>| comment_author_url && 'http://' != $comment->comment_author_url ) { ?> | |
- - - -comment_post_ID) ) { - echo " | comment_ID."\">" . __('Edit Comment') . ""; - echo ' | " . __('Delete Comment') . ' '; - } // end if any comments to show - // Get post title - if ( current_user_can('edit_post', $comment->comment_post_ID) ) { - $post_title = $wpdb->get_var("SELECT post_title FROM $wpdb->posts WHERE ID = $comment->comment_post_ID"); - $post_title = ('' == $post_title) ? "# $comment->comment_post_ID" : $post_title; - ?> | - - |
--
- - '; - wp_nonce_field('bulk-comments'); - echo '* | -' . __('Name') . ' | -' . __('E-mail') . ' | -' . __('IP') . ' | -' . __('Comment Excerpt') . ' | -' . __('Actions') . ' | -||
---|---|---|---|---|---|---|---|
comment_post_ID) ) { ?> | -- | - | - | - | - | comment_post_ID) ) { - echo "" . __('Edit') . ""; } ?> | -comment_post_ID) ) { - echo "comment_post_ID."&comment=".$comment->comment_ID, 'delete-comment_' . $comment->comment_ID) . "\" onclick=\"return confirm('" . __("You are about to delete this comment.\\n \'Cancel\' to stop, \'OK\' to delete.") . "')\" class='delete'>" . __('Delete') . ""; } ?> | -
')" />
- - -- -
- 0 || $deleted > 0 || $trashed > 0 || $untrashed > 0 || $spammed > 0 || $unspammed > 0 || $same > 0 ) { + if ( $approved > 0 ) + $messages[] = sprintf( _n( '%s comment approved', '%s comments approved', $approved ), $approved ); + + if ( $spammed > 0 ) { + $ids = isset($_REQUEST['ids']) ? $_REQUEST['ids'] : 0; + $messages[] = sprintf( _n( '%s comment marked as spam.', '%s comments marked as spam.', $spammed ), $spammed ) . ' ' . __('Undo') . '' . implode( "
\n", $messages ) . '