WP Maintenance v' . MTNC_VERSION . ' by WebFactory Ltd.'; $text .= ' Please ' . __('Rate the plugin ★★★★★', 'maintenance') . '. '; return $text; } // admin_footer_text // add settings link to plugins page function plugin_action_links($links) { $settings_link = '' . __('Settings', 'maintenance') . ''; $pro_link = '' . __('Get PRO', 'maintenance') . ''; array_unshift($links, $pro_link); array_unshift($links, $settings_link); return $links; } // plugin_action_links function pro_dialog() { $out = ''; $out .= ''; // weglot install dialog $out .= ''; // weglot install dialog return $out; } // pro_dialog public function mtnc_constants() { define('MTNC_VERSION', '4.06'); define('MTNC_DB_VERSION', 2); define('MTNC_WP_VERSION', get_bloginfo('version')); define('MTNC_DIR', trailingslashit(plugin_dir_path(__FILE__))); define('MTNC_URI', trailingslashit(plugin_dir_url(__FILE__))); define('MTNC_INCLUDES', MTNC_DIR . trailingslashit('includes')); define('MTNC_LOAD', MTNC_DIR . trailingslashit('load')); } public function mtnc_set_global_options() { global $mt_options; $mt_options = mtnc_get_plugin_options(true); } public function mtnc_lang() { load_plugin_textdomain('maintenance'); } public function mtnc_includes() { require_once MTNC_INCLUDES . 'functions.php'; require_once MTNC_INCLUDES . 'update.php'; require_once MTNC_DIR . 'load/functions.php'; require_once dirname(__FILE__) . '/wf-flyout/wf-flyout.php'; new wf_flyout(__FILE__); } public function mtnc_admin() { if (is_admin()) { require_once MTNC_INCLUDES . 'admin.php'; } } public function mtnc_activation() { self::mtnc_clear_cache(); } public function mtnc_deactivation() { self::mtnc_clear_cache(); } public static function mtnc_clear_cache() { wp_cache_flush(); if (function_exists('w3tc_pgcache_flush')) { w3tc_pgcache_flush(); } if (function_exists('wp_cache_clear_cache')) { wp_cache_clear_cache(); } if (method_exists('LiteSpeed_Cache_API', 'purge_all')) { LiteSpeed_Cache_API::purge_all(); } do_action('litespeed_purge_all'); if (class_exists('Endurance_Page_Cache')) { $epc = new Endurance_Page_Cache; $epc->purge_all(); } if (class_exists('SG_CachePress_Supercacher') && method_exists('SG_CachePress_Supercacher', 'purge_cache')) { SG_CachePress_Supercacher::purge_cache(true); } if (class_exists('SiteGround_Optimizer\Supercacher\Supercacher')) { SiteGround_Optimizer\Supercacher\Supercacher::purge_cache(); } if (isset($GLOBALS['wp_fastest_cache']) && method_exists($GLOBALS['wp_fastest_cache'], 'deleteCache')) { $GLOBALS['wp_fastest_cache']->deleteCache(true); } if (is_callable('wpfc_clear_all_cache')) { wpfc_clear_all_cache(true); } if (is_callable(array('Swift_Performance_Cache', 'clear_all_cache'))) { Swift_Performance_Cache::clear_all_cache(); } if (is_callable(array('Hummingbird\WP_Hummingbird', 'flush_cache'))) { Hummingbird\WP_Hummingbird::flush_cache(true, false); } if (function_exists('rocket_clean_domain')) { rocket_clean_domain(); } do_action('cache_enabler_clear_complete_cache'); } public function mtnc_user_logout() { wp_safe_redirect(get_bloginfo('url')); exit; } public function disable_feed() { global $mt_options; if (!is_user_logged_in() && !empty($mt_options['state'])) { nocache_headers(); echo 'Service unavailable.'; exit; } } public function mtnc_template_include($original_template) { $original_template = mtnc_load_maintenance_page($original_template); return $original_template; } public function mtnc_admin_bar() { add_action('admin_bar_menu', 'mtnc_add_toolbar_items', 100); } function is_plugin_installed($slug) { if (!function_exists('get_plugins')) { require_once ABSPATH . 'wp-admin/includes/plugin.php'; } $all_plugins = get_plugins(); if (!empty($all_plugins[$slug])) { return true; } else { return false; } } // is_plugin_installed // auto download / install / activate WP Force SSL plugin function install_wpfssl() { check_ajax_referer('install_wpfssl'); if (false === current_user_can('administrator')) { wp_die('Sorry, you have to be an admin to run this action.'); } $plugin_slug = 'wp-force-ssl/wp-force-ssl.php'; $plugin_zip = 'https://downloads.wordpress.org/plugin/wp-force-ssl.latest-stable.zip'; @include_once ABSPATH . 'wp-admin/includes/plugin.php'; @include_once ABSPATH . 'wp-admin/includes/class-wp-upgrader.php'; @include_once ABSPATH . 'wp-admin/includes/plugin-install.php'; @include_once ABSPATH . 'wp-admin/includes/file.php'; @include_once ABSPATH . 'wp-admin/includes/misc.php'; echo ''; echo '
'; echo 'If things are not done in a minute install the plugin manually via Plugins page

'; echo 'Starting ...

'; wp_cache_flush(); $upgrader = new Plugin_Upgrader(); echo 'Check if WP Force SSL is already installed ...
'; if ($this->is_plugin_installed($plugin_slug)) { echo 'WP Force SSL is already installed!

Making sure it\'s the latest version.
'; $upgrader->upgrade($plugin_slug); $installed = true; } else { echo 'Installing WP Force SSL.
'; $installed = $upgrader->install($plugin_zip); } wp_cache_flush(); if (!is_wp_error($installed) && $installed) { echo 'Activating WP Force SSL.
'; $activate = activate_plugin($plugin_slug); if (is_null($activate)) { echo 'WP Force SSL Activated.
'; echo ''; echo '
If you are not redirected in a few seconds - click here.'; } } else { echo 'Could not install WP Force SSL. You\'ll have to download and install manually.'; } echo '
'; } // install_wpfssl // auto download / install / activate Weglot plugin function install_weglot() { check_ajax_referer('install_weglot'); if (false === current_user_can('administrator')) { wp_die('Sorry, you have to be an admin to run this action.'); } $plugin_slug = 'weglot/weglot.php'; $plugin_zip = 'https://downloads.wordpress.org/plugin/weglot.latest-stable.zip'; @include_once ABSPATH . 'wp-admin/includes/plugin.php'; @include_once ABSPATH . 'wp-admin/includes/class-wp-upgrader.php'; @include_once ABSPATH . 'wp-admin/includes/plugin-install.php'; @include_once ABSPATH . 'wp-admin/includes/file.php'; @include_once ABSPATH . 'wp-admin/includes/misc.php'; echo ''; echo '
'; echo 'If things are not done in a minute install the plugin manually via Plugins page

'; echo 'Starting ...

'; wp_cache_flush(); $upgrader = new Plugin_Upgrader(); echo 'Check if Weglot is already installed ...
'; if ($this->is_plugin_installed($plugin_slug)) { echo 'Weglot is already installed!

Making sure it\'s the latest version.
'; $upgrader->upgrade($plugin_slug); $installed = true; } else { echo 'Installing Weglot.
'; $installed = $upgrader->install($plugin_zip); } wp_cache_flush(); if (!is_wp_error($installed) && $installed) { echo 'Activating Weglot.
'; $activate = activate_plugin($plugin_slug); if (is_null($activate)) { echo 'Weglot Activated.
'; echo ''; echo '
If you are not redirected in a few seconds - click here.'; } } else { echo 'Could not install Weglot. You\'ll have to download and install manually.'; } echo '
'; } // install_weglot } // class MTNC global $mtnc; $mtnc = new MTNC();