forked from wpengine/atlas-content-modeler
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathatlas-content-modeler.php
93 lines (81 loc) · 3.07 KB
/
atlas-content-modeler.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
82
83
84
85
86
87
88
89
90
91
92
93
<?php
/**
* Plugin Name: Atlas Content Modeler
* Plugin URI: https://developers.wpengine.com/
* Description: Model content for headless WordPress.
* Author: WP Engine
* Author URI: https://wpengine.com/
* Text Domain: atlas-content-modeler
* Domain Path: /languages
* Version: 0.24.0
* Requires at least: 5.7
* Requires PHP: 7.2
* License: GPLv2 or later
* License URI: https://www.gnu.org/licenses/gpl-2.0.html
*
* @package AtlasContentModeler
*/
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
define( 'ATLAS_CONTENT_MODELER_FILE', __FILE__ );
define( 'ATLAS_CONTENT_MODELER_INCLUDES_DIR', __DIR__ . '/includes/' );
define( 'ATLAS_CONTENT_MODELER_URL', plugin_dir_url( __FILE__ ) );
define( 'ATLAS_CONTENT_MODELER_PATH', plugin_basename( ATLAS_CONTENT_MODELER_FILE ) );
define( 'ATLAS_CONTENT_MODELER_SLUG', dirname( plugin_basename( ATLAS_CONTENT_MODELER_FILE ) ) );
add_action( 'plugins_loaded', 'atlas_content_modeler_loader' );
/**
* Bootstraps the plugin.
*/
function atlas_content_modeler_loader(): void {
$composer_autoloader = __DIR__ . '/vendor/autoload.php';
if ( file_exists( $composer_autoloader ) ) {
include_once $composer_autoloader;
}
load_plugin_textdomain( 'atlas_content_modeler', false, __DIR__ . '/languages' );
$plugin_files = array(
'publisher/lib/field-functions.php',
'shared-assets/wp_scripts/shared_assets.php',
'settings/settings-callbacks.php',
'content-registration/custom-post-types-registration.php',
'content-registration/register-taxonomies.php',
'content-registration/graphql-mutations.php',
'content-registration/class-wpe-rest-posts-controller.php',
'rest-api/init-rest-api.php',
'publisher/class-publisher-form-editing-experience.php',
'updates/version-updates.php',
'content-connect/autoload.php',
'blueprints/import.php',
'blueprints/fetch.php',
'blueprints/export.php',
'api/crud-functions.php',
'api/validation-functions.php',
'api/utility-functions.php',
'class-validation-exception.php',
'class-wp-error.php',
);
foreach ( $plugin_files as $file ) {
include_once ATLAS_CONTENT_MODELER_INCLUDES_DIR . $file;
}
if ( defined( 'WP_CLI' ) && WP_CLI ) {
include_once ATLAS_CONTENT_MODELER_INCLUDES_DIR . '/wp-cli/class-blueprint.php';
include_once ATLAS_CONTENT_MODELER_INCLUDES_DIR . '/wp-cli/class-reset.php';
include_once ATLAS_CONTENT_MODELER_INCLUDES_DIR . '/wp-cli/class-model.php';
\WP_CLI::add_command( 'acm blueprint', 'WPE\AtlasContentModeler\WP_CLI\Blueprint' );
\WP_CLI::add_command( 'acm reset', new WPE\AtlasContentModeler\WP_CLI\Reset() );
\WP_CLI::add_command( 'acm model', 'WPE\AtlasContentModeler\WP_CLI\Model' );
}
\WPE\AtlasContentModeler\VersionUpdater\update_plugin();
new \WPE\AtlasContentModeler\FormEditingExperience();
// Bootstrap relationships library.
acm_content_connect_autoloader();
\WPE\AtlasContentModeler\ContentConnect\Plugin::instance();
}
/**
* Determines if opt-in usage tracking is enabled.
*
* @return bool True if enabled, false if not.
*/
function acm_usage_tracking_enabled(): bool {
return (bool) get_option( 'atlas_content_modeler_usage_tracking', false );
}