array( 'classes' => array( 'DateTimeImmutable', ), ), 'dom' => array( 'classes' => array( 'DOMAttr', 'DOMComment', 'DOMDocument', 'DOMElement', 'DOMNode', 'DOMNodeList', 'DOMText', 'DOMXPath', ), ), 'json' => array( 'functions' => array( 'json_decode', 'json_encode', ), ), 'libxml' => array( 'functions' => array( 'libxml_use_internal_errors', 'libxml_clear_errors', ), ), 'spl' => array( 'functions' => array( 'spl_autoload_register', ), ), ); // Load Compatibility class the old fashioned way. if ( ! class_exists( 'Web_Stories_Compatibility' ) ) { require_once WEBSTORIES_PLUGIN_DIR_PATH . '/includes/compat/Web_Stories_Compatibility.php'; } $compatibility = new Web_Stories_Compatibility( $error ); $compatibility->set_extensions( $extensions ); $compatibility->set_php_version( WEBSTORIES_MINIMUM_PHP_VERSION ); $compatibility->set_wp_version( WEBSTORIES_MINIMUM_WP_VERSION ); $compatibility->set_required_files( array( WEBSTORIES_PLUGIN_DIR_PATH . '/assets/js/web-stories-editor.js', WEBSTORIES_PLUGIN_DIR_PATH . '/assets/js/web-stories-dashboard.js', WEBSTORIES_PLUGIN_DIR_PATH . '/assets/js/web-stories-block.js', WEBSTORIES_PLUGIN_DIR_PATH . '/includes/vendor/autoload.php', WEBSTORIES_PLUGIN_DIR_PATH . '/third-party/vendor/scoper-autoload.php', ) ); return $compatibility; } /** * Displays an admin notice about why the plugin is unable to load. * * @since 1.0.0 * * @return void */ function web_stories_print_admin_notice() { $compatibility = web_stories_get_compat_instance(); $compatibility->run_checks(); $_error = $compatibility->get_error(); if ( ! $_error->errors ) { return; } ?>

set_required_files( array( WEBSTORIES_PLUGIN_DIR_PATH . '/third-party/vendor/scoper-autoload.php', WEBSTORIES_PLUGIN_DIR_PATH . '/includes/vendor/autoload.php', ) ); $web_stories_compatibility->run_checks(); $_error = $web_stories_compatibility->get_error(); if ( $_error->errors ) { $heading = esc_html__( 'Web Stories plugin could not be initialized.', 'web-stories' ); if ( class_exists( '\WP_CLI' ) ) { WP_CLI::warning( $heading ); } else { echo "$heading\n"; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped } foreach ( array_keys( $_error->errors ) as $error_code ) { $message = $_error->get_error_message( $error_code ); $body = htmlspecialchars_decode( wp_strip_all_tags( $message ) ); if ( class_exists( '\WP_CLI' ) ) { WP_CLI::line( $body ); } else { echo "$body\n"; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped } } return; } } if ( ! $web_stories_compatibility->check_required_files() || ! $web_stories_compatibility->check_php_version() || ! $web_stories_compatibility->check_wp_version() ) { // However, we still need to stop further execution. return; } unset( $web_stories_compatibility ); // Autoloader for dependencies. if ( file_exists( WEBSTORIES_PLUGIN_DIR_PATH . '/third-party/vendor/scoper-autoload.php' ) ) { require WEBSTORIES_PLUGIN_DIR_PATH . '/third-party/vendor/scoper-autoload.php'; } // Autoloader for plugin itself. if ( file_exists( WEBSTORIES_PLUGIN_DIR_PATH . '/includes/vendor/autoload.php' ) ) { require WEBSTORIES_PLUGIN_DIR_PATH . '/includes/vendor/autoload.php'; } // Main plugin initialization happens there so that this file is still parsable in PHP < 7.0. require WEBSTORIES_PLUGIN_DIR_PATH . '/includes/namespace.php';