PluginProbe
Gutenberg / 9.7.2
Gutenberg v9.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 +161 -16 23.7.09.7.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.9
7 - * Requires PHP: 7.4
8 - * Version: 23.7.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: 9.7.2
9 9 * Author: Gutenberg Team
10 10 * Text Domain: gutenberg
11 11 *
12 12 * @package gutenberg
@@ -11,13 +11,134 @@
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', '9.7.2' );
17 +define( 'GUTENBERG_GIT_COMMIT', '549e7e48b49189a008cb1c5c384bff3987cccf0a' );
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 + 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 ( gutenberg_use_widgets_block_editor() ) {
48 + add_theme_page(
49 + __( 'Widgets', 'gutenberg' ),
50 + __( 'Widgets', 'gutenberg' ),
51 + 'edit_theme_options',
52 + 'gutenberg-widgets',
53 + 'the_gutenberg_widgets'
54 + );
55 + remove_submenu_page( 'themes.php', 'widgets.php' );
56 + }
57 +
58 + if ( get_option( 'gutenberg-experiments' ) ) {
59 + if ( array_key_exists( 'gutenberg-navigation', get_option( 'gutenberg-experiments' ) ) ) {
60 + add_submenu_page(
61 + 'gutenberg',
62 + __( 'Navigation (beta)', 'gutenberg' ),
63 + __( 'Navigation (beta)', 'gutenberg' ),
64 + 'edit_theme_options',
65 + 'gutenberg-navigation',
66 + 'gutenberg_navigation_page'
67 + );
68 + }
69 + }
70 + if ( current_user_can( 'edit_posts' ) ) {
71 + add_submenu_page(
72 + 'gutenberg',
73 + __( 'Support', 'gutenberg' ),
74 + __( 'Support', 'gutenberg' ),
75 + 'edit_posts',
76 + __( 'https://wordpress.org/support/plugin/gutenberg/', 'gutenberg' )
77 + );
78 + add_submenu_page(
79 + 'gutenberg',
80 + __( 'Documentation', 'gutenberg' ),
81 + __( 'Documentation', 'gutenberg' ),
82 + 'edit_posts',
83 + 'https://developer.wordpress.org/block-editor/'
84 + );
85 + }
86 +
87 + add_submenu_page(
88 + 'gutenberg',
89 + __( 'Experiments Settings', 'gutenberg' ),
90 + __( 'Experiments', 'gutenberg' ),
91 + 'edit_posts',
92 + 'gutenberg-experiments',
93 + 'the_gutenberg_experiments'
94 + );
95 +}
96 +add_action( 'admin_menu', 'gutenberg_menu', 9 );
97 +
98 +/**
99 + * Site editor's Menu.
100 + *
101 + * Adds a new wp-admin menu item for the Site editor.
102 + *
103 + * @since 9.4.0
104 + */
105 +function gutenberg_site_editor_menu() {
106 + if ( gutenberg_is_fse_theme() ) {
107 + add_menu_page(
108 + __( 'Site Editor (beta)', 'gutenberg' ),
109 + sprintf(
110 + /* translators: %s: "beta" label. */
111 + __( 'Site Editor %s', 'gutenberg' ),
112 + '<span class="awaiting-mod">' . __( 'beta', 'gutenberg' ) . '</span>'
113 + ),
114 + 'edit_theme_options',
115 + 'gutenberg-edit-site',
116 + 'gutenberg_edit_site_page',
117 + 'dashicons-layout'
118 + );
119 + }
120 +}
121 +add_action( 'admin_menu', 'gutenberg_site_editor_menu', 9 );
122 +
123 +/**
124 + * Modify WP admin bar.
125 + *
126 + * @param WP_Admin_Bar $wp_admin_bar Core class used to implement the Toolbar API.
127 + */
128 +function modify_admin_bar( $wp_admin_bar ) {
129 + if ( gutenberg_use_widgets_block_editor() ) {
130 + $wp_admin_bar->add_menu(
131 + array(
132 + 'id' => 'widgets',
133 + 'href' => admin_url( 'themes.php?page=gutenberg-widgets' ),
134 + )
135 + );
136 + }
137 +}
138 +add_action( 'admin_bar_menu', 'modify_admin_bar', 40 );
139 +
140 +/**
20 141 * Display a version notice and deactivate the Gutenberg plugin.
21 142 *
22 143 * @since 0.1.0
23 144 */
@@ -23,12 +144,12 @@
23 144 */
24 145 function gutenberg_wordpress_version_notice() {
25 146 echo '<div class="error"><p>';
26 147 /* 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 );
148 + printf( __( 'Gutenberg requires WordPress %s or later to function properly. Please upgrade WordPress before activating Gutenberg.', 'gutenberg' ), '5.3.0' );
28 149 echo '</p></div>';
29 150
30 - deactivate_plugins( array( plugin_basename( __FILE__ ) ) );
151 + deactivate_plugins( array( 'gutenberg/gutenberg.php' ) );
31 152 }
32 153
33 154 /**
34 155 * Display a build notice.
@@ -36,9 +157,9 @@
36 157 * @since 0.1.0
37 158 */
38 159 function gutenberg_build_files_notice() {
39 160 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' );
161 + _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 162 echo '</p></div>';
42 163 }
43 164
44 165 /**
@@ -44,15 +165,12 @@
44 165 /**
45 166 * Verify that we can initialize the Gutenberg editor , then load it.
46 167 *
47 168 * @since 1.5.0
48 - *
49 - * @global string $wp_version The WordPress version string.
50 - *
51 169 */
52 170 function gutenberg_pre_init() {
53 171 global $wp_version;
54 - if ( ! file_exists( __DIR__ . '/build/scripts/blocks' ) ) {
172 + if ( defined( 'GUTENBERG_DEVELOPMENT_MODE' ) && GUTENBERG_DEVELOPMENT_MODE && ! file_exists( __DIR__ . '/build/blocks' ) ) {
55 173 add_action( 'admin_notices', 'gutenberg_build_files_notice' );
56 174 return;
57 175 }
58 176
@@ -61,12 +179,9 @@
61 179
62 180 // Strip '-src' from the version string. Messes up version_compare().
63 181 $version = str_replace( '-src', '', $wp_version );
64 182
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, '<' ) ) {
183 + if ( version_compare( $version, '5.3.0', '<' ) ) {
69 184 add_action( 'admin_notices', 'gutenberg_wordpress_version_notice' );
70 185 return;
71 186 }
72 187
@@ -71,4 +186,34 @@
71 186 }
72 187
73 188 require_once __DIR__ . '/lib/load.php';
74 189 }
190 +
191 +/**
192 + * Outputs a WP REST API nonce.
193 + */
194 +function gutenberg_rest_nonce() {
195 + exit( wp_create_nonce( 'wp_rest' ) );
196 +}
197 +add_action( 'wp_ajax_gutenberg_rest_nonce', 'gutenberg_rest_nonce' );
198 +
199 +
200 +/**
201 + * Exposes the site icon url to the Gutenberg editor through the WordPress REST
202 + * API. The site icon url should instead be fetched from the wp/v2/settings
203 + * endpoint when https://github.com/WordPress/gutenberg/pull/19967 is complete.
204 + *
205 + * @since 8.2.1
206 + *
207 + * @param WP_REST_Response $response Response data served by the WordPress REST index endpoint.
208 + * @return WP_REST_Response
209 + */
210 +function register_site_icon_url( $response ) {
211 + $data = $response->data;
212 + $data['site_icon_url'] = get_site_icon_url();
213 + $response->set_data( $data );
214 + return $response;
215 +}
216 +
217 +add_filter( 'rest_index', 'register_site_icon_url' );
218 +
219 +add_theme_support( 'widgets-block-editor' );