wp/wp-admin/edit-comments.php
author ymh <ymh.work@gmail.com>
Tue, 09 Jun 2015 03:35:32 +0200
changeset 5 5e2f62d02dcd
parent 0 d970ebf37754
child 7 cf61fcea0001
permissions -rw-r--r--
upgrade wordpress + plugins
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
     1
<?php
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
     2
/**
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
     3
 * Edit Comments Administration Screen.
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
     4
 *
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
     5
 * @package WordPress
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
     6
 * @subpackage Administration
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
     7
 */
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
     8
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
     9
/** WordPress Administration Bootstrap */
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    10
require_once( dirname( __FILE__ ) . '/admin.php' );
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    11
if ( !current_user_can('edit_posts') )
5
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
    12
	wp_die( __( 'Cheatin&#8217; uh?' ), 403 );
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    13
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    14
$wp_list_table = _get_list_table('WP_Comments_List_Table');
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    15
$pagenum = $wp_list_table->get_pagenum();
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    16
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    17
$doaction = $wp_list_table->current_action();
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    18
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    19
if ( $doaction ) {
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    20
	check_admin_referer( 'bulk-comments' );
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    21
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    22
	if ( 'delete_all' == $doaction && !empty( $_REQUEST['pagegen_timestamp'] ) ) {
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    23
		$comment_status = wp_unslash( $_REQUEST['comment_status'] );
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    24
		$delete_time = wp_unslash( $_REQUEST['pagegen_timestamp'] );
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    25
		$comment_ids = $wpdb->get_col( $wpdb->prepare( "SELECT comment_ID FROM $wpdb->comments WHERE comment_approved = %s AND %s > comment_date_gmt", $comment_status, $delete_time ) );
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    26
		$doaction = 'delete';
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    27
	} elseif ( isset( $_REQUEST['delete_comments'] ) ) {
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    28
		$comment_ids = $_REQUEST['delete_comments'];
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    29
		$doaction = ( $_REQUEST['action'] != -1 ) ? $_REQUEST['action'] : $_REQUEST['action2'];
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    30
	} elseif ( isset( $_REQUEST['ids'] ) ) {
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    31
		$comment_ids = array_map( 'absint', explode( ',', $_REQUEST['ids'] ) );
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    32
	} elseif ( wp_get_referer() ) {
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    33
		wp_safe_redirect( wp_get_referer() );
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    34
		exit;
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    35
	}
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    36
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    37
	$approved = $unapproved = $spammed = $unspammed = $trashed = $untrashed = $deleted = 0;
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    38
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    39
	$redirect_to = remove_query_arg( array( 'trashed', 'untrashed', 'deleted', 'spammed', 'unspammed', 'approved', 'unapproved', 'ids' ), wp_get_referer() );
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    40
	$redirect_to = add_query_arg( 'paged', $pagenum, $redirect_to );
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    41
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    42
	foreach ( $comment_ids as $comment_id ) { // Check the permissions on each
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    43
		if ( !current_user_can( 'edit_comment', $comment_id ) )
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    44
			continue;
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    45
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    46
		switch ( $doaction ) {
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    47
			case 'approve' :
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    48
				wp_set_comment_status( $comment_id, 'approve' );
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    49
				$approved++;
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    50
				break;
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    51
			case 'unapprove' :
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    52
				wp_set_comment_status( $comment_id, 'hold' );
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    53
				$unapproved++;
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    54
				break;
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    55
			case 'spam' :
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    56
				wp_spam_comment( $comment_id );
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    57
				$spammed++;
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    58
				break;
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    59
			case 'unspam' :
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    60
				wp_unspam_comment( $comment_id );
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    61
				$unspammed++;
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    62
				break;
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    63
			case 'trash' :
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    64
				wp_trash_comment( $comment_id );
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    65
				$trashed++;
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    66
				break;
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    67
			case 'untrash' :
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    68
				wp_untrash_comment( $comment_id );
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    69
				$untrashed++;
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    70
				break;
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    71
			case 'delete' :
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    72
				wp_delete_comment( $comment_id );
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    73
				$deleted++;
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    74
				break;
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    75
		}
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    76
	}
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    77
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    78
	if ( $approved )
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    79
		$redirect_to = add_query_arg( 'approved', $approved, $redirect_to );
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    80
	if ( $unapproved )
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    81
		$redirect_to = add_query_arg( 'unapproved', $unapproved, $redirect_to );
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    82
	if ( $spammed )
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    83
		$redirect_to = add_query_arg( 'spammed', $spammed, $redirect_to );
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    84
	if ( $unspammed )
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    85
		$redirect_to = add_query_arg( 'unspammed', $unspammed, $redirect_to );
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    86
	if ( $trashed )
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    87
		$redirect_to = add_query_arg( 'trashed', $trashed, $redirect_to );
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    88
	if ( $untrashed )
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    89
		$redirect_to = add_query_arg( 'untrashed', $untrashed, $redirect_to );
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    90
	if ( $deleted )
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    91
		$redirect_to = add_query_arg( 'deleted', $deleted, $redirect_to );
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    92
	if ( $trashed || $spammed )
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    93
		$redirect_to = add_query_arg( 'ids', join( ',', $comment_ids ), $redirect_to );
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    94
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    95
	wp_safe_redirect( $redirect_to );
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    96
	exit;
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    97
} elseif ( ! empty( $_GET['_wp_http_referer'] ) ) {
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    98
	 wp_redirect( remove_query_arg( array( '_wp_http_referer', '_wpnonce' ), wp_unslash( $_SERVER['REQUEST_URI'] ) ) );
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    99
	 exit;
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   100
}
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   101
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   102
$wp_list_table->prepare_items();
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   103
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   104
wp_enqueue_script('admin-comments');
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   105
enqueue_comment_hotkeys_js();
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   106
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   107
if ( $post_id )
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   108
	$title = sprintf( __( 'Comments on &#8220;%s&#8221;' ), wp_html_excerpt( _draft_or_post_title( $post_id ), 50, '&hellip;' ) );
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   109
else
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   110
	$title = __('Comments');
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   111
5
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   112
add_screen_option( 'per_page' );
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   113
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   114
get_current_screen()->add_help_tab( array(
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   115
'id'		=> 'overview',
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   116
'title'		=> __('Overview'),
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   117
'content'	=>
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   118
	'<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>'
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   119
) );
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   120
get_current_screen()->add_help_tab( array(
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   121
'id'		=> 'moderating-comments',
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   122
'title'		=> __('Moderating Comments'),
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   123
'content'	=>
5
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   124
		'<p>' . __( 'A red bar on the left means the comment is waiting for you to moderate it.' ) . '</p>' .
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   125
		'<p>' . __( 'In the <strong>Author</strong> 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>' .
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   126
		'<p>' . __( 'In the <strong>Comment</strong> 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. Hovering over any comment gives you options to approve, reply (and approve), quick edit, edit, spam mark, or trash that comment.' ) . '</p>' .
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   127
		'<p>' . __( 'In the <strong>In Response To</strong> 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 View Post link leads to that post on your live site. The small bubble with the number in it shows the number of approved 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>' .
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   128
		'<p>' . __( 'Many people take advantage of keyboard shortcuts to moderate their comments more quickly. Use the link to the side to learn more.' ) . '</p>'
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   129
) );
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   130
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   131
get_current_screen()->set_help_sidebar(
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   132
	'<p><strong>' . __( 'For more information:' ) . '</strong></p>' .
5
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   133
	'<p>' . __( '<a href="https://codex.wordpress.org/Administration_Screens#Comments" target="_blank">Documentation on Comments</a>' ) . '</p>' .
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   134
	'<p>' . __( '<a href="https://codex.wordpress.org/Comment_Spam" target="_blank">Documentation on Comment Spam</a>' ) . '</p>' .
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   135
	'<p>' . __( '<a href="https://codex.wordpress.org/Keyboard_Shortcuts" target="_blank">Documentation on Keyboard Shortcuts</a>' ) . '</p>' .
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   136
	'<p>' . __( '<a href="https://wordpress.org/support/" target="_blank">Support Forums</a>' ) . '</p>'
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   137
);
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   138
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   139
require_once( ABSPATH . 'wp-admin/admin-header.php' );
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   140
?>
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   141
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   142
<div class="wrap">
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   143
<h2><?php
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   144
if ( $post_id )
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   145
	echo sprintf( __( 'Comments on &#8220;%s&#8221;' ),
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   146
		sprintf( '<a href="%s">%s</a>',
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   147
			get_edit_post_link( $post_id ),
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   148
			wp_html_excerpt( _draft_or_post_title( $post_id ), 50, '&hellip;' )
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   149
		)
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   150
	);
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   151
else
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   152
	echo __('Comments');
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   153
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   154
if ( isset($_REQUEST['s']) && $_REQUEST['s'] )
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   155
	echo '<span class="subtitle">' . sprintf( __( 'Search results for &#8220;%s&#8221;' ), wp_html_excerpt( esc_html( wp_unslash( $_REQUEST['s'] ) ), 50, '&hellip;' ) ) . '</span>'; ?>
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   156
</h2>
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   157
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   158
<?php
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   159
if ( isset( $_REQUEST['error'] ) ) {
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   160
	$error = (int) $_REQUEST['error'];
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   161
	$error_msg = '';
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   162
	switch ( $error ) {
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   163
		case 1 :
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   164
			$error_msg = __( 'Oops, no comment with this ID.' );
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   165
			break;
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   166
		case 2 :
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   167
			$error_msg = __( 'You are not allowed to edit comments on this post.' );
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   168
			break;
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   169
	}
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   170
	if ( $error_msg )
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   171
		echo '<div id="moderated" class="error"><p>' . $error_msg . '</p></div>';
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   172
}
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   173
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   174
if ( isset($_REQUEST['approved']) || isset($_REQUEST['deleted']) || isset($_REQUEST['trashed']) || isset($_REQUEST['untrashed']) || isset($_REQUEST['spammed']) || isset($_REQUEST['unspammed']) || isset($_REQUEST['same']) ) {
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   175
	$approved  = isset( $_REQUEST['approved']  ) ? (int) $_REQUEST['approved']  : 0;
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   176
	$deleted   = isset( $_REQUEST['deleted']   ) ? (int) $_REQUEST['deleted']   : 0;
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   177
	$trashed   = isset( $_REQUEST['trashed']   ) ? (int) $_REQUEST['trashed']   : 0;
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   178
	$untrashed = isset( $_REQUEST['untrashed'] ) ? (int) $_REQUEST['untrashed'] : 0;
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   179
	$spammed   = isset( $_REQUEST['spammed']   ) ? (int) $_REQUEST['spammed']   : 0;
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   180
	$unspammed = isset( $_REQUEST['unspammed'] ) ? (int) $_REQUEST['unspammed'] : 0;
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   181
	$same      = isset( $_REQUEST['same'] )      ? (int) $_REQUEST['same']      : 0;
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   182
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   183
	if ( $approved > 0 || $deleted > 0 || $trashed > 0 || $untrashed > 0 || $spammed > 0 || $unspammed > 0 || $same > 0 ) {
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   184
		if ( $approved > 0 )
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   185
			$messages[] = sprintf( _n( '%s comment approved', '%s comments approved', $approved ), $approved );
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   186
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   187
		if ( $spammed > 0 ) {
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   188
			$ids = isset($_REQUEST['ids']) ? $_REQUEST['ids'] : 0;
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   189
			$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 />';
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   190
		}
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   191
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   192
		if ( $unspammed > 0 )
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   193
			$messages[] = sprintf( _n( '%s comment restored from the spam', '%s comments restored from the spam', $unspammed ), $unspammed );
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   194
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   195
		if ( $trashed > 0 ) {
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   196
			$ids = isset($_REQUEST['ids']) ? $_REQUEST['ids'] : 0;
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   197
			$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 />';
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   198
		}
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   199
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   200
		if ( $untrashed > 0 )
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   201
			$messages[] = sprintf( _n( '%s comment restored from the Trash', '%s comments restored from the Trash', $untrashed ), $untrashed );
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   202
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   203
		if ( $deleted > 0 )
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   204
			$messages[] = sprintf( _n( '%s comment permanently deleted', '%s comments permanently deleted', $deleted ), $deleted );
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   205
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   206
		if ( $same > 0 && $comment = get_comment( $same ) ) {
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   207
			switch ( $comment->comment_approved ) {
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   208
				case '1' :
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   209
					$messages[] = __('This comment is already approved.') . ' <a href="' . esc_url( admin_url( "comment.php?action=editcomment&c=$same" ) ) . '">' . __( 'Edit comment' ) . '</a>';
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   210
					break;
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   211
				case 'trash' :
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   212
					$messages[] = __( 'This comment is already in the Trash.' ) . ' <a href="' . esc_url( admin_url( 'edit-comments.php?comment_status=trash' ) ) . '"> ' . __( 'View Trash' ) . '</a>';
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   213
					break;
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   214
				case 'spam' :
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   215
					$messages[] = __( 'This comment is already marked as spam.' ) . ' <a href="' . esc_url( admin_url( "comment.php?action=editcomment&c=$same" ) ) . '">' . __( 'Edit comment' ) . '</a>';
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   216
					break;
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   217
			}
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   218
		}
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   219
5
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   220
		echo '<div id="moderated" class="updated notice is-dismissible"><p>' . implode( "<br/>\n", $messages ) . '</p></div>';
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   221
	}
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   222
}
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   223
?>
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   224
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   225
<?php $wp_list_table->views(); ?>
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   226
5
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
   227
<form id="comments-form" method="get">
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   228
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   229
<?php $wp_list_table->search_box( __( 'Search Comments' ), 'comment' ); ?>
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   230
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   231
<?php if ( $post_id ) : ?>
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   232
<input type="hidden" name="p" value="<?php echo esc_attr( intval( $post_id ) ); ?>" />
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   233
<?php endif; ?>
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   234
<input type="hidden" name="comment_status" value="<?php echo esc_attr($comment_status); ?>" />
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   235
<input type="hidden" name="pagegen_timestamp" value="<?php echo esc_attr(current_time('mysql', 1)); ?>" />
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   236
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   237
<input type="hidden" name="_total" value="<?php echo esc_attr( $wp_list_table->get_pagination_arg('total_items') ); ?>" />
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   238
<input type="hidden" name="_per_page" value="<?php echo esc_attr( $wp_list_table->get_pagination_arg('per_page') ); ?>" />
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   239
<input type="hidden" name="_page" value="<?php echo esc_attr( $wp_list_table->get_pagination_arg('page') ); ?>" />
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   240
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   241
<?php if ( isset($_REQUEST['paged']) ) { ?>
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   242
	<input type="hidden" name="paged" value="<?php echo esc_attr( absint( $_REQUEST['paged'] ) ); ?>" />
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   243
<?php } ?>
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   244
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   245
<?php $wp_list_table->display(); ?>
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   246
</form>
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   247
</div>
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   248
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   249
<div id="ajax-response"></div>
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   250
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   251
<?php
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   252
wp_comment_reply('-1', true, 'detail');
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   253
wp_comment_trashnotice();
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   254
include( ABSPATH . 'wp-admin/admin-footer.php' ); ?>