diff -r be944660c56a -r 3d72ae0968f4 wp/wp-admin/includes/class-wp-plugin-install-list-table.php --- 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( - '%3$s', - esc_url( $activate_url ), - esc_attr( sprintf( $button_label, $plugin['name'] ) ), - $button_text - ); + $action_links[] = sprintf( + '%3$s', + esc_url( $activate_url ), + esc_attr( sprintf( $button_label, $plugin['name'] ) ), + $button_text + ); + } else { + $action_links[] = sprintf( + '', + _x( 'Cannot Activate', 'plugin' ) + ); + } } else { $action_links[] = sprintf( '', @@ -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 '

'; if ( ! $compatible_php && ! $compatible_wp ) { - _e( 'This plugin doesn’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( '

', '' ); } } elseif ( ! $compatible_wp ) { - _e( 'This plugin doesn’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’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. */