wp/wp-admin/includes/class-wp-ms-themes-list-table.php
changeset 21 48c4eec2b7e6
parent 19 3d72ae0968f4
child 22 8c2e4d02f4ef
--- a/wp/wp-admin/includes/class-wp-ms-themes-list-table.php	Thu Sep 29 08:06:27 2022 +0200
+++ b/wp/wp-admin/includes/class-wp-ms-themes-list-table.php	Fri Sep 05 18:40:08 2025 +0200
@@ -11,7 +11,6 @@
  * Core class used to implement displaying themes in a list table for the network admin.
  *
  * @since 3.1.0
- * @access private
  *
  * @see WP_List_Table
  */
@@ -100,7 +99,9 @@
 	public function prepare_items() {
 		global $status, $totals, $page, $orderby, $order, $s;
 
-		wp_reset_vars( array( 'orderby', 'order', 's' ) );
+		$orderby = ! empty( $_REQUEST['orderby'] ) ? sanitize_text_field( $_REQUEST['orderby'] ) : '';
+		$order   = ! empty( $_REQUEST['order'] ) ? sanitize_text_field( $_REQUEST['order'] ) : '';
+		$s       = ! empty( $_REQUEST['s'] ) ? sanitize_text_field( $_REQUEST['s'] ) : '';
 
 		$themes = array(
 			/**
@@ -323,7 +324,7 @@
 	}
 
 	/**
-	 * @return array
+	 * @return string[] Array of column titles keyed by their column name.
 	 */
 	public function get_columns() {
 		$columns = array(
@@ -344,7 +345,7 @@
 	 */
 	protected function get_sortable_columns() {
 		return array(
-			'name' => 'name',
+			'name' => array( 'name', false, __( 'Theme' ), __( 'Table ordered by Theme Name.' ), 'asc' ),
 		);
 	}
 
@@ -444,16 +445,15 @@
 			}
 
 			if ( 'search' !== $type ) {
-				$status_links[ $type ] = sprintf(
-					"<a href='%s'%s>%s</a>",
-					esc_url( add_query_arg( 'theme_status', $type, $url ) ),
-					( $type === $status ) ? ' class="current" aria-current="page"' : '',
-					sprintf( $text, number_format_i18n( $count ) )
+				$status_links[ $type ] = array(
+					'url'     => esc_url( add_query_arg( 'theme_status', $type, $url ) ),
+					'label'   => sprintf( $text, number_format_i18n( $count ) ),
+					'current' => $type === $status,
 				);
 			}
 		}
 
-		return $status_links;
+		return $this->get_views_links( $status_links );
 	}
 
 	/**
@@ -511,11 +511,22 @@
 	 */
 	public function column_cb( $item ) {
 		// Restores the more descriptive, specific name for use within this method.
-		$theme       = $item;
+		$theme = $item;
+
 		$checkbox_id = 'checkbox_' . md5( $theme->get( 'Name' ) );
 		?>
 		<input type="checkbox" name="checked[]" value="<?php echo esc_attr( $theme->get_stylesheet() ); ?>" id="<?php echo $checkbox_id; ?>" />
-		<label class="screen-reader-text" for="<?php echo $checkbox_id; ?>" ><?php _e( 'Select' ); ?>  <?php echo $theme->display( 'Name' ); ?></label>
+		<label for="<?php echo $checkbox_id; ?>" >
+			<span class="screen-reader-text">
+			<?php
+			printf(
+				/* translators: Hidden accessibility text. %s: Theme name */
+				__( 'Select %s' ),
+				$theme->display( 'Name' )
+			);
+			?>
+			</span>
+		</label>
 		<?php
 	}
 
@@ -851,7 +862,13 @@
 		 */
 		echo apply_filters( 'theme_auto_update_setting_html', $html, $stylesheet, $theme );
 
-		echo '<div class="notice notice-error notice-alt inline hidden"><p></p></div>';
+		wp_admin_notice(
+			'',
+			array(
+				'type'               => 'error',
+				'additional_classes' => array( 'notice-alt', 'inline', 'hidden' ),
+			)
+		);
 	}
 
 	/**
@@ -864,6 +881,11 @@
 	 * @param string   $column_name The current column name.
 	 */
 	public function column_default( $item, $column_name ) {
+		// Restores the more descriptive, specific name for use within this method.
+		$theme = $item;
+
+		$stylesheet = $theme->get_stylesheet();
+
 		/**
 		 * Fires inside each custom column of the Multisite themes list table.
 		 *
@@ -873,12 +895,7 @@
 		 * @param string   $stylesheet  Directory name of the theme.
 		 * @param WP_Theme $theme       Current WP_Theme object.
 		 */
-		do_action(
-			'manage_themes_custom_column',
-			$column_name,
-			$item->get_stylesheet(), // Directory name of the theme.
-			$item // Theme object.
-		);
+		do_action( 'manage_themes_custom_column', $column_name, $stylesheet, $theme );
 	}
 
 	/**