Skip to content

Commit 91be813

Browse files
Docs: Improve docblocks in WP_Comments_List_Table.
Adds missing summary descriptions and improves and tags in to comply with WordPress coding standards.
1 parent 2f9b1d2 commit 91be813

File tree

1 file changed

+46
-10
lines changed

1 file changed

+46
-10
lines changed

src/wp-admin/includes/class-wp-comments-list-table.php

Lines changed: 46 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -70,13 +70,17 @@ public function floated_admin_avatar( $name, $comment_id ) {
7070
}
7171

7272
/**
73-
* @return bool
73+
* Checks if the user can edit posts.
74+
*
75+
* @return bool Whether the user can edit posts.
7476
*/
7577
public function ajax_user_can() {
7678
return current_user_can( 'edit_posts' );
7779
}
7880

7981
/**
82+
* Prepares the comments list items.
83+
*
8084
* @global string $mode List table view mode.
8185
* @global int $post_id
8286
* @global string $comment_status
@@ -198,8 +202,10 @@ public function prepare_items() {
198202
}
199203

200204
/**
201-
* @param string $comment_status
202-
* @return int
205+
* Gets the number of comments to display per page.
206+
*
207+
* @param string $comment_status Comment status.
208+
* @return int Comments per page.
203209
*/
204210
public function get_per_page( $comment_status = 'all' ) {
205211
$comments_per_page = $this->get_items_per_page( 'edit_comments_per_page' );
@@ -216,6 +222,8 @@ public function get_per_page( $comment_status = 'all' ) {
216222
}
217223

218224
/**
225+
* Displays a message when no comments are found.
226+
*
219227
* @global string $comment_status
220228
*/
221229
public function no_items() {
@@ -231,9 +239,13 @@ public function no_items() {
231239
}
232240

233241
/**
234-
* @global int $post_id
242+
* Returns an array of comment status links.
243+
*
244+
* @global int $post_id
235245
* @global string $comment_status
236246
* @global string $comment_type
247+
*
248+
* @return string[] Array of comment status links.
237249
*/
238250
protected function get_views() {
239251
global $post_id, $comment_status, $comment_type;
@@ -354,9 +366,11 @@ protected function get_views() {
354366
}
355367

356368
/**
357-
* @global string $comment_status
369+
* Gets the available bulk actions for the comments list.
358370
*
359-
* @return array
371+
* @global string $comment_status Current comment status filter.
372+
*
373+
* @return array List of bulk action labels keyed by action name.
360374
*/
361375
protected function get_bulk_actions() {
362376
global $comment_status;
@@ -395,10 +409,12 @@ protected function get_bulk_actions() {
395409
}
396410

397411
/**
412+
* Displays extra controls between bulk actions and pagination.
413+
*
398414
* @global string $comment_status
399415
* @global string $comment_type
400416
*
401-
* @param string $which
417+
* @param string $which The location of the extra table nav markup: Either 'top' or 'bottom'.
402418
*/
403419
protected function extra_tablenav( $which ) {
404420
global $comment_status, $comment_type;
@@ -453,7 +469,9 @@ protected function extra_tablenav( $which ) {
453469
}
454470

455471
/**
456-
* @return string|false
472+
* Gets the current action selected from the bulk actions dropdown.
473+
*
474+
* @return string|false Current action or false if none.
457475
*/
458476
public function current_action() {
459477
if ( isset( $_REQUEST['delete_all'] ) || isset( $_REQUEST['delete_all2'] ) ) {
@@ -464,6 +482,8 @@ public function current_action() {
464482
}
465483

466484
/**
485+
* Gets the list of columns.
486+
*
467487
* @global int $post_id
468488
*
469489
* @return string[] Array of column titles keyed by their column name.
@@ -547,7 +567,9 @@ protected function comment_type_dropdown( $comment_type ) {
547567
}
548568

549569
/**
550-
* @return array
570+
* Gets a list of sortable columns.
571+
*
572+
* @return array An associative array containing the sortable columns.
551573
*/
552574
protected function get_sortable_columns() {
553575
return array(
@@ -638,10 +660,12 @@ public function display() {
638660
}
639661

640662
/**
663+
* Generates content for a single row of the table.
664+
*
641665
* @global WP_Post $post Global post object.
642666
* @global WP_Comment $comment Global comment object.
643667
*
644-
* @param WP_Comment $item
668+
* @param WP_Comment $item The comment object.
645669
*/
646670
public function single_row( $item ) {
647671
global $post, $comment;
@@ -917,6 +941,8 @@ protected function handle_row_actions( $item, $column_name, $primary ) {
917941
}
918942

919943
/**
944+
* Outputs the checkbox column.
945+
*
920946
* @since 5.9.0 Renamed `$comment` to `$item` to match parent class for PHP 8 named parameter support.
921947
*
922948
* @param WP_Comment $item The comment object.
@@ -941,6 +967,8 @@ public function column_cb( $item ) {
941967
}
942968

943969
/**
970+
* Outputs the comment column.
971+
*
944972
* @param WP_Comment $comment The comment object.
945973
*/
946974
public function column_comment( $comment ) {
@@ -980,6 +1008,8 @@ public function column_comment( $comment ) {
9801008
}
9811009

9821010
/**
1011+
* Outputs the author column.
1012+
*
9831013
* @global string $comment_status
9841014
*
9851015
* @param WP_Comment $comment The comment object.
@@ -1039,6 +1069,8 @@ public function column_author( $comment ) {
10391069
}
10401070

10411071
/**
1072+
* Outputs the date column.
1073+
*
10421074
* @param WP_Comment $comment The comment object.
10431075
*/
10441076
public function column_date( $comment ) {
@@ -1067,6 +1099,8 @@ public function column_date( $comment ) {
10671099
}
10681100

10691101
/**
1102+
* Outputs the response column.
1103+
*
10701104
* @param WP_Comment $comment The comment object.
10711105
*/
10721106
public function column_response( $comment ) {
@@ -1113,6 +1147,8 @@ public function column_response( $comment ) {
11131147
}
11141148

11151149
/**
1150+
* Outputs the default column.
1151+
*
11161152
* @since 5.9.0 Renamed `$comment` to `$item` to match parent class for PHP 8 named parameter support.
11171153
*
11181154
* @param WP_Comment $item The comment object.

0 commit comments

Comments
 (0)