Plugin root
build
3 months ago
lib
3 months ago
packages
4 months ago
README.md
6.4 KB
4 months ago
changelog.txt
4.1 MB
3 months ago
gutenberg.php
2.5 KB
3 months ago
post-content.php
11.0 KB
6 months ago
readme.txt
7.7 KB
3 months ago
| 1 | <?php |
| 2 | /** |
| 3 | * Plugin Name: Gutenberg |
| 4 | * Plugin URI: https://github.com/WordPress/gutenberg |
| 5 | * Description: Printing since 1440. This is the development plugin for the block editor, site editor, and other future WordPress core functionality. |
| 6 | * Requires at least: 6.8 |
| 7 | * Requires PHP: 7.4 |
| 8 | * Version: 23.2.0 |
| 9 | * Author: Gutenberg Team |
| 10 | * Text Domain: gutenberg |
| 11 | * |
| 12 | * @package gutenberg |
| 13 | */ |
| 14 | |
| 15 | defined( 'GUTENBERG_MINIMUM_WP_VERSION' ) or define( 'GUTENBERG_MINIMUM_WP_VERSION', '6.8' ); |
| 16 | |
| 17 | gutenberg_pre_init(); |
| 18 | |
| 19 | /** |
| 20 | * Display a version notice and deactivate the Gutenberg plugin. |
| 21 | * |
| 22 | * @since 0.1.0 |
| 23 | */ |
| 24 | function gutenberg_wordpress_version_notice() { |
| 25 | echo '<div class="error"><p>'; |
| 26 | /* translators: %s: Minimum required version */ |
| 27 | printf( __( 'Gutenberg requires WordPress %s or later to function properly. Please upgrade WordPress before activating Gutenberg.', 'gutenberg' ), GUTENBERG_MINIMUM_WP_VERSION ); |
| 28 | echo '</p></div>'; |
| 29 | |
| 30 | deactivate_plugins( array( 'gutenberg/gutenberg.php' ) ); |
| 31 | } |
| 32 | |
| 33 | /** |
| 34 | * Display a build notice. |
| 35 | * |
| 36 | * @since 0.1.0 |
| 37 | */ |
| 38 | function gutenberg_build_files_notice() { |
| 39 | echo '<div class="error"><p>'; |
| 40 | _e( 'Gutenberg development mode requires files to be built. Run <code>npm install</code> to install dependencies, <code>npm run build</code> to build the files or <code>npm run dev</code> to build the files and watch for changes. Read the <a href="https://github.com/WordPress/gutenberg/blob/HEAD/docs/contributors/code/getting-started-with-code-contribution.md">contributing</a> file for more information.', 'gutenberg' ); |
| 41 | echo '</p></div>'; |
| 42 | } |
| 43 | |
| 44 | /** |
| 45 | * Verify that we can initialize the Gutenberg editor , then load it. |
| 46 | * |
| 47 | * @since 1.5.0 |
| 48 | * |
| 49 | * @global string $wp_version The WordPress version string. |
| 50 | * |
| 51 | */ |
| 52 | function gutenberg_pre_init() { |
| 53 | global $wp_version; |
| 54 | if ( ! file_exists( __DIR__ . '/build/scripts/blocks' ) ) { |
| 55 | add_action( 'admin_notices', 'gutenberg_build_files_notice' ); |
| 56 | return; |
| 57 | } |
| 58 | |
| 59 | // Get unmodified $wp_version. |
| 60 | include ABSPATH . WPINC . '/version.php'; |
| 61 | |
| 62 | // Strip '-src' from the version string. Messes up version_compare(). |
| 63 | $version = str_replace( '-src', '', $wp_version ); |
| 64 | |
| 65 | // Compare against major release versions (X.Y) rather than minor (X.Y.Z) |
| 66 | // unless a minor release is the actual minimum requirement. WordPress reports |
| 67 | // X.Y for its major releases. |
| 68 | if ( version_compare( $version, GUTENBERG_MINIMUM_WP_VERSION, '<' ) ) { |
| 69 | add_action( 'admin_notices', 'gutenberg_wordpress_version_notice' ); |
| 70 | return; |
| 71 | } |
| 72 | |
| 73 | require_once __DIR__ . '/lib/load.php'; |
| 74 | } |
| 75 |