| 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 |
// These files only need to be loaded if within a rest server instance |
| 13 |
// which this class will exist if that is the case. |
| 14 |
if ( class_exists( 'WP_REST_Controller' ) ) { |
| 15 |
if ( ! class_exists( 'WP_REST_Blocks_Controller' ) ) { |
| 16 |
require dirname( __FILE__ ) . '/class-wp-rest-blocks-controller.php'; |
| 17 |
} |
| 18 |
if ( ! class_exists( 'WP_REST_Autosaves_Controller' ) ) { |
| 19 |
require dirname( __FILE__ ) . '/class-wp-rest-autosaves-controller.php'; |
| 20 |
} |
| 21 |
if ( ! class_exists( 'WP_REST_Themes_Controller' ) ) { |
| 22 |
require dirname( __FILE__ ) . '/class-wp-rest-themes-controller.php'; |
| 23 |
} |
| 24 |
if ( ! class_exists( 'WP_REST_Block_Renderer_Controller' ) ) { |
| 25 |
require dirname( __FILE__ ) . '/class-wp-rest-block-renderer-controller.php'; |
| 26 |
} |
| 27 |
if ( ! class_exists( 'WP_REST_Search_Controller' ) ) { |
| 28 |
require dirname( __FILE__ ) . '/class-wp-rest-search-controller.php'; |
| 29 |
} |
| 30 |
if ( ! class_exists( 'WP_REST_Search_Handler' ) ) { |
| 31 |
require dirname( __FILE__ ) . '/class-wp-rest-search-handler.php'; |
| 32 |
} |
| 33 |
if ( ! class_exists( 'WP_REST_Post_Search_Handler' ) ) { |
| 34 |
require dirname( __FILE__ ) . '/class-wp-rest-post-search-handler.php'; |
| 35 |
} |
| 36 |
|
| 37 |
require dirname( __FILE__ ) . '/rest-api.php'; |
| 38 |
} |
| 39 |
|
| 40 |
require dirname( __FILE__ ) . '/meta-box-partial-page.php'; |
| 41 |
if ( ! class_exists( 'WP_Block_Type' ) ) { |
| 42 |
require dirname( __FILE__ ) . '/class-wp-block-type.php'; |
| 43 |
} |
| 44 |
if ( ! class_exists( 'WP_Block_Type_Registry' ) ) { |
| 45 |
require dirname( __FILE__ ) . '/class-wp-block-type-registry.php'; |
| 46 |
} |
| 47 |
require dirname( __FILE__ ) . '/blocks.php'; |
| 48 |
require dirname( __FILE__ ) . '/client-assets.php'; |
| 49 |
require dirname( __FILE__ ) . '/compat.php'; |
| 50 |
require dirname( __FILE__ ) . '/plugin-compat.php'; |
| 51 |
require dirname( __FILE__ ) . '/i18n.php'; |
| 52 |
require dirname( __FILE__ ) . '/register.php'; |
| 53 |
|
| 54 |
|
| 55 |
// Register server-side code for individual blocks. |
| 56 |
if ( ! function_exists( 'render_block_core_archives' ) ) { |
| 57 |
require dirname( __FILE__ ) . '/../packages/block-library/src/archives/index.php'; |
| 58 |
} |
| 59 |
if ( ! function_exists( 'render_block_core_block' ) ) { |
| 60 |
require dirname( __FILE__ ) . '/../packages/block-library/src/block/index.php'; |
| 61 |
} |
| 62 |
if ( ! function_exists( 'render_block_core_categories' ) ) { |
| 63 |
require dirname( __FILE__ ) . '/../packages/block-library/src/categories/index.php'; |
| 64 |
} |
| 65 |
// Currently merged in core as `gutenberg_render_block_core_latest_comments`, |
| 66 |
// expected to change soon. |
| 67 |
if ( ! function_exists( 'render_block_core_latest_comments' ) |
| 68 |
&& ! function_exists( 'gutenberg_render_block_core_latest_comments' ) ) { |
| 69 |
require dirname( __FILE__ ) . '/../packages/block-library/src/latest-comments/index.php'; |
| 70 |
} |
| 71 |
if ( ! function_exists( 'render_block_core_latest_posts' ) ) { |
| 72 |
require dirname( __FILE__ ) . '/../packages/block-library/src/latest-posts/index.php'; |
| 73 |
} |
| 74 |
if ( ! function_exists( 'render_block_core_shortcode' ) ) { |
| 75 |
require dirname( __FILE__ ) . '/../packages/block-library/src/shortcode/index.php'; |
| 76 |
} |
| 77 |
|