Skip to content

Commit 3e5ffd4

Browse files
jeryjclaude
andcommitted
Plugin: Bump minimum required WordPress version to 7.0
WordPress 7.1 is the current release, and the plugin only supports the last two major WordPress versions. Removes lib/compat/wordpress-7.0/, whose contents WordPress 7.0 supplies. Each file was either dead behind a class_exists()/function_exists() guard for a symbol core requires in wp-settings.php before plugins load, or the plugin's own copy of a core implementation that it swapped in with remove_action()/remove_filter() -- the same shape as the lib/compat/wordpress-6.9/ files removed in #79196. Three pieces have no core equivalent and move rather than being deleted: - gutenberg_get_allowed_icon_svg_tags(), to lib/class-wp-icons-registry-gutenberg.php, its only consumer - the Fonts and Connectors admin menu registrations, which point at pages generated by the routes build and so are plugin-only, to lib/compat/plugin/ - the Gutenberg-only edit-site preload path filter, likewise Tests that called the removed functions now call core's equivalents, so the suite keeps the same 2294 tests and 4734 assertions as trunk. The templates controller test compares by key and value rather than by key order: core merges the registered `date` field at a different position than the removed subclass did, and a JSON object's key order is not part of the contract. Its expected values are unchanged. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01V2EiC2qBSowsxKEoALHiHt
1 parent 380c3ee commit 3e5ffd4

27 files changed

Lines changed: 191 additions & 3701 deletions

‎gutenberg.php‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
* Plugin Name: Gutenberg
44
* Plugin URI: https://github.com/WordPress/gutenberg
55
* 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
6+
* Requires at least: 7.0
77
* Requires PHP: 7.4
88
* Version: 23.9.0
99
* Author: Gutenberg Team
@@ -12,7 +12,7 @@
1212
* @package gutenberg
1313
*/
1414

15-
defined( 'GUTENBERG_MINIMUM_WP_VERSION' ) or define( 'GUTENBERG_MINIMUM_WP_VERSION', '6.9' );
15+
defined( 'GUTENBERG_MINIMUM_WP_VERSION' ) or define( 'GUTENBERG_MINIMUM_WP_VERSION', '7.0' );
1616

1717
gutenberg_pre_init();
1818

‎lib/class-wp-icons-registry-gutenberg.php‎

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,64 @@
11
<?php
22

3+
/**
4+
* Returns the SVG elements and attributes allowed for registered icons.
5+
*
6+
* @return array[] Allowed SVG elements and attributes.
7+
* @phpstan-return array<non-falsy-string, array<non-falsy-string, true>>
8+
*/
9+
function gutenberg_get_allowed_icon_svg_tags(): array {
10+
$stroke_attributes = array(
11+
'style' => true,
12+
'stroke' => true,
13+
'stroke-width' => true,
14+
'stroke-linecap' => true,
15+
'stroke-linejoin' => true,
16+
'stroke-miterlimit' => true,
17+
'vector-effect' => true,
18+
);
19+
20+
return array(
21+
'svg' => array_merge(
22+
array(
23+
'class' => true,
24+
'xmlns' => true,
25+
'width' => true,
26+
'height' => true,
27+
'viewbox' => true,
28+
'aria-hidden' => true,
29+
'role' => true,
30+
'focusable' => true,
31+
'fill' => true,
32+
'fill-rule' => true,
33+
'clip-rule' => true,
34+
),
35+
$stroke_attributes
36+
),
37+
'path' => array_merge(
38+
array(
39+
'fill' => true,
40+
'fill-rule' => true,
41+
'clip-rule' => true,
42+
'd' => true,
43+
'transform' => true,
44+
),
45+
$stroke_attributes
46+
),
47+
'polygon' => array_merge(
48+
array(
49+
'fill' => true,
50+
'fill-rule' => true,
51+
'clip-rule' => true,
52+
'points' => true,
53+
'transform' => true,
54+
'focusable' => true,
55+
),
56+
$stroke_attributes
57+
),
58+
);
59+
}
60+
61+
362
class WP_Icons_Registry_Gutenberg extends WP_Icons_Registry {
463
/**
564
* Overridden to skip the parent's core icon registration, which uses the

‎lib/compat/plugin/connectors.php‎

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
<?php
2+
/**
3+
* Bootstraps the Connectors settings page in wp-admin.
4+
*
5+
* @package gutenberg
6+
*/
7+
// Priority 11 to run after Core's menu.php sets up the connectors menu.
8+
add_action( 'admin_menu', '_gutenberg_connectors_add_settings_menu_item', 11 );
9+
10+
/**
11+
* Registers the Connectors menu item under Settings.
12+
* Removes Core's connectors menu item first to prevent duplication.
13+
*
14+
* @access private
15+
*/
16+
function _gutenberg_connectors_add_settings_menu_item(): void {
17+
if ( ! class_exists( '\WordPress\AiClient\AiClient' ) || ! function_exists( 'gutenberg_options_connectors_wp_admin_render_page' ) ) {
18+
return;
19+
}
20+
21+
// Remove Core's connectors menu item if it exists.
22+
remove_submenu_page( 'options-general.php', 'connectors-wp-admin' );
23+
remove_submenu_page( 'options-general.php', 'options-connectors.php' );
24+
25+
add_submenu_page(
26+
'options-general.php',
27+
__( 'Connectors', 'gutenberg' ),
28+
__( 'Connectors', 'gutenberg' ),
29+
'manage_options',
30+
'options-connectors-wp-admin',
31+
'gutenberg_options_connectors_wp_admin_render_page',
32+
1
33+
);
34+
}

‎lib/compat/plugin/fonts.php‎

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,3 +41,24 @@ function gutenberg_before_delete_font_face( $post_id, $post ) {
4141
}
4242
}
4343
add_action( 'before_delete_post', 'gutenberg_before_delete_font_face', 10, 2 );
44+
45+
// Priority 11 to run after Core's menu.php sets up the fonts menu.
46+
add_action( 'admin_menu', 'gutenberg_register_fonts_menu_item', 11 );
47+
48+
/**
49+
* Registers the Fonts menu item under Appearance using the font-library page.
50+
* Removes Core's fonts menu item first to prevent duplication.
51+
*/
52+
function gutenberg_register_fonts_menu_item() {
53+
// Remove Core's fonts menu item if it exists.
54+
remove_submenu_page( 'themes.php', 'font-library.php' );
55+
56+
add_submenu_page(
57+
'themes.php',
58+
__( 'Fonts', 'gutenberg' ),
59+
__( 'Fonts', 'gutenberg' ),
60+
'edit_theme_options',
61+
'font-library-wp-admin',
62+
'gutenberg_font_library_wp_admin_render_page'
63+
);
64+
}
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,9 @@
11
<?php
2+
/**
3+
* Gutenberg-only adjustments to the block editor preload paths.
4+
*
5+
* @package gutenberg
6+
*/
27

38
/**
49
* Preload necessary resources for the editors.

‎lib/compat/wordpress-7.0/auto-register.php‎

Lines changed: 0 additions & 92 deletions
This file was deleted.

0 commit comments

Comments
 (0)