35 'ajax' => true, |
49 'ajax' => true, |
36 'screen' => isset( $args['screen'] ) ? $args['screen'] : null, |
50 'screen' => isset( $args['screen'] ) ? $args['screen'] : null, |
37 ) ); |
51 ) ); |
38 } |
52 } |
39 |
53 |
40 function ajax_user_can() { |
54 public function ajax_user_can() { |
41 return current_user_can('edit_posts'); |
55 return current_user_can('edit_posts'); |
42 } |
56 } |
43 |
57 |
44 function prepare_items() { |
58 public function prepare_items() { |
45 global $post_id, $comment_status, $search, $comment_type; |
59 global $post_id, $comment_status, $search, $comment_type; |
46 |
60 |
47 $comment_status = isset( $_REQUEST['comment_status'] ) ? $_REQUEST['comment_status'] : 'all'; |
61 $comment_status = isset( $_REQUEST['comment_status'] ) ? $_REQUEST['comment_status'] : 'all'; |
48 if ( !in_array( $comment_status, array( 'all', 'moderated', 'approved', 'spam', 'trash' ) ) ) |
62 if ( !in_array( $comment_status, array( 'all', 'moderated', 'approved', 'spam', 'trash' ) ) ) |
49 $comment_status = 'all'; |
63 $comment_status = 'all'; |
123 'total_items' => $total_comments, |
137 'total_items' => $total_comments, |
124 'per_page' => $comments_per_page, |
138 'per_page' => $comments_per_page, |
125 ) ); |
139 ) ); |
126 } |
140 } |
127 |
141 |
128 function get_per_page( $comment_status = 'all' ) { |
142 public function get_per_page( $comment_status = 'all' ) { |
129 $comments_per_page = $this->get_items_per_page( 'edit_comments_per_page' ); |
143 $comments_per_page = $this->get_items_per_page( 'edit_comments_per_page' ); |
|
144 /** |
|
145 * Filter the number of comments listed per page in the comments list table. |
|
146 * |
|
147 * @since 2.6.0 |
|
148 * |
|
149 * @param int $comments_per_page The number of comments to list per page. |
|
150 * @param string $comment_status The comment status name. Default 'All'. |
|
151 */ |
130 $comments_per_page = apply_filters( 'comments_per_page', $comments_per_page, $comment_status ); |
152 $comments_per_page = apply_filters( 'comments_per_page', $comments_per_page, $comment_status ); |
131 return $comments_per_page; |
153 return $comments_per_page; |
132 } |
154 } |
133 |
155 |
134 function no_items() { |
156 public function no_items() { |
135 global $comment_status; |
157 global $comment_status; |
136 |
158 |
137 if ( 'moderated' == $comment_status ) |
159 if ( 'moderated' == $comment_status ) |
138 _e( 'No comments awaiting moderation.' ); |
160 _e( 'No comments awaiting moderation.' ); |
139 else |
161 else |
140 _e( 'No comments found.' ); |
162 _e( 'No comments found.' ); |
141 } |
163 } |
142 |
164 |
143 function get_views() { |
165 protected function get_views() { |
144 global $post_id, $comment_status, $comment_type; |
166 global $post_id, $comment_status, $comment_type; |
145 |
167 |
146 $status_links = array(); |
168 $status_links = array(); |
147 $num_comments = ( $post_id ) ? wp_count_comments( $post_id ) : wp_count_comments(); |
169 $num_comments = ( $post_id ) ? wp_count_comments( $post_id ) : wp_count_comments(); |
148 //, number_format_i18n($num_comments->moderated) ), "<span class='comment-count'>" . number_format_i18n($num_comments->moderated) . "</span>"), |
170 //, number_format_i18n($num_comments->moderated) ), "<span class='comment-count'>" . number_format_i18n($num_comments->moderated) . "</span>"), |
179 translate_nooped_plural( $label, $num_comments->$status ), |
201 translate_nooped_plural( $label, $num_comments->$status ), |
180 number_format_i18n( $num_comments->$status ) |
202 number_format_i18n( $num_comments->$status ) |
181 ) . '</a>'; |
203 ) . '</a>'; |
182 } |
204 } |
183 |
205 |
|
206 /** |
|
207 * Filter the comment status links. |
|
208 * |
|
209 * @since 2.5.0 |
|
210 * |
|
211 * @param array $status_links An array of fully-formed status links. Default 'All'. |
|
212 * Accepts 'All', 'Pending', 'Approved', 'Spam', and 'Trash'. |
|
213 */ |
184 $status_links = apply_filters( 'comment_status_links', $status_links ); |
214 $status_links = apply_filters( 'comment_status_links', $status_links ); |
185 return $status_links; |
215 return $status_links; |
186 } |
216 } |
187 |
217 |
188 function get_bulk_actions() { |
218 protected function get_bulk_actions() { |
189 global $comment_status; |
219 global $comment_status; |
190 |
220 |
191 $actions = array(); |
221 $actions = array(); |
192 if ( in_array( $comment_status, array( 'all', 'approved' ) ) ) |
222 if ( in_array( $comment_status, array( 'all', 'approved' ) ) ) |
193 $actions['unapprove'] = __( 'Unapprove' ); |
223 $actions['unapprove'] = __( 'Unapprove' ); |
194 if ( in_array( $comment_status, array( 'all', 'moderated' ) ) ) |
224 if ( in_array( $comment_status, array( 'all', 'moderated' ) ) ) |
195 $actions['approve'] = __( 'Approve' ); |
225 $actions['approve'] = __( 'Approve' ); |
196 if ( in_array( $comment_status, array( 'all', 'moderated', 'approved' ) ) ) |
226 if ( in_array( $comment_status, array( 'all', 'moderated', 'approved', 'trash' ) ) ) |
197 $actions['spam'] = _x( 'Mark as Spam', 'comment' ); |
227 $actions['spam'] = _x( 'Mark as Spam', 'comment' ); |
198 |
228 |
199 if ( 'trash' == $comment_status ) |
229 if ( 'trash' == $comment_status ) |
200 $actions['untrash'] = __( 'Restore' ); |
230 $actions['untrash'] = __( 'Restore' ); |
201 elseif ( 'spam' == $comment_status ) |
231 elseif ( 'spam' == $comment_status ) |
207 $actions['trash'] = __( 'Move to Trash' ); |
237 $actions['trash'] = __( 'Move to Trash' ); |
208 |
238 |
209 return $actions; |
239 return $actions; |
210 } |
240 } |
211 |
241 |
212 function extra_tablenav( $which ) { |
242 protected function extra_tablenav( $which ) { |
213 global $comment_status, $comment_type; |
243 global $comment_status, $comment_type; |
214 ?> |
244 ?> |
215 <div class="alignleft actions"> |
245 <div class="alignleft actions"> |
216 <?php |
246 <?php |
217 if ( 'top' == $which ) { |
247 if ( 'top' == $which ) { |
218 ?> |
248 ?> |
219 <select name="comment_type"> |
249 <label class="screen-reader-text" for="filter-by-comment-type"><?php _e( 'Filter by comment type' ); ?></label> |
220 <option value=""><?php _e( 'Show all comment types' ); ?></option> |
250 <select id="filter-by-comment-type" name="comment_type"> |
|
251 <option value=""><?php _e( 'All comment types' ); ?></option> |
221 <?php |
252 <?php |
|
253 /** |
|
254 * Filter the comment types dropdown menu. |
|
255 * |
|
256 * @since 2.7.0 |
|
257 * |
|
258 * @param array $comment_types An array of comment types. Accepts 'Comments', 'Pings'. |
|
259 */ |
222 $comment_types = apply_filters( 'admin_comment_types_dropdown', array( |
260 $comment_types = apply_filters( 'admin_comment_types_dropdown', array( |
223 'comment' => __( 'Comments' ), |
261 'comment' => __( 'Comments' ), |
224 'pings' => __( 'Pings' ), |
262 'pings' => __( 'Pings' ), |
225 ) ); |
263 ) ); |
226 |
264 |
227 foreach ( $comment_types as $type => $label ) |
265 foreach ( $comment_types as $type => $label ) |
228 echo "\t<option value='" . esc_attr( $type ) . "'" . selected( $comment_type, $type, false ) . ">$label</option>\n"; |
266 echo "\t" . '<option value="' . esc_attr( $type ) . '"' . selected( $comment_type, $type, false ) . ">$label</option>\n"; |
229 ?> |
267 ?> |
230 </select> |
268 </select> |
231 <?php |
269 <?php |
|
270 /** |
|
271 * Fires just before the Filter submit button for comment types. |
|
272 * |
|
273 * @since 3.5.0 |
|
274 */ |
232 do_action( 'restrict_manage_comments' ); |
275 do_action( 'restrict_manage_comments' ); |
233 submit_button( __( 'Filter' ), 'button', false, false, array( 'id' => 'post-query-submit' ) ); |
276 submit_button( __( 'Filter' ), 'button', 'filter_action', false, array( 'id' => 'post-query-submit' ) ); |
234 } |
277 } |
235 |
278 |
236 if ( ( 'spam' == $comment_status || 'trash' == $comment_status ) && current_user_can( 'moderate_comments' ) ) { |
279 if ( ( 'spam' == $comment_status || 'trash' == $comment_status ) && current_user_can( 'moderate_comments' ) ) { |
237 wp_nonce_field( 'bulk-destroy', '_destroy_nonce' ); |
280 wp_nonce_field( 'bulk-destroy', '_destroy_nonce' ); |
238 $title = ( 'spam' == $comment_status ) ? esc_attr__( 'Empty Spam' ) : esc_attr__( 'Empty Trash' ); |
281 $title = ( 'spam' == $comment_status ) ? esc_attr__( 'Empty Spam' ) : esc_attr__( 'Empty Trash' ); |
239 submit_button( $title, 'apply', 'delete_all', false ); |
282 submit_button( $title, 'apply', 'delete_all', false ); |
240 } |
283 } |
|
284 /** |
|
285 * Fires after the Filter submit button for comment types. |
|
286 * |
|
287 * @since 2.5.0 |
|
288 * |
|
289 * @param string $comment_status The comment status name. Default 'All'. |
|
290 */ |
241 do_action( 'manage_comments_nav', $comment_status ); |
291 do_action( 'manage_comments_nav', $comment_status ); |
242 echo '</div>'; |
292 echo '</div>'; |
243 } |
293 } |
244 |
294 |
245 function current_action() { |
295 public function current_action() { |
246 if ( isset( $_REQUEST['delete_all'] ) || isset( $_REQUEST['delete_all2'] ) ) |
296 if ( isset( $_REQUEST['delete_all'] ) || isset( $_REQUEST['delete_all2'] ) ) |
247 return 'delete_all'; |
297 return 'delete_all'; |
248 |
298 |
249 return parent::current_action(); |
299 return parent::current_action(); |
250 } |
300 } |
251 |
301 |
252 function get_columns() { |
302 public function get_columns() { |
253 global $post_id; |
303 global $post_id; |
254 |
304 |
255 $columns = array(); |
305 $columns = array(); |
256 |
306 |
257 if ( $this->checkbox ) |
307 if ( $this->checkbox ) |
264 $columns['response'] = _x( 'In Response To', 'column name' ); |
314 $columns['response'] = _x( 'In Response To', 'column name' ); |
265 |
315 |
266 return $columns; |
316 return $columns; |
267 } |
317 } |
268 |
318 |
269 function get_sortable_columns() { |
319 protected function get_sortable_columns() { |
270 return array( |
320 return array( |
271 'author' => 'comment_author', |
321 'author' => 'comment_author', |
272 'response' => 'comment_post_ID' |
322 'response' => 'comment_post_ID' |
273 ); |
323 ); |
274 } |
324 } |
275 |
325 |
276 function display() { |
326 public function display() { |
277 extract( $this->_args ); |
|
278 |
|
279 wp_nonce_field( "fetch-list-" . get_class( $this ), '_ajax_fetch_list_nonce' ); |
327 wp_nonce_field( "fetch-list-" . get_class( $this ), '_ajax_fetch_list_nonce' ); |
280 |
328 |
281 $this->display_tablenav( 'top' ); |
329 $this->display_tablenav( 'top' ); |
282 |
330 |
283 ?> |
331 ?> |
284 <table class="<?php echo implode( ' ', $this->get_table_classes() ); ?>" cellspacing="0"> |
332 <table class="<?php echo implode( ' ', $this->get_table_classes() ); ?>"> |
285 <thead> |
333 <thead> |
286 <tr> |
334 <tr> |
287 <?php $this->print_column_headers(); ?> |
335 <?php $this->print_column_headers(); ?> |
288 </tr> |
336 </tr> |
289 </thead> |
337 </thead> |
290 |
338 |
|
339 <tbody id="the-comment-list" data-wp-lists="list:comment"> |
|
340 <?php $this->display_rows_or_placeholder(); ?> |
|
341 </tbody> |
|
342 |
|
343 <tbody id="the-extra-comment-list" data-wp-lists="list:comment" style="display: none;"> |
|
344 <?php $this->items = $this->extra_items; $this->display_rows(); ?> |
|
345 </tbody> |
|
346 |
291 <tfoot> |
347 <tfoot> |
292 <tr> |
348 <tr> |
293 <?php $this->print_column_headers( false ); ?> |
349 <?php $this->print_column_headers( false ); ?> |
294 </tr> |
350 </tr> |
295 </tfoot> |
351 </tfoot> |
296 |
352 |
297 <tbody id="the-comment-list" data-wp-lists="list:comment"> |
|
298 <?php $this->display_rows_or_placeholder(); ?> |
|
299 </tbody> |
|
300 |
|
301 <tbody id="the-extra-comment-list" data-wp-lists="list:comment" style="display: none;"> |
|
302 <?php $this->items = $this->extra_items; $this->display_rows(); ?> |
|
303 </tbody> |
|
304 </table> |
353 </table> |
305 <?php |
354 <?php |
306 |
355 |
307 $this->display_tablenav( 'bottom' ); |
356 $this->display_tablenav( 'bottom' ); |
308 } |
357 } |
309 |
358 |
310 function single_row( $a_comment ) { |
359 public function single_row( $a_comment ) { |
311 global $post, $comment; |
360 global $post, $comment; |
312 |
361 |
313 $comment = $a_comment; |
362 $comment = $a_comment; |
314 $the_comment_class = join( ' ', get_comment_class( wp_get_comment_status( $comment->comment_ID ) ) ); |
363 $the_comment_class = wp_get_comment_status( $comment->comment_ID ); |
|
364 if ( ! $the_comment_class ) { |
|
365 $the_comment_class = ''; |
|
366 } |
|
367 $the_comment_class = join( ' ', get_comment_class( $the_comment_class, $comment->comment_ID, $comment->comment_post_ID ) ); |
315 |
368 |
316 $post = get_post( $comment->comment_post_ID ); |
369 $post = get_post( $comment->comment_post_ID ); |
317 |
370 |
318 $this->user_can = current_user_can( 'edit_comment', $comment->comment_ID ); |
371 $this->user_can = current_user_can( 'edit_comment', $comment->comment_ID ); |
319 |
372 |
320 echo "<tr id='comment-$comment->comment_ID' class='$the_comment_class'>"; |
373 echo "<tr id='comment-$comment->comment_ID' class='$the_comment_class'>"; |
321 $this->single_row_columns( $comment ); |
374 $this->single_row_columns( $comment ); |
322 echo "</tr>\n"; |
375 echo "</tr>\n"; |
323 } |
376 } |
324 |
377 |
325 function column_cb( $comment ) { |
378 public function column_cb( $comment ) { |
326 if ( $this->user_can ) { ?> |
379 if ( $this->user_can ) { ?> |
327 <label class="screen-reader-text" for="cb-select-<?php echo $comment->comment_ID; ?>"><?php _e( 'Select comment' ); ?></label> |
380 <label class="screen-reader-text" for="cb-select-<?php echo $comment->comment_ID; ?>"><?php _e( 'Select comment' ); ?></label> |
328 <input id="cb-select-<?php echo $comment->comment_ID; ?>" type="checkbox" name="delete_comments[]" value="<?php echo $comment->comment_ID; ?>" /> |
381 <input id="cb-select-<?php echo $comment->comment_ID; ?>" type="checkbox" name="delete_comments[]" value="<?php echo $comment->comment_ID; ?>" /> |
329 <?php |
382 <?php |
330 } |
383 } |
331 } |
384 } |
332 |
385 |
333 function column_comment( $comment ) { |
386 public function column_comment( $comment ) { |
334 global $comment_status; |
387 global $comment_status; |
335 $post = get_post(); |
388 $post = get_post(); |
336 |
389 |
337 $user_can = $this->user_can; |
|
338 |
|
339 $comment_url = esc_url( get_comment_link( $comment->comment_ID ) ); |
390 $comment_url = esc_url( get_comment_link( $comment->comment_ID ) ); |
340 $the_comment_status = wp_get_comment_status( $comment->comment_ID ); |
391 $the_comment_status = wp_get_comment_status( $comment->comment_ID ); |
341 |
392 |
342 if ( $user_can ) { |
393 if ( $this->user_can ) { |
343 $del_nonce = esc_html( '_wpnonce=' . wp_create_nonce( "delete-comment_$comment->comment_ID" ) ); |
394 $del_nonce = esc_html( '_wpnonce=' . wp_create_nonce( "delete-comment_$comment->comment_ID" ) ); |
344 $approve_nonce = esc_html( '_wpnonce=' . wp_create_nonce( "approve-comment_$comment->comment_ID" ) ); |
395 $approve_nonce = esc_html( '_wpnonce=' . wp_create_nonce( "approve-comment_$comment->comment_ID" ) ); |
345 |
396 |
346 $url = "comment.php?c=$comment->comment_ID"; |
397 $url = "comment.php?c=$comment->comment_ID"; |
347 |
398 |
352 $trash_url = esc_url( $url . "&action=trashcomment&$del_nonce" ); |
403 $trash_url = esc_url( $url . "&action=trashcomment&$del_nonce" ); |
353 $untrash_url = esc_url( $url . "&action=untrashcomment&$del_nonce" ); |
404 $untrash_url = esc_url( $url . "&action=untrashcomment&$del_nonce" ); |
354 $delete_url = esc_url( $url . "&action=deletecomment&$del_nonce" ); |
405 $delete_url = esc_url( $url . "&action=deletecomment&$del_nonce" ); |
355 } |
406 } |
356 |
407 |
|
408 echo '<div class="comment-author">'; |
|
409 $this->column_author( $comment ); |
|
410 echo '</div>'; |
|
411 |
357 echo '<div class="submitted-on">'; |
412 echo '<div class="submitted-on">'; |
358 /* translators: 2: comment date, 3: comment time */ |
413 /* translators: 2: comment date, 3: comment time */ |
359 printf( __( 'Submitted on <a href="%1$s">%2$s at %3$s</a>' ), $comment_url, |
414 printf( __( 'Submitted on <a href="%1$s">%2$s at %3$s</a>' ), $comment_url, |
360 /* translators: comment date format. See http://php.net/date */ |
415 /* translators: comment date format. See http://php.net/date */ |
361 get_comment_date( __( 'Y/m/d' ) ), |
416 get_comment_date( __( 'Y/m/d' ) ), |
369 printf( ' | '.__( 'In reply to <a href="%1$s">%2$s</a>.' ), $parent_link, $name ); |
424 printf( ' | '.__( 'In reply to <a href="%1$s">%2$s</a>.' ), $parent_link, $name ); |
370 } |
425 } |
371 |
426 |
372 echo '</div>'; |
427 echo '</div>'; |
373 comment_text(); |
428 comment_text(); |
374 if ( $user_can ) { ?> |
429 if ( $this->user_can ) { ?> |
375 <div id="inline-<?php echo $comment->comment_ID; ?>" class="hidden"> |
430 <div id="inline-<?php echo $comment->comment_ID; ?>" class="hidden"> |
376 <textarea class="comment" rows="1" cols="1"><?php echo esc_textarea( apply_filters( 'comment_edit_pre', $comment->comment_content ) ); ?></textarea> |
431 <textarea class="comment" rows="1" cols="1"><?php |
|
432 /** This filter is documented in wp-admin/includes/comment.php */ |
|
433 echo esc_textarea( apply_filters( 'comment_edit_pre', $comment->comment_content ) ); |
|
434 ?></textarea> |
377 <div class="author-email"><?php echo esc_attr( $comment->comment_author_email ); ?></div> |
435 <div class="author-email"><?php echo esc_attr( $comment->comment_author_email ); ?></div> |
378 <div class="author"><?php echo esc_attr( $comment->comment_author ); ?></div> |
436 <div class="author"><?php echo esc_attr( $comment->comment_author ); ?></div> |
379 <div class="author-url"><?php echo esc_attr( $comment->comment_author_url ); ?></div> |
437 <div class="author-url"><?php echo esc_attr( $comment->comment_author_url ); ?></div> |
380 <div class="comment_status"><?php echo $comment->comment_approved; ?></div> |
438 <div class="comment_status"><?php echo $comment->comment_approved; ?></div> |
381 </div> |
439 </div> |
382 <?php |
440 <?php |
383 } |
441 } |
384 |
442 |
385 if ( $user_can ) { |
443 if ( $this->user_can ) { |
386 // preorder it: Approve | Reply | Quick Edit | Edit | Spam | Trash |
444 // Preorder it: Approve | Reply | Quick Edit | Edit | Spam | Trash. |
387 $actions = array( |
445 $actions = array( |
388 'approve' => '', 'unapprove' => '', |
446 'approve' => '', 'unapprove' => '', |
389 'reply' => '', |
447 'reply' => '', |
390 'quickedit' => '', |
448 'quickedit' => '', |
391 'edit' => '', |
449 'edit' => '', |
392 'spam' => '', 'unspam' => '', |
450 'spam' => '', 'unspam' => '', |
393 'trash' => '', 'untrash' => '', 'delete' => '' |
451 'trash' => '', 'untrash' => '', 'delete' => '' |
394 ); |
452 ); |
395 |
453 |
396 if ( $comment_status && 'all' != $comment_status ) { // not looking at all comments |
454 // Not looking at all comments. |
397 if ( 'approved' == $the_comment_status ) |
455 if ( $comment_status && 'all' != $comment_status ) { |
|
456 if ( 'approved' == $the_comment_status ) { |
398 $actions['unapprove'] = "<a href='$unapprove_url' data-wp-lists='delete:the-comment-list:comment-$comment->comment_ID:e7e7d3:action=dim-comment&new=unapproved' class='vim-u vim-destructive' title='" . esc_attr__( 'Unapprove this comment' ) . "'>" . __( 'Unapprove' ) . '</a>'; |
457 $actions['unapprove'] = "<a href='$unapprove_url' data-wp-lists='delete:the-comment-list:comment-$comment->comment_ID:e7e7d3:action=dim-comment&new=unapproved' class='vim-u vim-destructive' title='" . esc_attr__( 'Unapprove this comment' ) . "'>" . __( 'Unapprove' ) . '</a>'; |
399 else if ( 'unapproved' == $the_comment_status ) |
458 } elseif ( 'unapproved' == $the_comment_status ) { |
400 $actions['approve'] = "<a href='$approve_url' data-wp-lists='delete:the-comment-list:comment-$comment->comment_ID:e7e7d3:action=dim-comment&new=approved' class='vim-a vim-destructive' title='" . esc_attr__( 'Approve this comment' ) . "'>" . __( 'Approve' ) . '</a>'; |
459 $actions['approve'] = "<a href='$approve_url' data-wp-lists='delete:the-comment-list:comment-$comment->comment_ID:e7e7d3:action=dim-comment&new=approved' class='vim-a vim-destructive' title='" . esc_attr__( 'Approve this comment' ) . "'>" . __( 'Approve' ) . '</a>'; |
|
460 } |
401 } else { |
461 } else { |
402 $actions['approve'] = "<a href='$approve_url' data-wp-lists='dim:the-comment-list:comment-$comment->comment_ID:unapproved:e7e7d3:e7e7d3:new=approved' class='vim-a' title='" . esc_attr__( 'Approve this comment' ) . "'>" . __( 'Approve' ) . '</a>'; |
462 $actions['approve'] = "<a href='$approve_url' data-wp-lists='dim:the-comment-list:comment-$comment->comment_ID:unapproved:e7e7d3:e7e7d3:new=approved' class='vim-a' title='" . esc_attr__( 'Approve this comment' ) . "'>" . __( 'Approve' ) . '</a>'; |
403 $actions['unapprove'] = "<a href='$unapprove_url' data-wp-lists='dim:the-comment-list:comment-$comment->comment_ID:unapproved:e7e7d3:e7e7d3:new=unapproved' class='vim-u' title='" . esc_attr__( 'Unapprove this comment' ) . "'>" . __( 'Unapprove' ) . '</a>'; |
463 $actions['unapprove'] = "<a href='$unapprove_url' data-wp-lists='dim:the-comment-list:comment-$comment->comment_ID:unapproved:e7e7d3:e7e7d3:new=unapproved' class='vim-u' title='" . esc_attr__( 'Unapprove this comment' ) . "'>" . __( 'Unapprove' ) . '</a>'; |
404 } |
464 } |
405 |
465 |
406 if ( 'spam' != $the_comment_status && 'trash' != $the_comment_status ) { |
466 if ( 'spam' != $the_comment_status ) { |
407 $actions['spam'] = "<a href='$spam_url' data-wp-lists='delete:the-comment-list:comment-$comment->comment_ID::spam=1' class='vim-s vim-destructive' title='" . esc_attr__( 'Mark this comment as spam' ) . "'>" . /* translators: mark as spam link */ _x( 'Spam', 'verb' ) . '</a>'; |
467 $actions['spam'] = "<a href='$spam_url' data-wp-lists='delete:the-comment-list:comment-$comment->comment_ID::spam=1' class='vim-s vim-destructive' title='" . esc_attr__( 'Mark this comment as spam' ) . "'>" . /* translators: mark as spam link */ _x( 'Spam', 'verb' ) . '</a>'; |
408 } elseif ( 'spam' == $the_comment_status ) { |
468 } elseif ( 'spam' == $the_comment_status ) { |
409 $actions['unspam'] = "<a href='$unspam_url' data-wp-lists='delete:the-comment-list:comment-$comment->comment_ID:66cc66:unspam=1' class='vim-z vim-destructive'>" . _x( 'Not Spam', 'comment' ) . '</a>'; |
469 $actions['unspam'] = "<a href='$unspam_url' data-wp-lists='delete:the-comment-list:comment-$comment->comment_ID:66cc66:unspam=1' class='vim-z vim-destructive'>" . _x( 'Not Spam', 'comment' ) . '</a>'; |
410 } elseif ( 'trash' == $the_comment_status ) { |
470 } |
|
471 |
|
472 if ( 'trash' == $the_comment_status ) { |
411 $actions['untrash'] = "<a href='$untrash_url' data-wp-lists='delete:the-comment-list:comment-$comment->comment_ID:66cc66:untrash=1' class='vim-z vim-destructive'>" . __( 'Restore' ) . '</a>'; |
473 $actions['untrash'] = "<a href='$untrash_url' data-wp-lists='delete:the-comment-list:comment-$comment->comment_ID:66cc66:untrash=1' class='vim-z vim-destructive'>" . __( 'Restore' ) . '</a>'; |
412 } |
474 } |
413 |
475 |
414 if ( 'spam' == $the_comment_status || 'trash' == $the_comment_status || !EMPTY_TRASH_DAYS ) { |
476 if ( 'spam' == $the_comment_status || 'trash' == $the_comment_status || !EMPTY_TRASH_DAYS ) { |
415 $actions['delete'] = "<a href='$delete_url' data-wp-lists='delete:the-comment-list:comment-$comment->comment_ID::delete=1' class='delete vim-d vim-destructive'>" . __( 'Delete Permanently' ) . '</a>'; |
477 $actions['delete'] = "<a href='$delete_url' data-wp-lists='delete:the-comment-list:comment-$comment->comment_ID::delete=1' class='delete vim-d vim-destructive'>" . __( 'Delete Permanently' ) . '</a>'; |
417 $actions['trash'] = "<a href='$trash_url' data-wp-lists='delete:the-comment-list:comment-$comment->comment_ID::trash=1' class='delete vim-d vim-destructive' title='" . esc_attr__( 'Move this comment to the trash' ) . "'>" . _x( 'Trash', 'verb' ) . '</a>'; |
479 $actions['trash'] = "<a href='$trash_url' data-wp-lists='delete:the-comment-list:comment-$comment->comment_ID::trash=1' class='delete vim-d vim-destructive' title='" . esc_attr__( 'Move this comment to the trash' ) . "'>" . _x( 'Trash', 'verb' ) . '</a>'; |
418 } |
480 } |
419 |
481 |
420 if ( 'spam' != $the_comment_status && 'trash' != $the_comment_status ) { |
482 if ( 'spam' != $the_comment_status && 'trash' != $the_comment_status ) { |
421 $actions['edit'] = "<a href='comment.php?action=editcomment&c={$comment->comment_ID}' title='" . esc_attr__( 'Edit comment' ) . "'>". __( 'Edit' ) . '</a>'; |
483 $actions['edit'] = "<a href='comment.php?action=editcomment&c={$comment->comment_ID}' title='" . esc_attr__( 'Edit comment' ) . "'>". __( 'Edit' ) . '</a>'; |
422 $actions['quickedit'] = '<a onclick="commentReply.open( \''.$comment->comment_ID.'\',\''.$post->ID.'\',\'edit\' );return false;" class="vim-q" title="'.esc_attr__( 'Quick Edit' ).'" href="#">' . __( 'Quick Edit' ) . '</a>'; |
484 |
423 $actions['reply'] = '<a onclick="commentReply.open( \''.$comment->comment_ID.'\',\''.$post->ID.'\' );return false;" class="vim-r" title="'.esc_attr__( 'Reply to this comment' ).'" href="#">' . __( 'Reply' ) . '</a>'; |
485 $format = '<a data-comment-id="%d" data-post-id="%d" data-action="%s" class="%s" title="%s" href="#">%s</a>'; |
424 } |
486 |
425 |
487 $actions['quickedit'] = sprintf( $format, $comment->comment_ID, $post->ID, 'edit', 'vim-q comment-inline',esc_attr__( 'Edit this item inline' ), __( 'Quick Edit' ) ); |
|
488 |
|
489 $actions['reply'] = sprintf( $format, $comment->comment_ID, $post->ID, 'replyto', 'vim-r comment-inline', esc_attr__( 'Reply to this comment' ), __( 'Reply' ) ); |
|
490 } |
|
491 |
|
492 /** This filter is documented in wp-admin/includes/dashboard.php */ |
426 $actions = apply_filters( 'comment_row_actions', array_filter( $actions ), $comment ); |
493 $actions = apply_filters( 'comment_row_actions', array_filter( $actions ), $comment ); |
427 |
494 |
428 $i = 0; |
495 $i = 0; |
429 echo '<div class="row-actions">'; |
496 echo '<div class="row-actions">'; |
430 foreach ( $actions as $action => $link ) { |
497 foreach ( $actions as $action => $link ) { |
464 if ( $this->user_can ) { |
531 if ( $this->user_can ) { |
465 if ( !empty( $comment->comment_author_email ) ) { |
532 if ( !empty( $comment->comment_author_email ) ) { |
466 comment_author_email_link(); |
533 comment_author_email_link(); |
467 echo '<br />'; |
534 echo '<br />'; |
468 } |
535 } |
469 echo '<a href="edit-comments.php?s='; |
536 |
470 comment_author_IP(); |
537 $author_ip = get_comment_author_IP(); |
471 echo '&mode=detail'; |
538 if ( $author_ip ) { |
472 if ( 'spam' == $comment_status ) |
539 $author_ip_url = add_query_arg( array( 's' => $author_ip, 'mode' => 'detail' ), 'edit-comments.php' ); |
473 echo '&comment_status=spam'; |
540 if ( 'spam' == $comment_status ) { |
474 echo '">'; |
541 $author_ip_url = add_query_arg( 'comment_status', 'spam', $author_ip_url ); |
475 comment_author_IP(); |
542 } |
476 echo '</a>'; |
543 printf( '<a href="%s">%s</a>', esc_url( $author_ip_url ), $author_ip ); |
477 } |
544 } |
478 } |
545 } |
479 |
546 } |
480 function column_date( $comment ) { |
547 |
481 return get_comment_date( __( 'Y/m/d \a\t g:ia' ) ); |
548 public function column_date() { |
482 } |
549 return get_comment_date( __( 'Y/m/d \a\t g:i a' ) ); |
483 |
550 } |
484 function column_response( $comment ) { |
551 |
|
552 public function column_response() { |
485 $post = get_post(); |
553 $post = get_post(); |
486 |
554 |
487 if ( isset( $this->pending_count[$post->ID] ) ) { |
555 if ( isset( $this->pending_count[$post->ID] ) ) { |
488 $pending_comments = $this->pending_count[$post->ID]; |
556 $pending_comments = $this->pending_count[$post->ID]; |
489 } else { |
557 } else { |
491 $pending_comments = $this->pending_count[$post->ID] = $_pending_count_temp[$post->ID]; |
559 $pending_comments = $this->pending_count[$post->ID] = $_pending_count_temp[$post->ID]; |
492 } |
560 } |
493 |
561 |
494 if ( current_user_can( 'edit_post', $post->ID ) ) { |
562 if ( current_user_can( 'edit_post', $post->ID ) ) { |
495 $post_link = "<a href='" . get_edit_post_link( $post->ID ) . "'>"; |
563 $post_link = "<a href='" . get_edit_post_link( $post->ID ) . "'>"; |
496 $post_link .= get_the_title( $post->ID ) . '</a>'; |
564 $post_link .= esc_html( get_the_title( $post->ID ) ) . '</a>'; |
497 } else { |
565 } else { |
498 $post_link = get_the_title( $post->ID ); |
566 $post_link = esc_html( get_the_title( $post->ID ) ); |
499 } |
567 } |
500 |
568 |
501 echo '<div class="response-links"><span class="post-com-count-wrapper">'; |
569 echo '<div class="response-links"><span class="post-com-count-wrapper">'; |
502 echo $post_link . '<br />'; |
570 echo $post_link . '<br />'; |
503 $this->comments_bubble( $post->ID, $pending_comments ); |
571 $this->comments_bubble( $post->ID, $pending_comments ); |
524 * |
600 * |
525 * @see WP_Comments_Table |
601 * @see WP_Comments_Table |
526 */ |
602 */ |
527 class WP_Post_Comments_List_Table extends WP_Comments_List_Table { |
603 class WP_Post_Comments_List_Table extends WP_Comments_List_Table { |
528 |
604 |
529 function get_column_info() { |
605 protected function get_column_info() { |
530 $this->_column_headers = array( |
606 return array( |
531 array( |
607 array( |
532 'author' => __( 'Author' ), |
608 'author' => __( 'Author' ), |
533 'comment' => _x( 'Comment', 'column name' ), |
609 'comment' => _x( 'Comment', 'column name' ), |
534 ), |
610 ), |
535 array(), |
611 array(), |
536 array(), |
612 array(), |
537 ); |
613 ); |
538 |
614 } |
539 return $this->_column_headers; |
615 |
540 } |
616 protected function get_table_classes() { |
541 |
|
542 function get_table_classes() { |
|
543 $classes = parent::get_table_classes(); |
617 $classes = parent::get_table_classes(); |
544 $classes[] = 'comments-box'; |
618 $classes[] = 'comments-box'; |
545 return $classes; |
619 return $classes; |
546 } |
620 } |
547 |
621 |
548 function display( $output_empty = false ) { |
622 public function display( $output_empty = false ) { |
549 extract( $this->_args ); |
623 $singular = $this->_args['singular']; |
550 |
624 |
551 wp_nonce_field( "fetch-list-" . get_class( $this ), '_ajax_fetch_list_nonce' ); |
625 wp_nonce_field( "fetch-list-" . get_class( $this ), '_ajax_fetch_list_nonce' ); |
552 ?> |
626 ?> |
553 <table class="<?php echo implode( ' ', $this->get_table_classes() ); ?>" cellspacing="0" style="display:none;"> |
627 <table class="<?php echo implode( ' ', $this->get_table_classes() ); ?>" style="display:none;"> |
554 <tbody id="the-comment-list"<?php if ( $singular ) echo " data-wp-lists='list:$singular'"; ?>> |
628 <tbody id="the-comment-list"<?php |
555 <?php if ( ! $output_empty ) $this->display_rows_or_placeholder(); ?> |
629 if ( $singular ) { |
|
630 echo " data-wp-lists='list:$singular'"; |
|
631 } ?>> |
|
632 <?php if ( ! $output_empty ) { |
|
633 $this->display_rows_or_placeholder(); |
|
634 } ?> |
556 </tbody> |
635 </tbody> |
557 </table> |
636 </table> |
558 <?php |
637 <?php |
559 } |
638 } |
560 |
639 |
561 function get_per_page( $comment_status = false ) { |
640 public function get_per_page( $comment_status = false ) { |
562 return 10; |
641 return 10; |
563 } |
642 } |
564 } |
643 } |