wp-maintenance-mode
Last commit date
assets
1 year ago
includes
1 year ago
languages
5 years ago
vendor
1 year ago
views
1 year ago
CHANGELOG.md
1 year ago
README.md
1 year ago
index.php
9 years ago
readme.txt
1 year ago
uninstall.php
5 years ago
wp-maintenance-mode.php
1 year ago
wp-maintenance-mode.php
111 lines
| 1 | <?php |
| 2 | /** |
| 3 | * LightStart |
| 4 | * |
| 5 | * Plugin Name: LightStart - Maintenance Mode, Coming Soon and Landing Page Builder |
| 6 | * Description: Adds a splash page to your site that lets visitors know your site is down for maintenance. It's perfect for a coming soon or landing page. |
| 7 | * Version: 2.6.18 |
| 8 | * Author: Themeisle |
| 9 | * Author URI: https://themeisle.com/ |
| 10 | * Twitter: themeisle |
| 11 | * GitHub Plugin URI: https://github.com/codeinwp/wp-maintenance-mode |
| 12 | * License: GPL-2.0+ |
| 13 | * License URI: http://www.gnu.org/licenses/gpl-2.0.txt |
| 14 | * Text Domain: wp-maintenance-mode |
| 15 | * Domain Path: /languages |
| 16 | * WordPress Available: yes |
| 17 | * Requires License: no |
| 18 | */ |
| 19 | |
| 20 | defined( 'ABSPATH' ) || exit; |
| 21 | |
| 22 | /** |
| 23 | * DEFINE PATHS |
| 24 | */ |
| 25 | define( 'WPMM_PATH', plugin_dir_path( __FILE__ ) ); |
| 26 | define( 'WPMM_FILE', __FILE__ ); |
| 27 | define( 'WPMM_CLASSES_PATH', WPMM_PATH . 'includes/classes/' ); |
| 28 | define( 'WPMM_FUNCTIONS_PATH', WPMM_PATH . 'includes/functions/' ); |
| 29 | define( 'WPMM_LANGUAGES_PATH', basename( WPMM_PATH ) . '/languages/' ); |
| 30 | define( 'WPMM_VIEWS_PATH', WPMM_PATH . 'views/' ); |
| 31 | define( 'WPMM_CSS_PATH', WPMM_PATH . 'assets/css/' ); |
| 32 | define( 'WPMM_TEMPLATES_PATH', WPMM_PATH . 'assets/templates/' ); |
| 33 | define( 'WPMM_PRODUCT_SLUG', basename( dirname( __FILE__ ) ) ); |
| 34 | |
| 35 | /** |
| 36 | * DEFINE URLS |
| 37 | */ |
| 38 | define( 'WPMM_URL', plugin_dir_url( __FILE__ ) ); |
| 39 | define( 'WPMM_JS_URL', WPMM_URL . 'assets/js/' ); |
| 40 | define( 'WPMM_CSS_URL', WPMM_URL . 'assets/css/' ); |
| 41 | define( 'WPMM_IMAGES_URL', WPMM_URL . 'assets/images/' ); |
| 42 | define( 'WPMM_TEMPLATES_URL', WPMM_URL . 'assets/templates/' ); |
| 43 | |
| 44 | /** |
| 45 | * OTHER DEFINES |
| 46 | */ |
| 47 | define( 'WPMM_ASSETS_SUFFIX', ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) ? '' : '.min' ); |
| 48 | |
| 49 | /** |
| 50 | * FUNCTIONS |
| 51 | */ |
| 52 | require_once WPMM_FUNCTIONS_PATH . 'hooks.php'; |
| 53 | require_once WPMM_FUNCTIONS_PATH . 'helpers.php'; |
| 54 | if ( is_multisite() && ! function_exists( 'is_plugin_active_for_network' ) ) { |
| 55 | require_once ABSPATH . '/wp-admin/includes/plugin.php'; |
| 56 | } |
| 57 | |
| 58 | /** |
| 59 | * FRONTEND |
| 60 | */ |
| 61 | require_once WPMM_CLASSES_PATH . 'wp-maintenance-mode-shortcodes.php'; |
| 62 | require_once WPMM_CLASSES_PATH . 'wp-maintenance-mode.php'; |
| 63 | register_activation_hook( __FILE__, array( 'WP_Maintenance_Mode', 'activate' ) ); |
| 64 | register_deactivation_hook( __FILE__, array( 'WP_Maintenance_Mode', 'deactivate' ) ); |
| 65 | |
| 66 | add_action( 'plugins_loaded', array( 'WP_Maintenance_Mode', 'get_instance' ) ); |
| 67 | |
| 68 | /** |
| 69 | * DASHBOARD |
| 70 | */ |
| 71 | if ( is_admin() ) { |
| 72 | require_once WPMM_CLASSES_PATH . 'wp-maintenance-mode-admin.php'; |
| 73 | add_action( 'plugins_loaded', array( 'WP_Maintenance_Mode_Admin', 'get_instance' ) ); |
| 74 | } |
| 75 | |
| 76 | add_filter( 'themeisle_sdk_products', 'wpmm_load_sdk' ); |
| 77 | |
| 78 | add_filter( |
| 79 | 'wp_maintenance_mode_about_us_metadata', |
| 80 | function() { |
| 81 | return array( |
| 82 | 'logo' => esc_url( WPMM_IMAGES_URL . 'icon.svg' ), |
| 83 | 'location' => 'wp-maintenance-mode', |
| 84 | ); |
| 85 | } |
| 86 | ); |
| 87 | |
| 88 | /** |
| 89 | * Filter products array. |
| 90 | * |
| 91 | * @param array $products products array. |
| 92 | * |
| 93 | * @return array |
| 94 | */ |
| 95 | function wpmm_load_sdk( $products ) { |
| 96 | $products[] = __FILE__; |
| 97 | return $products; |
| 98 | } |
| 99 | |
| 100 | $autoload_path = __DIR__ . '/vendor/autoload.php'; |
| 101 | if ( is_file( $autoload_path ) ) { |
| 102 | require_once $autoload_path; |
| 103 | } |
| 104 | |
| 105 | add_filter( |
| 106 | 'wp_maintenance_mode_load_promotions', |
| 107 | function() { |
| 108 | return array( 'otter' ); |
| 109 | } |
| 110 | ); |
| 111 |