| 1 |
<?php |
| 2 |
/** |
| 3 |
* Load API functions, register scripts and actions, etc. |
| 4 |
* |
| 5 |
* @package gutenberg |
| 6 |
*/ |
| 7 |
|
| 8 |
if ( ! defined( 'ABSPATH' ) ) { |
| 9 |
die( 'Silence is golden.' ); |
| 10 |
} |
| 11 |
|
| 12 |
/** |
| 13 |
* Checks whether the Gutenberg experiment is enabled. |
| 14 |
* |
| 15 |
* @since 6.7.0 |
| 16 |
* |
| 17 |
* @param string $name The name of the experiment. |
| 18 |
* |
| 19 |
* @return bool True when the experiment is enabled. |
| 20 |
*/ |
| 21 |
function gutenberg_is_experiment_enabled( $name ) { |
| 22 |
$experiments = get_option( 'gutenberg-experiments' ); |
| 23 |
return ! empty( $experiments[ $name ] ); |
| 24 |
} |
| 25 |
|
| 26 |
// These files only need to be loaded if within a rest server instance |
| 27 |
// which this class will exist if that is the case. |
| 28 |
if ( class_exists( 'WP_REST_Controller' ) ) { |
| 29 |
/** |
| 30 |
* Start: Include for phase 2 |
| 31 |
*/ |
| 32 |
if ( ! class_exists( 'WP_REST_Widget_Forms' ) ) { |
| 33 |
require dirname( __FILE__ ) . '/class-wp-rest-widget-forms.php'; |
| 34 |
} |
| 35 |
if ( ! class_exists( 'WP_REST_Widget_Areas_Controller' ) ) { |
| 36 |
require dirname( __FILE__ ) . '/class-experimental-wp-widget-blocks-manager.php'; |
| 37 |
require dirname( __FILE__ ) . '/class-wp-rest-widget-areas-controller.php'; |
| 38 |
} |
| 39 |
if ( ! class_exists( 'WP_REST_Block_Directory_Controller' ) ) { |
| 40 |
require dirname( __FILE__ ) . '/class-wp-rest-block-directory-controller.php'; |
| 41 |
} |
| 42 |
if ( ! class_exists( 'WP_REST_Block_Types_Controller' ) ) { |
| 43 |
require dirname( __FILE__ ) . '/class-wp-rest-block-types-controller.php'; |
| 44 |
} |
| 45 |
if ( ! class_exists( 'WP_REST_Menus_Controller' ) ) { |
| 46 |
require_once dirname( __FILE__ ) . '/class-wp-rest-menus-controller.php'; |
| 47 |
} |
| 48 |
if ( ! class_exists( 'WP_REST_Menu_Items_Controller' ) ) { |
| 49 |
require_once dirname( __FILE__ ) . '/class-wp-rest-menu-items-controller.php'; |
| 50 |
} |
| 51 |
if ( ! class_exists( 'WP_REST_Menu_Locations_Controller' ) ) { |
| 52 |
require_once dirname( __FILE__ ) . '/class-wp-rest-menu-locations-controller.php'; |
| 53 |
} |
| 54 |
if ( ! class_exists( 'WP_Rest_Customizer_Nonces' ) ) { |
| 55 |
require_once dirname( __FILE__ ) . '/class-wp-rest-customizer-nonces.php'; |
| 56 |
} |
| 57 |
if ( ! class_exists( 'WP_REST_Image_Editor_Controller' ) ) { |
| 58 |
require dirname( __FILE__ ) . '/class-wp-rest-image-editor-controller.php'; |
| 59 |
} |
| 60 |
if ( ! class_exists( 'WP_REST_Plugins_Controller' ) ) { |
| 61 |
require_once dirname( __FILE__ ) . '/class-wp-rest-plugins-controller.php'; |
| 62 |
} |
| 63 |
/** |
| 64 |
* End: Include for phase 2 |
| 65 |
*/ |
| 66 |
|
| 67 |
require dirname( __FILE__ ) . '/rest-api.php'; |
| 68 |
} |
| 69 |
|
| 70 |
if ( ! class_exists( 'WP_Block_Patterns_Registry' ) ) { |
| 71 |
require dirname( __FILE__ ) . '/class-wp-block-patterns-registry.php'; |
| 72 |
} |
| 73 |
|
| 74 |
if ( ! class_exists( 'WP_Block_Pattern_Categories_Registry' ) ) { |
| 75 |
require dirname( __FILE__ ) . '/class-wp-block-pattern-categories-registry.php'; |
| 76 |
} |
| 77 |
|
| 78 |
if ( ! class_exists( 'WP_Block' ) ) { |
| 79 |
require dirname( __FILE__ ) . '/class-wp-block.php'; |
| 80 |
} |
| 81 |
|
| 82 |
if ( ! class_exists( 'WP_Block_List' ) ) { |
| 83 |
require dirname( __FILE__ ) . '/class-wp-block-list.php'; |
| 84 |
} |
| 85 |
|
| 86 |
require dirname( __FILE__ ) . '/compat.php'; |
| 87 |
require dirname( __FILE__ ) . '/utils.php'; |
| 88 |
|
| 89 |
require dirname( __FILE__ ) . '/block-patterns.php'; |
| 90 |
require dirname( __FILE__ ) . '/blocks.php'; |
| 91 |
require dirname( __FILE__ ) . '/templates.php'; |
| 92 |
require dirname( __FILE__ ) . '/template-parts.php'; |
| 93 |
require dirname( __FILE__ ) . '/template-loader.php'; |
| 94 |
require dirname( __FILE__ ) . '/client-assets.php'; |
| 95 |
require dirname( __FILE__ ) . '/block-directory.php'; |
| 96 |
require dirname( __FILE__ ) . '/demo.php'; |
| 97 |
require dirname( __FILE__ ) . '/widgets.php'; |
| 98 |
require dirname( __FILE__ ) . '/widgets-page.php'; |
| 99 |
require dirname( __FILE__ ) . '/navigation-page.php'; |
| 100 |
require dirname( __FILE__ ) . '/experiments-page.php'; |
| 101 |
require dirname( __FILE__ ) . '/customizer.php'; |
| 102 |
require dirname( __FILE__ ) . '/edit-site-page.php'; |
| 103 |
require dirname( __FILE__ ) . '/edit-site-export.php'; |
| 104 |
require dirname( __FILE__ ) . '/editor-features.php'; |
| 105 |
require dirname( __FILE__ ) . '/global-styles.php'; |
| 106 |
|