Make WordPress Core


Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/3.0/wp-admin/edit-comments.php

    r17345 r15295  
    99/** WordPress Administration Bootstrap */
    1010require_once('./admin.php');
     11
    1112if ( !current_user_can('edit_posts') )
    1213    wp_die(__('Cheatin’ uh?'));
    1314
    14 $wp_list_table = _get_list_table('WP_Comments_List_Table');
    15 $pagenum = $wp_list_table->get_pagenum();
    16 
    17 $doaction = $wp_list_table->current_action();
    18 
    19 if ( $doaction ) {
    20     check_admin_referer( 'bulk-comments' );
    21 
    22     if ( 'delete_all' == $doaction && !empty( $_REQUEST['pagegen_timestamp'] ) ) {
    23         $comment_status = $wpdb->escape( $_REQUEST['comment_status'] );
    24         $delete_time = $wpdb->escape( $_REQUEST['pagegen_timestamp'] );
     15wp_enqueue_script('admin-comments');
     16enqueue_comment_hotkeys_js();
     17
     18$post_id = isset($_REQUEST['p']) ? (int) $_REQUEST['p'] : 0;
     19
     20if ( isset($_REQUEST['doaction']) ||  isset($_REQUEST['doaction2']) || isset($_REQUEST['delete_all']) || isset($_REQUEST['delete_all2']) ) {
     21    check_admin_referer('bulk-comments');
     22
     23    if ( (isset($_REQUEST['delete_all']) || isset($_REQUEST['delete_all2'])) && !empty($_REQUEST['pagegen_timestamp']) ) {
     24        $comment_status = $wpdb->escape($_REQUEST['comment_status']);
     25        $delete_time = $wpdb->escape($_REQUEST['pagegen_timestamp']);
    2526        $comment_ids = $wpdb->get_col( "SELECT comment_ID FROM $wpdb->comments WHERE comment_approved = '$comment_status' AND '$delete_time' > comment_date_gmt" );
    2627        $doaction = 'delete';
    27     } elseif ( isset( $_REQUEST['delete_comments'] ) ) {
     28    } elseif ( ($_REQUEST['action'] != -1 || $_REQUEST['action2'] != -1) && isset($_REQUEST['delete_comments']) ) {
    2829        $comment_ids = $_REQUEST['delete_comments'];
    29         $doaction = ( $_REQUEST['action'] != -1 ) ? $_REQUEST['action'] : $_REQUEST['action2'];
    30     } elseif ( isset( $_REQUEST['ids'] ) ) {
    31         $comment_ids = array_map( 'absint', explode( ',', $_REQUEST['ids'] ) );
    32     } elseif ( wp_get_referer() ) {
     30        $doaction = ($_REQUEST['action'] != -1) ? $_REQUEST['action'] : $_REQUEST['action2'];
     31    } elseif ( $_REQUEST['doaction'] == 'undo' && isset($_REQUEST['ids']) ) {
     32        $comment_ids = array_map( 'absint', explode(',', $_REQUEST['ids']) );
     33        $doaction = $_REQUEST['action'];
     34    } else {
    3335        wp_redirect( wp_get_referer() );
    34         exit;
    3536    }
    3637
    3738    $approved = $unapproved = $spammed = $unspammed = $trashed = $untrashed = $deleted = 0;
    38 
    39     $redirect_to = remove_query_arg( array( 'trashed', 'untrashed', 'deleted', 'spammed', 'unspammed', 'approved', 'unapproved', 'ids' ), wp_get_referer() );
    40     $redirect_to = add_query_arg( 'paged', $pagenum, $redirect_to );
    41 
    42     foreach ( $comment_ids as $comment_id ) { // Check the permissions on each
    43         if ( !current_user_can( 'edit_comment', $comment_id ) )
     39    $redirect_to = remove_query_arg( array('trashed', 'untrashed', 'deleted', 'spammed', 'unspammed', 'approved', 'unapproved', 'ids'), wp_get_referer() );
     40
     41    foreach ($comment_ids as $comment_id) { // Check the permissions on each
     42        $_post_id = (int) $wpdb->get_var( $wpdb->prepare( "SELECT comment_post_ID FROM $wpdb->comments WHERE comment_ID = %d", $comment_id) );
     43
     44        if ( !current_user_can('edit_post', $_post_id) )
    4445            continue;
    4546
    46         switch ( $doaction ) {
     47        switch( $doaction ) {
    4748            case 'approve' :
    48                 wp_set_comment_status( $comment_id, 'approve' );
     49                wp_set_comment_status($comment_id, 'approve');
    4950                $approved++;
    5051                break;
    5152            case 'unapprove' :
    52                 wp_set_comment_status( $comment_id, 'hold' );
     53                wp_set_comment_status($comment_id, 'hold');
    5354                $unapproved++;
    5455                break;
    5556            case 'spam' :
    56                 wp_spam_comment( $comment_id );
     57                wp_spam_comment($comment_id);
    5758                $spammed++;
    5859                break;
    5960            case 'unspam' :
    60                 wp_unspam_comment( $comment_id );
     61                wp_unspam_comment($comment_id);
    6162                $unspammed++;
    6263                break;
    6364            case 'trash' :
    64                 wp_trash_comment( $comment_id );
     65                wp_trash_comment($comment_id);
    6566                $trashed++;
    6667                break;
    6768            case 'untrash' :
    68                 wp_untrash_comment( $comment_id );
     69                wp_untrash_comment($comment_id);
    6970                $untrashed++;
    7071                break;
    7172            case 'delete' :
    72                 wp_delete_comment( $comment_id );
     73                wp_delete_comment($comment_id);
    7374                $deleted++;
    7475                break;
     
    9192        $redirect_to = add_query_arg( 'deleted', $deleted, $redirect_to );
    9293    if ( $trashed || $spammed )
    93         $redirect_to = add_query_arg( 'ids', join( ',', $comment_ids ), $redirect_to );
     94        $redirect_to = add_query_arg( 'ids', join(',', $comment_ids), $redirect_to );
    9495
    9596    wp_redirect( $redirect_to );
    9697    exit;
    97 } elseif ( ! empty( $_GET['_wp_http_referer'] ) ) {
    98      wp_redirect( remove_query_arg( array( '_wp_http_referer', '_wpnonce' ), stripslashes( $_SERVER['REQUEST_URI'] ) ) );
     98} elseif ( ! empty($_GET['_wp_http_referer']) ) {
     99     wp_redirect( remove_query_arg( array('_wp_http_referer', '_wpnonce'), stripslashes($_SERVER['REQUEST_URI']) ) );
    99100     exit;
    100101}
    101 
    102 $wp_list_table->prepare_items();
    103 
    104 $total_pages = $wp_list_table->get_pagination_arg( 'total_pages' );
    105 if ( $pagenum > $total_pages && $total_pages > 0 ) {
    106     wp_redirect( add_query_arg( 'paged', $total_pages ) );
    107     exit;
    108 }
    109 
    110 wp_enqueue_script('admin-comments');
    111 enqueue_comment_hotkeys_js();
    112102
    113103if ( $post_id )
     
    116106    $title = __('Comments');
    117107
    118 add_screen_option( 'per_page', array('label' => _x( 'Comments', 'comments per page (screen options)' )) );
    119 
    120 add_contextual_help( $current_screen, '<p>' . __( '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.' ) . '</p>' .
    121     '<p>' . __( 'A yellow row means the comment is waiting for you to moderate it.' ) . '</p>' .
    122     '<p>' . __( 'In the Author column, in addition to the author&#8217;s name, email address, and blog URL, the commenter&#8217;s IP address is shown. Clicking on this link will show you all the comments made from this IP address.' ) . '</p>' .
    123     '<p>' . __( 'In the Comment column, above each comment it says &#8220;Submitted on,&#8221; followed by the date and time the comment was left on your site. Clicking on the date/time link will take you to that comment on your live site.' ) . '</p>' .
    124     '<p>' . __( 'In the In Response To column, there are three elements. The text is the name of the post that inspired the comment, and links to the post editor for that entry. The &#8220;#&#8221; permalink symbol below leads to that post on your live site. The small bubble with the number in it shows how many comments that post has received. If the bubble is gray, you have moderated all comments for that post. If it is blue, there are pending comments. Clicking the bubble will filter the comments screen to show only comments on that post.' ) . '</p>' .
    125     '<p>' . __( 'Many people take advantage of keyboard shortcuts to moderate their comments more quickly. Use the link below to learn more.' ) . '</p>' .
     108add_contextual_help( $current_screen, '<p>' . __('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.') . '</p>' .
     109    '<p>' . __('A yellow row means the comment is waiting for you to moderate it.') . '</p>' .
     110    '<p>' . __('In the Author column, in addition to the author&#8217;s name, email address, and blog URL, the commenter&#8217;s IP address is shown. Clicking on this link will show you all the comments made from this IP address.') . '</p>' .
     111    '<p>' . __('In the Comment column, above each comment it says &#8220;Submitted on,&#8221; followed by the date and time the comment was left on your site. Clicking on the date/time link will take you to that comment on your live site.') . '</p>' .
     112    '<p>' . __('In the In Response To column, there are three elements. The text is the name of the post that inspired the comment, and links to the post editor for that entry. The &#8220;#&#8221; permalink symbol below leads to that post on your live site. The small bubble with the number in it shows how many comments that post has received. If the bubble is gray, you have moderated all comments for that post. If it is blue, there are pending comments. Clicking the bubble will filter the comments screen to show only comments on that post.') . '</p>' .
     113    '<p>' . __('Many people take advantage of keyboard shortcuts to moderate their comments more quickly. Use the link below to learn more.') . '</p>' .
    126114    '<p><strong>' . __( 'For more information:' ) . '</strong></p>' .
    127     '<p>' . __( '<a href="http://codex.wordpress.org/Administration_Panels#Comments" target="_blank">Documentation on Comments</a>' ) . '</p>' .
    128     '<p>' . __( '<a href="http://codex.wordpress.org/Comment_Spam" target="_blank">Documentation on Comment Spam</a>' ) . '</p>' .
    129     '<p>' . __( '<a href="http://codex.wordpress.org/Keyboard_Shortcuts" target="_blank">Documentation on Keyboard Shortcuts</a>' ) . '</p>' .
    130     '<p>' . __( '<a href="http://wordpress.org/support/" target="_blank">Support Forums</a>' ) . '</p>'
     115    '<p>' . __( '<a href="http://codex.wordpress.org/Administration_Panels#Comments" target="_blank">Comments Documentation</a>' ) . '</p>' .
     116    '<p>' . __( '<a href="http://codex.wordpress.org/Comment_Spam" target="_blank">Comment Spam Documentation</a>') . '</p>' .
     117    '<p>' . __( '<a href="http://codex.wordpress.org/Keyboard_Shortcuts" target="_blank">Keyboard Shortcuts Documentation</a>') . '</p>' .
     118    '<p>' . __( '<a href="http://wordpress.org/support/" target="_blank">Support Forums</a>') . '</p>'
    131119);
    132120require_once('./admin-header.php');
    133 ?>
     121
     122$mode = ( empty($_GET['mode']) ) ? 'detail' : esc_attr($_GET['mode']);
     123
     124$comment_status = isset($_REQUEST['comment_status']) ? $_REQUEST['comment_status'] : 'all';
     125if ( !in_array($comment_status, array('all', 'moderated', 'approved', 'spam', 'trash')) )
     126    $comment_status = 'all';
     127
     128$comment_type = !empty($_GET['comment_type']) ? esc_attr($_GET['comment_type']) : '';
     129
     130$search_dirty = ( isset($_GET['s']) ) ? $_GET['s'] : '';
     131$search = esc_attr( $search_dirty ); ?>
    134132
    135133<div class="wrap">
    136134<?php screen_icon(); ?>
    137 <h2><?php
    138 if ( $post_id )
    139     echo sprintf(__('Comments on &#8220;%s&#8221;'),
    140         sprintf('<a href="%s">%s</a>',
    141             get_edit_post_link($post_id),
    142             wp_html_excerpt(_draft_or_post_title($post_id), 50)
    143         )
    144     );
    145 else
    146     echo __('Comments');
    147 
    148 if ( isset($_REQUEST['s']) && $_REQUEST['s'] )
    149     printf( '<span class="subtitle">' . sprintf( __( 'Search results for &#8220;%s&#8221;' ), wp_html_excerpt( esc_html( stripslashes( $_REQUEST['s'] ) ), 50 ) ) . '</span>' ); ?>
     135<h2><?php echo esc_html( $title );
     136if ( isset($_GET['s']) && $_GET['s'] )
     137    printf( '<span class="subtitle">' . sprintf( __( 'Search results for &#8220;%s&#8221;' ), wp_html_excerpt( esc_html( stripslashes( $_GET['s'] ) ), 50 ) ) . '</span>' ); ?>
    150138</h2>
    151139
    152140<?php
    153 if ( isset( $_REQUEST['error'] ) ) {
    154     $error = (int) $_REQUEST['error'];
     141if ( isset( $_GET['error'] ) ) {
     142    $error = (int) $_GET['error'];
    155143    $error_msg = '';
    156144    switch ( $error ) {
     
    166154}
    167155
    168 if ( isset($_REQUEST['approved']) || isset($_REQUEST['deleted']) || isset($_REQUEST['trashed']) || isset($_REQUEST['untrashed']) || isset($_REQUEST['spammed']) || isset($_REQUEST['unspammed']) || isset($_REQUEST['same']) ) {
    169     $approved  = isset( $_REQUEST['approved']  ) ? (int) $_REQUEST['approved']  : 0;
    170     $deleted   = isset( $_REQUEST['deleted']   ) ? (int) $_REQUEST['deleted']   : 0;
    171     $trashed   = isset( $_REQUEST['trashed']   ) ? (int) $_REQUEST['trashed']   : 0;
    172     $untrashed = isset( $_REQUEST['untrashed'] ) ? (int) $_REQUEST['untrashed'] : 0;
    173     $spammed   = isset( $_REQUEST['spammed']   ) ? (int) $_REQUEST['spammed']   : 0;
    174     $unspammed = isset( $_REQUEST['unspammed'] ) ? (int) $_REQUEST['unspammed'] : 0;
    175     $same      = isset( $_REQUEST['same'] )      ? (int) $_REQUEST['same']      : 0;
     156if ( isset($_GET['approved']) || isset($_GET['deleted']) || isset($_GET['trashed']) || isset($_GET['untrashed']) || isset($_GET['spammed']) || isset($_GET['unspammed']) || isset($_GET['same']) ) {
     157    $approved  = isset( $_GET['approved']  ) ? (int) $_GET['approved']  : 0;
     158    $deleted   = isset( $_GET['deleted']   ) ? (int) $_GET['deleted']   : 0;
     159    $trashed   = isset( $_GET['trashed']   ) ? (int) $_GET['trashed']   : 0;
     160    $untrashed = isset( $_GET['untrashed'] ) ? (int) $_GET['untrashed'] : 0;
     161    $spammed   = isset( $_GET['spammed']   ) ? (int) $_GET['spammed']   : 0;
     162    $unspammed = isset( $_GET['unspammed'] ) ? (int) $_GET['unspammed'] : 0;
     163    $same      = isset( $_GET['same'] )      ? (int) $_GET['same']      : 0;
    176164
    177165    if ( $approved > 0 || $deleted > 0 || $trashed > 0 || $untrashed > 0 || $spammed > 0 || $unspammed > 0 || $same > 0 ) {
     
    180168
    181169        if ( $spammed > 0 ) {
    182             $ids = isset($_REQUEST['ids']) ? $_REQUEST['ids'] : 0;
     170            $ids = isset($_GET['ids']) ? $_GET['ids'] : 0;
    183171            $messages[] = sprintf( _n( '%s comment marked as spam.', '%s comments marked as spam.', $spammed ), $spammed ) . ' <a href="' . esc_url( wp_nonce_url( "edit-comments.php?doaction=undo&action=unspam&ids=$ids", "bulk-comments" ) ) . '">' . __('Undo') . '</a><br />';
    184172        }
     
    188176
    189177        if ( $trashed > 0 ) {
    190             $ids = isset($_REQUEST['ids']) ? $_REQUEST['ids'] : 0;
     178            $ids = isset($_GET['ids']) ? $_GET['ids'] : 0;
    191179            $messages[] = sprintf( _n( '%s comment moved to the Trash.', '%s comments moved to the Trash.', $trashed ), $trashed ) . ' <a href="' . esc_url( wp_nonce_url( "edit-comments.php?doaction=undo&action=untrash&ids=$ids", "bulk-comments" ) ) . '">' . __('Undo') . '</a><br />';
    192180        }
     
    217205?>
    218206
    219 <?php $wp_list_table->views(); ?>
    220 
    221207<form id="comments-form" action="" method="get">
    222 
    223 <?php $wp_list_table->search_box( __( 'Search Comments' ), 'comment' ); ?>
    224 
     208<ul class="subsubsub">
     209<?php
     210$status_links = array();
     211$num_comments = ( $post_id ) ? wp_count_comments( $post_id ) : wp_count_comments();
     212//, number_format_i18n($num_comments->moderated) ), "<span class='comment-count'>" . number_format_i18n($num_comments->moderated) . "</span>"),
     213//, number_format_i18n($num_comments->spam) ), "<span class='spam-comment-count'>" . number_format_i18n($num_comments->spam) . "</span>")
     214$stati = array(
     215        'all' => _nx_noop('All', 'All', 'comments'), // singular not used
     216        'moderated' => _n_noop('Pending <span class="count">(<span class="pending-count">%s</span>)</span>', 'Pending <span class="count">(<span class="pending-count">%s</span>)</span>'),
     217        'approved' => _n_noop('Approved', 'Approved'), // singular not used
     218        '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>'),
     219        '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>')
     220    );
     221
     222if ( !EMPTY_TRASH_DAYS )
     223    unset($stati['trash']);
     224
     225$link = 'edit-comments.php';
     226if ( !empty($comment_type) && 'all' != $comment_type )
     227    $link = add_query_arg( 'comment_type', $comment_type, $link );
     228
     229foreach ( $stati as $status => $label ) {
     230    $class = ( $status == $comment_status ) ? ' class="current"' : '';
     231
     232    if ( !isset( $num_comments->$status ) )
     233        $num_comments->$status = 10;
     234    $link = add_query_arg( 'comment_status', $status, $link );
     235    if ( $post_id )
     236        $link = add_query_arg( 'p', absint( $post_id ), $link );
     237    /*
     238    // I toyed with this, but decided against it. Leaving it in here in case anyone thinks it is a good idea. ~ Mark
     239    if ( !empty( $_GET['s'] ) )
     240        $link = add_query_arg( 's', esc_attr( stripslashes( $_GET['s'] ) ), $link );
     241    */
     242    if ( isset( $label[2] ) )
     243        $translated_label = _nx( $label[0], $label[1], $num_comments->$status, $label[2] );
     244    else
     245        $translated_label = _n( $label[0], $label[1], $num_comments->$status );
     246    $status_links[] = "<li class='$status'><a href='$link'$class>" . sprintf(
     247        $translated_label,
     248        number_format_i18n( $num_comments->$status )
     249    ) . '</a>';
     250}
     251
     252$status_links = apply_filters( 'comment_status_links', $status_links );
     253
     254echo implode( " |</li>\n", $status_links) . '</li>';
     255unset($status_links);
     256?>
     257</ul>
     258
     259<p class="search-box">
     260    <label class="screen-reader-text" for="comment-search-input"><?php _e( 'Search Comments' ); ?>:</label>
     261    <input type="text" id="comment-search-input" name="s" value="<?php _admin_search_query(); ?>" />
     262    <input type="submit" value="<?php esc_attr_e( 'Search Comments' ); ?>" class="button" />
     263</p>
     264
     265<?php
     266$comments_per_page = (int) get_user_option( 'edit_comments_per_page' );
     267if ( empty( $comments_per_page ) || $comments_per_page < 1 )
     268    $comments_per_page = 20;
     269$comments_per_page = apply_filters( 'comments_per_page', $comments_per_page, $comment_status );
     270
     271if ( isset( $_GET['apage'] ) )
     272    $page = abs( (int) $_GET['apage'] );
     273else
     274    $page = 1;
     275
     276$start = $offset = ( $page - 1 ) * $comments_per_page;
     277
     278list($_comments, $total) = _wp_get_comment_list( $comment_status, $search_dirty, $start, $comments_per_page + 8, $post_id, $comment_type ); // Grab a few extra
     279
     280$_comment_post_ids = array();
     281foreach ( $_comments as $_c ) {
     282    $_comment_post_ids[] = $_c->comment_post_ID;
     283}
     284
     285$_comment_pending_count = get_pending_comments_num($_comment_post_ids);
     286
     287$comments = array_slice($_comments, 0, $comments_per_page);
     288$extra_comments = array_slice($_comments, $comments_per_page);
     289
     290$page_links = paginate_links( array(
     291    'base' => add_query_arg( 'apage', '%#%' ),
     292    'format' => '',
     293    'prev_text' => __('&laquo;'),
     294    'next_text' => __('&raquo;'),
     295    'total' => ceil($total / $comments_per_page),
     296    'current' => $page
     297));
     298
     299?>
     300
     301<input type="hidden" name="mode" value="<?php echo esc_attr($mode); ?>" />
    225302<?php if ( $post_id ) : ?>
    226303<input type="hidden" name="p" value="<?php echo esc_attr( intval( $post_id ) ); ?>" />
     
    229306<input type="hidden" name="pagegen_timestamp" value="<?php echo esc_attr(current_time('mysql', 1)); ?>" />
    230307
    231 <input type="hidden" name="_total" value="<?php echo esc_attr( $wp_list_table->get_pagination_arg('total_items') ); ?>" />
    232 <input type="hidden" name="_per_page" value="<?php echo esc_attr( $wp_list_table->get_pagination_arg('per_page') ); ?>" />
    233 <input type="hidden" name="_page" value="<?php echo esc_attr( $wp_list_table->get_pagination_arg('page') ); ?>" />
    234 
    235 <?php if ( isset($_REQUEST['paged']) ) { ?>
    236     <input type="hidden" name="paged" value="<?php echo esc_attr( absint( $_REQUEST['paged'] ) ); ?>" />
     308<div class="tablenav">
     309
     310<?php if ( $page_links ) : ?>
     311<div class="tablenav-pages"><?php $page_links_text = sprintf( '<span class="displaying-num">' . __( 'Displaying %s&#8211;%s of %s' ) . '</span>%s',
     312    number_format_i18n( $start + 1 ),
     313    number_format_i18n( min( $page * $comments_per_page, $total ) ),
     314    '<span class="total-type-count">' . number_format_i18n( $total ) . '</span>',
     315    $page_links
     316); echo $page_links_text; ?></div>
     317<input type="hidden" name="_total" value="<?php echo esc_attr($total); ?>" />
     318<input type="hidden" name="_per_page" value="<?php echo esc_attr($comments_per_page); ?>" />
     319<input type="hidden" name="_page" value="<?php echo esc_attr($page); ?>" />
     320<?php endif; ?>
     321
     322<?php if ( $comments ) : ?>
     323<div class="alignleft actions">
     324<select name="action">
     325<option value="-1" selected="selected"><?php _e('Bulk Actions') ?></option>
     326<?php if ( 'all' == $comment_status || 'approved' == $comment_status ): ?>
     327<option value="unapprove"><?php _e('Unapprove'); ?></option>
     328<?php endif; ?>
     329<?php if ( 'all' == $comment_status || 'moderated' == $comment_status || 'spam' == $comment_status ): ?>
     330<option value="approve"><?php _e('Approve'); ?></option>
     331<?php endif; ?>
     332<?php if ( 'all' == $comment_status || 'approved' == $comment_status || 'moderated' == $comment_status ): ?>
     333<option value="spam"><?php _ex('Mark as Spam', 'comment'); ?></option>
     334<?php endif; ?>
     335<?php if ( 'trash' == $comment_status ): ?>
     336<option value="untrash"><?php _e('Restore'); ?></option>
     337<?php elseif ( 'spam' == $comment_status ): ?>
     338<option value="unspam"><?php _ex('Not Spam', 'comment'); ?></option>
     339<?php endif; ?>
     340<?php if ( 'trash' == $comment_status || 'spam' == $comment_status || !EMPTY_TRASH_DAYS ): ?>
     341<option value="delete"><?php _e('Delete Permanently'); ?></option>
     342<?php else: ?>
     343<option value="trash"><?php _e('Move to Trash'); ?></option>
     344<?php endif; ?>
     345</select>
     346<input type="submit" name="doaction" id="doaction" value="<?php esc_attr_e('Apply'); ?>" class="button-secondary apply" />
     347<?php wp_nonce_field('bulk-comments'); ?>
     348
     349<?php endif; ?>
     350
     351<select name="comment_type">
     352    <option value="all"><?php _e('Show all comment types'); ?></option>
     353<?php
     354    $comment_types = apply_filters( 'admin_comment_types_dropdown', array(
     355        'comment' => __('Comments'),
     356        'pings' => __('Pings'),
     357    ) );
     358
     359    foreach ( $comment_types as $type => $label ) {
     360        echo "  <option value='" . esc_attr($type) . "'";
     361        selected( $comment_type, $type );
     362        echo ">$label</option>\n";
     363    }
     364?>
     365</select>
     366<input type="submit" id="post-query-submit" value="<?php esc_attr_e('Filter'); ?>" class="button-secondary" />
     367
     368<?php if ( isset($_GET['apage']) ) { ?>
     369    <input type="hidden" name="apage" value="<?php echo esc_attr( absint( $_GET['apage'] ) ); ?>" />
     370<?php }
     371
     372if ( ( 'spam' == $comment_status || 'trash' == $comment_status) && current_user_can ('moderate_comments') ) {
     373    wp_nonce_field('bulk-destroy', '_destroy_nonce');
     374    if ( 'spam' == $comment_status && current_user_can('moderate_comments') ) { ?>
     375        <input type="submit" name="delete_all" id="delete_all" value="<?php esc_attr_e('Empty Spam'); ?>" class="button-secondary apply" />
     376<?php } elseif ( 'trash' == $comment_status && current_user_can('moderate_comments') ) { ?>
     377        <input type="submit" name="delete_all" id="delete_all" value="<?php esc_attr_e('Empty Trash'); ?>" class="button-secondary apply" />
     378<?php }
     379} ?>
     380<?php do_action('manage_comments_nav', $comment_status); ?>
     381</div>
     382
     383<br class="clear" />
     384
     385</div>
     386
     387<div class="clear"></div>
     388<?php if ( $comments ) { ?>
     389
     390<table class="widefat comments fixed" cellspacing="0">
     391<thead>
     392    <tr>
     393<?php print_column_headers('edit-comments'); ?>
     394    </tr>
     395</thead>
     396
     397<tfoot>
     398    <tr>
     399<?php print_column_headers('edit-comments', false); ?>
     400    </tr>
     401</tfoot>
     402
     403<tbody id="the-comment-list" class="list:comment">
     404<?php
     405    foreach ($comments as $comment)
     406        _wp_comment_row( $comment->comment_ID, $mode, $comment_status );
     407?>
     408</tbody>
     409<tbody id="the-extra-comment-list" class="list:comment" style="display: none;">
     410<?php
     411    foreach ($extra_comments as $comment)
     412        _wp_comment_row( $comment->comment_ID, $mode, $comment_status );
     413?>
     414</tbody>
     415</table>
     416
     417<div class="tablenav">
     418<?php
     419if ( $page_links )
     420    echo "<div class='tablenav-pages'>$page_links_text</div>";
     421?>
     422
     423<div class="alignleft actions">
     424<select name="action2">
     425<option value="-1" selected="selected"><?php _e('Bulk Actions') ?></option>
     426<?php if ( 'all' == $comment_status || 'approved' == $comment_status ): ?>
     427<option value="unapprove"><?php _e('Unapprove'); ?></option>
     428<?php endif; ?>
     429<?php if ( 'all' == $comment_status || 'moderated' == $comment_status || 'spam' == $comment_status ): ?>
     430<option value="approve"><?php _e('Approve'); ?></option>
     431<?php endif; ?>
     432<?php if ( 'all' == $comment_status || 'approved' == $comment_status || 'moderated' == $comment_status ): ?>
     433<option value="spam"><?php _ex('Mark as Spam', 'comment'); ?></option>
     434<?php endif; ?>
     435<?php if ( 'trash' == $comment_status ): ?>
     436<option value="untrash"><?php _e('Restore'); ?></option>
     437<?php endif; ?>
     438<?php if ( 'trash' == $comment_status || 'spam' == $comment_status || !EMPTY_TRASH_DAYS ): ?>
     439<option value="delete"><?php _e('Delete Permanently'); ?></option>
     440<?php elseif ( 'spam' == $comment_status ): ?>
     441<option value="unspam"><?php _ex('Not Spam', 'comment'); ?></option>
     442<?php else: ?>
     443<option value="trash"><?php _e('Move to Trash'); ?></option>
     444<?php endif; ?>
     445</select>
     446<input type="submit" name="doaction2" id="doaction2" value="<?php esc_attr_e('Apply'); ?>" class="button-secondary apply" />
     447
     448<?php if ( 'spam' == $comment_status && current_user_can('moderate_comments') ) { ?>
     449<input type="submit" name="delete_all2" id="delete_all2" value="<?php esc_attr_e('Empty Spam'); ?>" class="button-secondary apply" />
     450<?php } elseif ( 'trash' == $comment_status && current_user_can('moderate_comments') ) { ?>
     451<input type="submit" name="delete_all2" id="delete_all2" value="<?php esc_attr_e('Empty Trash'); ?>" class="button-secondary apply" />
    237452<?php } ?>
    238 
    239 <?php $wp_list_table->display(); ?>
     453<?php do_action('manage_comments_nav', $comment_status); ?>
     454</div>
     455
     456<br class="clear" />
     457</div>
     458
    240459</form>
    241 </div>
     460
     461<form id="get-extra-comments" method="post" action="" class="add:the-extra-comment-list:" style="display: none;">
     462    <input type="hidden" name="s" value="<?php echo esc_attr($search); ?>" />
     463    <input type="hidden" name="mode" value="<?php echo esc_attr($mode); ?>" />
     464    <input type="hidden" name="comment_status" value="<?php echo esc_attr($comment_status); ?>" />
     465    <input type="hidden" name="page" value="<?php echo esc_attr($page); ?>" />
     466    <input type="hidden" name="per_page" value="<?php echo esc_attr($comments_per_page); ?>" />
     467    <input type="hidden" name="p" value="<?php echo esc_attr( $post_id ); ?>" />
     468    <input type="hidden" name="comment_type" value="<?php echo esc_attr( $comment_type ); ?>" />
     469    <?php wp_nonce_field( 'add-comment', '_ajax_nonce', false ); ?>
     470</form>
    242471
    243472<div id="ajax-response"></div>
     473
     474<?php } elseif ( 'moderated' == $comment_status ) { ?>
     475<p><?php _e('No comments awaiting moderation&hellip; yet.') ?></p>
     476</div>
     477</form>
     478
     479<?php } else { ?>
     480<p><?php _e('No comments found.') ?></p>
     481</div>
     482</form>
     483
     484<?php } ?>
     485</div>
    244486
    245487<?php
Note: See TracChangeset for help on using the changeset viewer.