Changeset 57658 for trunk/src/wp-settings.php
- Timestamp:
- 02/20/2024 07:25:38 AM (14 months ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-settings.php
r57628 r57658 389 389 require ABSPATH . WPINC . '/interactivity-api/class-wp-interactivity-api-directives-processor.php'; 390 390 require ABSPATH . WPINC . '/interactivity-api/interactivity-api.php'; 391 require ABSPATH . WPINC . '/class-wp-plugin-dependencies.php'; 391 392 392 393 wp_script_modules()->add_hooks(); … … 419 420 420 421 $GLOBALS['wp_plugin_paths'] = array(); 421 422 // Load and initialize WP_Plugin_Dependencies.423 require_once ABSPATH . WPINC . '/class-wp-plugin-dependencies.php';424 if ( ! defined( 'WP_RUN_CORE_TESTS' ) ) {425 WP_Plugin_Dependencies::initialize();426 }427 422 428 423 // Load must-use plugins. … … 500 495 501 496 // Load active plugins. 502 $all_plugin_data = get_option( 'plugin_data', array() );503 $failed_plugins = array();504 $plugins_dir_strlen = strlen( trailingslashit( WP_PLUGIN_DIR ) );505 497 foreach ( wp_get_active_and_valid_plugins() as $plugin ) { 506 $plugin_file = substr( $plugin, $plugins_dir_strlen );507 508 /*509 * Skip any plugins that have not been added to the 'plugin_data' option yet.510 *511 * Some plugin files may be added locally and activated, but will not yet be512 * added to the 'plugin_data' option. This causes the 'active_plugins' option513 * and the 'plugin_data' option to be temporarily out of sync until the next514 * call to `get_plugins()`.515 */516 if ( isset( $all_plugin_data[ $plugin_file ] ) ) {517 $plugin_headers = $all_plugin_data[ $plugin_file ];518 $errors = array();519 $requirements = array(520 'requires' => ! empty( $plugin_headers['RequiresWP'] ) ? $plugin_headers['RequiresWP'] : '',521 'requires_php' => ! empty( $plugin_headers['RequiresPHP'] ) ? $plugin_headers['RequiresPHP'] : '',522 );523 $compatible_wp = is_wp_version_compatible( $requirements['requires'] );524 $compatible_php = is_php_version_compatible( $requirements['requires_php'] );525 526 $php_update_message = '</p><p>' . sprintf(527 /* translators: %s: URL to Update PHP page. */528 __( '<a href="%s">Learn more about updating PHP</a>.' ),529 esc_url( wp_get_update_php_url() )530 );531 532 $annotation = wp_get_update_php_annotation();533 534 if ( $annotation ) {535 $php_update_message .= '</p><p><em>' . $annotation . '</em>';536 }537 538 if ( ! $compatible_wp && ! $compatible_php ) {539 $errors[] = sprintf(540 /* translators: 1: Current WordPress version, 2: Current PHP version, 3: Plugin name, 4: Required WordPress version, 5: Required PHP version. */541 _x( '<strong>Error:</strong> Current versions of WordPress (%1$s) and PHP (%2$s) do not meet minimum requirements for %3$s. The plugin requires WordPress %4$s and PHP %5$s.', 'plugin' ),542 get_bloginfo( 'version' ),543 PHP_VERSION,544 $plugin_headers['Name'],545 $requirements['requires'],546 $requirements['requires_php']547 ) . $php_update_message;548 } elseif ( ! $compatible_php ) {549 $errors[] = sprintf(550 /* translators: 1: Current PHP version, 2: Plugin name, 3: Required PHP version. */551 _x( '<strong>Error:</strong> Current PHP version (%1$s) does not meet minimum requirements for %2$s. The plugin requires PHP %3$s.', 'plugin' ),552 PHP_VERSION,553 $plugin_headers['Name'],554 $requirements['requires_php']555 ) . $php_update_message;556 } elseif ( ! $compatible_wp ) {557 $errors[] = sprintf(558 /* translators: 1: Current WordPress version, 2: Plugin name, 3: Required WordPress version. */559 _x( '<strong>Error:</strong> Current WordPress version (%1$s) does not meet minimum requirements for %2$s. The plugin requires WordPress %3$s.', 'plugin' ),560 get_bloginfo( 'version' ),561 $plugin_headers['Name'],562 $requirements['requires']563 );564 }565 566 if ( ! empty( $errors ) ) {567 $failed_plugins[ $plugin_file ] = '';568 foreach ( $errors as $error ) {569 $failed_plugins[ $plugin_file ] .= wp_get_admin_notice(570 $error,571 array(572 'type' => 'error',573 'dismissible' => true,574 )575 );576 }577 continue;578 }579 }580 581 498 wp_register_plugin_realpath( $plugin ); 582 499 … … 596 513 unset( $plugin, $_wp_plugin_file ); 597 514 598 if ( ! empty( $failed_plugins ) ) {599 add_action(600 'admin_notices',601 function () use ( $failed_plugins ) {602 global $pagenow;603 604 if ( 'index.php' === $pagenow || 'plugins.php' === $pagenow ) {605 echo implode( '', $failed_plugins );606 }607 }608 );609 }610 unset( $failed_plugins );611 612 515 // Load pluggable functions. 613 516 require ABSPATH . WPINC . '/pluggable.php';
Note: See TracChangeset
for help on using the changeset viewer.