wp-staging
Last commit date
Backend
1 day ago
Backup
1 day ago
Basic
1 day ago
Component
1 day ago
Core
1 day ago
Framework
1 day ago
Frontend
1 day ago
Notifications
1 day ago
Staging
1 day ago
assets
1 day ago
languages
1 day ago
resources
1 day ago
vendor_wpstg
1 day ago
views
1 day ago
CONTRIBUTING.md
2 years ago
Deactivate.php
1 day ago
README.md
5 months ago
SECURITY.md
3 weeks ago
autoloader.php
1 day ago
bootstrap.php
1 day ago
commonBootstrap.php
1 day ago
constantsFree.php
1 day ago
freeBootstrap.php
1 day ago
install.php
1 day ago
opcacheBootstrap.php
1 day ago
readme.txt
1 day ago
runtimeRequirements.php
1 day ago
uninstall.php
1 day ago
wp-staging-error-handler.php
1 day ago
wp-staging.php
1 day ago
bootstrap.php
157 lines
| 1 | <?php |
| 2 | |
| 3 | use WPStaging\Core\WPStaging; |
| 4 | |
| 5 | |
| 6 | |
| 7 | |
| 8 | $pluginFilePath = $pluginFilePath ?? ''; |
| 9 | if (file_exists(__DIR__ . '/autoloader_dev.php')) { |
| 10 | include_once __DIR__ . '/autoloader_dev.php'; |
| 11 | } elseif (wpstgDoLoadPluginAutoLoad($pluginFilePath)) { |
| 12 | include_once __DIR__ . '/autoloader.php'; |
| 13 | } |
| 14 | |
| 15 | |
| 16 | |
| 17 | |
| 18 | |
| 19 | |
| 20 | |
| 21 | if ( |
| 22 | !class_exists('\WPStaging\Vendor\lucatume\DI52\Container') |
| 23 | || !class_exists('\WPStaging\Core\WPStaging') |
| 24 | ) { |
| 25 | add_action('admin_notices', function () { |
| 26 | if (!current_user_can('manage_options')) { |
| 27 | return; |
| 28 | } |
| 29 | |
| 30 | |
| 31 | |
| 32 | echo '<div class="notice notice-error"><p><strong>WP STAGING:</strong> ' |
| 33 | . esc_html('Plugin files appear to be missing or corrupted. Please reinstall the plugin or contact support@wp-staging.com for help.') |
| 34 | . '</p></div>'; |
| 35 | }); |
| 36 | |
| 37 | return; |
| 38 | } |
| 39 | |
| 40 | |
| 41 | if (!defined('WPSTG_PLUGIN_FILE')) { |
| 42 | define('WPSTG_PLUGIN_FILE', $pluginFilePath); |
| 43 | } |
| 44 | |
| 45 | |
| 46 | if (!defined('WPSTG_PLUGIN_DIR')) { |
| 47 | define('WPSTG_PLUGIN_DIR', plugin_dir_path($pluginFilePath)); |
| 48 | } |
| 49 | |
| 50 | |
| 51 | if (!defined('WPSTG_PLUGIN_URL')) { |
| 52 | define('WPSTG_PLUGIN_URL', plugin_dir_url($pluginFilePath)); |
| 53 | } |
| 54 | |
| 55 | |
| 56 | if (!defined('WPSTG_OPTIMIZER_MUVERSION')) { |
| 57 | define('WPSTG_OPTIMIZER_MUVERSION', '1.6.2'); |
| 58 | } |
| 59 | |
| 60 | |
| 61 | if (!defined('WPSTG_PLUGIN_SLUG')) { |
| 62 | define('WPSTG_PLUGIN_SLUG', basename(dirname($pluginFilePath))); |
| 63 | } |
| 64 | |
| 65 | |
| 66 | if (!defined('WPSTG_PLUGIN_DOMAIN')) { |
| 67 | define('WPSTG_PLUGIN_DOMAIN', 'wp-staging'); |
| 68 | } |
| 69 | |
| 70 | |
| 71 | if (!defined('WPSTG_VIEWS_DIR')) { |
| 72 | define('WPSTG_VIEWS_DIR', WPSTG_PLUGIN_DIR . 'views/'); |
| 73 | } |
| 74 | |
| 75 | |
| 76 | if (!defined('WPSTG_RESOURCES_DIR')) { |
| 77 | define('WPSTG_RESOURCES_DIR', WPSTG_PLUGIN_DIR . 'resources/'); |
| 78 | } |
| 79 | |
| 80 | |
| 81 | if (!defined('KB_IN_BYTES')) { |
| 82 | define('KB_IN_BYTES', 1024); |
| 83 | } |
| 84 | |
| 85 | if (!defined('MB_IN_BYTES')) { |
| 86 | define('MB_IN_BYTES', 1024 * KB_IN_BYTES); |
| 87 | } |
| 88 | |
| 89 | if (!defined('GB_IN_BYTES')) { |
| 90 | define('GB_IN_BYTES', 1024 * MB_IN_BYTES); |
| 91 | } |
| 92 | |
| 93 | if (!defined('MINUTE_IN_SECONDS')) { |
| 94 | define('MINUTE_IN_SECONDS', 60); |
| 95 | } |
| 96 | |
| 97 | if (!defined('HOUR_IN_SECONDS')) { |
| 98 | define('HOUR_IN_SECONDS', 60 * MINUTE_IN_SECONDS); |
| 99 | } |
| 100 | |
| 101 | if (!defined('DAY_IN_SECONDS')) { |
| 102 | define('DAY_IN_SECONDS', 24 * HOUR_IN_SECONDS); |
| 103 | } |
| 104 | |
| 105 | if (!defined('WEEK_IN_SECONDS')) { |
| 106 | define('WEEK_IN_SECONDS', 7 * DAY_IN_SECONDS); |
| 107 | } |
| 108 | |
| 109 | if (!defined('MONTH_IN_SECONDS')) { |
| 110 | define('MONTH_IN_SECONDS', 30 * DAY_IN_SECONDS); |
| 111 | } |
| 112 | |
| 113 | if (!defined('YEAR_IN_SECONDS')) { |
| 114 | define('YEAR_IN_SECONDS', 365 * DAY_IN_SECONDS); |
| 115 | } |
| 116 | |
| 117 | |
| 118 | |
| 119 | |
| 120 | |
| 121 | |
| 122 | if (file_exists(__DIR__ . '/constantsPro.php')) { |
| 123 | include_once __DIR__ . '/constantsPro.php'; |
| 124 | } elseif (file_exists(__DIR__ . '/constantsFree.php')) { |
| 125 | include_once __DIR__ . '/constantsFree.php'; |
| 126 | } |
| 127 | |
| 128 | if (!function_exists('\WPStaging\functions\debug_log') && file_exists(__DIR__ . '/wp-staging-error-handler.php')) { |
| 129 | include_once __DIR__ . '/wp-staging-error-handler.php'; |
| 130 | } |
| 131 | |
| 132 | |
| 133 | if (php_sapi_name() === "cli" && defined("WPSTG_UNIT_TESTS") && constant("WPSTG_UNIT_TESTS")) { |
| 134 | WPStaging::setUseBaseContainerSingleton(true); |
| 135 | } |
| 136 | |
| 137 | $wpStaging = WPStaging::getInstance(); |
| 138 | $wpStaging->registerErrorHandler(); |
| 139 | |
| 140 | |
| 141 | |
| 142 | |
| 143 | |
| 144 | $wpStaging->set('WPSTG_COMPATIBLE', WPSTG_COMPATIBLE); |
| 145 | |
| 146 | |
| 147 | |
| 148 | |
| 149 | $wpStaging->set('WPSTG_ALLOW_VFS', false); |
| 150 | |
| 151 | |
| 152 | global $wpdb; |
| 153 | |
| 154 | if ($wpdb instanceof wpdb) { |
| 155 | $wpStaging->set("wpdb", $wpdb); |
| 156 | } |
| 157 |