PluginProbe
Gutenberg / 8.9.2
Gutenberg v8.9.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 +134 -16 23.1.08.9.2 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.8
7 - * Requires PHP: 7.4
8 - * Version: 23.1.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.9.2
9 9 * Author: Gutenberg Team
10 10 * Text Domain: gutenberg
11 11 *
12 12 * @package gutenberg
@@ -11,13 +11,107 @@
11 11 *
12 12 * @package gutenberg
13 13 */
14 14
15 -defined( 'GUTENBERG_MINIMUM_WP_VERSION' ) or define( 'GUTENBERG_MINIMUM_WP_VERSION', '6.8' );
15 +### BEGIN AUTO-GENERATED DEFINES
16 +define( 'GUTENBERG_VERSION', '8.9.2' );
17 +define( 'GUTENBERG_GIT_COMMIT', '0ac5d4e840646aa80f1b69d59913e2471ab29d22' );
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 ( gutenberg_use_widgets_block_editor() ) {
50 + add_theme_page(
51 + __( 'Widgets', 'gutenberg' ),
52 + __( 'Widgets', 'gutenberg' ),
53 + 'edit_theme_options',
54 + 'gutenberg-widgets',
55 + 'the_gutenberg_widgets'
56 + );
57 + $submenu['themes.php'] = array_filter(
58 + $submenu['themes.php'],
59 + function( $current_menu_item ) {
60 + return isset( $current_menu_item[2] ) && 'widgets.php' !== $current_menu_item[2];
61 + }
62 + );
63 + }
64 +
65 + if ( get_option( 'gutenberg-experiments' ) ) {
66 + if ( array_key_exists( 'gutenberg-navigation', get_option( 'gutenberg-experiments' ) ) ) {
67 + add_submenu_page(
68 + 'gutenberg',
69 + __( 'Navigation (beta)', 'gutenberg' ),
70 + __( 'Navigation (beta)', 'gutenberg' ),
71 + 'edit_theme_options',
72 + 'gutenberg-navigation',
73 + 'gutenberg_navigation_page'
74 + );
75 + }
76 + if ( array_key_exists( 'gutenberg-full-site-editing', get_option( 'gutenberg-experiments' ) ) ) {
77 + add_menu_page(
78 + __( 'Site Editor (beta)', 'gutenberg' ),
79 + __( 'Site Editor (beta)', 'gutenberg' ),
80 + 'edit_theme_options',
81 + 'gutenberg-edit-site',
82 + 'gutenberg_edit_site_page',
83 + 'dashicons-layout'
84 + );
85 + }
86 + }
87 +
88 + if ( current_user_can( 'edit_posts' ) ) {
89 + $submenu['gutenberg'][] = array(
90 + __( 'Support', 'gutenberg' ),
91 + 'edit_posts',
92 + __( 'https://wordpress.org/support/plugin/gutenberg', 'gutenberg' ),
93 + );
94 +
95 + $submenu['gutenberg'][] = array(
96 + __( 'Documentation', 'gutenberg' ),
97 + 'edit_posts',
98 + 'https://developer.wordpress.org/block-editor/',
99 + );
100 + }
101 +
102 + add_submenu_page(
103 + 'gutenberg',
104 + __( 'Experiments Settings', 'gutenberg' ),
105 + __( 'Experiments', 'gutenberg' ),
106 + 'edit_posts',
107 + 'gutenberg-experiments',
108 + 'the_gutenberg_experiments'
109 + );
110 +}
111 +add_action( 'admin_menu', 'gutenberg_menu', 9 );
112 +
113 +/**
20 114 * Display a version notice and deactivate the Gutenberg plugin.
21 115 *
22 116 * @since 0.1.0
23 117 */
@@ -23,9 +117,9 @@
23 117 */
24 118 function gutenberg_wordpress_version_notice() {
25 119 echo '<div class="error"><p>';
26 120 /* 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 );
121 + printf( __( 'Gutenberg requires WordPress %s or later to function properly. Please upgrade WordPress before activating Gutenberg.', 'gutenberg' ), '5.3.0' );
28 122 echo '</p></div>';
29 123
30 124 deactivate_plugins( array( 'gutenberg/gutenberg.php' ) );
31 125 }
@@ -36,9 +130,9 @@
36 130 * @since 0.1.0
37 131 */
38 132 function gutenberg_build_files_notice() {
39 133 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' );
134 + _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 135 echo '</p></div>';
42 136 }
43 137
44 138 /**
@@ -44,15 +138,12 @@
44 138 /**
45 139 * Verify that we can initialize the Gutenberg editor , then load it.
46 140 *
47 141 * @since 1.5.0
48 - *
49 - * @global string $wp_version The WordPress version string.
50 - *
51 142 */
52 143 function gutenberg_pre_init() {
53 144 global $wp_version;
54 - if ( ! file_exists( __DIR__ . '/build/scripts/blocks' ) ) {
145 + if ( defined( 'GUTENBERG_DEVELOPMENT_MODE' ) && GUTENBERG_DEVELOPMENT_MODE && ! file_exists( dirname( __FILE__ ) . '/build/blocks' ) ) {
55 146 add_action( 'admin_notices', 'gutenberg_build_files_notice' );
56 147 return;
57 148 }
58 149
@@ -61,14 +152,41 @@
61 152
62 153 // Strip '-src' from the version string. Messes up version_compare().
63 154 $version = str_replace( '-src', '', $wp_version );
64 155
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, '<' ) ) {
156 + if ( version_compare( $version, '5.3.0', '<' ) ) {
69 157 add_action( 'admin_notices', 'gutenberg_wordpress_version_notice' );
70 158 return;
71 159 }
72 160
73 - require_once __DIR__ . '/lib/load.php';
161 + require_once dirname( __FILE__ ) . '/lib/load.php';
74 162 }
163 +
164 +/**
165 + * Outputs a WP REST API nonce.
166 + */
167 +function gutenberg_rest_nonce() {
168 + exit( wp_create_nonce( 'wp_rest' ) );
169 +}
170 +add_action( 'wp_ajax_gutenberg_rest_nonce', 'gutenberg_rest_nonce' );
171 +
172 +
173 +/**
174 + * Exposes the site icon url to the Gutenberg editor through the WordPress REST
175 + * API. The site icon url should instead be fetched from the wp/v2/settings
176 + * endpoint when https://github.com/WordPress/gutenberg/pull/19967 is complete.
177 + *
178 + * @since 8.2.1
179 + *
180 + * @param WP_REST_Response $response Response data served by the WordPress REST index endpoint.
181 + * @return WP_REST_Response
182 + */
183 +function register_site_icon_url( $response ) {
184 + $data = $response->data;
185 + $data['site_icon_url'] = get_site_icon_url();
186 + $response->set_data( $data );
187 + return $response;
188 +}
189 +
190 +add_filter( 'rest_index', 'register_site_icon_url' );
191 +
192 +add_theme_support( 'widgets-block-editor' );