-
-
Notifications
You must be signed in to change notification settings - Fork 75
Expand file tree
/
Copy pathultimate-multisite.php
More file actions
140 lines (133 loc) · 5.58 KB
/
ultimate-multisite.php
File metadata and controls
140 lines (133 loc) · 5.58 KB
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
<?php
/**
* Plugin Name: Ultimate Multisite – WordPress Multisite SaaS & WaaS Platform
* Plugin URI: https://ultimatemultisite.com
* Description: Ultimate Multisite is a WordPress Multisite plugin that turns your network into a complete Website-as-a-Service (WaaS) platform with subscriptions, site provisioning, domain mapping, and customer management. Formerly WP Ultimo.
* Version: 2.6.0
* Author: Ultimate Multisite Community
* Author URI: https://ultimatemultisite.com
* License: GPLv2 or later
* License URI: https://www.gnu.org/licenses/gpl-2.0.html
* Text Domain: ultimate-multisite
* Domain Path: /lang
* Network: true
* Requires at least: 5.3
* Requires PHP: 7.4.30
*
* Ultimate Multisite is distributed under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 2 of the License, or
* any later version.
*
* Ultimate Multisite is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Ultimate Multisite. If not, see <http://www.gnu.org/licenses/>.
*
* @author Arindo Duque, NextPress, WPMUDEV, and the Ultimate Multisite Community
* @category Core
* @package Ultimate_Multisite
* @version 2.6.0
*/
// Exit if accessed directly
defined('ABSPATH') || exit;
if (defined('WP_SANDBOX_SCRAPING') && WP_SANDBOX_SCRAPING) {
require_once ABSPATH . 'wp-admin/includes/plugin.php';
$wu_possible_conflicts = false;
foreach ( ['wp-ultimo/wp-ultimo.php', 'wp-multisite-waas/wp-multisite-waas.php', 'multisite-ultimate/multisite-ultimate.php'] as $plugin_file ) {
if ( is_plugin_active($plugin_file) ) {
// old plugin still installed and active with the old name and path
// and the user is trying to activate this plugin. So deactivate and return.
deactivate_plugins($plugin_file, true, true);
$wu_possible_conflicts = true;
}
}
if (file_exists(WP_CONTENT_DIR . '/sunrise.php')) {
// We must override the old sunrise file or more name conflicts will occur.
copy(__DIR__ . '/sunrise.php', WP_CONTENT_DIR . '/sunrise.php');
if (function_exists('opcache_invalidate')) {
opcache_invalidate(WP_CONTENT_DIR . '/sunrise.php', true);
}
$wu_possible_conflicts = true;
}
if ($wu_possible_conflicts) {
// return to avoid loading the plugin which will have name conflicts.
// on the next page load the plugin will load normally and old plugin will be gone.
return;
}
}
if ( ! defined('WP_ULTIMO_PLUGIN_FILE')) {
define('WP_ULTIMO_PLUGIN_FILE', __FILE__);
}
if ( ! defined('MULTISITE_ULTIMATE_UPDATE_URL')) {
define('MULTISITE_ULTIMATE_UPDATE_URL', 'https://ultimatemultisite.com/');
}
/**
* Require core file dependencies
*/
require_once __DIR__ . '/constants.php';
try {
// Skip the Jetpack autoloader only when a root-level autoloader (e.g. Bedrock/Composer
// roots) has already mapped ALL plugin dependencies including our own classes.
// Checking BerlinDB\Database\Table alone is insufficient: class-sunrise.php manually
// requires BerlinDB files without registering our classmap, causing a false-positive
// that leaves WP_Ultimo classes unmapped. We therefore also verify that the main
// WP_Ultimo class is discoverable before deciding the autoloader can be skipped.
$berlin_db_loaded = class_exists( 'BerlinDB\Database\Table', false );
$wu_autoloader_present = interface_exists( 'WP_Ultimo\Traits\Singleton', false ) ||
class_exists( 'WP_Ultimo', false );
if ( ! $berlin_db_loaded || ! $wu_autoloader_present ) {
require_once __DIR__ . '/vendor/autoload_packages.php';
}
} catch ( \Error $exception ) {
if ( defined('WP_DEBUG') && WP_DEBUG ) {
// This message is not translated as at this point it's too early to load translations.
error_log( // phpcs:ignore
esc_html('Your installation of Ultimate Multisite is incomplete. If you installed Ultimate Multisite from GitHub, please refer to this document to set up your development environment: https://github.com/superdav42/wp-multisite-waas?tab=readme-ov-file#method-2-using-git-and-composer-for-developers')
);
}
add_action(
'network_admin_notices',
function () {
?>
<div class="notice notice-error">
<p>
<?php
printf(
/* translators: 1: is a link to a support document. 2: closing link */
esc_html__('Your installation of Ultimate Multisite is incomplete. If you installed from GitHub, %1$splease refer to this document%2$s to set up your development environment or download a pre-packaged ZIP release.', 'ultimate-multisite'),
'<a href="' . esc_url('https://github.com/superdav42/wp-multisite-waas?tab=readme-ov-file#method-2-using-git-and-composer-for-developers') . '" target="_blank" rel="noopener noreferrer">',
'</a>'
);
?>
</p>
</div>
<?php
}
);
return;
}
require_once __DIR__ . '/vendor/woocommerce/action-scheduler/action-scheduler.php';
/**
* Setup activation/deactivation hooks
*/
WP_Ultimo\Hooks::init();
if ( ! function_exists('WP_Ultimo')) {
/**
* Initializes the WP Ultimo class
*
* This function returns the WP_Ultimo class singleton, and
* should be used to avoid declaring globals.
*
* @return WP_Ultimo
* @since 2.0.0
*/
function WP_Ultimo() { // phpcs:ignore WordPress.NamingConventions.ValidFunctionName.FunctionNameInvalid
return WP_Ultimo::get_instance();
}
}
// Initialize and set to global for back-compat
$GLOBALS['WP_Ultimo'] = WP_Ultimo();
// End of ultimate-multisite.php