| @@ -13,22 +13,8 @@ | ||
| 13 | 13 | |
| 14 | 14 | require_once __DIR__ . '/init.php'; |
| 15 | 15 | require_once __DIR__ . '/upgrade.php'; |
| 16 | 16 | |
| 17 | -// Load auto-generated build registration. | |
| 18 | -$build_registration = plugin_dir_path( __DIR__ ) . 'build/build.php'; | |
| 19 | -if ( file_exists( $build_registration ) ) { | |
| 20 | - require_once $build_registration; | |
| 21 | -} | |
| 22 | - | |
| 23 | -// Define version constant for backwards compatibility. | |
| 24 | -// The constants.php file returns an array but doesn't define constants to avoid conflicts. | |
| 25 | -$constants_file = plugin_dir_path( __DIR__ ) . 'build/constants.php'; | |
| 26 | -if ( file_exists( $constants_file ) && ! defined( 'GUTENBERG_VERSION' ) ) { | |
| 27 | - $build_constants = require_once $constants_file; | |
| 28 | - define( 'GUTENBERG_VERSION', $build_constants['version'] ); | |
| 29 | -} | |
| 30 | - | |
| 31 | 17 | /** |
| 32 | 18 | * Checks whether the Gutenberg experiment is enabled. |
| 33 | 19 | * |
| 34 | 20 | * @since 6.7.0 |
| @@ -37,14 +23,8 @@ | ||
| 37 | 23 | * |
| 38 | 24 | * @return bool True when the experiment is enabled. |
| 39 | 25 | */ |
| 40 | 26 | function gutenberg_is_experiment_enabled( $name ) { |
| 41 | - // Special handling for active_templates - check if the active_templates option exists. | |
| 42 | - // This is not stored in the experiments array but as a separate option. | |
| 43 | - if ( 'active_templates' === $name ) { | |
| 44 | - return is_array( get_option( 'active_templates' ) ); | |
| 45 | - } | |
| 46 | - | |
| 47 | 27 | $experiments = get_option( 'gutenberg-experiments' ); |
| 48 | 28 | return ! empty( $experiments[ $name ] ); |
| 49 | 29 | } |
| 50 | 30 | |
| @@ -54,93 +34,101 @@ | ||
| 54 | 34 | if ( ! class_exists( 'WP_REST_Block_Editor_Settings_Controller' ) ) { |
| 55 | 35 | require_once __DIR__ . '/experimental/class-wp-rest-block-editor-settings-controller.php'; |
| 56 | 36 | } |
| 57 | 37 | |
| 58 | - // WordPress 6.9 compat. | |
| 59 | - require __DIR__ . '/compat/wordpress-6.9/class-gutenberg-rest-attachments-controller-6-9.php'; | |
| 60 | - require __DIR__ . '/compat/wordpress-6.9/block-bindings.php'; | |
| 61 | - require __DIR__ . '/compat/wordpress-6.9/post-data-block-bindings.php'; | |
| 62 | - require __DIR__ . '/compat/wordpress-6.9/term-data-block-bindings.php'; | |
| 63 | - require __DIR__ . '/compat/wordpress-6.9/rest-api.php'; | |
| 64 | - require __DIR__ . '/compat/wordpress-6.9/block-comments.php'; | |
| 65 | - require __DIR__ . '/compat/wordpress-6.9/class-gutenberg-rest-comment-controller-6-9.php'; | |
| 38 | + // WordPress 6.6 compat. | |
| 39 | + require __DIR__ . '/compat/wordpress-6.6/class-gutenberg-rest-global-styles-revisions-controller-6-6.php'; | |
| 40 | + require __DIR__ . '/compat/wordpress-6.6/class-gutenberg-rest-templates-controller-6-6.php'; | |
| 41 | + require __DIR__ . '/compat/wordpress-6.6/rest-api.php'; | |
| 66 | 42 | |
| 67 | - // WordPress 7.0 compat. | |
| 68 | - require __DIR__ . '/compat/wordpress-7.0/class-gutenberg-rest-autosaves-controller.php'; | |
| 69 | - require __DIR__ . '/compat/wordpress-7.0/class-gutenberg-rest-revisions-controller.php'; | |
| 70 | - require __DIR__ . '/compat/wordpress-7.0/class-gutenberg-rest-block-patterns-controller-7-0.php'; | |
| 71 | - require __DIR__ . '/compat/wordpress-7.0/class-gutenberg-rest-templates-controller-7-0.php'; | |
| 72 | - require __DIR__ . '/compat/wordpress-7.0/class-gutenberg-rest-static-templates-controller.php'; | |
| 73 | - require __DIR__ . '/compat/wordpress-7.0/class-wp-icons-registry.php'; | |
| 74 | - require __DIR__ . '/compat/wordpress-7.0/class-wp-rest-icons-controller.php'; | |
| 75 | - require __DIR__ . '/compat/wordpress-7.0/collaboration.php'; | |
| 76 | - require __DIR__ . '/compat/wordpress-7.0/template-activate.php'; | |
| 77 | - require __DIR__ . '/compat/wordpress-7.0/rest-api.php'; | |
| 78 | - require __DIR__ . '/compat/wordpress-7.0/global-styles.php'; | |
| 79 | - require __DIR__ . '/compat/wordpress-7.0/class-wp-connector-registry.php'; | |
| 80 | - require __DIR__ . '/compat/wordpress-7.0/connectors.php'; | |
| 43 | + // WordPress 6.7 compat. | |
| 44 | + require __DIR__ . '/compat/wordpress-6.7/class-gutenberg-rest-posts-controller-6-7.php'; | |
| 45 | + require __DIR__ . '/compat/wordpress-6.7/class-gutenberg-rest-templates-controller-6-7.php'; | |
| 46 | + require __DIR__ . '/compat/wordpress-6.7/class-gutenberg-rest-server.php'; | |
| 47 | + require __DIR__ . '/compat/wordpress-6.7/rest-api.php'; | |
| 81 | 48 | |
| 82 | - // WordPress 7.1 compat. | |
| 83 | - require __DIR__ . '/compat/wordpress-7.1/class-gutenberg-rest-view-config-controller-7-1.php'; | |
| 84 | - require __DIR__ . '/compat/wordpress-7.1/rest-api.php'; | |
| 49 | + // WordPress 6.8 compat. | |
| 50 | + require __DIR__ . '/compat/wordpress-6.8/block-comments.php'; | |
| 51 | + require __DIR__ . '/compat/wordpress-6.8/class-gutenberg-rest-comment-controller-6-8.php'; | |
| 85 | 52 | |
| 86 | 53 | // Plugin specific code. |
| 87 | 54 | require_once __DIR__ . '/class-wp-rest-global-styles-controller-gutenberg.php'; |
| 88 | 55 | require_once __DIR__ . '/class-wp-rest-edit-site-export-controller-gutenberg.php'; |
| 89 | - require_once __DIR__ . '/class-wp-icons-registry-gutenberg.php'; | |
| 90 | - require_once __DIR__ . '/class-wp-rest-icons-controller-gutenberg.php'; | |
| 91 | 56 | require_once __DIR__ . '/rest-api.php'; |
| 92 | 57 | |
| 93 | - // Experimental autosaves controller override for real-time collaboration. | |
| 94 | - | |
| 95 | 58 | require_once __DIR__ . '/experimental/rest-api.php'; |
| 96 | 59 | require_once __DIR__ . '/experimental/kses-allowed-html.php'; |
| 60 | +} | |
| 97 | 61 | |
| 98 | - require_once __DIR__ . '/experimental/class-gutenberg-hierarchical-sort.php'; | |
| 62 | +// Experimental signaling server. | |
| 63 | +if ( ! class_exists( 'Gutenberg_HTTP_Singling_Server' ) ) { | |
| 64 | + require_once __DIR__ . '/experimental/sync/class-gutenberg-http-signaling-server.php'; | |
| 99 | 65 | } |
| 100 | 66 | |
| 101 | -require_once __DIR__ . '/remove-core-enqueue-scripts.php'; | |
| 102 | -require_once __DIR__ . '/experimental/editor-settings.php'; | |
| 103 | -require_once __DIR__ . '/experimental/rest-api-overrides.php'; | |
| 67 | +require __DIR__ . '/experimental/editor-settings.php'; | |
| 104 | 68 | |
| 105 | 69 | // Gutenberg plugin compat. |
| 106 | 70 | require __DIR__ . '/compat/plugin/edit-site-routes-backwards-compat.php'; |
| 107 | 71 | require __DIR__ . '/compat/plugin/fonts.php'; |
| 108 | 72 | |
| 73 | +// The Token Map was created during 6.6 in order to support the HTML API. It must be loaded before it. | |
| 74 | +require __DIR__ . '/compat/wordpress-6.6/class-gutenberg-token-map-6-6.php'; | |
| 75 | +require __DIR__ . '/compat/wordpress-6.7/class-gutenberg-token-map-6-7.php'; | |
| 109 | 76 | |
| 110 | -// WordPress 6.9 compat. | |
| 111 | -require __DIR__ . '/compat/wordpress-6.9/customizer-preview-custom-css.php'; | |
| 112 | -require __DIR__ . '/compat/wordpress-6.9/command-palette.php'; | |
| 113 | -require __DIR__ . '/compat/wordpress-6.9/client-assets.php'; | |
| 77 | +require __DIR__ . '/compat/wordpress-6.6/html-api/gutenberg-html5-named-character-references-6-6.php'; | |
| 78 | +require __DIR__ . '/compat/wordpress-6.6/html-api/class-gutenberg-html-decoder-6-6.php'; | |
| 79 | +require __DIR__ . '/compat/wordpress-6.6/html-api/class-gutenberg-html-tag-processor-6-6.php'; | |
| 80 | +require __DIR__ . '/compat/wordpress-6.6/html-api/class-gutenberg-html-open-elements-6-6.php'; | |
| 81 | +require __DIR__ . '/compat/wordpress-6.6/html-api/class-gutenberg-html-stack-event-6-6.php'; | |
| 82 | +require __DIR__ . '/compat/wordpress-6.6/html-api/class-gutenberg-html-processor-state-6-6.php'; | |
| 83 | +require __DIR__ . '/compat/wordpress-6.6/html-api/class-gutenberg-html-processor-6-6.php'; | |
| 114 | 84 | |
| 115 | -// WordPress 7.0 compat. | |
| 116 | -require __DIR__ . '/compat/wordpress-7.0/preload.php'; | |
| 117 | -require __DIR__ . '/compat/wordpress-7.0/auto-register.php'; | |
| 118 | -require __DIR__ . '/compat/wordpress-7.0/blocks.php'; | |
| 119 | -require __DIR__ . '/compat/wordpress-7.0/kses.php'; | |
| 120 | -require __DIR__ . '/compat/wordpress-7.0/media.php'; | |
| 121 | -require __DIR__ . '/compat/wordpress-7.0/command-palette.php'; | |
| 122 | -require __DIR__ . '/compat/wordpress-7.0/meta-box-rtc-compat.php'; | |
| 123 | -require __DIR__ . '/compat/wordpress-7.0/script-modules.php'; | |
| 85 | +// Type annotations were added in 6.7 so every file is updated. | |
| 86 | +require __DIR__ . '/compat/wordpress-6.7/html-api/class-gutenberg-html-active-formatting-elements-6-7.php'; | |
| 87 | +require __DIR__ . '/compat/wordpress-6.7/html-api/class-gutenberg-html-attribute-token-6-7.php'; | |
| 88 | +require __DIR__ . '/compat/wordpress-6.7/html-api/class-gutenberg-html-decoder-6-7.php'; | |
| 89 | +require __DIR__ . '/compat/wordpress-6.7/html-api/class-gutenberg-html-open-elements-6-7.php'; | |
| 90 | +require __DIR__ . '/compat/wordpress-6.7/html-api/class-gutenberg-html-span-6-7.php'; | |
| 91 | +require __DIR__ . '/compat/wordpress-6.7/html-api/class-gutenberg-html-stack-event-6-7.php'; | |
| 92 | +require __DIR__ . '/compat/wordpress-6.7/html-api/class-gutenberg-html-text-replacement-6-7.php'; | |
| 93 | +require __DIR__ . '/compat/wordpress-6.7/html-api/class-gutenberg-html-token-6-7.php'; | |
| 94 | +require __DIR__ . '/compat/wordpress-6.7/html-api/class-gutenberg-html-unsupported-exception-6-7.php'; | |
| 95 | +require __DIR__ . '/compat/wordpress-6.7/html-api/class-gutenberg-html-tag-processor-6-7.php'; | |
| 96 | +require __DIR__ . '/compat/wordpress-6.7/html-api/class-gutenberg-html-processor-state-6-7.php'; | |
| 97 | +require __DIR__ . '/compat/wordpress-6.7/html-api/class-gutenberg-html-processor-6-7.php'; | |
| 124 | 98 | |
| 125 | -// WordPress 7.1 compat. | |
| 126 | -require __DIR__ . '/compat/wordpress-7.1/classic-block.php'; | |
| 99 | +// WordPress 6.6 compat. | |
| 100 | +require __DIR__ . '/compat/wordpress-6.6/admin-bar.php'; | |
| 101 | +require __DIR__ . '/compat/wordpress-6.6/blocks.php'; | |
| 102 | +require __DIR__ . '/compat/wordpress-6.6/block-editor.php'; | |
| 103 | +require __DIR__ . '/compat/wordpress-6.6/compat.php'; | |
| 104 | +require __DIR__ . '/compat/wordpress-6.6/resolve-patterns.php'; | |
| 105 | +require __DIR__ . '/compat/wordpress-6.6/block-bindings/pattern-overrides.php'; | |
| 106 | +require __DIR__ . '/compat/wordpress-6.6/block-template-utils.php'; | |
| 107 | +require __DIR__ . '/compat/wordpress-6.6/option.php'; | |
| 108 | +require __DIR__ . '/compat/wordpress-6.6/post.php'; | |
| 127 | 109 | |
| 110 | +// WordPress 6.7 compat. | |
| 111 | +require __DIR__ . '/compat/wordpress-6.7/block-templates.php'; | |
| 112 | +require __DIR__ . '/compat/wordpress-6.7/blocks.php'; | |
| 113 | +require __DIR__ . '/compat/wordpress-6.7/block-bindings.php'; | |
| 114 | +require __DIR__ . '/compat/wordpress-6.7/script-modules.php'; | |
| 115 | +require __DIR__ . '/compat/wordpress-6.7/class-wp-block-templates-registry.php'; | |
| 116 | +require __DIR__ . '/compat/wordpress-6.7/compat.php'; | |
| 117 | +require __DIR__ . '/compat/wordpress-6.7/post-formats.php'; | |
| 118 | + | |
| 128 | 119 | // Experimental features. |
| 129 | 120 | require __DIR__ . '/experimental/block-editor-settings-mobile.php'; |
| 130 | 121 | require __DIR__ . '/experimental/blocks.php'; |
| 131 | 122 | require __DIR__ . '/experimental/navigation-theme-opt-in.php'; |
| 132 | 123 | require __DIR__ . '/experimental/kses.php'; |
| 124 | +require __DIR__ . '/experimental/l10n.php'; | |
| 125 | +require __DIR__ . '/experimental/synchronization.php'; | |
| 133 | 126 | require __DIR__ . '/experimental/script-modules.php'; |
| 134 | -require __DIR__ . '/experimental/pages/site-editor.php'; | |
| 135 | -require __DIR__ . '/experimental/extensible-site-editor.php'; | |
| 136 | -require __DIR__ . '/experimental/fonts/load.php'; | |
| 137 | -if ( class_exists( '\WordPress\AiClient\AiClient' ) ) { | |
| 138 | - require __DIR__ . '/experimental/connectors/load.php'; | |
| 139 | -} | |
| 127 | +require __DIR__ . '/experimental/posts/load.php'; | |
| 140 | 128 | |
| 141 | -if ( gutenberg_is_experiment_enabled( 'gutenberg-workflow-palette' ) ) { | |
| 142 | - require __DIR__ . '/experimental/workflow-palette.php'; | |
| 129 | +if ( gutenberg_is_experiment_enabled( 'gutenberg-no-tinymce' ) ) { | |
| 130 | + require __DIR__ . '/experimental/disable-tinymce.php'; | |
| 143 | 131 | } |
| 144 | 132 | |
| 145 | 133 | // Load the BC Layer to avoid fatal errors of extenders using the Fonts API. |
| 146 | 134 | // @core-merge: do not merge the BC layer files into WordPress Core. |
| @@ -167,22 +155,24 @@ | ||
| 167 | 155 | require __DIR__ . '/class-wp-duotone-gutenberg.php'; |
| 168 | 156 | require __DIR__ . '/blocks.php'; |
| 169 | 157 | require __DIR__ . '/block-editor-settings.php'; |
| 170 | 158 | require __DIR__ . '/client-assets.php'; |
| 171 | -require __DIR__ . '/mathml-kses.php'; | |
| 172 | 159 | require __DIR__ . '/demo.php'; |
| 173 | -require __DIR__ . '/experimental/experiments/load.php'; | |
| 160 | +require __DIR__ . '/experiments-page.php'; | |
| 174 | 161 | require __DIR__ . '/interactivity-api.php'; |
| 175 | 162 | require __DIR__ . '/block-template-utils.php'; |
| 163 | +if ( gutenberg_is_experiment_enabled( 'gutenberg-full-page-client-side-navigation' ) ) { | |
| 164 | + require __DIR__ . '/experimental/full-page-client-side-navigation.php'; | |
| 165 | +} | |
| 176 | 166 | |
| 177 | 167 | // Copied package PHP files. |
| 178 | -if ( is_dir( __DIR__ . '/../build/scripts/style-engine' ) ) { | |
| 179 | - require_once __DIR__ . '/../build/scripts/style-engine/class-wp-style-engine-css-declarations-gutenberg.php'; | |
| 180 | - require_once __DIR__ . '/../build/scripts/style-engine/class-wp-style-engine-css-rule-gutenberg.php'; | |
| 181 | - require_once __DIR__ . '/../build/scripts/style-engine/class-wp-style-engine-css-rules-store-gutenberg.php'; | |
| 182 | - require_once __DIR__ . '/../build/scripts/style-engine/class-wp-style-engine-processor-gutenberg.php'; | |
| 183 | - require_once __DIR__ . '/../build/scripts/style-engine/class-wp-style-engine-gutenberg.php'; | |
| 184 | - require_once __DIR__ . '/../build/scripts/style-engine/style-engine-gutenberg.php'; | |
| 168 | +if ( is_dir( __DIR__ . '/../build/style-engine' ) ) { | |
| 169 | + require_once __DIR__ . '/../build/style-engine/class-wp-style-engine-css-declarations-gutenberg.php'; | |
| 170 | + require_once __DIR__ . '/../build/style-engine/class-wp-style-engine-css-rule-gutenberg.php'; | |
| 171 | + require_once __DIR__ . '/../build/style-engine/class-wp-style-engine-css-rules-store-gutenberg.php'; | |
| 172 | + require_once __DIR__ . '/../build/style-engine/class-wp-style-engine-processor-gutenberg.php'; | |
| 173 | + require_once __DIR__ . '/../build/style-engine/class-wp-style-engine-gutenberg.php'; | |
| 174 | + require_once __DIR__ . '/../build/style-engine/style-engine-gutenberg.php'; | |
| 185 | 175 | } |
| 186 | 176 | |
| 187 | 177 | // Block supports overrides. |
| 188 | 178 | require __DIR__ . '/block-supports/settings.php'; |
| @@ -197,37 +187,12 @@ | ||
| 197 | 187 | require __DIR__ . '/block-supports/duotone.php'; |
| 198 | 188 | require __DIR__ . '/block-supports/shadow.php'; |
| 199 | 189 | require __DIR__ . '/block-supports/background.php'; |
| 200 | 190 | require __DIR__ . '/block-supports/block-style-variations.php'; |
| 201 | -require __DIR__ . '/block-supports/aria-label.php'; | |
| 202 | -require __DIR__ . '/block-supports/anchor.php'; | |
| 203 | -require __DIR__ . '/block-supports/block-visibility.php'; | |
| 204 | -require __DIR__ . '/block-supports/custom-css.php'; | |
| 205 | 191 | |
| 192 | +// Data views. | |
| 193 | +require_once __DIR__ . '/experimental/data-views.php'; | |
| 194 | + | |
| 206 | 195 | // Client-side media processing. |
| 207 | -require_once __DIR__ . '/media/load.php'; | |
| 208 | - | |
| 209 | -// Interactivity API full-page client-side navigation. | |
| 210 | -if ( gutenberg_is_experiment_enabled( 'gutenberg-full-page-client-side-navigation' ) ) { | |
| 211 | - require __DIR__ . '/experimental/interactivity-api/class-gutenberg-interactivity-api-full-page-navigation.php'; | |
| 212 | - Gutenberg_Interactivity_API_Full_Page_Navigation::instance(); | |
| 213 | -} | |
| 214 | - | |
| 215 | -// Block patterns for navigation overlays. | |
| 216 | -require __DIR__ . '/overlay-patterns.php'; | |
| 217 | - | |
| 218 | -// Guidelines (only load when experiment is enabled). | |
| 219 | -if ( gutenberg_is_experiment_enabled( 'gutenberg-guidelines' ) ) { | |
| 220 | - require __DIR__ . '/experimental/guidelines/load.php'; | |
| 221 | - require __DIR__ . '/experimental/guidelines/index.php'; | |
| 222 | -} | |
| 223 | - | |
| 224 | -// Content types (only load when experiment is enabled). | |
| 225 | -if ( gutenberg_is_experiment_enabled( 'gutenberg-content-types' ) ) { | |
| 226 | - require __DIR__ . '/experimental/content-types/load.php'; | |
| 227 | - require __DIR__ . '/experimental/content-types/index.php'; | |
| 228 | -} | |
| 229 | - | |
| 230 | -// Dashboard Widgets (only load when experiment is enabled). | |
| 231 | -if ( gutenberg_is_experiment_enabled( 'gutenberg-dashboard-widgets' ) ) { | |
| 232 | - require __DIR__ . '/experimental/dashboard-widgets/load.php'; | |
| 196 | +if ( gutenberg_is_experiment_enabled( 'gutenberg-media-processing' ) ) { | |
| 197 | + require_once __DIR__ . '/experimental/media/load.php'; | |
| 233 | 198 | } |