| @@ -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 $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,103 +34,103 @@ | ||
| 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 7.0 compat. | |
| 59 | - require __DIR__ . '/compat/wordpress-7.0/class-gutenberg-rest-revisions-controller.php'; | |
| 60 | - require __DIR__ . '/compat/wordpress-7.0/class-gutenberg-rest-block-patterns-controller-7-0.php'; | |
| 61 | - require __DIR__ . '/compat/wordpress-7.0/class-gutenberg-rest-templates-controller-7-0.php'; | |
| 62 | - require __DIR__ . '/compat/wordpress-7.0/class-gutenberg-rest-static-templates-controller.php'; | |
| 63 | - require __DIR__ . '/compat/wordpress-7.0/class-wp-icons-registry.php'; | |
| 64 | - require __DIR__ . '/compat/wordpress-7.0/class-wp-rest-icons-controller.php'; | |
| 65 | - require __DIR__ . '/compat/wordpress-7.0/template-activate.php'; | |
| 66 | - require __DIR__ . '/compat/wordpress-7.0/rest-api.php'; | |
| 67 | - require __DIR__ . '/compat/wordpress-7.0/global-styles.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'; | |
| 68 | 42 | |
| 69 | - // WordPress 7.1 compat. | |
| 70 | - require __DIR__ . '/compat/wordpress-7.1/class-gutenberg-rest-attachments-controller-7-1.php'; | |
| 71 | - require __DIR__ . '/compat/wordpress-7.1/class-gutenberg-view-config-data.php'; | |
| 72 | - require __DIR__ . '/compat/wordpress-7.1/view-config-api.php'; | |
| 73 | - require __DIR__ . '/compat/wordpress-7.1/class-gutenberg-rest-view-config-controller-7-1.php'; | |
| 74 | - require __DIR__ . '/compat/wordpress-7.1/class-wp-icon-collections-registry.php'; | |
| 75 | - require __DIR__ . '/compat/wordpress-7.1/class-wp-rest-icon-collections-controller.php'; | |
| 76 | - require __DIR__ . '/compat/wordpress-7.1/rest-api.php'; | |
| 77 | - require __DIR__ . '/compat/wordpress-7.1/block-bindings.php'; | |
| 78 | - require __DIR__ . '/compat/wordpress-7.1/query-block.php'; | |
| 79 | - require __DIR__ . '/compat/wordpress-7.1/block-comments.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'; | |
| 80 | 48 | |
| 81 | - // Real-time collaboration. | |
| 82 | - require __DIR__ . '/experimental/collaboration/class-gutenberg-rest-autosaves-controller.php'; | |
| 83 | - require __DIR__ . '/experimental/collaboration/rest-api.php'; | |
| 84 | - require __DIR__ . '/experimental/collaboration/collaboration.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 | 58 | require_once __DIR__ . '/experimental/rest-api.php'; |
| 94 | 59 | require_once __DIR__ . '/experimental/kses-allowed-html.php'; |
| 60 | +} | |
| 95 | 61 | |
| 96 | - 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'; | |
| 97 | 65 | } |
| 98 | 66 | |
| 99 | -require_once __DIR__ . '/remove-core-enqueue-scripts.php'; | |
| 100 | -require_once __DIR__ . '/experimental/editor-settings.php'; | |
| 101 | -require_once __DIR__ . '/experimental/rest-api-overrides.php'; | |
| 67 | +require __DIR__ . '/experimental/editor-settings.php'; | |
| 102 | 68 | |
| 103 | 69 | // Gutenberg plugin compat. |
| 104 | 70 | require __DIR__ . '/compat/plugin/edit-site-routes-backwards-compat.php'; |
| 105 | 71 | require __DIR__ . '/compat/plugin/fonts.php'; |
| 106 | -require __DIR__ . '/compat/plugin/style-state-aliases.php'; | |
| 107 | 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'; | |
| 108 | 76 | |
| 109 | -// WordPress 7.0 compat. | |
| 110 | -require __DIR__ . '/compat/wordpress-7.0/preload.php'; | |
| 111 | -require __DIR__ . '/compat/wordpress-7.0/auto-register.php'; | |
| 112 | -require __DIR__ . '/compat/wordpress-7.0/blocks.php'; | |
| 113 | -require __DIR__ . '/compat/wordpress-7.0/kses.php'; | |
| 114 | -require __DIR__ . '/compat/wordpress-7.0/command-palette.php'; | |
| 115 | -require __DIR__ . '/compat/wordpress-7.0/script-modules.php'; | |
| 116 | -require __DIR__ . '/compat/wordpress-7.0/fonts.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'; | |
| 117 | 84 | |
| 118 | -if ( class_exists( '\WordPress\AiClient\AiClient' ) ) { | |
| 119 | - require __DIR__ . '/compat/wordpress-7.0/class-wp-connector-registry.php'; | |
| 120 | - require __DIR__ . '/compat/wordpress-7.0/connectors.php'; | |
| 121 | - require __DIR__ . '/compat/wordpress-7.0/default-connectors.php'; | |
| 122 | -} | |
| 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'; | |
| 123 | 98 | |
| 124 | -// WordPress 7.1 compat. | |
| 125 | -require __DIR__ . '/compat/wordpress-7.1/admin-bar.php'; | |
| 126 | -require __DIR__ . '/compat/wordpress-7.1/blocks.php'; | |
| 127 | -require __DIR__ . '/compat/wordpress-7.1/kses.php'; | |
| 128 | -require __DIR__ . '/compat/wordpress-7.1/media.php'; | |
| 129 | -require __DIR__ . '/compat/wordpress-7.1/preload.php'; | |
| 130 | -require __DIR__ . '/compat/wordpress-7.1/icons.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'; | |
| 131 | 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 | + | |
| 132 | 119 | // Experimental features. |
| 133 | 120 | require __DIR__ . '/experimental/block-editor-settings-mobile.php'; |
| 134 | 121 | require __DIR__ . '/experimental/blocks.php'; |
| 135 | 122 | require __DIR__ . '/experimental/navigation-theme-opt-in.php'; |
| 136 | 123 | require __DIR__ . '/experimental/kses.php'; |
| 124 | +require __DIR__ . '/experimental/l10n.php'; | |
| 125 | +require __DIR__ . '/experimental/synchronization.php'; | |
| 137 | 126 | require __DIR__ . '/experimental/script-modules.php'; |
| 138 | -require __DIR__ . '/experimental/pages/site-editor.php'; | |
| 139 | -require __DIR__ . '/experimental/extensible-site-editor.php'; | |
| 140 | -require __DIR__ . '/experimental/collaboration/meta-box-rtc-compat.php'; | |
| 127 | +require __DIR__ . '/experimental/posts/load.php'; | |
| 141 | 128 | |
| 142 | -if ( gutenberg_is_experiment_enabled( 'gutenberg-dataform-inspector' ) ) { | |
| 143 | - require __DIR__ . '/experimental/dataform-inspector-preload.php'; | |
| 129 | +if ( gutenberg_is_experiment_enabled( 'gutenberg-no-tinymce' ) ) { | |
| 130 | + require __DIR__ . '/experimental/disable-tinymce.php'; | |
| 144 | 131 | } |
| 145 | -if ( gutenberg_is_experiment_enabled( 'gutenberg-media-editor' ) ) { | |
| 146 | - require __DIR__ . '/experimental/media-editor/load.php'; | |
| 147 | -} | |
| 148 | 132 | |
| 149 | -if ( gutenberg_is_experiment_enabled( 'gutenberg-workflow-palette' ) ) { | |
| 150 | - require __DIR__ . '/experimental/workflow-palette.php'; | |
| 151 | -} | |
| 152 | - | |
| 153 | 133 | // Load the BC Layer to avoid fatal errors of extenders using the Fonts API. |
| 154 | 134 | // @core-merge: do not merge the BC layer files into WordPress Core. |
| 155 | 135 | require __DIR__ . '/experimental/font-face/bc-layer/class-wp-fonts-provider.php'; |
| 156 | 136 | require __DIR__ . '/experimental/font-face/bc-layer/class-wp-fonts-utils.php'; |
| @@ -175,22 +155,24 @@ | ||
| 175 | 155 | require __DIR__ . '/class-wp-duotone-gutenberg.php'; |
| 176 | 156 | require __DIR__ . '/blocks.php'; |
| 177 | 157 | require __DIR__ . '/block-editor-settings.php'; |
| 178 | 158 | require __DIR__ . '/client-assets.php'; |
| 179 | -require __DIR__ . '/mathml-kses.php'; | |
| 180 | 159 | require __DIR__ . '/demo.php'; |
| 181 | -require __DIR__ . '/experimental/experiments/load.php'; | |
| 160 | +require __DIR__ . '/experiments-page.php'; | |
| 182 | 161 | require __DIR__ . '/interactivity-api.php'; |
| 183 | 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 | +} | |
| 184 | 166 | |
| 185 | 167 | // Copied package PHP files. |
| 186 | -if ( is_dir( __DIR__ . '/../build/scripts/style-engine' ) ) { | |
| 187 | - require_once __DIR__ . '/../build/scripts/style-engine/class-wp-style-engine-css-declarations-gutenberg.php'; | |
| 188 | - require_once __DIR__ . '/../build/scripts/style-engine/class-wp-style-engine-css-rule-gutenberg.php'; | |
| 189 | - require_once __DIR__ . '/../build/scripts/style-engine/class-wp-style-engine-css-rules-store-gutenberg.php'; | |
| 190 | - require_once __DIR__ . '/../build/scripts/style-engine/class-wp-style-engine-processor-gutenberg.php'; | |
| 191 | - require_once __DIR__ . '/../build/scripts/style-engine/class-wp-style-engine-gutenberg.php'; | |
| 192 | - 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'; | |
| 193 | 175 | } |
| 194 | 176 | |
| 195 | 177 | // Block supports overrides. |
| 196 | 178 | require __DIR__ . '/block-supports/settings.php'; |
| @@ -205,42 +187,12 @@ | ||
| 205 | 187 | require __DIR__ . '/block-supports/duotone.php'; |
| 206 | 188 | require __DIR__ . '/block-supports/shadow.php'; |
| 207 | 189 | require __DIR__ . '/block-supports/background.php'; |
| 208 | 190 | require __DIR__ . '/block-supports/block-style-variations.php'; |
| 209 | -require __DIR__ . '/block-supports/aria-label.php'; | |
| 210 | -require __DIR__ . '/block-supports/anchor.php'; | |
| 211 | -require __DIR__ . '/block-supports/block-visibility.php'; | |
| 212 | -require __DIR__ . '/block-supports/custom-css.php'; | |
| 213 | -require __DIR__ . '/block-supports/states.php'; | |
| 214 | 191 | |
| 192 | +// Data views. | |
| 193 | +require_once __DIR__ . '/experimental/data-views.php'; | |
| 194 | + | |
| 215 | 195 | // Client-side media processing. |
| 216 | -require_once __DIR__ . '/media/load.php'; | |
| 217 | - | |
| 218 | -// Interactivity API full-page client-side navigation. | |
| 219 | -if ( gutenberg_is_experiment_enabled( 'gutenberg-full-page-client-side-navigation' ) ) { | |
| 220 | - require __DIR__ . '/experimental/interactivity-api/class-gutenberg-interactivity-api-full-page-navigation.php'; | |
| 221 | - Gutenberg_Interactivity_API_Full_Page_Navigation::instance(); | |
| 222 | -} | |
| 223 | - | |
| 224 | -// Block patterns for navigation overlays. | |
| 225 | -require __DIR__ . '/overlay-patterns.php'; | |
| 226 | - | |
| 227 | -// Guidelines (only load when experiment is enabled). | |
| 228 | -if ( gutenberg_is_experiment_enabled( 'gutenberg-guidelines' ) ) { | |
| 229 | - require __DIR__ . '/experimental/knowledge/load.php'; | |
| 230 | - require __DIR__ . '/experimental/knowledge/index.php'; | |
| 231 | -} | |
| 232 | - | |
| 233 | -// Content types (only load when experiment is enabled). | |
| 234 | -if ( gutenberg_is_experiment_enabled( 'gutenberg-content-types' ) ) { | |
| 235 | - require __DIR__ . '/experimental/content-types/load.php'; | |
| 236 | - require __DIR__ . '/experimental/content-types/index.php'; | |
| 237 | - require __DIR__ . '/experimental/content-types/post-types.php'; | |
| 238 | -} | |
| 239 | - | |
| 240 | -// Dashboard Widgets (only load when experiment is enabled). | |
| 241 | -if ( gutenberg_is_experiment_enabled( 'gutenberg-dashboard-widgets' ) ) { | |
| 242 | - require __DIR__ . '/experimental/dashboard-widgets/load.php'; | |
| 243 | - require __DIR__ . '/experimental/dashboard-widgets/widget-types.php'; | |
| 244 | - require __DIR__ . '/experimental/dashboard-widgets/dashboard-layout.php'; | |
| 245 | - require __DIR__ . '/experimental/dashboard-widgets/default-layout-seed.php'; | |
| 196 | +if ( gutenberg_is_experiment_enabled( 'gutenberg-media-processing' ) ) { | |
| 197 | + require_once __DIR__ . '/experimental/media/load.php'; | |
| 246 | 198 | } |