2003-10-27 02:09:25 -05:00
< ? php
2008-08-16 03:27:34 -04:00
/**
* Edit Comments Administration Panel .
*
* @ package WordPress
* @ subpackage Administration
*/
/** WordPress Administration Bootstrap */
2010-04-18 02:14:45 -04:00
require_once ( './admin.php' );
2004-04-22 23:23:05 -04:00
2009-08-01 17:58:59 -04:00
if ( ! current_user_can ( 'edit_posts' ) )
wp_die ( __ ( 'Cheatin’ uh?' ));
2008-11-12 04:35:50 -05:00
wp_enqueue_script ( 'admin-comments' );
2008-10-16 18:23:32 -04:00
enqueue_comment_hotkeys_js ();
2004-08-22 19:24:50 -04:00
2008-12-05 22:59:03 -05:00
$post_id = isset ( $_REQUEST [ 'p' ]) ? ( int ) $_REQUEST [ 'p' ] : 0 ;
2009-07-30 09:39:34 -04:00
if ( isset ( $_REQUEST [ 'doaction' ]) || isset ( $_REQUEST [ 'doaction2' ]) || isset ( $_REQUEST [ 'delete_all' ]) || isset ( $_REQUEST [ 'delete_all2' ]) ) {
2006-05-02 18:36:06 -04:00
check_admin_referer ( 'bulk-comments' );
2009-09-14 10:03:32 -04:00
2009-11-27 05:34:09 -05:00
if ( ( isset ( $_REQUEST [ 'delete_all' ]) || isset ( $_REQUEST [ 'delete_all2' ])) && ! empty ( $_REQUEST [ 'pagegen_timestamp' ]) ) {
2009-07-20 23:11:12 -04:00
$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 " );
2009-07-30 09:39:34 -04:00
$doaction = 'delete' ;
2009-11-27 05:34:09 -05:00
} elseif ( ( $_REQUEST [ 'action' ] != - 1 || $_REQUEST [ 'action2' ] != - 1 ) && isset ( $_REQUEST [ 'delete_comments' ]) ) {
2009-07-20 23:11:12 -04:00
$comment_ids = $_REQUEST [ 'delete_comments' ];
$doaction = ( $_REQUEST [ 'action' ] != - 1 ) ? $_REQUEST [ 'action' ] : $_REQUEST [ 'action2' ];
2009-11-27 05:34:09 -05:00
} elseif ( $_REQUEST [ 'doaction' ] == 'undo' && isset ( $_REQUEST [ 'ids' ]) ) {
$comment_ids = array_map ( 'absint' , explode ( ',' , $_REQUEST [ 'ids' ]) );
$doaction = $_REQUEST [ 'action' ];
} else {
2009-12-19 06:30:54 -05:00
wp_redirect ( wp_get_referer () );
2009-11-27 05:34:09 -05:00
}
2009-09-14 10:03:32 -04:00
2009-11-27 05:34:09 -05:00
$approved = $unapproved = $spammed = $unspammed = $trashed = $untrashed = $deleted = 0 ;
2009-12-19 06:30:54 -05:00
$redirect_to = remove_query_arg ( array ( 'trashed' , 'untrashed' , 'deleted' , 'spammed' , 'unspammed' , 'approved' , 'unapproved' , 'ids' ), wp_get_referer () );
2009-09-14 10:03:32 -04:00
2009-07-20 23:11:12 -04:00
foreach ( $comment_ids as $comment_id ) { // Check the permissions on each
2008-12-05 22:59:03 -05:00
$_post_id = ( int ) $wpdb -> get_var ( $wpdb -> prepare ( " SELECT comment_post_ID FROM $wpdb->comments WHERE comment_ID = %d " , $comment_id ) );
2006-03-30 18:12:54 -05:00
2008-12-05 22:59:03 -05:00
if ( ! current_user_can ( 'edit_post' , $_post_id ) )
2008-02-23 21:33:30 -05:00
continue ;
2008-09-29 05:26:21 -04:00
switch ( $doaction ) {
2009-07-20 23:11:12 -04:00
case 'approve' :
wp_set_comment_status ( $comment_id , 'approve' );
$approved ++ ;
break ;
case 'unapprove' :
wp_set_comment_status ( $comment_id , 'hold' );
$unapproved ++ ;
break ;
2009-11-27 05:34:09 -05:00
case 'spam' :
wp_spam_comment ( $comment_id );
2008-09-29 05:26:21 -04:00
$spammed ++ ;
break ;
2009-11-27 05:34:09 -05:00
case 'unspam' :
wp_unspam_comment ( $comment_id );
$unspammed ++ ;
break ;
2009-07-30 09:39:34 -04:00
case 'trash' :
wp_trash_comment ( $comment_id );
$trashed ++ ;
break ;
case 'untrash' :
wp_untrash_comment ( $comment_id );
$untrashed ++ ;
break ;
2008-09-29 05:26:21 -04:00
case 'delete' :
2009-07-30 09:39:34 -04:00
wp_delete_comment ( $comment_id );
2008-09-29 05:26:21 -04:00
$deleted ++ ;
break ;
2006-02-14 15:09:13 -05:00
}
2009-07-20 23:11:12 -04:00
}
2008-09-29 05:26:21 -04:00
2009-11-27 05:34:09 -05:00
if ( $approved )
$redirect_to = add_query_arg ( 'approved' , $approved , $redirect_to );
if ( $unapproved )
$redirect_to = add_query_arg ( 'unapproved' , $unapproved , $redirect_to );
if ( $spammed )
$redirect_to = add_query_arg ( 'spammed' , $spammed , $redirect_to );
if ( $unspammed )
$redirect_to = add_query_arg ( 'unspammed' , $unspammed , $redirect_to );
if ( $trashed )
$redirect_to = add_query_arg ( 'trashed' , $trashed , $redirect_to );
if ( $untrashed )
$redirect_to = add_query_arg ( 'untrashed' , $untrashed , $redirect_to );
if ( $deleted )
$redirect_to = add_query_arg ( 'deleted' , $deleted , $redirect_to );
if ( $trashed || $spammed )
$redirect_to = add_query_arg ( 'ids' , join ( ',' , $comment_ids ), $redirect_to );
2008-02-24 15:28:36 -05:00
wp_redirect ( $redirect_to );
2009-12-19 06:30:54 -05:00
exit ;
2010-03-19 17:29:21 -04:00
} elseif ( ! empty ( $_GET [ '_wp_http_referer' ]) ) {
2008-09-29 05:26:21 -04:00
wp_redirect ( remove_query_arg ( array ( '_wp_http_referer' , '_wpnonce' ), stripslashes ( $_SERVER [ 'REQUEST_URI' ]) ) );
2008-03-02 15:17:30 -05:00
exit ;
2008-02-24 15:28:36 -05:00
}
2004-02-17 05:50:33 -05:00
2008-11-19 23:51:47 -05:00
if ( $post_id )
2010-05-15 01:07:31 -04:00
$title = sprintf ( __ ( 'Comments on “%s”' ), wp_html_excerpt ( _draft_or_post_title ( $post_id ), 50 ));
2008-11-19 23:51:47 -05:00
else
2010-05-15 01:07:31 -04:00
$title = __ ( 'Comments' );
2008-11-19 23:51:47 -05:00
2010-05-25 17:59:42 -04:00
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>' .
'<p>' . __ ( 'A yellow row means the comment is waiting for you to moderate it.' ) . '</p>' .
'<p>' . __ ( 'In the Author column, in addition to the author’s name, email address, and blog URL, the commenter’s IP address is shown. Clicking on this link will show you all the comments made from this IP address.' ) . '</p>' .
2010-06-01 13:44:38 -04:00
'<p>' . __ ( 'In the Comment column, above each comment it says “Submitted on,” 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>' .
'<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 “#” 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>' .
2010-05-27 19:38:20 -04:00
'<p>' . __ ( 'Many people take advantage of keyboard shortcuts to moderate their comments more quickly. Use the link below to learn more.' ) . '</p>' .
'<p><strong>' . __ ( 'For more information:' ) . '</strong></p>' .
2010-06-03 17:00:39 -04:00
'<p>' . __ ( '<a href="http://codex.wordpress.org/Administration_Panels#Comments" target="_blank">Comments Documentation</a>' ) . '</p>' .
'<p>' . __ ( '<a href="http://codex.wordpress.org/Comment_Spam" target="_blank">Comment Spam Documentation</a>' ) . '</p>' .
'<p>' . __ ( '<a href="http://codex.wordpress.org/Keyboard_Shortcuts" target="_blank">Keyboard Shortcuts Documentation</a>' ) . '</p>' .
'<p>' . __ ( '<a href="http://wordpress.org/support/" target="_blank">Support Forums</a>' ) . '</p>'
2010-05-25 17:59:42 -04:00
);
2010-04-18 02:14:45 -04:00
require_once ( './admin-header.php' );
2008-02-23 23:51:47 -05:00
2010-03-19 17:29:21 -04:00
$mode = ( empty ( $_GET [ 'mode' ]) ) ? 'detail' : esc_attr ( $_GET [ 'mode' ]);
2008-02-24 15:28:36 -05:00
2009-05-07 03:38:14 -04:00
$comment_status = isset ( $_REQUEST [ 'comment_status' ]) ? $_REQUEST [ 'comment_status' ] : 'all' ;
2009-07-30 09:39:34 -04:00
if ( ! in_array ( $comment_status , array ( 'all' , 'moderated' , 'approved' , 'spam' , 'trash' )) )
2009-04-21 17:12:01 -04:00
$comment_status = 'all' ;
2008-10-01 11:48:45 -04:00
2009-05-05 15:43:53 -04:00
$comment_type = ! empty ( $_GET [ 'comment_type' ]) ? esc_attr ( $_GET [ 'comment_type' ]) : '' ;
2008-02-28 01:50:25 -05:00
2008-08-24 02:56:22 -04:00
$search_dirty = ( isset ( $_GET [ 's' ]) ) ? $_GET [ 's' ] : '' ;
2009-05-05 15:43:53 -04:00
$search = esc_attr ( $search_dirty ); ?>
2008-09-08 17:49:26 -04:00
2008-11-05 14:48:43 -05:00
< div class = " wrap " >
2008-11-26 08:51:25 -05:00
< ? php screen_icon (); ?>
2009-05-18 11:11:07 -04:00
< h2 >< ? php echo esc_html ( $title );
2008-12-04 07:01:02 -05:00
if ( isset ( $_GET [ 's' ]) && $_GET [ 's' ] )
2009-05-18 11:11:07 -04:00
printf ( '<span class="subtitle">' . sprintf ( __ ( 'Search results for “%s”' ), wp_html_excerpt ( esc_html ( stripslashes ( $_GET [ 's' ] ) ), 50 ) ) . '</span>' ); ?>
2008-12-04 07:01:02 -05:00
</ h2 >
2008-11-05 14:48:43 -05:00
2008-09-28 00:11:27 -04:00
< ? php
2010-02-20 06:18:25 -05:00
if ( isset ( $_GET [ 'error' ] ) ) {
$error = ( int ) $_GET [ 'error' ];
$error_msg = '' ;
switch ( $error ) {
case 1 :
$error_msg = __ ( 'Oops, no comment with this ID.' );
break ;
case 2 :
$error_msg = __ ( 'You are not allowed to edit comments on this post.' );
break ;
}
if ( $error_msg )
echo '<div id="moderated" class="error"><p>' . $error_msg . '</p></div>' ;
}
2010-02-20 06:48:38 -05:00
if ( isset ( $_GET [ 'approved' ]) || isset ( $_GET [ 'deleted' ]) || isset ( $_GET [ 'trashed' ]) || isset ( $_GET [ 'untrashed' ]) || isset ( $_GET [ 'spammed' ]) || isset ( $_GET [ 'unspammed' ]) || isset ( $_GET [ 'same' ]) ) {
2010-02-20 06:18:25 -05:00
$approved = isset ( $_GET [ 'approved' ] ) ? ( int ) $_GET [ 'approved' ] : 0 ;
$deleted = isset ( $_GET [ 'deleted' ] ) ? ( int ) $_GET [ 'deleted' ] : 0 ;
$trashed = isset ( $_GET [ 'trashed' ] ) ? ( int ) $_GET [ 'trashed' ] : 0 ;
$untrashed = isset ( $_GET [ 'untrashed' ] ) ? ( int ) $_GET [ 'untrashed' ] : 0 ;
$spammed = isset ( $_GET [ 'spammed' ] ) ? ( int ) $_GET [ 'spammed' ] : 0 ;
$unspammed = isset ( $_GET [ 'unspammed' ] ) ? ( int ) $_GET [ 'unspammed' ] : 0 ;
2010-02-20 06:48:38 -05:00
$same = isset ( $_GET [ 'same' ] ) ? ( int ) $_GET [ 'same' ] : 0 ;
2009-07-30 09:39:34 -04:00
2010-02-20 06:48:38 -05:00
if ( $approved > 0 || $deleted > 0 || $trashed > 0 || $untrashed > 0 || $spammed > 0 || $unspammed > 0 || $same > 0 ) {
2010-02-20 06:18:25 -05:00
if ( $approved > 0 )
$messages [] = sprintf ( _n ( '%s comment approved' , '%s comments approved' , $approved ), $approved );
2008-02-23 21:33:30 -05:00
2009-11-27 05:34:09 -05:00
if ( $spammed > 0 ) {
$ids = isset ( $_GET [ 'ids' ]) ? $_GET [ 'ids' ] : 0 ;
2010-05-03 14:16:22 -04:00
$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 />' ;
2009-07-20 23:11:12 -04:00
}
2010-02-20 06:18:25 -05:00
if ( $unspammed > 0 )
2010-04-18 03:32:59 -04:00
$messages [] = sprintf ( _n ( '%s comment restored from the spam' , '%s comments restored from the spam' , $unspammed ), $unspammed );
2010-02-20 06:18:25 -05:00
2009-07-30 09:39:34 -04:00
if ( $trashed > 0 ) {
2009-10-08 04:24:59 -04:00
$ids = isset ( $_GET [ 'ids' ]) ? $_GET [ 'ids' ] : 0 ;
2010-05-03 14:16:22 -04:00
$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 />' ;
2008-02-23 21:33:30 -05:00
}
2010-02-20 06:18:25 -05:00
if ( $untrashed > 0 )
2010-04-20 10:54:36 -04:00
$messages [] = sprintf ( _n ( '%s comment restored from the Trash' , '%s comments restored from the Trash' , $untrashed ), $untrashed );
2010-02-20 06:18:25 -05:00
if ( $deleted > 0 )
$messages [] = sprintf ( _n ( '%s comment permanently deleted' , '%s comments permanently deleted' , $deleted ), $deleted );
2010-02-20 06:48:38 -05:00
if ( $same > 0 && $comment = get_comment ( $same ) ) {
switch ( $comment -> comment_approved ) {
case '1' :
2010-05-03 14:16:22 -04:00
$messages [] = __ ( 'This comment is already approved.' ) . ' <a href="' . esc_url ( admin_url ( " comment.php?action=editcomment&c= $same " ) ) . '">' . __ ( 'Edit comment' ) . '</a>' ;
2010-02-20 06:48:38 -05:00
break ;
case 'trash' :
2010-05-03 14:16:22 -04:00
$messages [] = __ ( 'This comment is already in the Trash.' ) . ' <a href="' . esc_url ( admin_url ( 'edit-comments.php?comment_status=trash' ) ) . '"> ' . __ ( 'View Trash' ) . '</a>' ;
2010-02-20 06:48:38 -05:00
break ;
case 'spam' :
2010-05-03 14:16:22 -04:00
$messages [] = __ ( 'This comment is already marked as spam.' ) . ' <a href="' . esc_url ( admin_url ( " comment.php?action=editcomment&c= $same " ) ) . '">' . __ ( 'Edit comment' ) . '</a>' ;
2010-02-20 06:48:38 -05:00
break ;
}
}
2010-02-20 06:18:25 -05:00
echo '<div id="moderated" class="updated"><p>' . implode ( " <br/> \n " , $messages ) . '</p></div>' ;
2008-02-23 21:33:30 -05:00
}
}
?>
2008-09-29 05:26:21 -04:00
2008-10-31 14:02:20 -04:00
< form id = " comments-form " action = " " method = " get " >
2008-02-24 19:28:21 -05:00
< ul class = " subsubsub " >
< ? php
$status_links = array ();
2008-12-05 22:59:03 -05:00
$num_comments = ( $post_id ) ? wp_count_comments ( $post_id ) : wp_count_comments ();
2008-11-06 16:56:29 -05:00
//, number_format_i18n($num_comments->moderated) ), "<span class='comment-count'>" . number_format_i18n($num_comments->moderated) . "</span>"),
//, number_format_i18n($num_comments->spam) ), "<span class='spam-comment-count'>" . number_format_i18n($num_comments->spam) . "</span>")
2008-08-20 00:06:36 -04:00
$stati = array (
2010-01-21 16:37:43 -05:00
'all' => _nx_noop ( 'All' , 'All' , 'comments' ), // singular not used
2009-07-20 23:11:12 -04:00
'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>' ),
2009-02-20 14:22:34 -05:00
'approved' => _n_noop ( 'Approved' , 'Approved' ), // singular not used
2009-07-20 23:11:12 -04:00
'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>' ),
2009-07-30 09:39:34 -04:00
'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>' )
2008-08-20 00:06:36 -04:00
);
2009-11-10 05:38:19 -05:00
if ( ! EMPTY_TRASH_DAYS )
unset ( $stati [ 'trash' ]);
2008-12-05 22:59:03 -05:00
$link = 'edit-comments.php' ;
if ( ! empty ( $comment_type ) && 'all' != $comment_type )
$link = add_query_arg ( 'comment_type' , $comment_type , $link );
2009-11-10 05:38:19 -05:00
2008-02-24 19:28:21 -05:00
foreach ( $stati as $status => $label ) {
2010-02-13 03:49:27 -05:00
$class = ( $status == $comment_status ) ? ' class="current"' : '' ;
2008-02-24 19:28:21 -05:00
2008-11-06 16:56:29 -05:00
if ( ! isset ( $num_comments -> $status ) )
$num_comments -> $status = 10 ;
2009-04-21 17:12:01 -04:00
$link = add_query_arg ( 'comment_status' , $status , $link );
2008-12-05 22:59:03 -05:00
if ( $post_id )
$link = add_query_arg ( 'p' , absint ( $post_id ), $link );
/*
// I toyed with this, but decided against it. Leaving it in here in case anyone thinks it is a good idea. ~ Mark
if ( ! empty ( $_GET [ 's' ] ) )
2009-05-05 15:43:53 -04:00
$link = add_query_arg ( 's' , esc_attr ( stripslashes ( $_GET [ 's' ] ) ), $link );
2008-12-05 22:59:03 -05:00
*/
2010-06-21 08:21:09 -04:00
if ( isset ( $label [ 2 ] ) )
$translated_label = _nx ( $label [ 0 ], $label [ 1 ], $num_comments -> $status , $label [ 2 ] );
else
$translated_label = _n ( $label [ 0 ], $label [ 1 ], $num_comments -> $status );
$status_links [] = " <li class=' $status '><a href=' $link ' $class > " . sprintf (
$translated_label ,
2008-11-06 16:56:29 -05:00
number_format_i18n ( $num_comments -> $status )
) . '</a>' ;
2008-02-24 19:28:21 -05:00
}
2008-03-11 03:23:07 -04:00
$status_links = apply_filters ( 'comment_status_links' , $status_links );
2008-11-06 16:56:29 -05:00
echo implode ( " |</li> \n " , $status_links ) . '</li>' ;
2008-02-24 19:28:21 -05:00
unset ( $status_links );
?>
</ ul >
2008-02-23 21:33:30 -05:00
2008-10-02 20:13:12 -04:00
< p class = " search-box " >
2009-05-12 18:40:56 -04:00
< label class = " screen-reader-text " for = " comment-search-input " >< ? php _e ( 'Search Comments' ); ?> :</label>
2009-04-16 00:41:05 -04:00
< input type = " text " id = " comment-search-input " name = " s " value = " <?php _admin_search_query(); ?> " />
2009-05-05 15:43:53 -04:00
< input type = " submit " value = " <?php esc_attr_e( 'Search Comments' ); ?> " class = " button " />
2008-10-02 14:03:45 -04:00
</ p >
2008-02-23 03:01:51 -05:00
< ? php
2010-01-06 19:01:52 -05:00
$comments_per_page = ( int ) get_user_option ( 'edit_comments_per_page' );
2009-12-11 18:14:43 -05:00
if ( empty ( $comments_per_page ) || $comments_per_page < 1 )
2009-03-27 18:47:47 -04:00
$comments_per_page = 20 ;
2009-12-11 18:14:43 -05:00
$comments_per_page = apply_filters ( 'comments_per_page' , $comments_per_page , $comment_status );
2008-04-30 16:05:25 -04:00
2007-03-27 17:20:16 -04:00
if ( isset ( $_GET [ 'apage' ] ) )
2007-08-01 15:41:44 -04:00
$page = abs ( ( int ) $_GET [ 'apage' ] );
2007-03-27 17:20:16 -04:00
else
$page = 1 ;
2007-05-21 08:52:44 -04:00
2008-04-30 16:05:25 -04:00
$start = $offset = ( $page - 1 ) * $comments_per_page ;
2004-10-05 03:25:21 -04:00
2009-06-27 18:40:06 -04:00
list ( $_comments , $total ) = _wp_get_comment_list ( $comment_status , $search_dirty , $start , $comments_per_page + 8 , $post_id , $comment_type ); // Grab a few extra
2006-11-18 01:52:01 -05:00
2008-12-07 02:10:47 -05:00
$_comment_post_ids = array ();
foreach ( $_comments as $_c ) {
$_comment_post_ids [] = $_c -> comment_post_ID ;
}
2010-01-12 17:38:26 -05:00
$_comment_pending_count = get_pending_comments_num ( $_comment_post_ids );
2008-12-07 02:10:47 -05:00
2008-04-30 16:05:25 -04:00
$comments = array_slice ( $_comments , 0 , $comments_per_page );
$extra_comments = array_slice ( $_comments , $comments_per_page );
2007-03-27 17:20:16 -04:00
$page_links = paginate_links ( array (
2007-09-03 19:32:58 -04:00
'base' => add_query_arg ( 'apage' , '%#%' ),
2007-05-21 08:52:44 -04:00
'format' => '' ,
2008-11-26 19:28:24 -05:00
'prev_text' => __ ( '«' ),
'next_text' => __ ( '»' ),
2008-04-30 16:05:25 -04:00
'total' => ceil ( $total / $comments_per_page ),
2007-03-27 17:20:16 -04:00
'current' => $page
));
2008-02-23 03:01:51 -05:00
?>
2006-11-18 01:52:01 -05:00
2009-05-05 15:43:53 -04:00
< input type = " hidden " name = " mode " value = " <?php echo esc_attr( $mode ); ?> " />
2008-12-05 22:59:03 -05:00
< ? php if ( $post_id ) : ?>
2009-05-05 15:43:53 -04:00
< input type = " hidden " name = " p " value = " <?php echo esc_attr( intval( $post_id ) ); ?> " />
2008-12-05 22:59:03 -05:00
< ? php endif ; ?>
2009-05-05 15:43:53 -04:00
< input type = " hidden " name = " comment_status " value = " <?php echo esc_attr( $comment_status ); ?> " />
< input type = " hidden " name = " pagegen_timestamp " value = " <?php echo esc_attr(current_time('mysql', 1)); ?> " />
2008-02-28 01:50:25 -05:00
2008-02-23 03:01:51 -05:00
< div class = " tablenav " >
2006-04-19 04:30:56 -04:00
2008-11-06 16:56:29 -05:00
< ? php if ( $page_links ) : ?>
2008-11-10 12:42:51 -05:00
< div class = " tablenav-pages " >< ? php $page_links_text = sprintf ( '<span class="displaying-num">' . __ ( 'Displaying %s–%s of %s' ) . '</span>%s' ,
2008-11-06 16:56:29 -05:00
number_format_i18n ( $start + 1 ),
number_format_i18n ( min ( $page * $comments_per_page , $total ) ),
2008-12-14 07:13:30 -05:00
'<span class="total-type-count">' . number_format_i18n ( $total ) . '</span>' ,
2008-11-06 16:56:29 -05:00
$page_links
); echo $page_links_text ; ?> </div>
2009-05-05 15:43:53 -04:00
< input type = " hidden " name = " _total " value = " <?php echo esc_attr( $total ); ?> " />
< input type = " hidden " name = " _per_page " value = " <?php echo esc_attr( $comments_per_page ); ?> " />
< input type = " hidden " name = " _page " value = " <?php echo esc_attr( $page ); ?> " />
2008-11-06 16:56:29 -05:00
< ? php endif ; ?>
2008-02-23 03:01:51 -05:00
2010-05-08 06:10:41 -04:00
< ? php if ( $comments ) : ?>
2008-10-24 14:25:46 -04:00
< div class = " alignleft actions " >
2008-08-20 00:06:36 -04:00
< select name = " action " >
2008-12-09 21:27:08 -05:00
< option value = " -1 " selected = " selected " >< ? php _e ( 'Bulk Actions' ) ?> </option>
2009-04-21 17:12:01 -04:00
< ? php if ( 'all' == $comment_status || 'approved' == $comment_status ) : ?>
2008-08-20 00:06:36 -04:00
< option value = " unapprove " >< ? php _e ( 'Unapprove' ); ?> </option>
2008-09-04 14:00:21 -04:00
< ? php endif ; ?>
2009-07-24 03:23:11 -04:00
< ? php if ( 'all' == $comment_status || 'moderated' == $comment_status || 'spam' == $comment_status ) : ?>
2008-08-28 18:09:56 -04:00
< option value = " approve " >< ? php _e ( 'Approve' ); ?> </option>
2008-02-24 15:42:44 -05:00
< ? php endif ; ?>
2009-07-24 03:23:11 -04:00
< ? php if ( 'all' == $comment_status || 'approved' == $comment_status || 'moderated' == $comment_status ) : ?>
2010-05-14 17:46:25 -04:00
< option value = " spam " >< ? php _ex ( 'Mark as Spam' , 'comment' ); ?> </option>
2008-02-28 02:04:52 -05:00
< ? php endif ; ?>
2009-07-30 09:39:34 -04:00
< ? php if ( 'trash' == $comment_status ) : ?>
< option value = " untrash " >< ? php _e ( 'Restore' ); ?> </option>
2009-11-27 05:34:09 -05:00
< ? php elseif ( 'spam' == $comment_status ) : ?>
2010-05-14 17:46:25 -04:00
< option value = " unspam " >< ? php _ex ( 'Not Spam' , 'comment' ); ?> </option>
2009-07-24 03:23:11 -04:00
< ? php endif ; ?>
2009-11-10 05:38:19 -05:00
< ? php if ( 'trash' == $comment_status || 'spam' == $comment_status || ! EMPTY_TRASH_DAYS ) : ?>
2009-07-30 09:39:34 -04:00
< option value = " delete " >< ? php _e ( 'Delete Permanently' ); ?> </option>
2009-07-20 23:11:12 -04:00
< ? php else : ?>
2009-07-30 09:39:34 -04:00
< option value = " trash " >< ? php _e ( 'Move to Trash' ); ?> </option>
2009-07-20 23:11:12 -04:00
< ? php endif ; ?>
2008-08-20 00:06:36 -04:00
</ select >
2009-05-05 15:43:53 -04:00
< input type = " submit " name = " doaction " id = " doaction " value = " <?php esc_attr_e('Apply'); ?> " class = " button-secondary apply " />
2008-02-23 03:01:51 -05:00
< ? php wp_nonce_field ( 'bulk-comments' ); ?>
2008-10-24 14:25:46 -04:00
2010-05-08 06:10:41 -04:00
< ? php endif ; ?>
2008-10-24 14:25:46 -04:00
< select name = " comment_type " >
< option value = " all " >< ? php _e ( 'Show all comment types' ); ?> </option>
< ? php
$comment_types = apply_filters ( 'admin_comment_types_dropdown' , array (
'comment' => __ ( 'Comments' ),
'pings' => __ ( 'Pings' ),
) );
foreach ( $comment_types as $type => $label ) {
2009-05-05 15:43:53 -04:00
echo " <option value=' " . esc_attr ( $type ) . " ' " ;
2008-10-24 14:25:46 -04:00
selected ( $comment_type , $type );
echo " > $label </option> \n " ;
}
?>
</ select >
2009-05-05 15:43:53 -04:00
< input type = " submit " id = " post-query-submit " value = " <?php esc_attr_e('Filter'); ?> " class = " button-secondary " />
2008-10-24 14:25:46 -04:00
2008-07-25 23:51:39 -04:00
< ? php if ( isset ( $_GET [ 'apage' ]) ) { ?>
2009-05-05 15:43:53 -04:00
< input type = " hidden " name = " apage " value = " <?php echo esc_attr( absint( $_GET['apage'] ) ); ?> " />
2008-09-08 17:49:26 -04:00
< ? php }
2009-07-30 09:39:34 -04:00
if ( ( 'spam' == $comment_status || 'trash' == $comment_status ) && current_user_can ( 'moderate_comments' ) ) {
2009-07-20 23:11:12 -04:00
wp_nonce_field ( 'bulk-destroy' , '_destroy_nonce' );
2009-08-19 04:35:24 -04:00
if ( 'spam' == $comment_status && current_user_can ( 'moderate_comments' ) ) { ?>
2009-07-30 09:39:34 -04:00
< input type = " submit " name = " delete_all " id = " delete_all " value = " <?php esc_attr_e('Empty Spam'); ?> " class = " button-secondary apply " />
2009-08-05 19:50:29 -04:00
< ? php } elseif ( 'trash' == $comment_status && current_user_can ( 'moderate_comments' ) ) { ?>
2009-07-30 09:39:34 -04:00
< input type = " submit " name = " delete_all " id = " delete_all " value = " <?php esc_attr_e('Empty Trash'); ?> " class = " button-secondary apply " />
2009-07-20 23:11:12 -04:00
< ? php }
2008-12-30 13:30:55 -05:00
} ?>
2008-09-09 19:14:37 -04:00
< ? php do_action ( 'manage_comments_nav' , $comment_status ); ?>
2007-03-27 17:20:16 -04:00
</ div >
2004-10-05 03:25:21 -04:00
2008-03-14 19:58:31 -04:00
< br class = " clear " />
2008-02-23 03:01:51 -05:00
</ div >
2005-08-30 22:39:17 -04:00
2008-10-02 20:13:12 -04:00
< div class = " clear " ></ div >
2010-05-08 06:10:41 -04:00
< ? php if ( $comments ) { ?>
2008-09-29 05:26:21 -04:00
2008-11-17 13:01:00 -05:00
< table class = " widefat comments fixed " cellspacing = " 0 " >
2008-10-30 11:50:21 -04:00
< thead >
< tr >
2008-11-17 14:16:26 -05:00
< ? php print_column_headers ( 'edit-comments' ); ?>
2008-10-30 11:50:21 -04:00
</ tr >
</ thead >
< tfoot >
< tr >
2008-11-17 14:16:26 -05:00
< ? php print_column_headers ( 'edit-comments' , false ); ?>
2008-10-30 11:50:21 -04:00
</ tr >
</ tfoot >
< tbody id = " the-comment-list " class = " list:comment " >
2008-02-23 03:01:51 -05:00
< ? php
2008-02-28 01:50:25 -05:00
foreach ( $comments as $comment )
2008-02-28 17:12:04 -05:00
_wp_comment_row ( $comment -> comment_ID , $mode , $comment_status );
2004-02-17 03:35:04 -05:00
?>
2008-10-30 11:50:21 -04:00
</ tbody >
< tbody id = " the-extra-comment-list " class = " list:comment " style = " display: none; " >
2008-02-28 01:50:25 -05:00
< ? php
foreach ( $extra_comments as $comment )
2008-02-28 17:12:04 -05:00
_wp_comment_row ( $comment -> comment_ID , $mode , $comment_status );
2008-02-28 01:50:25 -05:00
?>
2008-10-30 11:50:21 -04:00
</ tbody >
</ table >
2008-02-23 03:01:51 -05:00
2008-09-29 05:26:21 -04:00
< div class = " tablenav " >
< ? php
if ( $page_links )
2008-11-06 16:56:29 -05:00
echo " <div class='tablenav-pages'> $page_links_text </div> " ;
2008-09-29 05:26:21 -04:00
?>
2008-10-24 14:25:46 -04:00
< div class = " alignleft actions " >
2008-09-29 05:26:21 -04:00
< select name = " action2 " >
2008-12-09 21:27:08 -05:00
< option value = " -1 " selected = " selected " >< ? php _e ( 'Bulk Actions' ) ?> </option>
2009-04-21 17:12:01 -04:00
< ? php if ( 'all' == $comment_status || 'approved' == $comment_status ) : ?>
2008-09-29 05:26:21 -04:00
< option value = " unapprove " >< ? php _e ( 'Unapprove' ); ?> </option>
< ? php endif ; ?>
2009-07-24 03:23:11 -04:00
< ? php if ( 'all' == $comment_status || 'moderated' == $comment_status || 'spam' == $comment_status ) : ?>
2008-09-29 05:26:21 -04:00
< option value = " approve " >< ? php _e ( 'Approve' ); ?> </option>
< ? php endif ; ?>
2009-07-24 03:23:11 -04:00
< ? php if ( 'all' == $comment_status || 'approved' == $comment_status || 'moderated' == $comment_status ) : ?>
2010-05-14 17:46:25 -04:00
< option value = " spam " >< ? php _ex ( 'Mark as Spam' , 'comment' ); ?> </option>
2008-09-29 05:26:21 -04:00
< ? php endif ; ?>
2009-07-30 09:39:34 -04:00
< ? php if ( 'trash' == $comment_status ) : ?>
< option value = " untrash " >< ? php _e ( 'Restore' ); ?> </option>
2009-07-24 03:23:11 -04:00
< ? php endif ; ?>
2009-11-10 05:38:19 -05:00
< ? php if ( 'trash' == $comment_status || 'spam' == $comment_status || ! EMPTY_TRASH_DAYS ) : ?>
2009-07-30 09:39:34 -04:00
< option value = " delete " >< ? php _e ( 'Delete Permanently' ); ?> </option>
2009-11-27 05:34:09 -05:00
< ? php elseif ( 'spam' == $comment_status ) : ?>
2010-05-14 17:46:25 -04:00
< option value = " unspam " >< ? php _ex ( 'Not Spam' , 'comment' ); ?> </option>
2009-07-20 23:11:12 -04:00
< ? php else : ?>
2009-07-30 09:39:34 -04:00
< option value = " trash " >< ? php _e ( 'Move to Trash' ); ?> </option>
2009-07-20 23:11:12 -04:00
< ? php endif ; ?>
2008-09-29 05:26:21 -04:00
</ select >
2009-05-05 15:43:53 -04:00
< input type = " submit " name = " doaction2 " id = " doaction2 " value = " <?php esc_attr_e('Apply'); ?> " class = " button-secondary apply " />
2008-09-29 05:26:21 -04:00
2009-08-19 04:35:24 -04:00
< ? php if ( 'spam' == $comment_status && current_user_can ( 'moderate_comments' ) ) { ?>
2009-07-30 09:39:34 -04:00
< input type = " submit " name = " delete_all2 " id = " delete_all2 " value = " <?php esc_attr_e('Empty Spam'); ?> " class = " button-secondary apply " />
2009-08-05 19:50:29 -04:00
< ? php } elseif ( 'trash' == $comment_status && current_user_can ( 'moderate_comments' ) ) { ?>
2009-07-30 09:39:34 -04:00
< input type = " submit " name = " delete_all2 " id = " delete_all2 " value = " <?php esc_attr_e('Empty Trash'); ?> " class = " button-secondary apply " />
2008-09-29 05:26:21 -04:00
< ? php } ?>
< ? php do_action ( 'manage_comments_nav' , $comment_status ); ?>
</ div >
< br class = " clear " />
</ div >
2008-02-28 01:50:25 -05:00
</ form >
< form id = " get-extra-comments " method = " post " action = " " class = " add:the-extra-comment-list: " style = " display: none; " >
2009-05-05 15:43:53 -04:00
< input type = " hidden " name = " s " value = " <?php echo esc_attr( $search ); ?> " />
< input type = " hidden " name = " mode " value = " <?php echo esc_attr( $mode ); ?> " />
< input type = " hidden " name = " comment_status " value = " <?php echo esc_attr( $comment_status ); ?> " />
2009-06-27 18:40:06 -04:00
< input type = " hidden " name = " page " value = " <?php echo esc_attr( $page ); ?> " />
< input type = " hidden " name = " per_page " value = " <?php echo esc_attr( $comments_per_page ); ?> " />
2009-05-05 15:43:53 -04:00
< input type = " hidden " name = " p " value = " <?php echo esc_attr( $post_id ); ?> " />
< input type = " hidden " name = " comment_type " value = " <?php echo esc_attr( $comment_type ); ?> " />
2008-02-28 01:50:25 -05:00
< ? php wp_nonce_field ( 'add-comment' , '_ajax_nonce' , false ); ?>
</ form >
2006-03-28 20:51:55 -05:00
< div id = " ajax-response " ></ div >
2003-10-27 02:09:25 -05:00
2009-04-21 17:12:01 -04:00
< ? php } elseif ( 'moderated' == $comment_status ) { ?>
2008-11-19 19:16:41 -05:00
< p >< ? php _e ( 'No comments awaiting moderation… yet.' ) ?> </p>
2010-05-06 22:38:12 -04:00
</ div >
2008-11-19 19:16:41 -05:00
</ form >
< ? php } else { ?>
2010-02-13 03:49:27 -05:00
< p >< ? php _e ( 'No comments found.' ) ?> </p>
2010-05-06 22:38:12 -04:00
</ div >
2008-11-19 19:16:41 -05:00
</ form >
< ? php } ?>
2008-02-28 01:50:25 -05:00
</ div >
2008-08-24 02:56:22 -04:00
< ? php
2008-10-30 11:50:21 -04:00
wp_comment_reply ( '-1' , true , 'detail' );
2009-10-08 04:24:59 -04:00
wp_comment_trashnotice ();
2010-04-18 02:14:45 -04:00
include ( './admin-footer.php' ); ?>