This repository has been archived by the owner on May 6, 2023. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 5
/
graphql-api.php
executable file
·79 lines (70 loc) · 2.06 KB
/
graphql-api.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
<?php
/*
Plugin Name: GraphQL API for WordPress
Plugin URI: https://graphql-api.com
Description: Transform your WordPress site into a GraphQL server.
Version: 1.0.0-dev
Requires at least: 5.4
Requires PHP: 8.1
Author: Leonardo Losoviz
Author URI: https://leoloso.com
License: GPLv2 or later
License URI: http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
Text Domain: graphql-api
Domain Path: /languages
GitHub Plugin URI: GraphQLAPI/graphql-api-for-wp-dist
*/
use GraphQLAPI\GraphQLAPI\Plugin;
use GraphQLAPI\GraphQLAPI\PluginApp;
// Exit if accessed directly
if (!defined('ABSPATH')) {
exit;
}
/**
* Load translations
* @todo Re-enable when an actual translation (*.po/*.mo) is provided
* @see https://github.com/leoloso/PoP/issues/2051
*/
// add_action('init', function (): void {
// load_plugin_textdomain('graphql-api', false, plugin_basename(__FILE__) . '/languages');
// });
/**
* Plugin's name and version.
*
* Use a stability suffix as supported by Composer.
*
* @see https://getcomposer.org/doc/articles/versions.md#stabilities
*/
$pluginVersion = '1.0.0-dev';
$pluginName = __('GraphQL API for WordPress', 'graphql-api');
/**
* If the plugin is already registered, print an error and halt loading
*/
if (class_exists(Plugin::class) && !PluginApp::getMainPluginManager()->assertIsValid($pluginVersion)) {
return;
}
/**
* The commit hash is added to the plugin version
* through the CI when merging the PR.
*
* It is required to regenerate the container when
* testing a generated .zip plugin without modifying
* the plugin version.
* (Otherwise, we'd have to @purge-cache.)
*
* Important: Do not modify this code!
* It will be replaced in the CI to append "#{commit hash}"
* when generating the plugin.
*/
$commitHash = null;
// Load Composer’s autoloader
require_once(__DIR__ . '/vendor/autoload.php');
// Initialize the GraphQL API App
PluginApp::initializePlugin();
// Create and set-up the plugin instance
PluginApp::getMainPluginManager()->register(new Plugin(
__FILE__,
$pluginVersion,
$pluginName,
$commitHash
))->setup();