forked from Ultimate-Multisite/ultimate-multisite
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathultimate-multisite.php
More file actions
129 lines (122 loc) · 4.72 KB
/
ultimate-multisite.php
File metadata and controls
129 lines (122 loc) · 4.72 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
<?php
/**
* Plugin Name: Ultimate Multisite
* Description: Transform your WordPress Multisite into a Website as a Service (WaaS) platform supporting site cloning, re-selling, and domain mapping integrations with many hosting providers.
* Plugin URI: https://ultimatemultisite.com
* Text Domain: ultimate-multisite
* Version: 2.4.7
* Author: Ultimate Multisite Community
* Author URI: https://github.com/superdav42/wp-multisite-waas
* GitHub Plugin URI: https://github.com/superdav42/wp-multisite-waas
* Network: true
* License: GPL2
* License URI: https://www.gnu.org/licenses/gpl-2.0.html
* Domain Path: /lang
* 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 and NextPress and the Ultimate Multisite Community
* @category Core
* @package WP_Ultimo
* @version 2.4.7
*/
// 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 {
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();