| 1 |
<?php |
| 2 |
|
| 3 |
/** |
| 4 |
* The plugin bootstrap file |
| 5 |
* |
| 6 |
* This file is read by WordPress to generate the plugin information in the plugin |
| 7 |
* admin area. This file also includes all of the dependencies used by the plugin, |
| 8 |
* registers the activation and deactivation functions, and defines a function |
| 9 |
* that starts the plugin. |
| 10 |
* |
| 11 |
* @link http://www.fugu.fr |
| 12 |
* @since 1.0.0 |
| 13 |
* @package Maintenance_Switch |
| 14 |
* |
| 15 |
* @wordpress-plugin |
| 16 |
* Plugin Name: Maintenance Switch |
| 17 |
* Plugin URI: https://wordpress.org/plugins/maintenance-switch |
| 18 |
* Description: Customize easily and switch in one-click to (native) maintenance mode from your backend or frontend. |
| 19 |
* Version: 1.7.3 |
| 20 |
* Author: Fugu |
| 21 |
* Author URI: http://www.fugu.fr |
| 22 |
* License: GPL-2.0+ |
| 23 |
* License URI: http://www.gnu.org/licenses/gpl-2.0.txt |
| 24 |
* Text Domain: maintenance-switch |
| 25 |
* Domain Path: /languages |
| 26 |
*/ |
| 27 |
|
| 28 |
// If this file is called directly, abort. |
| 29 |
if (!defined('WPINC')) { |
| 30 |
die; |
| 31 |
} |
| 32 |
|
| 33 |
/** |
| 34 |
* Path of the maintenance.php file. |
| 35 |
* @since 1.0.0 |
| 36 |
*/ |
| 37 |
define('MS_SLUG', 'maintenance-switch'); |
| 38 |
|
| 39 |
/** |
| 40 |
* Path of the maintenance.php file. |
| 41 |
* @since 1.3.6 |
| 42 |
*/ |
| 43 |
define('PLUGIN_VERSION', '1.7.3'); |
| 44 |
|
| 45 |
/** |
| 46 |
* The config file |
| 47 |
*/ |
| 48 |
require_once plugin_dir_path(__FILE__) . 'includes/config.php'; |
| 49 |
|
| 50 |
/** |
| 51 |
* The code that runs during plugin activation. |
| 52 |
* This action is documented in includes/class-maintenance-switch-activator.php |
| 53 |
* @since 1.0.0 |
| 54 |
*/ |
| 55 |
function maintenance_switch_activate() |
| 56 |
{ |
| 57 |
require_once plugin_dir_path(__FILE__) . 'includes/class-maintenance-switch-activator.php'; |
| 58 |
Maintenance_Switch_Activator::activate(); |
| 59 |
} |
| 60 |
|
| 61 |
/** |
| 62 |
* The code that runs during plugin deactivation. |
| 63 |
* This action is documented in includes/class-maintenance-switch-deactivator.php |
| 64 |
* @since 1.0.0 |
| 65 |
*/ |
| 66 |
function maintenance_switch_deactivate() |
| 67 |
{ |
| 68 |
require_once plugin_dir_path(__FILE__) . 'includes/class-maintenance-switch-deactivator.php'; |
| 69 |
Maintenance_Switch_Deactivator::deactivate(); |
| 70 |
} |
| 71 |
|
| 72 |
/** |
| 73 |
* Begins execution of the plugin. |
| 74 |
* |
| 75 |
* Since everything within the plugin is registered via hooks, |
| 76 |
* then kicking off the plugin from this point in the file does |
| 77 |
* not affect the page life cycle. |
| 78 |
* |
| 79 |
* @since 1.0.0 |
| 80 |
*/ |
| 81 |
function maintenance_switch_run() |
| 82 |
{ |
| 83 |
$plugin = new Maintenance_Switch(); |
| 84 |
$plugin->run(); |
| 85 |
} |
| 86 |
|
| 87 |
/** |
| 88 |
* Backward compatibility wrappers for legacy function names. |
| 89 |
* These ensure smooth updates for existing installations. |
| 90 |
* @since 1.0.0 |
| 91 |
* @deprecated Will be removed in a future version. |
| 92 |
*/ |
| 93 |
// phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedFunctionFound -- Backward compatibility wrapper |
| 94 |
function activate_maintenance_switch() { |
| 95 |
maintenance_switch_activate(); |
| 96 |
} |
| 97 |
|
| 98 |
// phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedFunctionFound -- Backward compatibility wrapper |
| 99 |
function deactivate_maintenance_switch() { |
| 100 |
maintenance_switch_deactivate(); |
| 101 |
} |
| 102 |
|
| 103 |
// phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedFunctionFound -- Backward compatibility wrapper |
| 104 |
function run_maintenance_switch() { |
| 105 |
maintenance_switch_run(); |
| 106 |
} |
| 107 |
|
| 108 |
// Register hooks with new function names |
| 109 |
register_activation_hook(__FILE__, 'maintenance_switch_activate'); |
| 110 |
register_deactivation_hook(__FILE__, 'maintenance_switch_deactivate'); |
| 111 |
|
| 112 |
/** |
| 113 |
* The core plugin class that is used to define internationalization, |
| 114 |
* admin-specific hooks, and public-facing site hooks. |
| 115 |
*/ |
| 116 |
require plugin_dir_path(__FILE__) . 'includes/class-maintenance-switch.php'; |
| 117 |
|
| 118 |
// Start the plugin |
| 119 |
maintenance_switch_run(); |
| 120 |
|