Version Description
(20/02/2019) = * bump "Tested up to" version to 5.1.0 * replace "wpmu_new_blog" action with "wp_initialize_site" action for WP 5.1.0 users because the first one is deprecated in the new version * small improvement to "check_exclude" method from "WP_Maintenance_Mode" class
Download this release
Release Info
| Developer | GeorgeJipa |
| Plugin | |
| Version | 2.2.3 |
| Comparing to | |
| See all releases | |
Code changes from version 2.2.2 to 2.2.3
- includes/classes/wp-maintenance-mode.php +23 -16
- readme.txt +7 -2
- wp-maintenance-mode.php +1 -1
includes/classes/wp-maintenance-mode.php
CHANGED
|
@@ -4,7 +4,7 @@ if (!class_exists('WP_Maintenance_Mode')) {
|
|
| 4 |
|
| 5 |
class WP_Maintenance_Mode {
|
| 6 |
|
| 7 |
-
const VERSION = '2.2.
|
| 8 |
|
| 9 |
protected $plugin_slug = 'wp-maintenance-mode';
|
| 10 |
protected $plugin_settings;
|
|
@@ -12,7 +12,7 @@ if (!class_exists('WP_Maintenance_Mode')) {
|
|
| 12 |
protected static $instance = null;
|
| 13 |
|
| 14 |
private function __construct() {
|
| 15 |
-
$this->plugin_settings = get_option('wpmm_settings');
|
| 16 |
$this->plugin_basename = plugin_basename(WPMM_PATH . $this->plugin_slug . '.php');
|
| 17 |
|
| 18 |
// Load plugin text domain
|
|
@@ -20,9 +20,10 @@ if (!class_exists('WP_Maintenance_Mode')) {
|
|
| 20 |
|
| 21 |
// Add shortcodes
|
| 22 |
add_action('init', array('WP_Maintenance_Mode_Shortcodes', 'init'));
|
| 23 |
-
|
| 24 |
// Activate plugin when new blog is added
|
| 25 |
-
|
|
|
|
| 26 |
|
| 27 |
// Check update
|
| 28 |
add_action('admin_init', array($this, 'check_update'));
|
|
@@ -248,13 +249,17 @@ if (!class_exists('WP_Maintenance_Mode')) {
|
|
| 248 |
* What to do when a new site is activated (multisite env)
|
| 249 |
*
|
| 250 |
* @since 2.0.0
|
| 251 |
-
* @param int $
|
| 252 |
*/
|
| 253 |
-
public function activate_new_site($
|
| 254 |
-
|
|
|
|
|
|
|
| 255 |
return;
|
| 256 |
}
|
| 257 |
-
|
|
|
|
|
|
|
| 258 |
switch_to_blog($blog_id);
|
| 259 |
self::single_activate();
|
| 260 |
restore_current_blog();
|
|
@@ -417,7 +422,7 @@ if (!class_exists('WP_Maintenance_Mode')) {
|
|
| 417 |
// set options
|
| 418 |
add_option('wpmm_settings', $v2_options);
|
| 419 |
}
|
| 420 |
-
|
| 421 |
$should_update = false;
|
| 422 |
|
| 423 |
/**
|
|
@@ -455,14 +460,14 @@ if (!class_exists('WP_Maintenance_Mode')) {
|
|
| 455 |
*/
|
| 456 |
if (empty($v2_options['modules']['ga_anonymize_ip'])) {
|
| 457 |
$v2_options['modules']['ga_anonymize_ip'] = $default_options['modules']['ga_anonymize_ip'];
|
| 458 |
-
|
| 459 |
// update options
|
| 460 |
update_option('wpmm_settings', $v2_options);
|
| 461 |
}
|
| 462 |
-
|
| 463 |
if (empty($v2_options['gdpr']['policy_page_target'])) {
|
| 464 |
$v2_options['gdpr']['policy_page_target'] = $default_options['gdpr']['policy_page_target'];
|
| 465 |
-
|
| 466 |
// update options
|
| 467 |
update_option('wpmm_settings', $v2_options);
|
| 468 |
}
|
|
@@ -752,13 +757,15 @@ if (!class_exists('WP_Maintenance_Mode')) {
|
|
| 752 |
|
| 753 |
if (!empty($this->plugin_settings['general']['exclude']) && is_array($this->plugin_settings['general']['exclude'])) {
|
| 754 |
$excluded_list = $this->plugin_settings['general']['exclude'];
|
| 755 |
-
|
|
|
|
|
|
|
| 756 |
foreach ($excluded_list as $item) {
|
| 757 |
if (empty($item)) { // just to be sure :-)
|
| 758 |
continue;
|
| 759 |
}
|
| 760 |
-
|
| 761 |
-
if (
|
| 762 |
$is_excluded = true;
|
| 763 |
break;
|
| 764 |
}
|
|
@@ -833,7 +840,7 @@ if (!class_exists('WP_Maintenance_Mode')) {
|
|
| 833 |
) {
|
| 834 |
$ga_options['anonymize_ip'] = true;
|
| 835 |
}
|
| 836 |
-
|
| 837 |
$ga_options = (object) $ga_options;
|
| 838 |
|
| 839 |
// show google analytics javascript snippet
|
| 4 |
|
| 5 |
class WP_Maintenance_Mode {
|
| 6 |
|
| 7 |
+
const VERSION = '2.2.3';
|
| 8 |
|
| 9 |
protected $plugin_slug = 'wp-maintenance-mode';
|
| 10 |
protected $plugin_settings;
|
| 12 |
protected static $instance = null;
|
| 13 |
|
| 14 |
private function __construct() {
|
| 15 |
+
$this->plugin_settings = get_option('wpmm_settings', array());
|
| 16 |
$this->plugin_basename = plugin_basename(WPMM_PATH . $this->plugin_slug . '.php');
|
| 17 |
|
| 18 |
// Load plugin text domain
|
| 20 |
|
| 21 |
// Add shortcodes
|
| 22 |
add_action('init', array('WP_Maintenance_Mode_Shortcodes', 'init'));
|
| 23 |
+
|
| 24 |
// Activate plugin when new blog is added
|
| 25 |
+
$new_blog_action = isset($GLOBALS['wp_version']) && version_compare($GLOBALS['wp_version'], '5.1-RC', '>=') ? 'wp_initialize_site' : 'wpmu_new_blog';
|
| 26 |
+
add_action($new_blog_action, array($this, 'activate_new_site'), 11, 1);
|
| 27 |
|
| 28 |
// Check update
|
| 29 |
add_action('admin_init', array($this, 'check_update'));
|
| 249 |
* What to do when a new site is activated (multisite env)
|
| 250 |
*
|
| 251 |
* @since 2.0.0
|
| 252 |
+
* @param int|object $blog
|
| 253 |
*/
|
| 254 |
+
public function activate_new_site($blog) {
|
| 255 |
+
$current_action = current_action();
|
| 256 |
+
|
| 257 |
+
if (1 !== did_action($current_action)) {
|
| 258 |
return;
|
| 259 |
}
|
| 260 |
+
|
| 261 |
+
$blog_id = is_object($blog) ? $blog->id : $blog;
|
| 262 |
+
|
| 263 |
switch_to_blog($blog_id);
|
| 264 |
self::single_activate();
|
| 265 |
restore_current_blog();
|
| 422 |
// set options
|
| 423 |
add_option('wpmm_settings', $v2_options);
|
| 424 |
}
|
| 425 |
+
|
| 426 |
$should_update = false;
|
| 427 |
|
| 428 |
/**
|
| 460 |
*/
|
| 461 |
if (empty($v2_options['modules']['ga_anonymize_ip'])) {
|
| 462 |
$v2_options['modules']['ga_anonymize_ip'] = $default_options['modules']['ga_anonymize_ip'];
|
| 463 |
+
|
| 464 |
// update options
|
| 465 |
update_option('wpmm_settings', $v2_options);
|
| 466 |
}
|
| 467 |
+
|
| 468 |
if (empty($v2_options['gdpr']['policy_page_target'])) {
|
| 469 |
$v2_options['gdpr']['policy_page_target'] = $default_options['gdpr']['policy_page_target'];
|
| 470 |
+
|
| 471 |
// update options
|
| 472 |
update_option('wpmm_settings', $v2_options);
|
| 473 |
}
|
| 757 |
|
| 758 |
if (!empty($this->plugin_settings['general']['exclude']) && is_array($this->plugin_settings['general']['exclude'])) {
|
| 759 |
$excluded_list = $this->plugin_settings['general']['exclude'];
|
| 760 |
+
$remote_address = isset($_SERVER['REMOTE_ADDR']) ? $_SERVER['REMOTE_ADDR'] : '';
|
| 761 |
+
$request_uri = isset($_SERVER['REQUEST_URI']) ? $_SERVER['REQUEST_URI'] : '';
|
| 762 |
+
|
| 763 |
foreach ($excluded_list as $item) {
|
| 764 |
if (empty($item)) { // just to be sure :-)
|
| 765 |
continue;
|
| 766 |
}
|
| 767 |
+
|
| 768 |
+
if (strstr($remote_address, $item) || strstr($request_uri, $item)) {
|
| 769 |
$is_excluded = true;
|
| 770 |
break;
|
| 771 |
}
|
| 840 |
) {
|
| 841 |
$ga_options['anonymize_ip'] = true;
|
| 842 |
}
|
| 843 |
+
|
| 844 |
$ga_options = (object) $ga_options;
|
| 845 |
|
| 846 |
// show google analytics javascript snippet
|
readme.txt
CHANGED
|
@@ -6,8 +6,8 @@ Author: Designmodo
|
|
| 6 |
Author URI: https://designmodo.com/
|
| 7 |
Tags: maintenance mode, admin, administration, unavailable, coming soon, multisite, landing page, under construction, contact form, subscribe, countdown
|
| 8 |
Requires at least: 3.5
|
| 9 |
-
Tested up to: 5.0
|
| 10 |
-
Stable tag: 2.2.
|
| 11 |
Requires PHP: 5.6
|
| 12 |
License: GPL-2.0+
|
| 13 |
|
|
@@ -77,6 +77,11 @@ If you change your login url, please add the new slug (url: http://domain.com/ne
|
|
| 77 |
|
| 78 |
== Changelog ==
|
| 79 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 80 |
= 2.2.2 (27/11/2018) =
|
| 81 |
* Google Analytics module: migrate from analytics.js to gtag.js + add ip anonymization [#178](https://github.com/Designmodocom/WP-Maintenance-Mode/issues/178)
|
| 82 |
* GDPR module: accept links inside texareas + add policy link target [#188](https://github.com/Designmodocom/WP-Maintenance-Mode/issues/188)
|
| 6 |
Author URI: https://designmodo.com/
|
| 7 |
Tags: maintenance mode, admin, administration, unavailable, coming soon, multisite, landing page, under construction, contact form, subscribe, countdown
|
| 8 |
Requires at least: 3.5
|
| 9 |
+
Tested up to: 5.1.0
|
| 10 |
+
Stable tag: 2.2.3
|
| 11 |
Requires PHP: 5.6
|
| 12 |
License: GPL-2.0+
|
| 13 |
|
| 77 |
|
| 78 |
== Changelog ==
|
| 79 |
|
| 80 |
+
= 2.2.3 (20/02/2019) =
|
| 81 |
+
* bump "Tested up to" version to 5.1.0
|
| 82 |
+
* replace "wpmu_new_blog" action with "wp_initialize_site" action for WP 5.1.0 users because the first one is deprecated in the new version
|
| 83 |
+
* small improvement to "check_exclude" method from "WP_Maintenance_Mode" class
|
| 84 |
+
|
| 85 |
= 2.2.2 (27/11/2018) =
|
| 86 |
* Google Analytics module: migrate from analytics.js to gtag.js + add ip anonymization [#178](https://github.com/Designmodocom/WP-Maintenance-Mode/issues/178)
|
| 87 |
* GDPR module: accept links inside texareas + add policy link target [#188](https://github.com/Designmodocom/WP-Maintenance-Mode/issues/188)
|
wp-maintenance-mode.php
CHANGED
|
@@ -6,7 +6,7 @@
|
|
| 6 |
* Plugin Name: WP Maintenance Mode
|
| 7 |
* Plugin URI: https://designmodo.com/
|
| 8 |
* 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 page.
|
| 9 |
-
* Version: 2.2.
|
| 10 |
* Author: Designmodo
|
| 11 |
* Author URI: https://designmodo.com/
|
| 12 |
* Twitter: designmodo
|
| 6 |
* Plugin Name: WP Maintenance Mode
|
| 7 |
* Plugin URI: https://designmodo.com/
|
| 8 |
* 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 page.
|
| 9 |
+
* Version: 2.2.3
|
| 10 |
* Author: Designmodo
|
| 11 |
* Author URI: https://designmodo.com/
|
| 12 |
* Twitter: designmodo
|
