wp/wp-admin/edit-comments.php
changeset 9 177826044cd9
parent 7 cf61fcea0001
child 16 a86126ab1dd4
equal deleted inserted replaced
8:c7c34916027a 9:177826044cd9
    14 		'<p>' . __( 'Sorry, you are not allowed to edit comments.' ) . '</p>',
    14 		'<p>' . __( 'Sorry, you are not allowed to edit comments.' ) . '</p>',
    15 		403
    15 		403
    16 	);
    16 	);
    17 }
    17 }
    18 
    18 
    19 $wp_list_table = _get_list_table('WP_Comments_List_Table');
    19 $wp_list_table = _get_list_table( 'WP_Comments_List_Table' );
    20 $pagenum = $wp_list_table->get_pagenum();
    20 $pagenum       = $wp_list_table->get_pagenum();
    21 
    21 
    22 $doaction = $wp_list_table->current_action();
    22 $doaction = $wp_list_table->current_action();
    23 
    23 
    24 if ( $doaction ) {
    24 if ( $doaction ) {
    25 	check_admin_referer( 'bulk-comments' );
    25 	check_admin_referer( 'bulk-comments' );
    26 
    26 
    27 	if ( 'delete_all' == $doaction && !empty( $_REQUEST['pagegen_timestamp'] ) ) {
    27 	if ( 'delete_all' == $doaction && ! empty( $_REQUEST['pagegen_timestamp'] ) ) {
    28 		$comment_status = wp_unslash( $_REQUEST['comment_status'] );
    28 		$comment_status = wp_unslash( $_REQUEST['comment_status'] );
    29 		$delete_time = wp_unslash( $_REQUEST['pagegen_timestamp'] );
    29 		$delete_time    = wp_unslash( $_REQUEST['pagegen_timestamp'] );
    30 		$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 ) );
    30 		$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 ) );
    31 		$doaction = 'delete';
    31 		$doaction       = 'delete';
    32 	} elseif ( isset( $_REQUEST['delete_comments'] ) ) {
    32 	} elseif ( isset( $_REQUEST['delete_comments'] ) ) {
    33 		$comment_ids = $_REQUEST['delete_comments'];
    33 		$comment_ids = $_REQUEST['delete_comments'];
    34 		$doaction = ( $_REQUEST['action'] != -1 ) ? $_REQUEST['action'] : $_REQUEST['action2'];
    34 		$doaction    = ( $_REQUEST['action'] != -1 ) ? $_REQUEST['action'] : $_REQUEST['action2'];
    35 	} elseif ( isset( $_REQUEST['ids'] ) ) {
    35 	} elseif ( isset( $_REQUEST['ids'] ) ) {
    36 		$comment_ids = array_map( 'absint', explode( ',', $_REQUEST['ids'] ) );
    36 		$comment_ids = array_map( 'absint', explode( ',', $_REQUEST['ids'] ) );
    37 	} elseif ( wp_get_referer() ) {
    37 	} elseif ( wp_get_referer() ) {
    38 		wp_safe_redirect( wp_get_referer() );
    38 		wp_safe_redirect( wp_get_referer() );
    39 		exit;
    39 		exit;
    45 	$redirect_to = add_query_arg( 'paged', $pagenum, $redirect_to );
    45 	$redirect_to = add_query_arg( 'paged', $pagenum, $redirect_to );
    46 
    46 
    47 	wp_defer_comment_counting( true );
    47 	wp_defer_comment_counting( true );
    48 
    48 
    49 	foreach ( $comment_ids as $comment_id ) { // Check the permissions on each
    49 	foreach ( $comment_ids as $comment_id ) { // Check the permissions on each
    50 		if ( !current_user_can( 'edit_comment', $comment_id ) )
    50 		if ( ! current_user_can( 'edit_comment', $comment_id ) ) {
    51 			continue;
    51 			continue;
       
    52 		}
    52 
    53 
    53 		switch ( $doaction ) {
    54 		switch ( $doaction ) {
    54 			case 'approve' :
    55 			case 'approve':
    55 				wp_set_comment_status( $comment_id, 'approve' );
    56 				wp_set_comment_status( $comment_id, 'approve' );
    56 				$approved++;
    57 				$approved++;
    57 				break;
    58 				break;
    58 			case 'unapprove' :
    59 			case 'unapprove':
    59 				wp_set_comment_status( $comment_id, 'hold' );
    60 				wp_set_comment_status( $comment_id, 'hold' );
    60 				$unapproved++;
    61 				$unapproved++;
    61 				break;
    62 				break;
    62 			case 'spam' :
    63 			case 'spam':
    63 				wp_spam_comment( $comment_id );
    64 				wp_spam_comment( $comment_id );
    64 				$spammed++;
    65 				$spammed++;
    65 				break;
    66 				break;
    66 			case 'unspam' :
    67 			case 'unspam':
    67 				wp_unspam_comment( $comment_id );
    68 				wp_unspam_comment( $comment_id );
    68 				$unspammed++;
    69 				$unspammed++;
    69 				break;
    70 				break;
    70 			case 'trash' :
    71 			case 'trash':
    71 				wp_trash_comment( $comment_id );
    72 				wp_trash_comment( $comment_id );
    72 				$trashed++;
    73 				$trashed++;
    73 				break;
    74 				break;
    74 			case 'untrash' :
    75 			case 'untrash':
    75 				wp_untrash_comment( $comment_id );
    76 				wp_untrash_comment( $comment_id );
    76 				$untrashed++;
    77 				$untrashed++;
    77 				break;
    78 				break;
    78 			case 'delete' :
    79 			case 'delete':
    79 				wp_delete_comment( $comment_id );
    80 				wp_delete_comment( $comment_id );
    80 				$deleted++;
    81 				$deleted++;
    81 				break;
    82 				break;
    82 		}
    83 		}
    83 	}
    84 	}
   102 		$redirect_to = apply_filters( "handle_bulk_actions-{$screen}", $redirect_to, $doaction, $comment_ids );
   103 		$redirect_to = apply_filters( "handle_bulk_actions-{$screen}", $redirect_to, $doaction, $comment_ids );
   103 	}
   104 	}
   104 
   105 
   105 	wp_defer_comment_counting( false );
   106 	wp_defer_comment_counting( false );
   106 
   107 
   107 	if ( $approved )
   108 	if ( $approved ) {
   108 		$redirect_to = add_query_arg( 'approved', $approved, $redirect_to );
   109 		$redirect_to = add_query_arg( 'approved', $approved, $redirect_to );
   109 	if ( $unapproved )
   110 	}
       
   111 	if ( $unapproved ) {
   110 		$redirect_to = add_query_arg( 'unapproved', $unapproved, $redirect_to );
   112 		$redirect_to = add_query_arg( 'unapproved', $unapproved, $redirect_to );
   111 	if ( $spammed )
   113 	}
       
   114 	if ( $spammed ) {
   112 		$redirect_to = add_query_arg( 'spammed', $spammed, $redirect_to );
   115 		$redirect_to = add_query_arg( 'spammed', $spammed, $redirect_to );
   113 	if ( $unspammed )
   116 	}
       
   117 	if ( $unspammed ) {
   114 		$redirect_to = add_query_arg( 'unspammed', $unspammed, $redirect_to );
   118 		$redirect_to = add_query_arg( 'unspammed', $unspammed, $redirect_to );
   115 	if ( $trashed )
   119 	}
       
   120 	if ( $trashed ) {
   116 		$redirect_to = add_query_arg( 'trashed', $trashed, $redirect_to );
   121 		$redirect_to = add_query_arg( 'trashed', $trashed, $redirect_to );
   117 	if ( $untrashed )
   122 	}
       
   123 	if ( $untrashed ) {
   118 		$redirect_to = add_query_arg( 'untrashed', $untrashed, $redirect_to );
   124 		$redirect_to = add_query_arg( 'untrashed', $untrashed, $redirect_to );
   119 	if ( $deleted )
   125 	}
       
   126 	if ( $deleted ) {
   120 		$redirect_to = add_query_arg( 'deleted', $deleted, $redirect_to );
   127 		$redirect_to = add_query_arg( 'deleted', $deleted, $redirect_to );
   121 	if ( $trashed || $spammed )
   128 	}
       
   129 	if ( $trashed || $spammed ) {
   122 		$redirect_to = add_query_arg( 'ids', join( ',', $comment_ids ), $redirect_to );
   130 		$redirect_to = add_query_arg( 'ids', join( ',', $comment_ids ), $redirect_to );
       
   131 	}
   123 
   132 
   124 	wp_safe_redirect( $redirect_to );
   133 	wp_safe_redirect( $redirect_to );
   125 	exit;
   134 	exit;
   126 } elseif ( ! empty( $_GET['_wp_http_referer'] ) ) {
   135 } elseif ( ! empty( $_GET['_wp_http_referer'] ) ) {
   127 	 wp_redirect( remove_query_arg( array( '_wp_http_referer', '_wpnonce' ), wp_unslash( $_SERVER['REQUEST_URI'] ) ) );
   136 	wp_redirect( remove_query_arg( array( '_wp_http_referer', '_wpnonce' ), wp_unslash( $_SERVER['REQUEST_URI'] ) ) );
   128 	 exit;
   137 	exit;
   129 }
   138 }
   130 
   139 
   131 $wp_list_table->prepare_items();
   140 $wp_list_table->prepare_items();
   132 
   141 
   133 wp_enqueue_script('admin-comments');
   142 wp_enqueue_script( 'admin-comments' );
   134 enqueue_comment_hotkeys_js();
   143 enqueue_comment_hotkeys_js();
   135 
   144 
   136 if ( $post_id ) {
   145 if ( $post_id ) {
   137 	$comments_count = wp_count_comments( $post_id );
   146 	$comments_count      = wp_count_comments( $post_id );
   138 	$draft_or_post_title = wp_html_excerpt( _draft_or_post_title( $post_id ), 50, '&hellip;' );
   147 	$draft_or_post_title = wp_html_excerpt( _draft_or_post_title( $post_id ), 50, '&hellip;' );
   139 	if ( $comments_count->moderated > 0 ) {
   148 	if ( $comments_count->moderated > 0 ) {
   140 		/* translators: 1: comments count 2: post title */
   149 		/* translators: 1: comments count, 2: post title */
   141 		$title = sprintf( __( 'Comments (%1$s) on &#8220;%2$s&#8221;' ),
   150 		$title = sprintf(
       
   151 			__( 'Comments (%1$s) on &#8220;%2$s&#8221;' ),
   142 			number_format_i18n( $comments_count->moderated ),
   152 			number_format_i18n( $comments_count->moderated ),
   143 			$draft_or_post_title
   153 			$draft_or_post_title
   144 		);
   154 		);
   145 	} else {
   155 	} else {
   146 		/* translators: %s: post title */
   156 		/* translators: %s: post title */
   147 		$title = sprintf( __( 'Comments on &#8220;%s&#8221;' ),
   157 		$title = sprintf(
       
   158 			__( 'Comments on &#8220;%s&#8221;' ),
   148 			$draft_or_post_title
   159 			$draft_or_post_title
   149 		);
   160 		);
   150 	}
   161 	}
   151 } else {
   162 } else {
   152 	$comments_count = wp_count_comments();
   163 	$comments_count = wp_count_comments();
   153 	if ( $comments_count->moderated > 0 ) {
   164 	if ( $comments_count->moderated > 0 ) {
   154 		/* translators: %s: comments count */
   165 		/* translators: %s: comments count */
   155 		$title = sprintf( __( 'Comments (%s)' ),
   166 		$title = sprintf(
       
   167 			__( 'Comments (%s)' ),
   156 			number_format_i18n( $comments_count->moderated )
   168 			number_format_i18n( $comments_count->moderated )
   157 		);
   169 		);
   158 	} else {
   170 	} else {
   159 		$title = __( 'Comments' );
   171 		$title = __( 'Comments' );
   160 	}
   172 	}
   161 }
   173 }
   162 
   174 
   163 add_screen_option( 'per_page' );
   175 add_screen_option( 'per_page' );
   164 
   176 
   165 get_current_screen()->add_help_tab( array(
   177 get_current_screen()->add_help_tab(
   166 'id'		=> 'overview',
   178 	array(
   167 'title'		=> __('Overview'),
   179 		'id'      => 'overview',
   168 'content'	=>
   180 		'title'   => __( 'Overview' ),
   169 	'<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>'
   181 		'content' =>
   170 ) );
   182 				 '<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>',
   171 get_current_screen()->add_help_tab( array(
   183 	)
   172 'id'		=> 'moderating-comments',
   184 );
   173 'title'		=> __('Moderating Comments'),
   185 get_current_screen()->add_help_tab(
   174 'content'	=>
   186 	array(
   175 		'<p>' . __( 'A red bar on the left means the comment is waiting for you to moderate it.' ) . '</p>' .
   187 		'id'      => 'moderating-comments',
   176 		'<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>' .
   188 		'title'   => __( 'Moderating Comments' ),
   177 		'<p>' . __( 'In the <strong>Comment</strong> column, hovering over any comment gives you options to approve, reply (and approve), quick edit, edit, spam mark, or trash that comment.' ) . '</p>' .
   189 		'content' =>
   178 		'<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 there are pending comments, a red notification circle with the number of pending comments is displayed. Clicking the notification circle will filter the comments screen to show only pending comments on that post.' ) . '</p>' .
   190 					 '<p>' . __( 'A red bar on the left means the comment is waiting for you to moderate it.' ) . '</p>' .
   179 		'<p>' . __( 'In the <strong>Submitted On</strong> column, the date and time the comment was left on your site appears. Clicking on the date/time link will take you to that comment on your live site.' ) . '</p>' .
   191 					 '<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>' .
   180 		'<p>' . __( 'Many people take advantage of keyboard shortcuts to moderate their comments more quickly. Use the link to the side to learn more.' ) . '</p>'
   192 					 '<p>' . __( 'In the <strong>Comment</strong> column, hovering over any comment gives you options to approve, reply (and approve), quick edit, edit, spam mark, or trash that comment.' ) . '</p>' .
   181 ) );
   193 					 '<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 there are pending comments, a red notification circle with the number of pending comments is displayed. Clicking the notification circle will filter the comments screen to show only pending comments on that post.' ) . '</p>' .
       
   194 					 '<p>' . __( 'In the <strong>Submitted On</strong> column, the date and time the comment was left on your site appears. Clicking on the date/time link will take you to that comment on your live site.' ) . '</p>' .
       
   195 					 '<p>' . __( 'Many people take advantage of keyboard shortcuts to moderate their comments more quickly. Use the link to the side to learn more.' ) . '</p>',
       
   196 	)
       
   197 );
   182 
   198 
   183 get_current_screen()->set_help_sidebar(
   199 get_current_screen()->set_help_sidebar(
   184 	'<p><strong>' . __( 'For more information:' ) . '</strong></p>' .
   200 	'<p><strong>' . __( 'For more information:' ) . '</strong></p>' .
   185 	'<p>' . __( '<a href="https://codex.wordpress.org/Administration_Screens#Comments">Documentation on Comments</a>' ) . '</p>' .
   201 	'<p>' . __( '<a href="https://codex.wordpress.org/Administration_Screens#Comments">Documentation on Comments</a>' ) . '</p>' .
   186 	'<p>' . __( '<a href="https://codex.wordpress.org/Comment_Spam">Documentation on Comment Spam</a>' ) . '</p>' .
   202 	'<p>' . __( '<a href="https://codex.wordpress.org/Comment_Spam">Documentation on Comment Spam</a>' ) . '</p>' .
   187 	'<p>' . __( '<a href="https://codex.wordpress.org/Keyboard_Shortcuts">Documentation on Keyboard Shortcuts</a>' ) . '</p>' .
   203 	'<p>' . __( '<a href="https://codex.wordpress.org/Keyboard_Shortcuts">Documentation on Keyboard Shortcuts</a>' ) . '</p>' .
   188 	'<p>' . __( '<a href="https://wordpress.org/support/">Support Forums</a>' ) . '</p>'
   204 	'<p>' . __( '<a href="https://wordpress.org/support/">Support</a>' ) . '</p>'
   189 );
   205 );
   190 
   206 
   191 get_current_screen()->set_screen_reader_content( array(
   207 get_current_screen()->set_screen_reader_content(
   192 	'heading_views'      => __( 'Filter comments list' ),
   208 	array(
   193 	'heading_pagination' => __( 'Comments list navigation' ),
   209 		'heading_views'      => __( 'Filter comments list' ),
   194 	'heading_list'       => __( 'Comments list' ),
   210 		'heading_pagination' => __( 'Comments list navigation' ),
   195 ) );
   211 		'heading_list'       => __( 'Comments list' ),
       
   212 	)
       
   213 );
   196 
   214 
   197 require_once( ABSPATH . 'wp-admin/admin-header.php' );
   215 require_once( ABSPATH . 'wp-admin/admin-header.php' );
   198 ?>
   216 ?>
   199 
   217 
   200 <div class="wrap">
   218 <div class="wrap">
   201 <h1 class="wp-heading-inline"><?php
   219 <h1 class="wp-heading-inline">
       
   220 <?php
   202 if ( $post_id ) {
   221 if ( $post_id ) {
   203 	/* translators: %s: link to post */
   222 	/* translators: %s: link to post */
   204 	printf( __( 'Comments on &#8220;%s&#8221;' ),
   223 	printf(
   205 		sprintf( '<a href="%1$s">%2$s</a>',
   224 		__( 'Comments on &#8220;%s&#8221;' ),
       
   225 		sprintf(
       
   226 			'<a href="%1$s">%2$s</a>',
   206 			get_edit_post_link( $post_id ),
   227 			get_edit_post_link( $post_id ),
   207 			wp_html_excerpt( _draft_or_post_title( $post_id ), 50, '&hellip;' )
   228 			wp_html_excerpt( _draft_or_post_title( $post_id ), 50, '&hellip;' )
   208 		)
   229 		)
   209 	);
   230 	);
   210 } else {
   231 } else {
   211 	_e( 'Comments' );
   232 	_e( 'Comments' );
   212 }
   233 }
   213 ?></h1>
   234 ?>
   214 
   235 </h1>
   215 <?php
   236 
   216 if ( isset($_REQUEST['s']) && strlen( $_REQUEST['s'] ) ) {
   237 <?php
       
   238 if ( isset( $_REQUEST['s'] ) && strlen( $_REQUEST['s'] ) ) {
   217 	echo '<span class="subtitle">';
   239 	echo '<span class="subtitle">';
   218 	/* translators: %s: search keywords */
   240 	/* translators: %s: search keywords */
   219 	printf( __( 'Search results for &#8220;%s&#8221;' ),
   241 	printf(
       
   242 		__( 'Search results for &#8220;%s&#8221;' ),
   220 		wp_html_excerpt( esc_html( wp_unslash( $_REQUEST['s'] ) ), 50, '&hellip;' )
   243 		wp_html_excerpt( esc_html( wp_unslash( $_REQUEST['s'] ) ), 50, '&hellip;' )
   221 	);
   244 	);
   222 	echo '</span>';
   245 	echo '</span>';
   223 }
   246 }
   224 ?>
   247 ?>
   225 
   248 
   226 <hr class="wp-header-end">
   249 <hr class="wp-header-end">
   227 
   250 
   228 <?php
   251 <?php
   229 if ( isset( $_REQUEST['error'] ) ) {
   252 if ( isset( $_REQUEST['error'] ) ) {
   230 	$error = (int) $_REQUEST['error'];
   253 	$error     = (int) $_REQUEST['error'];
   231 	$error_msg = '';
   254 	$error_msg = '';
   232 	switch ( $error ) {
   255 	switch ( $error ) {
   233 		case 1 :
   256 		case 1:
   234 			$error_msg = __( 'Invalid comment ID.' );
   257 			$error_msg = __( 'Invalid comment ID.' );
   235 			break;
   258 			break;
   236 		case 2 :
   259 		case 2:
   237 			$error_msg = __( 'Sorry, you are not allowed to edit comments on this post.' );
   260 			$error_msg = __( 'Sorry, you are not allowed to edit comments on this post.' );
   238 			break;
   261 			break;
   239 	}
   262 	}
   240 	if ( $error_msg )
   263 	if ( $error_msg ) {
   241 		echo '<div id="moderated" class="error"><p>' . $error_msg . '</p></div>';
   264 		echo '<div id="moderated" class="error"><p>' . $error_msg . '</p></div>';
   242 }
   265 	}
   243 
   266 }
   244 if ( isset($_REQUEST['approved']) || isset($_REQUEST['deleted']) || isset($_REQUEST['trashed']) || isset($_REQUEST['untrashed']) || isset($_REQUEST['spammed']) || isset($_REQUEST['unspammed']) || isset($_REQUEST['same']) ) {
   267 
   245 	$approved  = isset( $_REQUEST['approved']  ) ? (int) $_REQUEST['approved']  : 0;
   268 if ( isset( $_REQUEST['approved'] ) || isset( $_REQUEST['deleted'] ) || isset( $_REQUEST['trashed'] ) || isset( $_REQUEST['untrashed'] ) || isset( $_REQUEST['spammed'] ) || isset( $_REQUEST['unspammed'] ) || isset( $_REQUEST['same'] ) ) {
   246 	$deleted   = isset( $_REQUEST['deleted']   ) ? (int) $_REQUEST['deleted']   : 0;
   269 	$approved  = isset( $_REQUEST['approved'] ) ? (int) $_REQUEST['approved'] : 0;
   247 	$trashed   = isset( $_REQUEST['trashed']   ) ? (int) $_REQUEST['trashed']   : 0;
   270 	$deleted   = isset( $_REQUEST['deleted'] ) ? (int) $_REQUEST['deleted'] : 0;
       
   271 	$trashed   = isset( $_REQUEST['trashed'] ) ? (int) $_REQUEST['trashed'] : 0;
   248 	$untrashed = isset( $_REQUEST['untrashed'] ) ? (int) $_REQUEST['untrashed'] : 0;
   272 	$untrashed = isset( $_REQUEST['untrashed'] ) ? (int) $_REQUEST['untrashed'] : 0;
   249 	$spammed   = isset( $_REQUEST['spammed']   ) ? (int) $_REQUEST['spammed']   : 0;
   273 	$spammed   = isset( $_REQUEST['spammed'] ) ? (int) $_REQUEST['spammed'] : 0;
   250 	$unspammed = isset( $_REQUEST['unspammed'] ) ? (int) $_REQUEST['unspammed'] : 0;
   274 	$unspammed = isset( $_REQUEST['unspammed'] ) ? (int) $_REQUEST['unspammed'] : 0;
   251 	$same      = isset( $_REQUEST['same'] )      ? (int) $_REQUEST['same']      : 0;
   275 	$same      = isset( $_REQUEST['same'] ) ? (int) $_REQUEST['same'] : 0;
   252 
   276 
   253 	if ( $approved > 0 || $deleted > 0 || $trashed > 0 || $untrashed > 0 || $spammed > 0 || $unspammed > 0 || $same > 0 ) {
   277 	if ( $approved > 0 || $deleted > 0 || $trashed > 0 || $untrashed > 0 || $spammed > 0 || $unspammed > 0 || $same > 0 ) {
   254 		if ( $approved > 0 ) {
   278 		if ( $approved > 0 ) {
   255 			/* translators: %s: number of comments approved */
   279 			/* translators: %s: number of comments approved */
   256 			$messages[] = sprintf( _n( '%s comment approved', '%s comments approved', $approved ), $approved );
   280 			$messages[] = sprintf( _n( '%s comment approved', '%s comments approved', $approved ), $approved );
   257 		}
   281 		}
   258 
   282 
   259 		if ( $spammed > 0 ) {
   283 		if ( $spammed > 0 ) {
   260 			$ids = isset($_REQUEST['ids']) ? $_REQUEST['ids'] : 0;
   284 			$ids = isset( $_REQUEST['ids'] ) ? $_REQUEST['ids'] : 0;
   261 			/* translators: %s: number of comments marked as spam */
   285 			/* translators: %s: number of comments marked as spam */
   262 			$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 />';
   286 			$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 />';
   263 		}
   287 		}
   264 
   288 
   265 		if ( $unspammed > 0 ) {
   289 		if ( $unspammed > 0 ) {
   266 			/* translators: %s: number of comments restored from the spam */
   290 			/* translators: %s: number of comments restored from the spam */
   267 			$messages[] = sprintf( _n( '%s comment restored from the spam', '%s comments restored from the spam', $unspammed ), $unspammed );
   291 			$messages[] = sprintf( _n( '%s comment restored from the spam', '%s comments restored from the spam', $unspammed ), $unspammed );
   268 		}
   292 		}
   269 
   293 
   270 		if ( $trashed > 0 ) {
   294 		if ( $trashed > 0 ) {
   271 			$ids = isset($_REQUEST['ids']) ? $_REQUEST['ids'] : 0;
   295 			$ids = isset( $_REQUEST['ids'] ) ? $_REQUEST['ids'] : 0;
   272 			/* translators: %s: number of comments moved to the Trash */
   296 			/* translators: %s: number of comments moved to the Trash */
   273 			$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 />';
   297 			$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 />';
   274 		}
   298 		}
   275 
   299 
   276 		if ( $untrashed > 0 ) {
   300 		if ( $untrashed > 0 ) {
   277 			/* translators: %s: number of comments restored from the Trash */
   301 			/* translators: %s: number of comments restored from the Trash */
   278 			$messages[] = sprintf( _n( '%s comment restored from the Trash', '%s comments restored from the Trash', $untrashed ), $untrashed );
   302 			$messages[] = sprintf( _n( '%s comment restored from the Trash', '%s comments restored from the Trash', $untrashed ), $untrashed );
   283 			$messages[] = sprintf( _n( '%s comment permanently deleted', '%s comments permanently deleted', $deleted ), $deleted );
   307 			$messages[] = sprintf( _n( '%s comment permanently deleted', '%s comments permanently deleted', $deleted ), $deleted );
   284 		}
   308 		}
   285 
   309 
   286 		if ( $same > 0 && $comment = get_comment( $same ) ) {
   310 		if ( $same > 0 && $comment = get_comment( $same ) ) {
   287 			switch ( $comment->comment_approved ) {
   311 			switch ( $comment->comment_approved ) {
   288 				case '1' :
   312 				case '1':
   289 					$messages[] = __('This comment is already approved.') . ' <a href="' . esc_url( admin_url( "comment.php?action=editcomment&c=$same" ) ) . '">' . __( 'Edit comment' ) . '</a>';
   313 					$messages[] = __( 'This comment is already approved.' ) . ' <a href="' . esc_url( admin_url( "comment.php?action=editcomment&c=$same" ) ) . '">' . __( 'Edit comment' ) . '</a>';
   290 					break;
   314 					break;
   291 				case 'trash' :
   315 				case 'trash':
   292 					$messages[] = __( 'This comment is already in the Trash.' ) . ' <a href="' . esc_url( admin_url( 'edit-comments.php?comment_status=trash' ) ) . '"> ' . __( 'View Trash' ) . '</a>';
   316 					$messages[] = __( 'This comment is already in the Trash.' ) . ' <a href="' . esc_url( admin_url( 'edit-comments.php?comment_status=trash' ) ) . '"> ' . __( 'View Trash' ) . '</a>';
   293 					break;
   317 					break;
   294 				case 'spam' :
   318 				case 'spam':
   295 					$messages[] = __( 'This comment is already marked as spam.' ) . ' <a href="' . esc_url( admin_url( "comment.php?action=editcomment&c=$same" ) ) . '">' . __( 'Edit comment' ) . '</a>';
   319 					$messages[] = __( 'This comment is already marked as spam.' ) . ' <a href="' . esc_url( admin_url( "comment.php?action=editcomment&c=$same" ) ) . '">' . __( 'Edit comment' ) . '</a>';
   296 					break;
   320 					break;
   297 			}
   321 			}
   298 		}
   322 		}
   299 
   323 
   309 <?php $wp_list_table->search_box( __( 'Search Comments' ), 'comment' ); ?>
   333 <?php $wp_list_table->search_box( __( 'Search Comments' ), 'comment' ); ?>
   310 
   334 
   311 <?php if ( $post_id ) : ?>
   335 <?php if ( $post_id ) : ?>
   312 <input type="hidden" name="p" value="<?php echo esc_attr( intval( $post_id ) ); ?>" />
   336 <input type="hidden" name="p" value="<?php echo esc_attr( intval( $post_id ) ); ?>" />
   313 <?php endif; ?>
   337 <?php endif; ?>
   314 <input type="hidden" name="comment_status" value="<?php echo esc_attr($comment_status); ?>" />
   338 <input type="hidden" name="comment_status" value="<?php echo esc_attr( $comment_status ); ?>" />
   315 <input type="hidden" name="pagegen_timestamp" value="<?php echo esc_attr(current_time('mysql', 1)); ?>" />
   339 <input type="hidden" name="pagegen_timestamp" value="<?php echo esc_attr( current_time( 'mysql', 1 ) ); ?>" />
   316 
   340 
   317 <input type="hidden" name="_total" value="<?php echo esc_attr( $wp_list_table->get_pagination_arg('total_items') ); ?>" />
   341 <input type="hidden" name="_total" value="<?php echo esc_attr( $wp_list_table->get_pagination_arg( 'total_items' ) ); ?>" />
   318 <input type="hidden" name="_per_page" value="<?php echo esc_attr( $wp_list_table->get_pagination_arg('per_page') ); ?>" />
   342 <input type="hidden" name="_per_page" value="<?php echo esc_attr( $wp_list_table->get_pagination_arg( 'per_page' ) ); ?>" />
   319 <input type="hidden" name="_page" value="<?php echo esc_attr( $wp_list_table->get_pagination_arg('page') ); ?>" />
   343 <input type="hidden" name="_page" value="<?php echo esc_attr( $wp_list_table->get_pagination_arg( 'page' ) ); ?>" />
   320 
   344 
   321 <?php if ( isset($_REQUEST['paged']) ) { ?>
   345 <?php if ( isset( $_REQUEST['paged'] ) ) { ?>
   322 	<input type="hidden" name="paged" value="<?php echo esc_attr( absint( $_REQUEST['paged'] ) ); ?>" />
   346 	<input type="hidden" name="paged" value="<?php echo esc_attr( absint( $_REQUEST['paged'] ) ); ?>" />
   323 <?php } ?>
   347 <?php } ?>
   324 
   348 
   325 <?php $wp_list_table->display(); ?>
   349 <?php $wp_list_table->display(); ?>
   326 </form>
   350 </form>
   327 </div>
   351 </div>
   328 
   352 
   329 <div id="ajax-response"></div>
   353 <div id="ajax-response"></div>
   330 
   354 
   331 <?php
   355 <?php
   332 wp_comment_reply('-1', true, 'detail');
   356 wp_comment_reply( '-1', true, 'detail' );
   333 wp_comment_trashnotice();
   357 wp_comment_trashnotice();
   334 include( ABSPATH . 'wp-admin/admin-footer.php' ); ?>
   358 include( ABSPATH . 'wp-admin/admin-footer.php' ); ?>