diff --git a/wp-admin/includes/plugin.php b/wp-admin/includes/plugin.php index 680f4a7728..76e74d5986 100644 --- a/wp-admin/includes/plugin.php +++ b/wp-admin/includes/plugin.php @@ -1202,26 +1202,55 @@ function validate_plugin_requirements( $plugin ) { WP_Plugin_Dependencies::initialize(); if ( WP_Plugin_Dependencies::has_unmet_dependencies( $plugin ) ) { - $dependencies = WP_Plugin_Dependencies::get_dependencies( $plugin ); - $unmet_dependencies = array(); + $dependency_names = WP_Plugin_Dependencies::get_dependency_names( $plugin ); + $unmet_dependencies = array(); + $unmet_dependency_names = array(); - foreach ( $dependencies as $dependency ) { + foreach ( $dependency_names as $dependency => $dependency_name ) { $dependency_file = WP_Plugin_Dependencies::get_dependency_filepath( $dependency ); if ( false === $dependency_file ) { - $unmet_dependencies['not_installed'][] = $dependency; + $unmet_dependencies['not_installed'][ $dependency ] = $dependency_name; + $unmet_dependency_names[] = $dependency_name; } elseif ( is_plugin_inactive( $dependency_file ) ) { - $unmet_dependencies['inactive'][] = $dependency; + $unmet_dependencies['inactive'][ $dependency ] = $dependency_name; + $unmet_dependency_names[] = $dependency_name; } } + $error_message = sprintf( + /* translators: 1: Plugin name, 2: Number of plugins, 3: A comma-separated list of plugin names. */ + _n( + 'Error: %1$s requires %2$d plugin to be installed and activated: %3$s.', + 'Error: %1$s requires %2$d plugins to be installed and activated: %3$s.', + count( $unmet_dependency_names ) + ), + $plugin_headers['Name'], + count( $unmet_dependency_names ), + implode( wp_get_list_item_separator(), $unmet_dependency_names ) + ); + + if ( is_multisite() ) { + if ( current_user_can( 'manage_network_plugins' ) ) { + $error_message .= ' ' . sprintf( + /* translators: %s: Link to the plugins page. */ + __( 'Manage plugins.' ), + esc_url( network_admin_url( 'plugins.php' ) ) + ); + } else { + $error_message .= ' ' . __( 'Please contact your network administrator.' ); + } + } else { + $error_message .= ' ' . sprintf( + /* translators: %s: Link to the plugins page. */ + __( 'Manage plugins.' ), + esc_url( admin_url( 'plugins.php' ) ) + ); + } + return new WP_Error( 'plugin_missing_dependencies', - '
' . sprintf( - /* translators: %s: Plugin name. */ - _x( 'Error: %s requires plugins that are not installed or activated.', 'plugin' ), - $plugin_headers['Name'] - ) . '
', + "{$error_message}
", $unmet_dependencies ); } diff --git a/wp-includes/version.php b/wp-includes/version.php index a3bfe6ef2f..4185a0e846 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -16,7 +16,7 @@ * * @global string $wp_version */ -$wp_version = '6.5-beta3-57769'; +$wp_version = '6.5-beta3-57770'; /** * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.