wp/wp-admin/includes/class-wp-plugin-install-list-table.php
changeset 19 3d72ae0968f4
parent 18 be944660c56a
child 21 48c4eec2b7e6
--- a/wp/wp-admin/includes/class-wp-plugin-install-list-table.php	Wed Sep 21 18:19:35 2022 +0200
+++ b/wp/wp-admin/includes/class-wp-plugin-install-list-table.php	Tue Sep 27 16:37:53 2022 +0200
@@ -225,6 +225,8 @@
 		 *  - `install_plugins_table_api_args_popular`
 		 *  - `install_plugins_table_api_args_recommended`
 		 *  - `install_plugins_table_api_args_upload`
+		 *  - `install_plugins_table_api_args_search`
+		 *  - `install_plugins_table_api_args_beta`
 		 *
 		 * @since 3.7.0
 		 *
@@ -512,7 +514,19 @@
 
 			// Remove any HTML from the description.
 			$description = strip_tags( $plugin['short_description'] );
-			$version     = wp_kses( $plugin['version'], $plugins_allowedtags );
+
+			/**
+			 * Filters the plugin card description on the Add Plugins screen.
+			 *
+			 * @since 6.0.0
+			 *
+			 * @param string $description Plugin card description.
+			 * @param array  $plugin      An array of plugin data. See {@see plugins_api()}
+			 *                            for the list of possible values.
+			 */
+			$description = apply_filters( 'plugin_install_description', $description, $plugin );
+
+			$version = wp_kses( $plugin['version'], $plugins_allowedtags );
 
 			$name = strip_tags( $title . ' ' . $version );
 
@@ -586,31 +600,38 @@
 								_x( 'Active', 'plugin' )
 							);
 						} elseif ( current_user_can( 'activate_plugin', $status['file'] ) ) {
-							$button_text = __( 'Activate' );
-							/* translators: %s: Plugin name. */
-							$button_label = _x( 'Activate %s', 'plugin' );
-							$activate_url = add_query_arg(
-								array(
-									'_wpnonce' => wp_create_nonce( 'activate-plugin_' . $status['file'] ),
-									'action'   => 'activate',
-									'plugin'   => $status['file'],
-								),
-								network_admin_url( 'plugins.php' )
-							);
+							if ( $compatible_php && $compatible_wp ) {
+								$button_text = __( 'Activate' );
+								/* translators: %s: Plugin name. */
+								$button_label = _x( 'Activate %s', 'plugin' );
+								$activate_url = add_query_arg(
+									array(
+										'_wpnonce' => wp_create_nonce( 'activate-plugin_' . $status['file'] ),
+										'action'   => 'activate',
+										'plugin'   => $status['file'],
+									),
+									network_admin_url( 'plugins.php' )
+								);
 
-							if ( is_network_admin() ) {
-								$button_text = __( 'Network Activate' );
-								/* translators: %s: Plugin name. */
-								$button_label = _x( 'Network Activate %s', 'plugin' );
-								$activate_url = add_query_arg( array( 'networkwide' => 1 ), $activate_url );
-							}
+								if ( is_network_admin() ) {
+									$button_text = __( 'Network Activate' );
+									/* translators: %s: Plugin name. */
+									$button_label = _x( 'Network Activate %s', 'plugin' );
+									$activate_url = add_query_arg( array( 'networkwide' => 1 ), $activate_url );
+								}
 
-							$action_links[] = sprintf(
-								'<a href="%1$s" class="button activate-now" aria-label="%2$s">%3$s</a>',
-								esc_url( $activate_url ),
-								esc_attr( sprintf( $button_label, $plugin['name'] ) ),
-								$button_text
-							);
+								$action_links[] = sprintf(
+									'<a href="%1$s" class="button activate-now" aria-label="%2$s">%3$s</a>',
+									esc_url( $activate_url ),
+									esc_attr( sprintf( $button_label, $plugin['name'] ) ),
+									$button_text
+								);
+							} else {
+								$action_links[] = sprintf(
+									'<button type="button" class="button button-disabled" disabled="disabled">%s</button>',
+									_x( 'Cannot Activate', 'plugin' )
+								);
+							}
 						} else {
 							$action_links[] = sprintf(
 								'<button type="button" class="button button-disabled" disabled="disabled">%s</button>',
@@ -650,8 +671,10 @@
 			 *
 			 * @since 2.7.0
 			 *
-			 * @param string[] $action_links An array of plugin action links. Defaults are links to Details and Install Now.
-			 * @param array    $plugin       The plugin currently being listed.
+			 * @param string[] $action_links An array of plugin action links.
+			 *                               Defaults are links to Details and Install Now.
+			 * @param array    $plugin       An array of plugin data. See {@see plugins_api()}
+			 *                               for the list of possible values.
 			 */
 			$action_links = apply_filters( 'plugin_install_action_links', $action_links, $plugin );
 
@@ -662,7 +685,7 @@
 			if ( ! $compatible_php || ! $compatible_wp ) {
 				echo '<div class="notice inline notice-error notice-alt"><p>';
 				if ( ! $compatible_php && ! $compatible_wp ) {
-					_e( 'This plugin doesn&#8217;t work with your versions of WordPress and PHP.' );
+					_e( 'This plugin does not work with your versions of WordPress and PHP.' );
 					if ( current_user_can( 'update_core' ) && current_user_can( 'update_php' ) ) {
 						printf(
 							/* translators: 1: URL to WordPress Updates screen, 2: URL to Update PHP page. */
@@ -686,7 +709,7 @@
 						wp_update_php_annotation( '</p><p><em>', '</em>' );
 					}
 				} elseif ( ! $compatible_wp ) {
-					_e( 'This plugin doesn&#8217;t work with your version of WordPress.' );
+					_e( 'This plugin does not work with your version of WordPress.' );
 					if ( current_user_can( 'update_core' ) ) {
 						printf(
 							/* translators: %s: URL to WordPress Updates screen. */
@@ -695,7 +718,7 @@
 						);
 					}
 				} elseif ( ! $compatible_php ) {
-					_e( 'This plugin doesn&#8217;t work with your version of PHP.' );
+					_e( 'This plugin does not work with your version of PHP.' );
 					if ( current_user_can( 'update_php' ) ) {
 						printf(
 							/* translators: %s: URL to Update PHP page. */