PluginProbe
Gutenberg / 8.3.0
Gutenberg v8.3.0
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 +107 -17 24.0.08.3.0 View file →
@@ -1,12 +1,12 @@
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 + * Requires at least: 5.3
7 + * Requires PHP: 5.6
8 + * Version: 8.3.0
9 9 * Author: Gutenberg Team
10 10 * Text Domain: gutenberg
11 11 *
12 12 * @package gutenberg
@@ -11,13 +11,101 @@
11 11 *
12 12 * @package gutenberg
13 13 */
14 14
15 -defined( 'GUTENBERG_MINIMUM_WP_VERSION' ) or define( 'GUTENBERG_MINIMUM_WP_VERSION', '6.9' );
15 +### BEGIN AUTO-GENERATED DEFINES
16 +define( 'GUTENBERG_VERSION', '8.3.0' );
17 +define( 'GUTENBERG_GIT_COMMIT', 'a1159b60f3bd71b4a749b3b4529886d19b9196c7' );
18 +### END AUTO-GENERATED DEFINES
16 19
17 20 gutenberg_pre_init();
18 21
19 22 /**
23 + * Gutenberg's Menu.
24 + *
25 + * Adds a new wp-admin menu page for the Gutenberg editor.
26 + *
27 + * @since 0.1.0
28 + */
29 +function gutenberg_menu() {
30 + global $submenu;
31 +
32 + add_menu_page(
33 + 'Gutenberg',
34 + 'Gutenberg',
35 + 'edit_posts',
36 + 'gutenberg',
37 + '',
38 + 'dashicons-edit'
39 + );
40 +
41 + add_submenu_page(
42 + 'gutenberg',
43 + __( 'Demo', 'gutenberg' ),
44 + __( 'Demo', 'gutenberg' ),
45 + 'edit_posts',
46 + 'gutenberg'
47 + );
48 +
49 + if ( get_option( 'gutenberg-experiments' ) ) {
50 + if ( array_key_exists( 'gutenberg-widget-experiments', get_option( 'gutenberg-experiments' ) ) ) {
51 + add_submenu_page(
52 + 'gutenberg',
53 + __( 'Widgets (beta)', 'gutenberg' ),
54 + __( 'Widgets (beta)', 'gutenberg' ),
55 + 'edit_theme_options',
56 + 'gutenberg-widgets',
57 + 'the_gutenberg_widgets'
58 + );
59 + }
60 + if ( array_key_exists( 'gutenberg-navigation', get_option( 'gutenberg-experiments' ) ) ) {
61 + add_submenu_page(
62 + 'gutenberg',
63 + __( 'Navigation (beta)', 'gutenberg' ),
64 + __( 'Navigation (beta)', 'gutenberg' ),
65 + 'edit_theme_options',
66 + 'gutenberg-navigation',
67 + 'gutenberg_navigation_page'
68 + );
69 + }
70 + if ( array_key_exists( 'gutenberg-full-site-editing', get_option( 'gutenberg-experiments' ) ) ) {
71 + add_menu_page(
72 + __( 'Site Editor (beta)', 'gutenberg' ),
73 + __( 'Site Editor (beta)', 'gutenberg' ),
74 + 'edit_theme_options',
75 + 'gutenberg-edit-site',
76 + 'gutenberg_edit_site_page',
77 + 'dashicons-layout'
78 + );
79 + }
80 + }
81 +
82 + if ( current_user_can( 'edit_posts' ) ) {
83 + $submenu['gutenberg'][] = array(
84 + __( 'Support', 'gutenberg' ),
85 + 'edit_posts',
86 + __( 'https://wordpress.org/support/plugin/gutenberg', 'gutenberg' ),
87 + );
88 +
89 + $submenu['gutenberg'][] = array(
90 + __( 'Documentation', 'gutenberg' ),
91 + 'edit_posts',
92 + 'https://developer.wordpress.org/block-editor/',
93 + );
94 + }
95 +
96 + add_submenu_page(
97 + 'gutenberg',
98 + __( 'Experiments Settings', 'gutenberg' ),
99 + __( 'Experiments', 'gutenberg' ),
100 + 'edit_posts',
101 + 'gutenberg-experiments',
102 + 'the_gutenberg_experiments'
103 + );
104 +}
105 +add_action( 'admin_menu', 'gutenberg_menu' );
106 +
107 +/**
20 108 * Display a version notice and deactivate the Gutenberg plugin.
21 109 *
22 110 * @since 0.1.0
23 111 */
@@ -23,12 +111,12 @@
23 111 */
24 112 function gutenberg_wordpress_version_notice() {
25 113 echo '<div class="error"><p>';
26 114 /* 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 );
115 + printf( __( 'Gutenberg requires WordPress %s or later to function properly. Please upgrade WordPress before activating Gutenberg.', 'gutenberg' ), '5.3.0' );
28 116 echo '</p></div>';
29 117
30 - deactivate_plugins( array( plugin_basename( __FILE__ ) ) );
118 + deactivate_plugins( array( 'gutenberg/gutenberg.php' ) );
31 119 }
32 120
33 121 /**
34 122 * Display a build notice.
@@ -36,9 +124,9 @@
36 124 * @since 0.1.0
37 125 */
38 126 function gutenberg_build_files_notice() {
39 127 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' );
128 + _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 129 echo '</p></div>';
42 130 }
43 131
44 132 /**
@@ -44,15 +132,12 @@
44 132 /**
45 133 * Verify that we can initialize the Gutenberg editor , then load it.
46 134 *
47 135 * @since 1.5.0
48 - *
49 - * @global string $wp_version The WordPress version string.
50 - *
51 136 */
52 137 function gutenberg_pre_init() {
53 138 global $wp_version;
54 - if ( ! file_exists( __DIR__ . '/build/scripts/blocks' ) ) {
139 + if ( defined( 'GUTENBERG_DEVELOPMENT_MODE' ) && GUTENBERG_DEVELOPMENT_MODE && ! file_exists( dirname( __FILE__ ) . '/build/blocks' ) ) {
55 140 add_action( 'admin_notices', 'gutenberg_build_files_notice' );
56 141 return;
57 142 }
58 143
@@ -61,14 +146,19 @@
61 146
62 147 // Strip '-src' from the version string. Messes up version_compare().
63 148 $version = str_replace( '-src', '', $wp_version );
64 149
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, '<' ) ) {
150 + if ( version_compare( $version, '5.3.0', '<' ) ) {
69 151 add_action( 'admin_notices', 'gutenberg_wordpress_version_notice' );
70 152 return;
71 153 }
72 154
73 - require_once __DIR__ . '/lib/load.php';
155 + require_once dirname( __FILE__ ) . '/lib/load.php';
74 156 }
157 +
158 +/**
159 + * Outputs a WP REST API nonce.
160 + */
161 +function gutenberg_rest_nonce() {
162 + exit( wp_create_nonce( 'wp_rest' ) );
163 +}
164 +add_action( 'wp_ajax_gutenberg_rest_nonce', 'gutenberg_rest_nonce' );