| @@ -2,9 +2,11 @@ | ||
| 2 | 2 | /** |
| 3 | 3 | * Plugin Name: Gutenberg |
| 4 | 4 | * Plugin URI: https://github.com/WordPress/gutenberg |
| 5 | 5 | * Description: Printing since 1440. This is the development plugin for the new block editor in core. |
| 6 | - * Version: 7.4.0 | |
| 6 | + * Requires at least: 5.7 | |
| 7 | + * Requires PHP: 5.6 | |
| 8 | + * Version: 12.1.0 | |
| 7 | 9 | * Author: Gutenberg Team |
| 8 | 10 | * Text Domain: gutenberg |
| 9 | 11 | * |
| 10 | 12 | * @package gutenberg |
| @@ -10,90 +12,15 @@ | ||
| 10 | 12 | * @package gutenberg |
| 11 | 13 | */ |
| 12 | 14 | |
| 13 | 15 | ### BEGIN AUTO-GENERATED DEFINES |
| 14 | -define( 'GUTENBERG_VERSION', '7.4.0' ); | |
| 15 | -define( 'GUTENBERG_GIT_COMMIT', '892d5c7e085621bdf23bcb737355059c5073c13a' ); | |
| 16 | +define( 'GUTENBERG_VERSION', '12.1.0' ); | |
| 17 | +define( 'GUTENBERG_GIT_COMMIT', '78b235a583f3ab67f82301eff635e1ff95266db5' ); | |
| 16 | 18 | ### END AUTO-GENERATED DEFINES |
| 17 | 19 | |
| 18 | 20 | gutenberg_pre_init(); |
| 19 | 21 | |
| 20 | 22 | /** |
| 21 | - * Gutenberg's Menu. | |
| 22 | - * | |
| 23 | - * Adds a new wp-admin menu page for the Gutenberg editor. | |
| 24 | - * | |
| 25 | - * @since 0.1.0 | |
| 26 | - */ | |
| 27 | -function gutenberg_menu() { | |
| 28 | - global $submenu; | |
| 29 | - | |
| 30 | - add_menu_page( | |
| 31 | - 'Gutenberg', | |
| 32 | - 'Gutenberg', | |
| 33 | - 'edit_posts', | |
| 34 | - 'gutenberg', | |
| 35 | - '', | |
| 36 | - 'dashicons-edit' | |
| 37 | - ); | |
| 38 | - | |
| 39 | - add_submenu_page( | |
| 40 | - 'gutenberg', | |
| 41 | - __( 'Demo', 'gutenberg' ), | |
| 42 | - __( 'Demo', 'gutenberg' ), | |
| 43 | - 'edit_posts', | |
| 44 | - 'gutenberg' | |
| 45 | - ); | |
| 46 | - | |
| 47 | - if ( get_option( 'gutenberg-experiments' ) ) { | |
| 48 | - if ( array_key_exists( 'gutenberg-widget-experiments', get_option( 'gutenberg-experiments' ) ) ) { | |
| 49 | - add_submenu_page( | |
| 50 | - 'gutenberg', | |
| 51 | - __( 'Widgets (beta)', 'gutenberg' ), | |
| 52 | - __( 'Widgets (beta)', 'gutenberg' ), | |
| 53 | - 'edit_theme_options', | |
| 54 | - 'gutenberg-widgets', | |
| 55 | - 'the_gutenberg_widgets' | |
| 56 | - ); | |
| 57 | - } | |
| 58 | - if ( array_key_exists( 'gutenberg-full-site-editing', get_option( 'gutenberg-experiments' ) ) ) { | |
| 59 | - add_submenu_page( | |
| 60 | - 'gutenberg', | |
| 61 | - __( 'Site Editor (beta)', 'gutenberg' ), | |
| 62 | - __( 'Site Editor (beta)', 'gutenberg' ), | |
| 63 | - 'edit_theme_options', | |
| 64 | - 'gutenberg-edit-site', | |
| 65 | - 'gutenberg_edit_site_page' | |
| 66 | - ); | |
| 67 | - } | |
| 68 | - } | |
| 69 | - | |
| 70 | - if ( current_user_can( 'edit_posts' ) ) { | |
| 71 | - $submenu['gutenberg'][] = array( | |
| 72 | - __( 'Support', 'gutenberg' ), | |
| 73 | - 'edit_posts', | |
| 74 | - __( 'https://wordpress.org/support/plugin/gutenberg', 'gutenberg' ), | |
| 75 | - ); | |
| 76 | - | |
| 77 | - $submenu['gutenberg'][] = array( | |
| 78 | - __( 'Documentation', 'gutenberg' ), | |
| 79 | - 'edit_posts', | |
| 80 | - 'https://developer.wordpress.org/block-editor/', | |
| 81 | - ); | |
| 82 | - } | |
| 83 | - | |
| 84 | - add_submenu_page( | |
| 85 | - 'gutenberg', | |
| 86 | - __( 'Experiments Settings', 'gutenberg' ), | |
| 87 | - __( 'Experiments', 'gutenberg' ), | |
| 88 | - 'edit_posts', | |
| 89 | - 'gutenberg-experiments', | |
| 90 | - 'the_gutenberg_experiments' | |
| 91 | - ); | |
| 92 | -} | |
| 93 | -add_action( 'admin_menu', 'gutenberg_menu' ); | |
| 94 | - | |
| 95 | -/** | |
| 96 | 23 | * Display a version notice and deactivate the Gutenberg plugin. |
| 97 | 24 | * |
| 98 | 25 | * @since 0.1.0 |
| 99 | 26 | */ |
| @@ -99,9 +26,9 @@ | ||
| 99 | 26 | */ |
| 100 | 27 | function gutenberg_wordpress_version_notice() { |
| 101 | 28 | echo '<div class="error"><p>'; |
| 102 | 29 | /* translators: %s: Minimum required version */ |
| 103 | - printf( __( 'Gutenberg requires WordPress %s or later to function properly. Please upgrade WordPress before activating Gutenberg.', 'gutenberg' ), '5.2.0' ); | |
| 30 | + printf( __( 'Gutenberg requires WordPress %s or later to function properly. Please upgrade WordPress before activating Gutenberg.', 'gutenberg' ), '5.7' ); | |
| 104 | 31 | echo '</p></div>'; |
| 105 | 32 | |
| 106 | 33 | deactivate_plugins( array( 'gutenberg/gutenberg.php' ) ); |
| 107 | 34 | } |
| @@ -112,9 +39,9 @@ | ||
| 112 | 39 | * @since 0.1.0 |
| 113 | 40 | */ |
| 114 | 41 | function gutenberg_build_files_notice() { |
| 115 | 42 | echo '<div class="error"><p>'; |
| 116 | - _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/master/docs/contributors/getting-started.md">contributing</a> file for more information.', 'gutenberg' ); | |
| 43 | + _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' ); | |
| 117 | 44 | echo '</p></div>'; |
| 118 | 45 | } |
| 119 | 46 | |
| 120 | 47 | /** |
| @@ -123,9 +50,9 @@ | ||
| 123 | 50 | * @since 1.5.0 |
| 124 | 51 | */ |
| 125 | 52 | function gutenberg_pre_init() { |
| 126 | 53 | global $wp_version; |
| 127 | - if ( defined( 'GUTENBERG_DEVELOPMENT_MODE' ) && GUTENBERG_DEVELOPMENT_MODE && ! file_exists( dirname( __FILE__ ) . '/build/blocks' ) ) { | |
| 54 | + if ( defined( 'GUTENBERG_DEVELOPMENT_MODE' ) && GUTENBERG_DEVELOPMENT_MODE && ! file_exists( __DIR__ . '/build/blocks' ) ) { | |
| 128 | 55 | add_action( 'admin_notices', 'gutenberg_build_files_notice' ); |
| 129 | 56 | return; |
| 130 | 57 | } |
| 131 | 58 | |
| @@ -134,19 +61,14 @@ | ||
| 134 | 61 | |
| 135 | 62 | // Strip '-src' from the version string. Messes up version_compare(). |
| 136 | 63 | $version = str_replace( '-src', '', $wp_version ); |
| 137 | 64 | |
| 138 | - if ( version_compare( $version, '5.2.0', '<' ) ) { | |
| 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, '5.7', '<' ) ) { | |
| 139 | 69 | add_action( 'admin_notices', 'gutenberg_wordpress_version_notice' ); |
| 140 | 70 | return; |
| 141 | 71 | } |
| 142 | 72 | |
| 143 | - require_once dirname( __FILE__ ) . '/lib/load.php'; | |
| 73 | + require_once __DIR__ . '/lib/load.php'; | |
| 144 | 74 | } |
| 145 | - | |
| 146 | -/** | |
| 147 | - * Outputs a WP REST API nonce. | |
| 148 | - */ | |
| 149 | -function gutenberg_rest_nonce() { | |
| 150 | - exit( wp_create_nonce( 'wp_rest' ) ); | |
| 151 | -} | |
| 152 | -add_action( 'wp_ajax_gutenberg_rest_nonce', 'gutenberg_rest_nonce' ); | |