forked from wp-graphql/wp-graphql
-
Notifications
You must be signed in to change notification settings - Fork 0
/
wp-graphql.php
81 lines (70 loc) · 1.97 KB
/
wp-graphql.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
75
76
77
78
79
80
81
<?php
/**
* Plugin Name: WP GraphQL
* Plugin URI: https://github.com/wp-graphql/wp-graphql
* GitHub Plugin URI: https://github.com/wp-graphql/wp-graphql
* Description: GraphQL API for WordPress
* Author: WPGraphQL
* Author URI: http://www.wpgraphql.com
* Version: 1.11.1
* Text Domain: wp-graphql
* Domain Path: /languages/
* Requires at least: 5.0
* Tested up to: 5.9.1
* Requires PHP: 7.1
* License: GPL-3
* License URI: https://www.gnu.org/licenses/gpl-3.0.html
*
* @package WPGraphQL
* @category Core
* @author WPGraphQL
* @version 1.11.1
*/
// Exit if accessed directly.
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
// If the codeception remote coverage file exists, require it.
// This file should only exist locally or when CI bootstraps the environment for testing
if ( file_exists( __DIR__ . '/c3.php' ) ) {
require_once __DIR__ . '/c3.php';
}
// Run this function when WPGraphQL is de-activated
register_deactivation_hook( __FILE__, 'graphql_deactivation_callback' );
register_activation_hook( __FILE__, 'graphql_activation_callback' );
// Bootstrap the plugin
if ( ! class_exists( 'WPGraphQL' ) ) {
require_once __DIR__ . '/src/WPGraphQL.php';
}
if ( ! function_exists( 'graphql_init' ) ) {
/**
* Function that instantiates the plugins main class
*
* @return object
*/
function graphql_init() {
/**
* Return an instance of the action
*/
return \WPGraphQL::instance();
}
}
graphql_init();
if ( defined( 'WP_CLI' ) && WP_CLI ) {
require_once plugin_dir_path( __FILE__ ) . 'cli/wp-cli.php';
}
/**
* Initialize the plugin tracker
*
* @return void
*/
function graphql_init_appsero_telemetry() {
// If the class doesn't exist, or code is being scanned by PHPSTAN, move on.
if ( ! class_exists( 'Appsero\Client' ) || defined( 'PHPSTAN' ) ) {
return;
}
$client = new Appsero\Client( 'cd0d1172-95a0-4460-a36a-2c303807c9ef', 'WP GraphQL', __FILE__ );
// @phpstan-ignore-next-line
$client->insights()->init();
}
graphql_init_appsero_telemetry();