forked from spacedmonkey/wp-rest-blocks
-
Notifications
You must be signed in to change notification settings - Fork 0
/
wp-rest-blocks.php
55 lines (48 loc) · 1.47 KB
/
wp-rest-blocks.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
<?php
/**
* Plugin Name: REST API Blocks
* Plugin URI: https://github.com/spacedmonkey/wp-rest-blocks
* Description: Add gutenberg blocks data into post / page / widget REST API endpoints.
* Author: Jonathan Harris
* Author URI: https://www.spacedmonkey.com/
* Text Domain: wp-rest-blocks
* Domain Path: /languages
* Version: 0.5.0
* Requires at least: 5.5
* Requires PHP: 7.0
*
* @package WP_REST_Blocks
*/
namespace WP_REST_Blocks;
use WP_REST_Blocks\Posts;
use WP_REST_Blocks\Widgets;
if ( is_readable( __DIR__ . '/vendor/autoload.php' ) ) {
require_once __DIR__ . '/vendor/autoload.php';
}
if ( ! class_exists( '\pQuery' ) ) {
/**
* Displays an admin notice about why the plugin is unable to load.
*
* @return void
*/
function admin_notice() {
$message = sprintf(
/* translators: %s: build commands. */
__( ' Please run %s to finish installation.', 'wp-rest-blocks' ),
'<code>composer install</code>'
);
?>
<div class="notice notice-error">
<p><strong><?php esc_html_e( 'REST API Blocks plugin could not be initialized.', 'wp-rest-blocks' ); ?></strong></p>
<p><?php echo wp_kses( $message, [ 'code' => [] ] ); ?></p>
</div>
<?php
}
add_action( 'admin_notices', __NAMESPACE__ . '\admin_notice' );
return;
}
require_once __DIR__ . '/src/data.php';
require_once __DIR__ . '/src/posts.php';
require_once __DIR__ . '/src/widgets.php';
Posts\bootstrap();
Widgets\bootstrap();