649 |
649 |
650 /** |
650 /** |
651 * Generate and display row actions links. |
651 * Generate and display row actions links. |
652 * |
652 * |
653 * @since 4.3.0 |
653 * @since 4.3.0 |
|
654 * @since 5.9.0 Renamed `$comment` to `$item` to match parent class for PHP 8 named parameter support. |
654 * |
655 * |
655 * @global string $comment_status Status for the current listed comments. |
656 * @global string $comment_status Status for the current listed comments. |
656 * |
657 * |
657 * @param WP_Comment $comment The comment object. |
658 * @param WP_Comment $item The comment object. |
658 * @param string $column_name Current column name. |
659 * @param string $column_name Current column name. |
659 * @param string $primary Primary column name. |
660 * @param string $primary Primary column name. |
660 * @return string Row actions output for comments. An empty string |
661 * @return string Row actions output for comments. An empty string |
661 * if the current column is not the primary column, |
662 * if the current column is not the primary column, |
662 * or if the current user cannot edit the comment. |
663 * or if the current user cannot edit the comment. |
663 */ |
664 */ |
664 protected function handle_row_actions( $comment, $column_name, $primary ) { |
665 protected function handle_row_actions( $item, $column_name, $primary ) { |
665 global $comment_status; |
666 global $comment_status; |
666 |
667 |
667 if ( $primary !== $column_name ) { |
668 if ( $primary !== $column_name ) { |
668 return ''; |
669 return ''; |
669 } |
670 } |
670 |
671 |
671 if ( ! $this->user_can ) { |
672 if ( ! $this->user_can ) { |
672 return ''; |
673 return ''; |
673 } |
674 } |
674 |
675 |
|
676 // Restores the more descriptive, specific name for use within this method. |
|
677 $comment = $item; |
675 $the_comment_status = wp_get_comment_status( $comment ); |
678 $the_comment_status = wp_get_comment_status( $comment ); |
676 |
679 |
677 $out = ''; |
680 $out = ''; |
678 |
681 |
679 $del_nonce = esc_html( '_wpnonce=' . wp_create_nonce( "delete-comment_$comment->comment_ID" ) ); |
682 $del_nonce = esc_html( '_wpnonce=' . wp_create_nonce( "delete-comment_$comment->comment_ID" ) ); |
866 |
869 |
867 return $out; |
870 return $out; |
868 } |
871 } |
869 |
872 |
870 /** |
873 /** |
871 * @param WP_Comment $comment The comment object. |
874 * @since 5.9.0 Renamed `$comment` to `$item` to match parent class for PHP 8 named parameter support. |
872 */ |
875 * |
873 public function column_cb( $comment ) { |
876 * @param WP_Comment $item The comment object. |
|
877 */ |
|
878 public function column_cb( $item ) { |
|
879 // Restores the more descriptive, specific name for use within this method. |
|
880 $comment = $item; |
|
881 |
874 if ( $this->user_can ) { |
882 if ( $this->user_can ) { |
875 ?> |
883 ?> |
876 <label class="screen-reader-text" for="cb-select-<?php echo $comment->comment_ID; ?>"><?php _e( 'Select comment' ); ?></label> |
884 <label class="screen-reader-text" for="cb-select-<?php echo $comment->comment_ID; ?>"><?php _e( 'Select comment' ); ?></label> |
877 <input id="cb-select-<?php echo $comment->comment_ID; ?>" type="checkbox" name="delete_comments[]" value="<?php echo $comment->comment_ID; ?>" /> |
885 <input id="cb-select-<?php echo $comment->comment_ID; ?>" type="checkbox" name="delete_comments[]" value="<?php echo $comment->comment_ID; ?>" /> |
878 <?php |
886 <?php |
909 ?> |
917 ?> |
910 <div id="inline-<?php echo $comment->comment_ID; ?>" class="hidden"> |
918 <div id="inline-<?php echo $comment->comment_ID; ?>" class="hidden"> |
911 <textarea class="comment" rows="1" cols="1"><?php echo esc_textarea( $comment_content ); ?></textarea> |
919 <textarea class="comment" rows="1" cols="1"><?php echo esc_textarea( $comment_content ); ?></textarea> |
912 <div class="author-email"><?php echo esc_attr( $comment->comment_author_email ); ?></div> |
920 <div class="author-email"><?php echo esc_attr( $comment->comment_author_email ); ?></div> |
913 <div class="author"><?php echo esc_attr( $comment->comment_author ); ?></div> |
921 <div class="author"><?php echo esc_attr( $comment->comment_author ); ?></div> |
914 <div class="author-url"><?php echo esc_attr( $comment->comment_author_url ); ?></div> |
922 <div class="author-url"><?php echo esc_url( $comment->comment_author_url ); ?></div> |
915 <div class="comment_status"><?php echo $comment->comment_approved; ?></div> |
923 <div class="comment_status"><?php echo $comment->comment_approved; ?></div> |
916 </div> |
924 </div> |
917 <?php |
925 <?php |
918 } |
926 } |
919 } |
927 } |
937 echo '<strong>'; |
945 echo '<strong>'; |
938 comment_author( $comment ); |
946 comment_author( $comment ); |
939 echo '</strong><br />'; |
947 echo '</strong><br />'; |
940 |
948 |
941 if ( ! empty( $author_url_display ) ) { |
949 if ( ! empty( $author_url_display ) ) { |
942 printf( '<a href="%s">%s</a><br />', esc_url( $author_url ), esc_html( $author_url_display ) ); |
950 // Print link to author URL, and disallow referrer information (without using target="_blank"). |
|
951 printf( |
|
952 '<a href="%s" rel="noopener noreferrer">%s</a><br />', |
|
953 esc_url( $author_url ), |
|
954 esc_html( $author_url_display ) |
|
955 ); |
943 } |
956 } |
944 |
957 |
945 if ( $this->user_can ) { |
958 if ( $this->user_can ) { |
946 if ( ! empty( $comment->comment_author_email ) ) { |
959 if ( ! empty( $comment->comment_author_email ) ) { |
947 /** This filter is documented in wp-includes/comment-template.php */ |
960 /** This filter is documented in wp-includes/comment-template.php */ |
1045 |
1058 |
1046 echo '</div>'; |
1059 echo '</div>'; |
1047 } |
1060 } |
1048 |
1061 |
1049 /** |
1062 /** |
1050 * @param WP_Comment $comment The comment object. |
1063 * @since 5.9.0 Renamed `$comment` to `$item` to match parent class for PHP 8 named parameter support. |
|
1064 * |
|
1065 * @param WP_Comment $item The comment object. |
1051 * @param string $column_name The custom column's name. |
1066 * @param string $column_name The custom column's name. |
1052 */ |
1067 */ |
1053 public function column_default( $comment, $column_name ) { |
1068 public function column_default( $item, $column_name ) { |
1054 /** |
1069 /** |
1055 * Fires when the default column output is displayed for a single row. |
1070 * Fires when the default column output is displayed for a single row. |
1056 * |
1071 * |
1057 * @since 2.8.0 |
1072 * @since 2.8.0 |
1058 * |
1073 * |
1059 * @param string $column_name The custom column's name. |
1074 * @param string $column_name The custom column's name. |
1060 * @param int $comment_id The custom column's unique ID number. |
1075 * @param string $comment_id The comment ID as a numeric string. |
1061 */ |
1076 */ |
1062 do_action( 'manage_comments_custom_column', $column_name, $comment->comment_ID ); |
1077 do_action( 'manage_comments_custom_column', $column_name, $item->comment_ID ); |
1063 } |
1078 } |
1064 } |
1079 } |