-
Notifications
You must be signed in to change notification settings - Fork 14
/
wp-graphql-content-blocks.php
74 lines (64 loc) · 1.97 KB
/
wp-graphql-content-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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
<?php
/**
* Plugin Name: WPGraphQL Content Blocks
* Description: Extends WPGraphQL to support querying (Gutenberg) Blocks as data.
* Author: WP Engine
* Author URI: https://wpengine.com/
* License: GPLv2 or later
* License URI: https://www.gnu.org/licenses/gpl-2.0.html
* Text Domain: wp-graphql-content-blocks
* Domain Path: /languages
* Version: 4.2.0
* Requires PHP: 7.4
* Requires at least: 5.7
*
* @package WPGraphQL\ContentBlocks
*/
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
if ( ! function_exists( 'wpgraphql_content_blocks_constants' ) ) {
/**
* Defines plugin constants.
*
* @since 4.2.0
*/
function wpgraphql_content_blocks_constants(): void {
// Whether to autoload the files or not.
if ( ! defined( 'WPGRAPHQL_CONTENT_BLOCKS_AUTOLOAD' ) ) {
define( 'WPGRAPHQL_CONTENT_BLOCKS_AUTOLOAD', true );
}
if ( ! defined( 'WPGRAPHQL_CONTENT_BLOCKS_PLUGIN_DIR' ) ) {
define( 'WPGRAPHQL_CONTENT_BLOCKS_PLUGIN_DIR', __DIR__ );
}
if ( ! defined( 'WPGRAPHQL_CONTENT_BLOCKS_PLUGIN_FILE' ) ) {
define( 'WPGRAPHQL_CONTENT_BLOCKS_PLUGIN_FILE', __FILE__ );
}
if ( ! defined( 'WPGRAPHQL_CONTENT_BLOCKS_PLUGIN_PATH' ) ) {
define( 'WPGRAPHQL_CONTENT_BLOCKS_PLUGIN_PATH', plugin_basename( WPGRAPHQL_CONTENT_BLOCKS_PLUGIN_FILE ) );
}
if ( ! defined( 'WPGRAPHQL_CONTENT_BLOCKS_VERSION' ) ) {
define( 'WPGRAPHQL_CONTENT_BLOCKS_VERSION', '4.1.0' );
}
}
}
if ( ! function_exists( 'wpgraphql_content_blocks_init' ) ) {
/**
* The main function that returns the WPGraphQLContentBlocks class
*
* @since 0.0.1
*/
function wpgraphql_content_blocks_init(): void {
// Define plugin constants.
wpgraphql_content_blocks_constants();
// Load the autoloader.
require_once __DIR__ . '/includes/Autoloader.php';
if ( ! \WPGraphQL\ContentBlocks\Autoloader::autoload() ) {
return;
}
// Instantiate the plugin class.
WPGraphQLContentBlocks::instance();
}
}
// Get the plugin running.
add_action( 'plugins_loaded', 'wpgraphql_content_blocks_init', 15 );