67 public function ajax_user_can() { |
76 public function ajax_user_can() { |
68 return current_user_can( 'edit_posts' ); |
77 return current_user_can( 'edit_posts' ); |
69 } |
78 } |
70 |
79 |
71 /** |
80 /** |
|
81 * @global string $mode List table view mode. |
72 * @global int $post_id |
82 * @global int $post_id |
73 * @global string $comment_status |
83 * @global string $comment_status |
|
84 * @global string $comment_type |
74 * @global string $search |
85 * @global string $search |
75 * @global string $comment_type |
|
76 */ |
86 */ |
77 public function prepare_items() { |
87 public function prepare_items() { |
78 global $post_id, $comment_status, $search, $comment_type; |
88 global $mode, $post_id, $comment_status, $comment_type, $search; |
|
89 |
|
90 if ( ! empty( $_REQUEST['mode'] ) ) { |
|
91 $mode = 'excerpt' === $_REQUEST['mode'] ? 'excerpt' : 'list'; |
|
92 set_user_setting( 'posts_list_mode', $mode ); |
|
93 } else { |
|
94 $mode = get_user_setting( 'posts_list_mode', 'list' ); |
|
95 } |
79 |
96 |
80 $comment_status = isset( $_REQUEST['comment_status'] ) ? $_REQUEST['comment_status'] : 'all'; |
97 $comment_status = isset( $_REQUEST['comment_status'] ) ? $_REQUEST['comment_status'] : 'all'; |
81 if ( ! in_array( $comment_status, array( 'all', 'mine', 'moderated', 'approved', 'spam', 'trash' ) ) ) { |
98 if ( ! in_array( $comment_status, array( 'all', 'mine', 'moderated', 'approved', 'spam', 'trash' ), true ) ) { |
82 $comment_status = 'all'; |
99 $comment_status = 'all'; |
83 } |
100 } |
84 |
101 |
85 $comment_type = ! empty( $_REQUEST['comment_type'] ) ? $_REQUEST['comment_type'] : ''; |
102 $comment_type = ! empty( $_REQUEST['comment_type'] ) ? $_REQUEST['comment_type'] : ''; |
86 |
103 |
215 |
234 |
216 $status_links = array(); |
235 $status_links = array(); |
217 $num_comments = ( $post_id ) ? wp_count_comments( $post_id ) : wp_count_comments(); |
236 $num_comments = ( $post_id ) ? wp_count_comments( $post_id ) : wp_count_comments(); |
218 |
237 |
219 $stati = array( |
238 $stati = array( |
220 /* translators: %s: all comments count */ |
239 /* translators: %s: Number of comments. */ |
221 'all' => _nx_noop( |
240 'all' => _nx_noop( |
222 'All <span class="count">(%s)</span>', |
241 'All <span class="count">(%s)</span>', |
223 'All <span class="count">(%s)</span>', |
242 'All <span class="count">(%s)</span>', |
224 'comments' |
243 'comments' |
225 ), // singular not used |
244 ), // Singular not used. |
226 |
245 |
227 /* translators: %s: current user's comments count */ |
246 /* translators: %s: Number of comments. */ |
228 'mine' => _nx_noop( |
247 'mine' => _nx_noop( |
229 'Mine <span class="count">(%s)</span>', |
248 'Mine <span class="count">(%s)</span>', |
230 'Mine <span class="count">(%s)</span>', |
249 'Mine <span class="count">(%s)</span>', |
231 'comments' |
250 'comments' |
232 ), |
251 ), |
233 |
252 |
234 /* translators: %s: pending comments count */ |
253 /* translators: %s: Number of comments. */ |
235 'moderated' => _nx_noop( |
254 'moderated' => _nx_noop( |
236 'Pending <span class="count">(%s)</span>', |
255 'Pending <span class="count">(%s)</span>', |
237 'Pending <span class="count">(%s)</span>', |
256 'Pending <span class="count">(%s)</span>', |
238 'comments' |
257 'comments' |
239 ), |
258 ), |
240 |
259 |
241 /* translators: %s: approved comments count */ |
260 /* translators: %s: Number of comments. */ |
242 'approved' => _nx_noop( |
261 'approved' => _nx_noop( |
243 'Approved <span class="count">(%s)</span>', |
262 'Approved <span class="count">(%s)</span>', |
244 'Approved <span class="count">(%s)</span>', |
263 'Approved <span class="count">(%s)</span>', |
245 'comments' |
264 'comments' |
246 ), |
265 ), |
247 |
266 |
248 /* translators: %s: spam comments count */ |
267 /* translators: %s: Number of comments. */ |
249 'spam' => _nx_noop( |
268 'spam' => _nx_noop( |
250 'Spam <span class="count">(%s)</span>', |
269 'Spam <span class="count">(%s)</span>', |
251 'Spam <span class="count">(%s)</span>', |
270 'Spam <span class="count">(%s)</span>', |
252 'comments' |
271 'comments' |
253 ), |
272 ), |
254 |
273 |
255 /* translators: %s: trashed comments count */ |
274 /* translators: %s: Number of comments. */ |
256 'trash' => _nx_noop( |
275 'trash' => _nx_noop( |
257 'Trash <span class="count">(%s)</span>', |
276 'Trash <span class="count">(%s)</span>', |
258 'Trash <span class="count">(%s)</span>', |
277 'Trash <span class="count">(%s)</span>', |
259 'comments' |
278 'comments' |
260 ), |
279 ), |
331 */ |
350 */ |
332 protected function get_bulk_actions() { |
351 protected function get_bulk_actions() { |
333 global $comment_status; |
352 global $comment_status; |
334 |
353 |
335 $actions = array(); |
354 $actions = array(); |
336 if ( in_array( $comment_status, array( 'all', 'approved' ) ) ) { |
355 if ( in_array( $comment_status, array( 'all', 'approved' ), true ) ) { |
337 $actions['unapprove'] = __( 'Unapprove' ); |
356 $actions['unapprove'] = __( 'Unapprove' ); |
338 } |
357 } |
339 if ( in_array( $comment_status, array( 'all', 'moderated' ) ) ) { |
358 if ( in_array( $comment_status, array( 'all', 'moderated' ), true ) ) { |
340 $actions['approve'] = __( 'Approve' ); |
359 $actions['approve'] = __( 'Approve' ); |
341 } |
360 } |
342 if ( in_array( $comment_status, array( 'all', 'moderated', 'approved', 'trash' ) ) ) { |
361 if ( in_array( $comment_status, array( 'all', 'moderated', 'approved', 'trash' ), true ) ) { |
343 $actions['spam'] = _x( 'Mark as Spam', 'comment' ); |
362 $actions['spam'] = _x( 'Mark as spam', 'comment' ); |
344 } |
363 } |
345 |
364 |
346 if ( 'trash' === $comment_status ) { |
365 if ( 'trash' === $comment_status ) { |
347 $actions['untrash'] = __( 'Restore' ); |
366 $actions['untrash'] = __( 'Restore' ); |
348 } elseif ( 'spam' === $comment_status ) { |
367 } elseif ( 'spam' === $comment_status ) { |
349 $actions['unspam'] = _x( 'Not Spam', 'comment' ); |
368 $actions['unspam'] = _x( 'Not spam', 'comment' ); |
350 } |
369 } |
351 |
370 |
352 if ( in_array( $comment_status, array( 'trash', 'spam' ) ) || ! EMPTY_TRASH_DAYS ) { |
371 if ( in_array( $comment_status, array( 'trash', 'spam' ), true ) || ! EMPTY_TRASH_DAYS ) { |
353 $actions['delete'] = __( 'Delete Permanently' ); |
372 $actions['delete'] = __( 'Delete permanently' ); |
354 } else { |
373 } else { |
355 $actions['trash'] = __( 'Move to Trash' ); |
374 $actions['trash'] = __( 'Move to Trash' ); |
356 } |
375 } |
357 |
376 |
358 return $actions; |
377 return $actions; |
369 static $has_items; |
388 static $has_items; |
370 |
389 |
371 if ( ! isset( $has_items ) ) { |
390 if ( ! isset( $has_items ) ) { |
372 $has_items = $this->has_items(); |
391 $has_items = $this->has_items(); |
373 } |
392 } |
374 ?> |
393 echo '<div class="alignleft actions">'; |
375 <div class="alignleft actions"> |
|
376 <?php |
|
377 if ( 'top' === $which ) { |
394 if ( 'top' === $which ) { |
378 ?> |
395 ob_start(); |
379 <label class="screen-reader-text" for="filter-by-comment-type"><?php _e( 'Filter by comment type' ); ?></label> |
396 |
380 <select id="filter-by-comment-type" name="comment_type"> |
397 $this->comment_status_dropdown( $comment_type ); |
381 <option value=""><?php _e( 'All comment types' ); ?></option> |
|
382 <?php |
|
383 /** |
|
384 * Filters the comment types dropdown menu. |
|
385 * |
|
386 * @since 2.7.0 |
|
387 * |
|
388 * @param string[] $comment_types An array of comment types. Accepts 'Comments', 'Pings'. |
|
389 */ |
|
390 $comment_types = apply_filters( |
|
391 'admin_comment_types_dropdown', |
|
392 array( |
|
393 'comment' => __( 'Comments' ), |
|
394 'pings' => __( 'Pings' ), |
|
395 ) |
|
396 ); |
|
397 |
|
398 foreach ( $comment_types as $type => $label ) { |
|
399 echo "\t" . '<option value="' . esc_attr( $type ) . '"' . selected( $comment_type, $type, false ) . ">$label</option>\n"; |
|
400 } |
|
401 ?> |
|
402 </select> |
|
403 <?php |
|
404 /** |
398 /** |
405 * Fires just before the Filter submit button for comment types. |
399 * Fires just before the Filter submit button for comment types. |
406 * |
400 * |
407 * @since 3.5.0 |
401 * @since 3.5.0 |
408 */ |
402 */ |
409 do_action( 'restrict_manage_comments' ); |
403 do_action( 'restrict_manage_comments' ); |
410 submit_button( __( 'Filter' ), '', 'filter_action', false, array( 'id' => 'post-query-submit' ) ); |
404 |
|
405 $output = ob_get_clean(); |
|
406 |
|
407 if ( ! empty( $output ) && $this->has_items() ) { |
|
408 echo $output; |
|
409 submit_button( esc_html__( 'Filter' ), '', 'filter_action', false, array( 'id' => 'post-query-submit' ) ); |
|
410 } |
411 } |
411 } |
412 |
412 |
413 if ( ( 'spam' === $comment_status || 'trash' === $comment_status ) && current_user_can( 'moderate_comments' ) && $has_items ) { |
413 if ( ( 'spam' === $comment_status || 'trash' === $comment_status ) && current_user_can( 'moderate_comments' ) && $has_items ) { |
414 wp_nonce_field( 'bulk-destroy', '_destroy_nonce' ); |
414 wp_nonce_field( 'bulk-destroy', '_destroy_nonce' ); |
415 $title = ( 'spam' === $comment_status ) ? esc_attr__( 'Empty Spam' ) : esc_attr__( 'Empty Trash' ); |
415 $title = ( 'spam' === $comment_status ) ? esc_attr__( 'Empty Spam' ) : esc_attr__( 'Empty Trash' ); |
614 'untrash' => '', |
676 'untrash' => '', |
615 'delete' => '', |
677 'delete' => '', |
616 ); |
678 ); |
617 |
679 |
618 // Not looking at all comments. |
680 // Not looking at all comments. |
619 if ( $comment_status && 'all' != $comment_status ) { |
681 if ( $comment_status && 'all' !== $comment_status ) { |
620 if ( 'approved' === $the_comment_status ) { |
682 if ( 'approved' === $the_comment_status ) { |
621 $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 aria-button-if-js' aria-label='" . esc_attr__( 'Unapprove this comment' ) . "'>" . __( 'Unapprove' ) . '</a>'; |
683 $actions['unapprove'] = sprintf( |
|
684 '<a href="%s" data-wp-lists="%s" class="vim-u vim-destructive aria-button-if-js" aria-label="%s">%s</a>', |
|
685 $unapprove_url, |
|
686 "delete:the-comment-list:comment-{$comment->comment_ID}:e7e7d3:action=dim-comment&new=unapproved", |
|
687 esc_attr__( 'Unapprove this comment' ), |
|
688 __( 'Unapprove' ) |
|
689 ); |
622 } elseif ( 'unapproved' === $the_comment_status ) { |
690 } elseif ( 'unapproved' === $the_comment_status ) { |
623 $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 aria-button-if-js' aria-label='" . esc_attr__( 'Approve this comment' ) . "'>" . __( 'Approve' ) . '</a>'; |
691 $actions['approve'] = sprintf( |
|
692 '<a href="%s" data-wp-lists="%s" class="vim-a vim-destructive aria-button-if-js" aria-label="%s">%s</a>', |
|
693 $approve_url, |
|
694 "delete:the-comment-list:comment-{$comment->comment_ID}:e7e7d3:action=dim-comment&new=approved", |
|
695 esc_attr__( 'Approve this comment' ), |
|
696 __( 'Approve' ) |
|
697 ); |
624 } |
698 } |
625 } else { |
699 } else { |
626 $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 aria-button-if-js' aria-label='" . esc_attr__( 'Approve this comment' ) . "'>" . __( 'Approve' ) . '</a>'; |
700 $actions['approve'] = sprintf( |
627 $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 aria-button-if-js' aria-label='" . esc_attr__( 'Unapprove this comment' ) . "'>" . __( 'Unapprove' ) . '</a>'; |
701 '<a href="%s" data-wp-lists="%s" class="vim-a aria-button-if-js" aria-label="%s">%s</a>', |
|
702 $approve_url, |
|
703 "dim:the-comment-list:comment-{$comment->comment_ID}:unapproved:e7e7d3:e7e7d3:new=approved", |
|
704 esc_attr__( 'Approve this comment' ), |
|
705 __( 'Approve' ) |
|
706 ); |
|
707 |
|
708 $actions['unapprove'] = sprintf( |
|
709 '<a href="%s" data-wp-lists="%s" class="vim-u aria-button-if-js" aria-label="%s">%s</a>', |
|
710 $unapprove_url, |
|
711 "dim:the-comment-list:comment-{$comment->comment_ID}:unapproved:e7e7d3:e7e7d3:new=unapproved", |
|
712 esc_attr__( 'Unapprove this comment' ), |
|
713 __( 'Unapprove' ) |
|
714 ); |
628 } |
715 } |
629 |
716 |
630 if ( 'spam' !== $the_comment_status ) { |
717 if ( 'spam' !== $the_comment_status ) { |
631 $actions['spam'] = "<a href='$spam_url' data-wp-lists='delete:the-comment-list:comment-$comment->comment_ID::spam=1' class='vim-s vim-destructive aria-button-if-js' aria-label='" . esc_attr__( 'Mark this comment as spam' ) . "'>" . /* translators: mark as spam link */ _x( 'Spam', 'verb' ) . '</a>'; |
718 $actions['spam'] = sprintf( |
|
719 '<a href="%s" data-wp-lists="%s" class="vim-s vim-destructive aria-button-if-js" aria-label="%s">%s</a>', |
|
720 $spam_url, |
|
721 "delete:the-comment-list:comment-{$comment->comment_ID}::spam=1", |
|
722 esc_attr__( 'Mark this comment as spam' ), |
|
723 /* translators: "Mark as spam" link. */ |
|
724 _x( 'Spam', 'verb' ) |
|
725 ); |
632 } elseif ( 'spam' === $the_comment_status ) { |
726 } elseif ( 'spam' === $the_comment_status ) { |
633 $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 aria-button-if-js' aria-label='" . esc_attr__( 'Restore this comment from the spam' ) . "'>" . _x( 'Not Spam', 'comment' ) . '</a>'; |
727 $actions['unspam'] = sprintf( |
|
728 '<a href="%s" data-wp-lists="%s" class="vim-z vim-destructive aria-button-if-js" aria-label="%s">%s</a>', |
|
729 $unspam_url, |
|
730 "delete:the-comment-list:comment-{$comment->comment_ID}:66cc66:unspam=1", |
|
731 esc_attr__( 'Restore this comment from the spam' ), |
|
732 _x( 'Not Spam', 'comment' ) |
|
733 ); |
634 } |
734 } |
635 |
735 |
636 if ( 'trash' === $the_comment_status ) { |
736 if ( 'trash' === $the_comment_status ) { |
637 $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 aria-button-if-js' aria-label='" . esc_attr__( 'Restore this comment from the Trash' ) . "'>" . __( 'Restore' ) . '</a>'; |
737 $actions['untrash'] = sprintf( |
|
738 '<a href="%s" data-wp-lists="%s" class="vim-z vim-destructive aria-button-if-js" aria-label="%s">%s</a>', |
|
739 $untrash_url, |
|
740 "delete:the-comment-list:comment-{$comment->comment_ID}:66cc66:untrash=1", |
|
741 esc_attr__( 'Restore this comment from the Trash' ), |
|
742 __( 'Restore' ) |
|
743 ); |
638 } |
744 } |
639 |
745 |
640 if ( 'spam' === $the_comment_status || 'trash' === $the_comment_status || ! EMPTY_TRASH_DAYS ) { |
746 if ( 'spam' === $the_comment_status || 'trash' === $the_comment_status || ! EMPTY_TRASH_DAYS ) { |
641 $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 aria-button-if-js' aria-label='" . esc_attr__( 'Delete this comment permanently' ) . "'>" . __( 'Delete Permanently' ) . '</a>'; |
747 $actions['delete'] = sprintf( |
|
748 '<a href="%s" data-wp-lists="%s" class="delete vim-d vim-destructive aria-button-if-js" aria-label="%s">%s</a>', |
|
749 $delete_url, |
|
750 "delete:the-comment-list:comment-{$comment->comment_ID}::delete=1", |
|
751 esc_attr__( 'Delete this comment permanently' ), |
|
752 __( 'Delete Permanently' ) |
|
753 ); |
642 } else { |
754 } else { |
643 $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 aria-button-if-js' aria-label='" . esc_attr__( 'Move this comment to the Trash' ) . "'>" . _x( 'Trash', 'verb' ) . '</a>'; |
755 $actions['trash'] = sprintf( |
|
756 '<a href="%s" data-wp-lists="%s" class="delete vim-d vim-destructive aria-button-if-js" aria-label="%s">%s</a>', |
|
757 $trash_url, |
|
758 "delete:the-comment-list:comment-{$comment->comment_ID}::trash=1", |
|
759 esc_attr__( 'Move this comment to the Trash' ), |
|
760 _x( 'Trash', 'verb' ) |
|
761 ); |
644 } |
762 } |
645 |
763 |
646 if ( 'spam' !== $the_comment_status && 'trash' !== $the_comment_status ) { |
764 if ( 'spam' !== $the_comment_status && 'trash' !== $the_comment_status ) { |
647 $actions['edit'] = "<a href='comment.php?action=editcomment&c={$comment->comment_ID}' aria-label='" . esc_attr__( 'Edit this comment' ) . "'>" . __( 'Edit' ) . '</a>'; |
765 $actions['edit'] = sprintf( |
|
766 '<a href="%s" aria-label="%s">%s</a>', |
|
767 "comment.php?action=editcomment&c={$comment->comment_ID}", |
|
768 esc_attr__( 'Edit this comment' ), |
|
769 __( 'Edit' ) |
|
770 ); |
648 |
771 |
649 $format = '<button type="button" data-comment-id="%d" data-post-id="%d" data-action="%s" class="%s button-link" aria-expanded="false" aria-label="%s">%s</button>'; |
772 $format = '<button type="button" data-comment-id="%d" data-post-id="%d" data-action="%s" class="%s button-link" aria-expanded="false" aria-label="%s">%s</button>'; |
650 |
773 |
651 $actions['quickedit'] = sprintf( $format, $comment->comment_ID, $comment->comment_post_ID, 'edit', 'vim-q comment-inline', esc_attr__( 'Quick edit this comment inline' ), __( 'Quick Edit' ) ); |
774 $actions['quickedit'] = sprintf( |
652 |
775 $format, |
653 $actions['reply'] = sprintf( $format, $comment->comment_ID, $comment->comment_post_ID, 'replyto', 'vim-r comment-inline', esc_attr__( 'Reply to this comment' ), __( 'Reply' ) ); |
776 $comment->comment_ID, |
|
777 $comment->comment_post_ID, |
|
778 'edit', |
|
779 'vim-q comment-inline', |
|
780 esc_attr__( 'Quick edit this comment inline' ), |
|
781 __( 'Quick Edit' ) |
|
782 ); |
|
783 |
|
784 $actions['reply'] = sprintf( |
|
785 $format, |
|
786 $comment->comment_ID, |
|
787 $comment->comment_post_ID, |
|
788 'replyto', |
|
789 'vim-r comment-inline', |
|
790 esc_attr__( 'Reply to this comment' ), |
|
791 __( 'Reply' ) |
|
792 ); |
654 } |
793 } |
655 |
794 |
656 /** This filter is documented in wp-admin/includes/dashboard.php */ |
795 /** This filter is documented in wp-admin/includes/dashboard.php */ |
657 $actions = apply_filters( 'comment_row_actions', array_filter( $actions ), $comment ); |
796 $actions = apply_filters( 'comment_row_actions', array_filter( $actions ), $comment ); |
658 |
797 |
659 $i = 0; |
798 $always_visible = false; |
660 $out .= '<div class="row-actions">'; |
799 |
|
800 $mode = get_user_setting( 'posts_list_mode', 'list' ); |
|
801 |
|
802 if ( 'excerpt' === $mode ) { |
|
803 $always_visible = true; |
|
804 } |
|
805 |
|
806 $out .= '<div class="' . ( $always_visible ? 'row-actions visible' : 'row-actions' ) . '">'; |
|
807 |
|
808 $i = 0; |
|
809 |
661 foreach ( $actions as $action => $link ) { |
810 foreach ( $actions as $action => $link ) { |
662 ++$i; |
811 ++$i; |
663 ( ( ( 'approve' === $action || 'unapprove' === $action ) && 2 === $i ) || 1 === $i ) ? $sep = '' : $sep = ' | '; |
812 |
664 |
813 if ( ( ( 'approve' === $action || 'unapprove' === $action ) && 2 === $i ) |
665 // Reply and quickedit need a hide-if-no-js span when not added with ajax |
814 || 1 === $i |
|
815 ) { |
|
816 $sep = ''; |
|
817 } else { |
|
818 $sep = ' | '; |
|
819 } |
|
820 |
|
821 // Reply and quickedit need a hide-if-no-js span when not added with Ajax. |
666 if ( ( 'reply' === $action || 'quickedit' === $action ) && ! wp_doing_ajax() ) { |
822 if ( ( 'reply' === $action || 'quickedit' === $action ) && ! wp_doing_ajax() ) { |
667 $action .= ' hide-if-no-js'; |
823 $action .= ' hide-if-no-js'; |
668 } elseif ( ( $action === 'untrash' && $the_comment_status === 'trash' ) || ( $action === 'unspam' && $the_comment_status === 'spam' ) ) { |
824 } elseif ( ( 'untrash' === $action && 'trash' === $the_comment_status ) |
|
825 || ( 'unspam' === $action && 'spam' === $the_comment_status ) |
|
826 ) { |
669 if ( '1' == get_comment_meta( $comment->comment_ID, '_wp_trash_meta_status', true ) ) { |
827 if ( '1' == get_comment_meta( $comment->comment_ID, '_wp_trash_meta_status', true ) ) { |
670 $action .= ' approve'; |
828 $action .= ' approve'; |
671 } else { |
829 } else { |
672 $action .= ' unapprove'; |
830 $action .= ' unapprove'; |
673 } |
831 } |
674 } |
832 } |
675 |
833 |
676 $out .= "<span class='$action'>$sep$link</span>"; |
834 $out .= "<span class='$action'>$sep$link</span>"; |
677 } |
835 } |
|
836 |
678 $out .= '</div>'; |
837 $out .= '</div>'; |
679 |
838 |
680 $out .= '<button type="button" class="toggle-row"><span class="screen-reader-text">' . __( 'Show more details' ) . '</span></button>'; |
839 $out .= '<button type="button" class="toggle-row"><span class="screen-reader-text">' . __( 'Show more details' ) . '</span></button>'; |
681 |
840 |
682 return $out; |
841 return $out; |
817 } |
977 } |
818 |
978 |
819 if ( isset( $this->pending_count[ $post->ID ] ) ) { |
979 if ( isset( $this->pending_count[ $post->ID ] ) ) { |
820 $pending_comments = $this->pending_count[ $post->ID ]; |
980 $pending_comments = $this->pending_count[ $post->ID ]; |
821 } else { |
981 } else { |
822 $_pending_count_temp = get_pending_comments_num( array( $post->ID ) ); |
982 $_pending_count_temp = get_pending_comments_num( array( $post->ID ) ); |
823 $pending_comments = $this->pending_count[ $post->ID ] = $_pending_count_temp[ $post->ID ]; |
983 $pending_comments = $_pending_count_temp[ $post->ID ]; |
|
984 $this->pending_count[ $post->ID ] = $pending_comments; |
824 } |
985 } |
825 |
986 |
826 if ( current_user_can( 'edit_post', $post->ID ) ) { |
987 if ( current_user_can( 'edit_post', $post->ID ) ) { |
827 $post_link = "<a href='" . get_edit_post_link( $post->ID ) . "' class='comments-edit-item-link'>"; |
988 $post_link = "<a href='" . get_edit_post_link( $post->ID ) . "' class='comments-edit-item-link'>"; |
828 $post_link .= esc_html( get_the_title( $post->ID ) ) . '</a>'; |
989 $post_link .= esc_html( get_the_title( $post->ID ) ) . '</a>'; |
829 } else { |
990 } else { |
830 $post_link = esc_html( get_the_title( $post->ID ) ); |
991 $post_link = esc_html( get_the_title( $post->ID ) ); |
831 } |
992 } |
832 |
993 |
833 echo '<div class="response-links">'; |
994 echo '<div class="response-links">'; |
834 if ( 'attachment' === $post->post_type && ( $thumb = wp_get_attachment_image( $post->ID, array( 80, 60 ), true ) ) ) { |
995 if ( 'attachment' === $post->post_type ) { |
835 echo $thumb; |
996 $thumb = wp_get_attachment_image( $post->ID, array( 80, 60 ), true ); |
|
997 if ( $thumb ) { |
|
998 echo $thumb; |
|
999 } |
836 } |
1000 } |
837 echo $post_link; |
1001 echo $post_link; |
838 $post_type_object = get_post_type_object( $post->post_type ); |
1002 $post_type_object = get_post_type_object( $post->post_type ); |
839 echo "<a href='" . get_permalink( $post->ID ) . "' class='comments-view-item-link'>" . $post_type_object->labels->view_item . '</a>'; |
1003 echo "<a href='" . get_permalink( $post->ID ) . "' class='comments-view-item-link'>" . $post_type_object->labels->view_item . '</a>'; |
840 echo '<span class="post-com-count-wrapper post-com-count-', $post->ID, '">'; |
1004 echo '<span class="post-com-count-wrapper post-com-count-', $post->ID, '">'; |