Version Description
- Bug IP addresses fixed
- Clean code
=
Download this release
Release Info
Developer | Florent73 |
Plugin | WP Maintenance |
Version | 4.0.2 |
Comparing to | |
See all releases |
Code changes from version 4.0.1 to 4.0.2
- classes/wp-maintenance.php +18 -107
- includes/functions.php +14 -1
- readme.txt +9 -5
- wp-maintenance.php +2 -2
classes/wp-maintenance.php
CHANGED
@@ -23,6 +23,7 @@ class WP_maintenance {
|
|
23 |
add_filter( 'plugin_action_links', array( $this, 'wpm_plugin_actions'), 10, 2 );
|
24 |
add_action( 'admin_head', array( $this, 'wpm_admin_head') );
|
25 |
add_action( 'init', array( $this, 'wpm_date_picker') );
|
|
|
26 |
add_action( 'admin_bar_menu', array( $this, 'wpm_add_menu_admin_bar'), 999 );
|
27 |
add_action( 'admin_footer', array( $this, 'wpm_print_footer_scripts') );
|
28 |
add_action( 'template_redirect', array( $this, 'wpm_maintenance_mode') );
|
@@ -34,7 +35,7 @@ class WP_maintenance {
|
|
34 |
function wpm_theme_add_editor_styles() {
|
35 |
add_editor_style( plugins_url('../css/custom-editor-style.css', __FILE__ ) );
|
36 |
}
|
37 |
-
public static function
|
38 |
|
39 |
$nameServer = '';
|
40 |
if( isset($_SERVER['SERVER_NAME']) ) {
|
@@ -42,7 +43,6 @@ class WP_maintenance {
|
|
42 |
}
|
43 |
|
44 |
$wpMaintenanceAdminOptions = array(
|
45 |
-
'enable' => 0,
|
46 |
'color_bg' => "#f1f1f1",
|
47 |
'color_txt' => '#888888',
|
48 |
'color_bg_bottom' => '#333333',
|
@@ -335,89 +335,6 @@ a.wpmadashicons:hover { text-decoration:none;color: '.$colors[2].'!important; }
|
|
335 |
|
336 |
/*add_submenu_page( 'wp-maintenance', 'WP Maintenance > '.__('About', 'wp-maintenance'), __('About', 'wp-maintenance'), 'manage_options', 'wp-maintenance-about', array( $this, 'wpm_about_page') );*/
|
337 |
|
338 |
-
$nameServer = '';
|
339 |
-
if( isset($_SERVER['SERVER_NAME']) ) {
|
340 |
-
$nameServer = $_SERVER['SERVER_NAME'];
|
341 |
-
}
|
342 |
-
|
343 |
-
$wp_maintenanceAdminOptions = array(
|
344 |
-
'enable' => 0,
|
345 |
-
'color_bg' => "#f1f1f1",
|
346 |
-
'color_txt' => '#888888',
|
347 |
-
'color_bg_bottom' => '#333333',
|
348 |
-
'color_text_bottom' => '#FFFFFF',
|
349 |
-
'titre_maintenance' => __('This site is down for maintenance', 'wp-maintenance'),
|
350 |
-
'text_maintenance' => __('Come back quickly!', 'wp-maintenance'),
|
351 |
-
'userlimit' => 'administrator',
|
352 |
-
'image' => WP_PLUGIN_URL.'/wp-maintenance/images/default.png',
|
353 |
-
'image_width' => 310,
|
354 |
-
'image_height' => 185,
|
355 |
-
'font_title' => 'PT Sans',
|
356 |
-
'font_title_size' => 40,
|
357 |
-
'font_title_weigth' => 'normal',
|
358 |
-
'font_title_style' => '',
|
359 |
-
'font_text_style' => '',
|
360 |
-
'font_text' => 'Metrophobic',
|
361 |
-
'font_text_size' => 18,
|
362 |
-
'font_text_bottom' => 'PT Sans',
|
363 |
-
'font_text_weigth' => 'normal',
|
364 |
-
'font_bottom_size' => 12,
|
365 |
-
'font_bottom_weigth' => 'normal',
|
366 |
-
'font_bottom_style' => '',
|
367 |
-
'font_cpt' => 'PT Sans',
|
368 |
-
'color_cpt' => '#333333',
|
369 |
-
'enable_demo' => 0,
|
370 |
-
'color_field_text' => '#333333',
|
371 |
-
'color_text_button' => '#ffffff',
|
372 |
-
'color_field_background' => '#F1F1F1',
|
373 |
-
'color_field_border' => '#333333',
|
374 |
-
'color_button_onclick' => '#333333',
|
375 |
-
'color_button_hover' => '#cccccc',
|
376 |
-
'color_button' => '#1e73be',
|
377 |
-
'newletter' => 0,
|
378 |
-
'active_cpt' => 0,
|
379 |
-
'newletter_font_text' => 'PT Sans',
|
380 |
-
'newletter_size' => 18,
|
381 |
-
'newletter_font_style' => '',
|
382 |
-
'newletter_font_weigth' => 'normal',
|
383 |
-
'type_newletter' => 'shortcode',
|
384 |
-
'title_newletter' => '',
|
385 |
-
'code_newletter' => '',
|
386 |
-
'code_analytics' => '',
|
387 |
-
'domain_analytics' => $nameServer,
|
388 |
-
'text_bt_maintenance' => '',
|
389 |
-
'add_wplogin' => '',
|
390 |
-
'b_enable_image' => 0,
|
391 |
-
'disable' => 0,
|
392 |
-
'pageperso' => 0,
|
393 |
-
'date_cpt_size' => 40,
|
394 |
-
'color_bg_header' => '#f1f1f1',
|
395 |
-
'add_wplogin_title' => '',
|
396 |
-
'headercode' => '',
|
397 |
-
'message_cpt_fin' => '',
|
398 |
-
'b_repeat_image' => '',
|
399 |
-
'color_cpt_bg' => '',
|
400 |
-
'enable_slider' => 0,
|
401 |
-
'container_active' => 0,
|
402 |
-
'container_color' => '#ffffff',
|
403 |
-
'container_opacity' => '0.5',
|
404 |
-
'container_width' => 80
|
405 |
-
|
406 |
-
);
|
407 |
-
$getMaintenanceSettings = get_option('wp_maintenance_settings');
|
408 |
-
if ( empty($getMaintenanceSettings) ) {
|
409 |
-
foreach ($wp_maintenanceAdminOptions as $key => $option) {
|
410 |
-
$wp_maintenanceAdminOptions[$key] = $option;
|
411 |
-
}
|
412 |
-
update_option('wp_maintenance_settings', $wp_maintenanceAdminOptions);
|
413 |
-
}
|
414 |
-
|
415 |
-
if(!get_option('wp_maintenance_active')) { update_option('wp_maintenance_active', 0); }
|
416 |
-
|
417 |
-
if(!get_option('wp_maintenance_style') or get_option('wp_maintenance_style')=='') {
|
418 |
-
update_option('wp_maintenance_style', wpm_print_style());
|
419 |
-
}
|
420 |
-
|
421 |
// If you're not including an image upload then you can leave this function call out
|
422 |
if (isset($_GET['page']) && strpos($_GET['page'], 'wp-maintenance') !==false) {
|
423 |
|
@@ -644,44 +561,38 @@ a.wpmadashicons:hover { text-decoration:none;color: '.$colors[2].'!important; }
|
|
644 |
if(get_option('wp_maintenance_settings')) { extract(get_option('wp_maintenance_settings')); }
|
645 |
$paramMMode = get_option('wp_maintenance_settings');
|
646 |
|
647 |
-
if( isset($paramMMode) && !empty($paramMMode) ) {
|
648 |
-
foreach($paramMMode as $var =>$value) {
|
649 |
-
$paramMMode[$var] = ''.$value.'';
|
650 |
-
}
|
651 |
-
}
|
652 |
-
|
653 |
if(get_option('wp_maintenance_slider')) { extract(get_option('wp_maintenance_slider')); }
|
654 |
$paramSlider = get_option('wp_maintenance_slider');
|
655 |
|
656 |
if(get_option('wp_maintenance_slider_options')) { extract(get_option('wp_maintenance_slider_options')); }
|
657 |
$paramSliderOptions = get_option('wp_maintenance_slider_options');
|
658 |
|
659 |
-
|
660 |
-
$paramLimit = get_option('wp_maintenance_limit');
|
661 |
$statusActive = get_option('wp_maintenance_active');
|
662 |
|
663 |
-
// Récupère les ip autorisee
|
664 |
-
$paramIpAddress = get_option('wp_maintenance_ipaddresses');
|
665 |
-
|
666 |
-
if( !isset($paramMMode['active']) ) { $paramMMode['active'] = 0 ; }
|
667 |
-
if( !isset($statusActive) ) { update_option('wp_maintenance_active', $paramMMode['active']); }
|
668 |
-
|
669 |
$paramSocialOption = get_option('wp_maintenance_social_options');
|
670 |
|
671 |
-
|
|
|
672 |
/* Désactive le mode maintenance pour les IP définies */
|
673 |
if( isset($paramIpAddress) ) {
|
674 |
-
|
675 |
-
|
676 |
-
$
|
|
|
|
|
677 |
}
|
|
|
678 |
}
|
679 |
-
|
680 |
/* Désactive le mode maintenance pour les Roles définis */
|
|
|
|
|
|
|
681 |
if( isset($paramLimit) && count($paramLimit)>1 ) {
|
682 |
foreach($paramLimit as $limitrole) {
|
683 |
if( current_user_can($limitrole) == true ) {
|
684 |
-
$statusActive =
|
685 |
}
|
686 |
}
|
687 |
}
|
@@ -691,7 +602,7 @@ a.wpmadashicons:hover { text-decoration:none;color: '.$colors[2].'!important; }
|
|
691 |
$listPageId = explode(',', $paramMMode['id_pages']);
|
692 |
foreach($listPageId as $keyPageId => $valPageId) {
|
693 |
if( $valPageId == get_the_ID() ) {
|
694 |
-
$statusActive =
|
695 |
}
|
696 |
//echo 'Status: '.$statusActive.' - Page: '.$valPageId.' - ID:'.get_the_ID().'<br />';
|
697 |
}
|
@@ -723,7 +634,7 @@ a.wpmadashicons:hover { text-decoration:none;color: '.$colors[2].'!important; }
|
|
723 |
|
724 |
}
|
725 |
|
726 |
-
if ($statusActive == 1) {
|
727 |
|
728 |
if ( file_exists( get_stylesheet_directory() ) ) {
|
729 |
$urlTpl = get_stylesheet_directory();
|
23 |
add_filter( 'plugin_action_links', array( $this, 'wpm_plugin_actions'), 10, 2 );
|
24 |
add_action( 'admin_head', array( $this, 'wpm_admin_head') );
|
25 |
add_action( 'init', array( $this, 'wpm_date_picker') );
|
26 |
+
add_action( 'init', array( $this, 'wpm_install') );
|
27 |
add_action( 'admin_bar_menu', array( $this, 'wpm_add_menu_admin_bar'), 999 );
|
28 |
add_action( 'admin_footer', array( $this, 'wpm_print_footer_scripts') );
|
29 |
add_action( 'template_redirect', array( $this, 'wpm_maintenance_mode') );
|
35 |
function wpm_theme_add_editor_styles() {
|
36 |
add_editor_style( plugins_url('../css/custom-editor-style.css', __FILE__ ) );
|
37 |
}
|
38 |
+
public static function wpm_install() {
|
39 |
|
40 |
$nameServer = '';
|
41 |
if( isset($_SERVER['SERVER_NAME']) ) {
|
43 |
}
|
44 |
|
45 |
$wpMaintenanceAdminOptions = array(
|
|
|
46 |
'color_bg' => "#f1f1f1",
|
47 |
'color_txt' => '#888888',
|
48 |
'color_bg_bottom' => '#333333',
|
335 |
|
336 |
/*add_submenu_page( 'wp-maintenance', 'WP Maintenance > '.__('About', 'wp-maintenance'), __('About', 'wp-maintenance'), 'manage_options', 'wp-maintenance-about', array( $this, 'wpm_about_page') );*/
|
337 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
338 |
// If you're not including an image upload then you can leave this function call out
|
339 |
if (isset($_GET['page']) && strpos($_GET['page'], 'wp-maintenance') !==false) {
|
340 |
|
561 |
if(get_option('wp_maintenance_settings')) { extract(get_option('wp_maintenance_settings')); }
|
562 |
$paramMMode = get_option('wp_maintenance_settings');
|
563 |
|
|
|
|
|
|
|
|
|
|
|
|
|
564 |
if(get_option('wp_maintenance_slider')) { extract(get_option('wp_maintenance_slider')); }
|
565 |
$paramSlider = get_option('wp_maintenance_slider');
|
566 |
|
567 |
if(get_option('wp_maintenance_slider_options')) { extract(get_option('wp_maintenance_slider_options')); }
|
568 |
$paramSliderOptions = get_option('wp_maintenance_slider_options');
|
569 |
|
570 |
+
/* Récupère le status */
|
|
|
571 |
$statusActive = get_option('wp_maintenance_active');
|
572 |
|
|
|
|
|
|
|
|
|
|
|
|
|
573 |
$paramSocialOption = get_option('wp_maintenance_social_options');
|
574 |
|
575 |
+
// Récupère les ip autorisee
|
576 |
+
$paramIpAddress = get_option('wp_maintenance_ipaddresses');
|
577 |
/* Désactive le mode maintenance pour les IP définies */
|
578 |
if( isset($paramIpAddress) ) {
|
579 |
+
$lienIpAddress = explode("\n", $paramIpAddress);
|
580 |
+
foreach($lienIpAddress as $ipAutorized) {
|
581 |
+
if( strpos($ipAutorized, wpm_get_ip())!== false ) {
|
582 |
+
$statusActive = 1;
|
583 |
+
}
|
584 |
}
|
585 |
+
|
586 |
}
|
587 |
+
|
588 |
/* Désactive le mode maintenance pour les Roles définis */
|
589 |
+
if(get_option('wp_maintenance_limit')) { extract(get_option('wp_maintenance_limit')); }
|
590 |
+
$paramLimit = get_option('wp_maintenance_limit');
|
591 |
+
|
592 |
if( isset($paramLimit) && count($paramLimit)>1 ) {
|
593 |
foreach($paramLimit as $limitrole) {
|
594 |
if( current_user_can($limitrole) == true ) {
|
595 |
+
$statusActive = 1;
|
596 |
}
|
597 |
}
|
598 |
}
|
602 |
$listPageId = explode(',', $paramMMode['id_pages']);
|
603 |
foreach($listPageId as $keyPageId => $valPageId) {
|
604 |
if( $valPageId == get_the_ID() ) {
|
605 |
+
$statusActive = 1;
|
606 |
}
|
607 |
//echo 'Status: '.$statusActive.' - Page: '.$valPageId.' - ID:'.get_the_ID().'<br />';
|
608 |
}
|
634 |
|
635 |
}
|
636 |
|
637 |
+
if ( isset($statusActive) && $statusActive == 1) {
|
638 |
|
639 |
if ( file_exists( get_stylesheet_directory() ) ) {
|
640 |
$urlTpl = get_stylesheet_directory();
|
includes/functions.php
CHANGED
@@ -189,7 +189,20 @@ function wpm_get_roles() {
|
|
189 |
|
190 |
/* Retourne la vraie adresse IP */
|
191 |
function wpm_get_ip() {
|
192 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
193 |
}
|
194 |
|
195 |
function wpm_change_active($value = 0) {
|
189 |
|
190 |
/* Retourne la vraie adresse IP */
|
191 |
function wpm_get_ip() {
|
192 |
+
|
193 |
+
// IP si internet partagé
|
194 |
+
if (isset($_SERVER['HTTP_CLIENT_IP'])) {
|
195 |
+
return $_SERVER['HTTP_CLIENT_IP'];
|
196 |
+
}
|
197 |
+
// IP derrière un proxy
|
198 |
+
elseif (isset($_SERVER['HTTP_X_FORWARDED_FOR'])) {
|
199 |
+
return $_SERVER['HTTP_X_FORWARDED_FOR'];
|
200 |
+
}
|
201 |
+
// Sinon : IP normale
|
202 |
+
else {
|
203 |
+
return (isset($_SERVER['REMOTE_ADDR']) ? $_SERVER['REMOTE_ADDR'] : '');
|
204 |
+
}
|
205 |
+
|
206 |
}
|
207 |
|
208 |
function wpm_change_active($value = 0) {
|
readme.txt
CHANGED
@@ -3,15 +3,15 @@ Contributors: Florent73
|
|
3 |
Donate link: https://wpmaintenance.info/a-propos/
|
4 |
Tags: Maintenance, Construction, Launch, Coming soon
|
5 |
Requires at least: 3.0
|
6 |
-
Tested up to: 4.9
|
7 |
-
Stable tag: 4.0.
|
8 |
License: GPLv2 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
10 |
|
11 |
Create and customize your maintenance page
|
12 |
|
13 |
== Description ==
|
14 |
-
The WP Maintenance plugin allows you to put your website on the waiting time for you to do maintenance or launch your website. Personalize this page
|
15 |
|
16 |
== Features ==
|
17 |
- Choice texts colors and fonts
|
@@ -67,11 +67,15 @@ You can translate WP Maintenance on [__translate.wordpress.org__](https://transl
|
|
67 |
|
68 |
== Upgrade Notice ==
|
69 |
|
70 |
-
= 4.0. =
|
71 |
-
* Bug
|
|
|
72 |
|
73 |
== Changelog ==
|
74 |
|
|
|
|
|
|
|
75 |
= 4.0 =
|
76 |
* Remove getimagesize() function
|
77 |
* Adding input for logo size
|
3 |
Donate link: https://wpmaintenance.info/a-propos/
|
4 |
Tags: Maintenance, Construction, Launch, Coming soon
|
5 |
Requires at least: 3.0
|
6 |
+
Tested up to: 4.9
|
7 |
+
Stable tag: 4.0.2
|
8 |
License: GPLv2 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
10 |
|
11 |
Create and customize your maintenance page
|
12 |
|
13 |
== Description ==
|
14 |
+
The WP Maintenance plugin allows you to put your website on the waiting time for you to do maintenance or launch your website. Personalize this page, pictures and countdown with:
|
15 |
|
16 |
== Features ==
|
17 |
- Choice texts colors and fonts
|
67 |
|
68 |
== Upgrade Notice ==
|
69 |
|
70 |
+
= 4.0.2 =
|
71 |
+
* Bug IP addresses fixed
|
72 |
+
* Clean code
|
73 |
|
74 |
== Changelog ==
|
75 |
|
76 |
+
= 4.0.1 =
|
77 |
+
* Bug iframe fixed
|
78 |
+
|
79 |
= 4.0 =
|
80 |
* Remove getimagesize() function
|
81 |
* Adding input for logo size
|
wp-maintenance.php
CHANGED
@@ -5,7 +5,7 @@
|
|
5 |
* Description: The WP Maintenance plugin allows you to put your website on the waiting time for you to do maintenance or launch your website. Personalize this page with picture, countdown...
|
6 |
* Author: Florent Maillefaud
|
7 |
* Author URI: https://wpmaintenance.info
|
8 |
-
* Version: 4.0.
|
9 |
* Text Domain: wp-maintenance
|
10 |
* Domain Path: /languages/
|
11 |
*/
|
@@ -36,7 +36,7 @@ define( 'WPM_PLUGIN_BASENAME', plugin_basename( __FILE__ ) );
|
|
36 |
define( 'WPM_PLUGIN_URL', plugins_url().'/'.strtolower('wp-maintenance').'/');
|
37 |
define( 'WPM_ICONS_URL', plugins_url().'/'.strtolower('wp-maintenance').'/socialicons/');
|
38 |
|
39 |
-
if( !defined( 'WPM_VERSION' )) { define( 'WPM_VERSION', '4.0.
|
40 |
|
41 |
require WPM_DIR . 'classes/wp-maintenance.php';
|
42 |
require WPM_DIR . 'classes/slider.php';
|
5 |
* Description: The WP Maintenance plugin allows you to put your website on the waiting time for you to do maintenance or launch your website. Personalize this page with picture, countdown...
|
6 |
* Author: Florent Maillefaud
|
7 |
* Author URI: https://wpmaintenance.info
|
8 |
+
* Version: 4.0.2
|
9 |
* Text Domain: wp-maintenance
|
10 |
* Domain Path: /languages/
|
11 |
*/
|
36 |
define( 'WPM_PLUGIN_URL', plugins_url().'/'.strtolower('wp-maintenance').'/');
|
37 |
define( 'WPM_ICONS_URL', plugins_url().'/'.strtolower('wp-maintenance').'/socialicons/');
|
38 |
|
39 |
+
if( !defined( 'WPM_VERSION' )) { define( 'WPM_VERSION', '4.0.2' ); }
|
40 |
|
41 |
require WPM_DIR . 'classes/wp-maintenance.php';
|
42 |
require WPM_DIR . 'classes/slider.php';
|