-
Notifications
You must be signed in to change notification settings - Fork 8
/
bea-content-sync-fusion.php
164 lines (139 loc) · 5.57 KB
/
bea-content-sync-fusion.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
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
<?php
/*
Plugin Name: BEA - Content Sync Fusion
Plugin URI: https://beapi.fr
Description: Manage content synchronization across a WordPress multisite.
Version: 3.12.3
Author: Be API
Author URI: http://beapi.fr
Network: true
Required WP : 4.6
Copyright 2013-2023 - Be API Team ([email protected])
*/
// Plugin constants
define( 'BEA_CSF_VERSION', '3.12.3' );
define( 'BEA_CSF_DB_VERSION', '1649671234' );
define( 'BEA_CSF_OPTION', 'bea-content-sync-fusion' );
define( 'BEA_CSF_CRON_QTY', 500 );
if ( ! defined( 'BEA_CSF_MEDIA_FEATURE' ) ) {
define( 'BEA_CSF_MEDIA_FEATURE', true );
}
if ( file_exists( __DIR__ . '/vendor/autoload.php' ) ) {
require __DIR__ . '/vendor/autoload.php';
}
// Define the table relation variables
if ( empty( $GLOBALS['wpdb']->bea_csf_relations ) ) {
$GLOBALS['wpdb']->bea_csf_relations = $GLOBALS['wpdb']->base_prefix . 'bea_csf_relations';
$GLOBALS['wpdb']->ms_global_tables[] = 'bea_csf_relations';
}
// Tables for ASYNC
// Define the table queue variables
if ( empty( $GLOBALS['wpdb']->bea_csf_queue ) ) {
$GLOBALS['wpdb']->bea_csf_queue = $GLOBALS['wpdb']->base_prefix . 'bea_csf_queue';
$GLOBALS['wpdb']->ms_global_tables[] = 'bea_csf_queue';
}
if ( empty( $GLOBALS['wpdb']->bea_csf_queue_maintenance ) ) {
$GLOBALS['wpdb']->bea_csf_queue_maintenance = $GLOBALS['wpdb']->base_prefix . 'bea_csf_queue_maintenance';
$GLOBALS['wpdb']->ms_global_tables[] = 'bea_csf_queue_maintenance';
}
// Plugin URL and PATH
define( 'BEA_CSF_URL', plugin_dir_url( __FILE__ ) );
define( 'BEA_CSF_DIR', plugin_dir_path( __FILE__ ) );
// Plugin various
require BEA_CSF_DIR . 'classes/plugin.php';
require BEA_CSF_DIR . 'classes/client.php';
require BEA_CSF_DIR . 'classes/client-relations.php';
require BEA_CSF_DIR . 'classes/multisite.php';
require BEA_CSF_DIR . 'classes/media.php';
require BEA_CSF_DIR . 'classes/seo.php';
require BEA_CSF_DIR . 'classes/query.php';
// CLI
require BEA_CSF_DIR . 'classes/cli/_helper.php';
require BEA_CSF_DIR . 'classes/cli/migration.php';
require BEA_CSF_DIR . 'classes/cli/queue.php';
require BEA_CSF_DIR . 'classes/cli/flush.php';
require BEA_CSF_DIR . 'classes/cli/resync.php';
require BEA_CSF_DIR . 'classes/cli/relation.php';
// Plugins addons
require BEA_CSF_DIR . 'classes/addons/post-types-order.php';
require BEA_CSF_DIR . 'classes/addons/advanced-custom-fields.php';
require BEA_CSF_DIR . 'classes/addons/advanced-custom-fields-exclusion.php';
require BEA_CSF_DIR . 'classes/addons/events-calendar-series.php';
require BEA_CSF_DIR . 'classes/addons/revisionize.php';
require BEA_CSF_DIR . 'classes/addons/polylang.php';
require BEA_CSF_DIR . 'classes/addons/multisite-clone-duplicator.php';
require BEA_CSF_DIR . 'classes/addons/woocommerce.php';
require BEA_CSF_DIR . 'classes/addons/gutenberg.php';
require BEA_CSF_DIR . 'classes/addons/yoast-seo.php';
// Functions various
require BEA_CSF_DIR . 'functions/api.php';
// Models
require BEA_CSF_DIR . 'classes/models/async.php';
require BEA_CSF_DIR . 'classes/models/relations.php';
require BEA_CSF_DIR . 'classes/models/synchronization.php';
require BEA_CSF_DIR . 'classes/models/synchronizations.php';
// Library server
require BEA_CSF_DIR . 'classes/server/attachment.php';
require BEA_CSF_DIR . 'classes/server/post_type.php';
require BEA_CSF_DIR . 'classes/server/taxonomy.php';
require BEA_CSF_DIR . 'classes/server/p2p.php';
// Library client
require BEA_CSF_DIR . 'classes/client/attachment.php';
require BEA_CSF_DIR . 'classes/client/post_type.php';
require BEA_CSF_DIR . 'classes/client/taxonomy.php';
require BEA_CSF_DIR . 'classes/client/p2p.php';
// Call admin classes
require BEA_CSF_DIR . 'classes/admin/admin-blog.php';
require BEA_CSF_DIR . 'classes/admin/admin-synchronizations-network.php';
require BEA_CSF_DIR . 'classes/admin/admin-metaboxes.php';
require BEA_CSF_DIR . 'classes/admin/admin-client-metaboxes.php';
require BEA_CSF_DIR . 'classes/admin/admin-restrictions.php';
require BEA_CSF_DIR . 'classes/admin/admin-terms.php';
require BEA_CSF_DIR . 'classes/admin/admin-terms-metaboxes.php';
require BEA_CSF_DIR . 'classes/admin/admin-list.php';
require BEA_CSF_DIR . 'classes/admin/admin-dashboard-widgets.php';
// Plugin activate/desactive hooks
register_activation_hook( __FILE__, array( 'BEA_CSF_Plugin', 'activate' ) );
register_deactivation_hook( __FILE__, array( 'BEA_CSF_Plugin', 'deactivate' ) );
// Init !
add_action( 'plugins_loaded', 'init_bea_content_sync_fusion' );
function init_bea_content_sync_fusion() {
BEA_CSF_Plugin::check_for_db_update();
// Load translations
load_plugin_textdomain( 'bea-content-sync-fusion', false, basename( BEA_CSF_DIR ) . '/languages' );
// Synchronizations
BEA_CSF_Synchronizations::init_from_db();
// Server
new BEA_CSF_Client();
new BEA_CSF_Client_Relations();
new BEA_CSF_Multisite();
new BEA_CSF_SEO();
new BEA_CSF_Query();
// Server optional - MEDIA
if ( true === constant( 'BEA_CSF_MEDIA_FEATURE' ) ) {
new BEA_CSF_Media();
}
// Addons
new BEA_CSF_Addon_Post_Types_Order();
new BEA_CSF_Addon_ACF();
new BEA_CSF_Addon_ACF_Exclusion();
new BEA_CSF_Addon_Events_Calendar_Series();
new BEA_CSF_Addon_Revisionize();
new BEA_CSF_Addon_Multisite_Clone_Duplicator();
new BEA_CSF_Addon_WooCommerce();
new BEA_CSF_Addon_Polylang();
new BEA_CSF_Addon_Gutenberg();
new BEA_CSF_Addon_Yoast_Seo();
// Admin
if ( is_admin() ) {
new BEA_CSF_Admin_Synchronizations_Network();
new BEA_CSF_Admin_Metaboxes();
new BEA_CSF_Admin_Client_Metaboxes();
new BEA_CSF_Admin_Restrictions();
new BEA_CSF_Admin_Terms();
new BEA_CSF_Admin_Terms_Metaboxes();
new BEA_CSF_Admin_Blog();
new BEA_CSF_Admin_Dashboard_Widgets();
new BEA_CSF_Admin_List();
}
}