PluginProbe
Gutenberg / 7.7.2
Gutenberg v7.7.2
24.0.0 23.9.1 23.9.0 23.8.0 23.7.2 23.7.1 23.7.0 23.6.1 23.6.2 23.6.0 23.5.3 23.5.2 23.5.1 23.5.0 23.4.0 23.3.2 23.3.1 23.3.0 23.2.0 23.2.1 23.2.2 23.1.1 23.1.0 23.0.1 12.6.0 All 403 releases
← All changes | gutenberg.php +95 -17 24.0.07.7.2 View file →
@@ -1,12 +1,10 @@
1 1 <?php
2 2 /**
3 3 * Plugin Name: Gutenberg
4 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.9
7 - * Requires PHP: 7.4
8 - * Version: 24.0.0
5 + * Description: Printing since 1440. This is the development plugin for the new block editor in core.
6 + * Version: 7.7.2
9 7 * Author: Gutenberg Team
10 8 * Text Domain: gutenberg
11 9 *
12 10 * @package gutenberg
@@ -11,13 +9,91 @@
11 9 *
12 10 * @package gutenberg
13 11 */
14 12
15 -defined( 'GUTENBERG_MINIMUM_WP_VERSION' ) or define( 'GUTENBERG_MINIMUM_WP_VERSION', '6.9' );
13 +### BEGIN AUTO-GENERATED DEFINES
14 +define( 'GUTENBERG_VERSION', '7.7.2' );
15 +define( 'GUTENBERG_GIT_COMMIT', '77e1cb9d36139fd8e4a526f08d241aedcfa11607' );
16 +### END AUTO-GENERATED DEFINES
16 17
17 18 gutenberg_pre_init();
18 19
19 20 /**
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 +/**
20 96 * Display a version notice and deactivate the Gutenberg plugin.
21 97 *
22 98 * @since 0.1.0
23 99 */
@@ -23,12 +99,12 @@
23 99 */
24 100 function gutenberg_wordpress_version_notice() {
25 101 echo '<div class="error"><p>';
26 102 /* 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 );
103 + printf( __( 'Gutenberg requires WordPress %s or later to function properly. Please upgrade WordPress before activating Gutenberg.', 'gutenberg' ), '5.3.0' );
28 104 echo '</p></div>';
29 105
30 - deactivate_plugins( array( plugin_basename( __FILE__ ) ) );
106 + deactivate_plugins( array( 'gutenberg/gutenberg.php' ) );
31 107 }
32 108
33 109 /**
34 110 * Display a build notice.
@@ -36,9 +112,9 @@
36 112 * @since 0.1.0
37 113 */
38 114 function gutenberg_build_files_notice() {
39 115 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' );
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' );
41 117 echo '</p></div>';
42 118 }
43 119
44 120 /**
@@ -44,15 +120,12 @@
44 120 /**
45 121 * Verify that we can initialize the Gutenberg editor , then load it.
46 122 *
47 123 * @since 1.5.0
48 - *
49 - * @global string $wp_version The WordPress version string.
50 - *
51 124 */
52 125 function gutenberg_pre_init() {
53 126 global $wp_version;
54 - if ( ! file_exists( __DIR__ . '/build/scripts/blocks' ) ) {
127 + if ( defined( 'GUTENBERG_DEVELOPMENT_MODE' ) && GUTENBERG_DEVELOPMENT_MODE && ! file_exists( dirname( __FILE__ ) . '/build/blocks' ) ) {
55 128 add_action( 'admin_notices', 'gutenberg_build_files_notice' );
56 129 return;
57 130 }
58 131
@@ -61,14 +134,19 @@
61 134
62 135 // Strip '-src' from the version string. Messes up version_compare().
63 136 $version = str_replace( '-src', '', $wp_version );
64 137
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, '<' ) ) {
138 + if ( version_compare( $version, '5.3.0', '<' ) ) {
69 139 add_action( 'admin_notices', 'gutenberg_wordpress_version_notice' );
70 140 return;
71 141 }
72 142
73 - require_once __DIR__ . '/lib/load.php';
143 + require_once dirname( __FILE__ ) . '/lib/load.php';
74 144 }
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' );