Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
89 changes: 56 additions & 33 deletions src/wp-admin/includes/class-wp-ms-themes-list-table.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@ class WP_MS_Themes_List_Table extends WP_List_Table {
*
* @see WP_List_Table::__construct() for more information on default arguments.
*
* @global string $status
* @global int $page
* @global string $status The current theme status.
* @global int $page The current page number.
*
* @param array $args An associative array of arguments.
*/
Expand Down Expand Up @@ -70,15 +70,19 @@ public function __construct( $args = array() ) {
}

/**
* @return array
* Gets the list of CSS classes for the table tag.
*
* @return string[] The list of CSS classes.
*/
protected function get_table_classes() {
// @todo Remove and add CSS for .themes.
return array( 'widefat', 'plugins' );
}

/**
* @return bool
* Checks if the current user has permissions to perform AJAX actions.
*
* @return bool True if the current user has permissions, false otherwise.
*/
public function ajax_user_can() {
if ( $this->is_site_themes ) {
Expand All @@ -89,12 +93,14 @@ public function ajax_user_can() {
}

/**
* @global string $status
* @global array $totals
* @global int $page
* @global string $orderby
* @global string $order
* @global string $s
* Prepares the themes list for display.
*
* @global string $status The current theme status.
* @global array<string, int> $totals An array of theme counts for each status.
* @global int $page The current page number.
* @global string $orderby The column to order the themes list by.
* @global string $order The order of the themes list (ASC or DESC).
* @global string $s The search string.
*/
public function prepare_items() {
global $status, $totals, $page, $orderby, $order, $s;
Expand Down Expand Up @@ -261,8 +267,10 @@ public function prepare_items() {
}

/**
* @param WP_Theme $theme
* @return bool
* Helper to filter themes by search term.
*
* @param WP_Theme $theme The WP_Theme object to check.
* @return bool True if the theme matches the search term, false otherwise.
*/
public function _search_callback( $theme ) {
static $term = null;
Expand Down Expand Up @@ -290,11 +298,14 @@ public function _search_callback( $theme ) {

// Not used by any core columns.
/**
* @global string $orderby
* @global string $order
* @param array $theme_a
* @param array $theme_b
* @return int
* Helper to sort themes by a specific field.
*
* @global string $orderby The column to order the themes list by.
* @global string $order The order of the themes list (ASC or DESC).
*
* @param array<string, mixed> $theme_a The first theme to compare.
* @param array<string, mixed> $theme_b The second theme to compare.
* @return int 0 if equal, -1 if the first is less than the second, 1 if more.
*/
public function _order_callback( $theme_a, $theme_b ) {
global $orderby, $order;
Expand All @@ -308,6 +319,7 @@ public function _order_callback( $theme_a, $theme_b ) {
}

/**
* Displays the message to be displayed when there are no items to list.
*/
public function no_items() {
if ( $this->has_items ) {
Expand All @@ -318,6 +330,8 @@ public function no_items() {
}

/**
* Gets the list of columns for the list table.
*
* @return string[] Array of column titles keyed by their column name.
*/
public function get_columns() {
Expand All @@ -335,7 +349,9 @@ public function get_columns() {
}

/**
* @return array
* Gets the list of sortable columns for the list table.
*
* @return array<string, array<int, mixed>> An array of sortable columns.
*/
protected function get_sortable_columns() {
return array(
Expand All @@ -355,9 +371,12 @@ protected function get_primary_column_name() {
}

/**
* @global array $totals
* @global string $status
* @return array
* Gets the list of views (statuses) for the list table.
*
* @global array<string, int> $totals An array of theme counts for each status.
* @global string $status The current theme status.
*
* @return array<string, string> The list of views.
*/
protected function get_views() {
global $totals, $status;
Expand Down Expand Up @@ -451,9 +470,11 @@ protected function get_views() {
}

/**
* @global string $status
* Gets the list of bulk actions for the list table.
*
* @global string $status The current theme status.
*
* @return array
* @return array<string, string> The list of bulk actions.
*/
protected function get_bulk_actions() {
global $status;
Expand Down Expand Up @@ -532,9 +553,9 @@ public function column_cb( $item ) {
*
* @since 4.3.0
*
* @global string $status
* @global int $page
* @global string $s
* @global string $status The current theme status.
* @global int $page The current page number.
* @global string $s The search string.
*
* @param WP_Theme $theme The current WP_Theme object.
*/
Expand Down Expand Up @@ -689,8 +710,8 @@ public function column_name( $theme ) {
*
* @since 4.3.0
*
* @global string $status
* @global array $totals
* @global string $status The current theme status.
* @global array<string, int> $totals An array of theme counts for each status.
*
* @param WP_Theme $theme The current WP_Theme object.
*/
Expand Down Expand Up @@ -777,8 +798,8 @@ public function column_description( $theme ) {
*
* @since 5.5.0
*
* @global string $status
* @global int $page
* @global string $status The current theme status.
* @global int $page The current page number.
*
* @param WP_Theme $theme The current WP_Theme object.
*/
Expand Down Expand Up @@ -979,10 +1000,12 @@ public function single_row_columns( $item ) {
}

/**
* @global string $status
* @global array $totals
* Handles the output for a single table row.
*
* @global string $status The current theme status.
* @global array<string, int> $totals An array of theme counts for each status.
*
* @param WP_Theme $theme
* @param WP_Theme $theme The current WP_Theme object.
*/
public function single_row( $theme ) {
global $status, $totals;
Expand Down
Loading