wp/wp-admin/includes/class-wp-theme-install-list-table.php
changeset 16 a86126ab1dd4
parent 9 177826044cd9
child 18 be944660c56a
--- a/wp/wp-admin/includes/class-wp-theme-install-list-table.php	Tue Oct 22 16:11:46 2019 +0200
+++ b/wp/wp-admin/includes/class-wp-theme-install-list-table.php	Tue Dec 15 13:49:49 2020 +0100
@@ -34,7 +34,7 @@
 	 * @global array  $theme_field_defaults
 	 */
 	public function prepare_items() {
-		include( ABSPATH . 'wp-admin/includes/theme-install.php' );
+		require ABSPATH . 'wp-admin/includes/theme-install.php';
 
 		global $tabs, $tab, $paged, $type, $theme_field_defaults;
 		wp_reset_vars( array( 'tab' ) );
@@ -82,7 +82,7 @@
 		$nonmenu_tabs = apply_filters( 'install_themes_nonmenu_tabs', $nonmenu_tabs );
 
 		// If a non-valid menu tab has been selected, And it's not a non-menu action.
-		if ( empty( $tab ) || ( ! isset( $tabs[ $tab ] ) && ! in_array( $tab, (array) $nonmenu_tabs ) ) ) {
+		if ( empty( $tab ) || ( ! isset( $tabs[ $tab ] ) && ! in_array( $tab, (array) $nonmenu_tabs, true ) ) ) {
 			$tab = key( $tabs );
 		}
 
@@ -137,7 +137,7 @@
 		 *
 		 * @since 3.7.0
 		 *
-		 * @param array $args An array of themes API arguments.
+		 * @param array|false $args Theme install API arguments.
 		 */
 		$args = apply_filters( "install_themes_table_api_args_{$tab}", $args );
 
@@ -148,7 +148,7 @@
 		$api = themes_api( 'query_themes', $args );
 
 		if ( is_wp_error( $api ) ) {
-			wp_die( $api->get_error_message() . '</p> <p><a href="#" onclick="document.location.reload(); return false;">' . __( 'Try again' ) . '</a>' );
+			wp_die( $api->get_error_message() . '</p> <p><a href="#" onclick="document.location.reload(); return false;">' . __( 'Try Again' ) . '</a>' );
 		}
 
 		$this->items = $api->themes;
@@ -187,6 +187,11 @@
 	}
 
 	/**
+	 * Displays the theme install table.
+	 *
+	 * Overrides the parent display() method to provide a different container.
+	 *
+	 * @since 3.1.0
 	 */
 	public function display() {
 		wp_nonce_field( 'fetch-list-' . get_class( $this ), '_ajax_fetch_list_nonce' );
@@ -226,7 +231,7 @@
 				?>
 				</div>
 			<?php
-		} // end foreach $theme_names
+		} // End foreach $theme_names.
 
 		$this->theme_installer();
 	}
@@ -241,15 +246,15 @@
 	 * @param object $theme {
 	 *     An object that contains theme data returned by the WordPress.org API.
 	 *
-	 *     @type string $name           Theme name, e.g. 'Twenty Nineteen'.
-	 *     @type string $slug           Theme slug, e.g. 'twentynineteen'.
+	 *     @type string $name           Theme name, e.g. 'Twenty Twenty'.
+	 *     @type string $slug           Theme slug, e.g. 'twentytwenty'.
 	 *     @type string $version        Theme version, e.g. '1.1'.
 	 *     @type string $author         Theme author username, e.g. 'melchoyce'.
-	 *     @type string $preview_url    Preview URL, e.g. 'http://2019.wordpress.net/'.
-	 *     @type string $screenshot_url Screenshot URL, e.g. 'https://wordpress.org/themes/twentynineteen/'.
+	 *     @type string $preview_url    Preview URL, e.g. 'https://2020.wordpress.net/'.
+	 *     @type string $screenshot_url Screenshot URL, e.g. 'https://wordpress.org/themes/twentytwenty/'.
 	 *     @type float  $rating         Rating score.
 	 *     @type int    $num_ratings    The number of ratings.
-	 *     @type string $homepage       Theme homepage, e.g. 'https://wordpress.org/themes/twentynineteen/'.
+	 *     @type string $homepage       Theme homepage, e.g. 'https://wordpress.org/themes/twentytwenty/'.
 	 *     @type string $description    Theme description.
 	 *     @type string $download_link  Theme ZIP download URL.
 	 * }
@@ -264,7 +269,7 @@
 		$name   = wp_kses( $theme->name, $themes_allowedtags );
 		$author = wp_kses( $theme->author, $themes_allowedtags );
 
-		/* translators: %s: theme name */
+		/* translators: %s: Theme name. */
 		$preview_title = sprintf( __( 'Preview &#8220;%s&#8221;' ), $name );
 		$preview_url   = add_query_arg(
 			array(
@@ -299,7 +304,7 @@
 				$actions[] = sprintf(
 					'<a class="install-now" href="%s" title="%s">%s</a>',
 					esc_url( wp_nonce_url( $update_url, 'upgrade-theme_' . $theme->slug ) ),
-					/* translators: %s: theme version */
+					/* translators: %s: Theme version. */
 					esc_attr( sprintf( __( 'Update to version %s' ), $theme->version ) ),
 					__( 'Update' )
 				);
@@ -317,8 +322,8 @@
 				$actions[] = sprintf(
 					'<a class="install-now" href="%s" title="%s">%s</a>',
 					esc_url( wp_nonce_url( $install_url, 'install-theme_' . $theme->slug ) ),
-					/* translators: %s: theme name */
-					esc_attr( sprintf( __( 'Install %s' ), $name ) ),
+					/* translators: %s: Theme name. */
+					esc_attr( sprintf( _x( 'Install %s', 'theme' ), $name ) ),
 					__( 'Install Now' )
 				);
 				break;
@@ -327,7 +332,7 @@
 		$actions[] = sprintf(
 			'<a class="install-theme-preview" href="%s" title="%s">%s</a>',
 			esc_url( $preview_url ),
-			/* translators: %s: theme name */
+			/* translators: %s: Theme name. */
 			esc_attr( sprintf( __( 'Preview %s' ), $name ) ),
 			__( 'Preview' )
 		);
@@ -351,7 +356,7 @@
 		<h3><?php echo $name; ?></h3>
 		<div class="theme-author">
 		<?php
-			/* translators: %s: theme author */
+			/* translators: %s: Theme author. */
 			printf( __( 'By %s' ), $author );
 		?>
 		</div>
@@ -457,7 +462,7 @@
 				printf(
 					'<a class="theme-install button button-primary" href="%s" title="%s">%s</a>',
 					esc_url( wp_nonce_url( $update_url, 'upgrade-theme_' . $theme->slug ) ),
-					/* translators: %s: theme version */
+					/* translators: %s: Theme version. */
 					esc_attr( sprintf( __( 'Update to version %s' ), $theme->version ) ),
 					__( 'Update' )
 				);
@@ -483,7 +488,7 @@
 			<h3 class="theme-name"><?php echo $name; ?></h3>
 			<span class="theme-by">
 			<?php
-				/* translators: %s: theme author */
+				/* translators: %s: Theme author. */
 				printf( __( 'By %s' ), $author );
 			?>
 			</span>