WP Maintenance - Version 0.7

Version Description

Cette version est stable / This version is stable

=

Download this release

Release Info

Developer Florent73
Plugin Icon 128x128 WP Maintenance
Version 0.7
Comparing to
See all releases

Code changes from version 0.6 to 0.7

Files changed (5) hide show
  1. readme.txt +5 -2
  2. uninstall.php +11 -0
  3. wp-maintenance-admin.php +10 -16
  4. wp-maintenance.php +118 -23
  5. wpm-style.css +0 -5
readme.txt CHANGED
@@ -4,7 +4,7 @@ Donate link:
4
  Tags: wordpress maintenance plugin
5
  Requires at least: 2.0
6
  Tested up to: 3.6
7
- Stable tag: 0.6
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
@@ -48,12 +48,15 @@ Oui mais merci de me soumettre les modifications souhaitées afin de mettre à j
48
 
49
  == Upgrade Notice ==
50
 
51
- = 0.6 =
52
  Cette version est stable / This version is stable
53
 
54
 
55
  == Changelog ==
56
 
 
 
 
57
  = 0.6 =
58
  * Conflits javascript résolus / Javascript conflicts fixed
59
 
4
  Tags: wordpress maintenance plugin
5
  Requires at least: 2.0
6
  Tested up to: 3.6
7
+ Stable tag: 0.7
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
48
 
49
  == Upgrade Notice ==
50
 
51
+ = 0.7 =
52
  Cette version est stable / This version is stable
53
 
54
 
55
  == Changelog ==
56
 
57
+ = 0.7 =
58
+ * Bugs sur les couleurs résolus / Colors Bugs fixed
59
+
60
  = 0.6 =
61
  * Conflits javascript résolus / Javascript conflicts fixed
62
 
uninstall.php ADDED
@@ -0,0 +1,11 @@
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Désinstallation du plugin WP Maintenance
5
+ */
6
+ function wpm_uninstall() {
7
+ if(get_option('wp_maintenance_settings')) { delete_option('wp_maintenance_settings'); }
8
+ if(get_option('wp_maintenance_version')) { delete_option('wp_maintenance_version'); }
9
+ if(get_option('wp_maintenance_style')) { delete_option('wp_maintenance_style'); }
10
+ }
11
+ register_deactivation_hook(__FILE__, 'wpm_uninstall');
wp-maintenance-admin.php CHANGED
@@ -4,6 +4,7 @@
4
  /* Update des paramètres */
5
  if($_POST['action'] == 'update' && $_POST["wp_maintenance_settings"]!='') {
6
  update_option('wp_maintenance_settings', $_POST["wp_maintenance_settings"]);
 
7
  $options_saved = true;
8
  echo '<div id="message" class="updated fade"><p><strong>'.__('Options saved.', 'wp-maintenance').'</strong></p></div>';
9
  }
@@ -12,19 +13,9 @@ if($_POST['action'] == 'update' && $_POST["wp_maintenance_settings"]!='') {
12
  if(get_option('wp_maintenance_settings')) { extract(get_option('wp_maintenance_settings')); }
13
  $paramMMode = get_option('wp_maintenance_settings');
14
 
15
- /* Si on réinitialise les feuille de styles */
16
- if($_POST['wp_maintenance_settings']['initcss']==1) {
17
- $paramMMode['stylecss'] = '';
18
- $_POST['wp_maintenance_settings']['initcss'] = '';
19
- update_option('wp_maintenance_settings', $_POST["wp_maintenance_settings"]);
20
- $options_saved = true;
21
- echo '<div id="message" class="updated fade"><p><strong>Feuillez de style réinitialisée !</strong></p></div>';
22
- }
23
-
24
 
25
  /* Feuille de style par défault */
26
- if($paramMMode['stylecss'] == '') {
27
- $paramMMode['stylecss'] = '
28
  h1 {
29
  margin-left:auto;
30
  margin-right:auto;
@@ -109,12 +100,15 @@ body {
109
  padding: 25px 5px 0 2px;
110
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.5);
111
  }
 
112
 
113
- ';
114
-
 
 
 
115
  }
116
 
117
- echo $paramMMode['styless'];
118
  ?>
119
  <style type="text/css">.postbox h3 { cursor:pointer; }</style>
120
  <div class="wrap">
@@ -282,7 +276,7 @@ echo $paramMMode['styless'];
282
  <li><h3><?php echo __('CSS style sheet code :', 'wp-maintenance'); ?></h3>
283
  <?php echo __('Edit the CSS sheet of your maintenance page here. Click "Reset" and "Save" to retrieve the default style sheet.', 'wp-maintenance'); ?><br /><br />
284
  <div style="float:left;width:55%;margin-right:15px;">
285
- <TEXTAREA NAME="wp_maintenance_settings[stylecss]" COLS=70 ROWS=24 style="width:100%;"><?php echo stripslashes($paramMMode['stylecss']); ?></TEXTAREA>
286
  </div>
287
  <div style="float:left;position:relative;width:40%;">
288
  <table class="wp-list-table widefat fixed" cellspacing="0">
@@ -318,7 +312,7 @@ echo $paramMMode['styless'];
318
  <br />
319
  </li>
320
  <li>
321
- <input type= "checkbox" name="wp_maintenance_settings[initcss]" value="1" id="initcss" >&nbsp;<label for="initcss"><?php echo __('Reset default CSS stylesheet ?', 'wp-maintenance'); ?></label><br />
322
  </li>
323
  <li> &nbsp;</li>
324
 
4
  /* Update des paramètres */
5
  if($_POST['action'] == 'update' && $_POST["wp_maintenance_settings"]!='') {
6
  update_option('wp_maintenance_settings', $_POST["wp_maintenance_settings"]);
7
+ update_option('wp_maintenance_style', $_POST["wp_maintenance_style"]);
8
  $options_saved = true;
9
  echo '<div id="message" class="updated fade"><p><strong>'.__('Options saved.', 'wp-maintenance').'</strong></p></div>';
10
  }
13
  if(get_option('wp_maintenance_settings')) { extract(get_option('wp_maintenance_settings')); }
14
  $paramMMode = get_option('wp_maintenance_settings');
15
 
 
 
 
 
 
 
 
 
 
16
 
17
  /* Feuille de style par défault */
18
+ $wpm_style_defaut = '
 
19
  h1 {
20
  margin-left:auto;
21
  margin-right:auto;
100
  padding: 25px 5px 0 2px;
101
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.5);
102
  }
103
+ ';
104
 
105
+ /* Si on réinitialise les feuille de styles */
106
+ if($_POST['wpm_initcss']==1) {
107
+ update_option('wp_maintenance_style', $wpm_style_defaut);
108
+ $options_saved = true;
109
+ echo '<div id="message" class="updated fade"><p><strong>Feuillez de style réinitialisée !</strong></p></div>';
110
  }
111
 
 
112
  ?>
113
  <style type="text/css">.postbox h3 { cursor:pointer; }</style>
114
  <div class="wrap">
276
  <li><h3><?php echo __('CSS style sheet code :', 'wp-maintenance'); ?></h3>
277
  <?php echo __('Edit the CSS sheet of your maintenance page here. Click "Reset" and "Save" to retrieve the default style sheet.', 'wp-maintenance'); ?><br /><br />
278
  <div style="float:left;width:55%;margin-right:15px;">
279
+ <TEXTAREA NAME="wp_maintenance_style" COLS=70 ROWS=24 style="width:100%;"><?php echo stripslashes(trim(get_option('wp_maintenance_style'))); ?></TEXTAREA>
280
  </div>
281
  <div style="float:left;position:relative;width:40%;">
282
  <table class="wp-list-table widefat fixed" cellspacing="0">
312
  <br />
313
  </li>
314
  <li>
315
+ <input type= "checkbox" name="wpm_initcss" value="1" id="initcss" >&nbsp;<label for="wpm_initcss"><?php echo __('Reset default CSS stylesheet ?', 'wp-maintenance'); ?></label><br />
316
  </li>
317
  <li> &nbsp;</li>
318
 
wp-maintenance.php CHANGED
@@ -6,12 +6,13 @@ Plugin URI: http://wordpress.org/extend/plugins/wp-maintenance/
6
  Description: Le plugin WP Maintenance vous permet de mettre votre site en attente le temps pour vous de faire une maintenance. Personnalisez cette page de maintenance.
7
  Author: Florent Maillefaud
8
  Author URI: http://www.restezconnectes.fr/
9
- Version: 0.6
10
  */
11
 
12
 
13
  /*
14
  Change Log
 
15
  11/09/2013 - Conflits javascript résolus
16
  30/08/2013 - CSS personnalisable
17
  27/08/2013 - Ajout du multilangue
@@ -32,32 +33,34 @@ if(!defined( 'WPM_BASENAME')) { define( 'WPM_BASENAME', plugin_basename(__FILE__
32
  $wpmaintenance_dashboard = ( is_admin() ) ? 'options-general.php?page=wp-maintenance/wp-maintenance.php' : '';
33
  define( 'WPM_SETTINGS', $wpmaintenance_dashboard);
34
 
 
 
35
  // Add "Réglages" link on plugins page
36
- add_filter( 'plugin_action_links_' . WPM_BASENAME, 'WpMaintenancePlugin_actions' );
37
- function WpMaintenancePlugin_actions ( $links ) {
38
  $settings_link = '<a href="'.WPM_SETTINGS.'">'.__('Settings', 'wp-maintenance').'</a>';
39
  array_unshift ( $links, $settings_link );
40
  return $links;
41
  }
42
 
43
  // multilingue
44
- add_action( 'init', 'make_wpm_multilang' );
45
- function make_wpm_multilang() {
46
  load_plugin_textdomain('wp-maintenance', false, dirname( plugin_basename( __FILE__ ) ).'/languages');
47
  }
48
 
49
  /* Ajoute la version dnas les options */
50
- define('WPM_VERSION', '0.6');
51
  $option['wp_maintenance_version'] = WPM_VERSION;
52
  add_option('wp_maintenance_version',$option);
53
 
54
  //récupère le formulaire d'administration du plugin
55
- function adminWpMaintenancePanel() {
56
  include("wp-maintenance-admin.php");
57
  }
58
 
59
- function addWpMaintenanceAdmin() {
60
- $hook = add_options_page("Options pour l'affichage de la page maintenance", "WP Maintenance", 10, __FILE__, "adminWpMaintenancePanel");
61
 
62
  $wp_maintenanceAdminOptions = array(
63
  'active' => 0,
@@ -71,15 +74,107 @@ function addWpMaintenanceAdmin() {
71
  foreach ($getMaintenanceSettings as $key => $option) {
72
  $wp_maintenanceAdminOptions[$key] = $option;
73
  }
74
- }
 
75
  update_option('wp_maintenance_settings', $wp_maintenanceAdminOptions);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
76
  }
77
 
78
- function WpMaintenanceAdminScripts() {
 
 
 
 
79
  wp_enqueue_script('media-upload');
80
  wp_enqueue_script('thickbox');
81
  wp_register_script('wpm-my-upload', WP_PLUGIN_URL.'/wp-maintenance/wpm-script.js', array('jquery','media-upload','thickbox'));
82
  wp_enqueue_script('wpm-my-upload');
 
 
83
  }
84
 
85
  add_action( 'admin_enqueue_scripts', 'mw_enqueue_color_picker' );
@@ -89,22 +184,18 @@ function mw_enqueue_color_picker( $hook_suffix ) {
89
  wp_enqueue_script( 'my-script-handle', plugins_url('wpm-color-options.js', __FILE__ ), array( 'wp-color-picker' ), false, true );
90
  }
91
 
92
- function WpMaintenanceAdminStyles() {
93
  wp_enqueue_style('thickbox');
94
  }
95
- function wpm_admin_scripts() {
96
- wp_register_script('wpm-admin-settings', WP_PLUGIN_URL.'/wp-maintenance/wpm-admin-settings.js');
97
- wp_enqueue_script('wpm-admin-settings');
98
- }
99
 
100
  if (isset($_GET['page']) && $_GET['page'] == 'wp-maintenance/wp-maintenance.php') {
101
- add_action('admin_print_scripts', 'WpMaintenanceAdminScripts');
102
- add_action('admin_print_styles', 'WpMaintenanceAdminStyles');
103
  add_action('admin_print_scripts', 'wpm_admin_scripts');
104
  }
105
 
106
  /* Mode Mainteance */
107
- function maintenance_mode() {
108
 
109
  global $current_user;
110
 
@@ -149,7 +240,7 @@ function maintenance_mode() {
149
  "#_DATESIZE" => $paramMMode['date_cpt_size'],
150
  "#_COLORCPT" => $paramMMode['color_cpt']
151
  );
152
- $paramMMode['styless'] = str_replace(array_keys($styleRemplacements), array_values($styleRemplacements), $paramMMode['styless']);
153
 
154
  $content = '
155
  <!DOCTYPE html>
@@ -160,7 +251,7 @@ function maintenance_mode() {
160
  $content .= '</title>
161
  <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
162
  <meta name="description" content="'.__('This site is down for maintenance', 'wp-maintenance').'" />
163
- <style type="text/css">'.$paramMMode['stylecss'].'</style>
164
  </head>
165
  <body><div id="wrapper">
166
  ';
@@ -206,9 +297,13 @@ function maintenance_mode() {
206
  }
207
 
208
  }
209
- add_action('get_header', 'maintenance_mode');
 
 
 
 
210
 
211
  //intègre le tout aux pages Admin de Wordpress
212
- add_action("admin_menu", "addWpMaintenanceAdmin");
213
 
214
  ?>
6
  Description: Le plugin WP Maintenance vous permet de mettre votre site en attente le temps pour vous de faire une maintenance. Personnalisez cette page de maintenance.
7
  Author: Florent Maillefaud
8
  Author URI: http://www.restezconnectes.fr/
9
+ Version: 0.7
10
  */
11
 
12
 
13
  /*
14
  Change Log
15
+ 03/10/2013 - Bugs sur les couleurs
16
  11/09/2013 - Conflits javascript résolus
17
  30/08/2013 - CSS personnalisable
18
  27/08/2013 - Ajout du multilangue
33
  $wpmaintenance_dashboard = ( is_admin() ) ? 'options-general.php?page=wp-maintenance/wp-maintenance.php' : '';
34
  define( 'WPM_SETTINGS', $wpmaintenance_dashboard);
35
 
36
+ include("uninstall.php");
37
+
38
  // Add "Réglages" link on plugins page
39
+ add_filter( 'plugin_action_links_' . WPM_BASENAME, 'wpm_plugin_actions' );
40
+ function wpm_plugin_actions ( $links ) {
41
  $settings_link = '<a href="'.WPM_SETTINGS.'">'.__('Settings', 'wp-maintenance').'</a>';
42
  array_unshift ( $links, $settings_link );
43
  return $links;
44
  }
45
 
46
  // multilingue
47
+ add_action( 'init', 'wpm_make_multilang' );
48
+ function wpm_make_multilang() {
49
  load_plugin_textdomain('wp-maintenance', false, dirname( plugin_basename( __FILE__ ) ).'/languages');
50
  }
51
 
52
  /* Ajoute la version dnas les options */
53
+ define('WPM_VERSION', '0.7');
54
  $option['wp_maintenance_version'] = WPM_VERSION;
55
  add_option('wp_maintenance_version',$option);
56
 
57
  //récupère le formulaire d'administration du plugin
58
+ function wpm_admin_panel() {
59
  include("wp-maintenance-admin.php");
60
  }
61
 
62
+ function wpm_add_admin() {
63
+ $hook = add_options_page("Options pour l'affichage de la page maintenance", "WP Maintenance", 10, __FILE__, "wpm_admin_panel");
64
 
65
  $wp_maintenanceAdminOptions = array(
66
  'active' => 0,
74
  foreach ($getMaintenanceSettings as $key => $option) {
75
  $wp_maintenanceAdminOptions[$key] = $option;
76
  }
77
+ }
78
+
79
  update_option('wp_maintenance_settings', $wp_maintenanceAdminOptions);
80
+
81
+ $wp_maintenanceStyles = '
82
+ h1 {
83
+ margin-left:auto;
84
+ margin-right:auto;
85
+ width: 700px;
86
+ padding: 10px;
87
+ text-align:center;
88
+ color: #_COLORTXT;
89
+ }
90
+
91
+ body {
92
+ background: none repeat scroll 0 0 #_COLORBG;
93
+ color: #_COLORTXT;
94
+ font: 12px/1.5em Arial,Helvetica,Sans-serif;
95
+ }
96
+ #header {
97
+ clear: both;
98
+ padding: 20px 0 10px;
99
+ position: relative;
100
+ }
101
+ .full {
102
+ margin: 0 auto;
103
+ width: 720px;
104
+ }
105
+ #logo {
106
+ text-align: center;
107
+ }
108
+ #main {
109
+ padding: 0px 50px;
110
+ }
111
+ #main .block {
112
+ font-size: 13px;
113
+ margin-bottom: 30px;
114
+ }
115
+ #main .block h3 {
116
+ line-height: 60px;
117
+ margin-bottom: 40px;
118
+ text-align: center;
119
+ }
120
+ #main #intro h3 {
121
+ font-size: 40px;
122
+ text-shadow: 0 10px 10px #FFFFFF;
123
+ }
124
+ #main #intro p {
125
+ font-family: Muli,sans-serif;
126
+ font-size: 16px;
127
+ line-height: 22px;
128
+ text-align: center;
129
+ }
130
+
131
+ #maintenance {
132
+ text-align:center;
133
+ margin-top:25px;
134
+ }
135
+
136
+ .cptR-rec_countdown {
137
+ position: relative;
138
+ font-family: "Ubuntu";
139
+ background: #_COLORCPTBG;
140
+ display: inline-block;
141
+ line-height: #_DATESIZE px;
142
+ min-width: 160px;
143
+ min-height: 60px;
144
+ padding: 30px 20px 5px 20px;
145
+ text-shadow: 0 1px 3px rgba(0, 0, 0, 0.5);
146
+ text-transform: uppercase;
147
+ text-align:center;
148
+ }
149
+
150
+ #cptR-day, #cptR-hours, #cptR-minutes, #cptR-seconds {
151
+ color: #_COLORCPT;
152
+ display: block;
153
+ font-size: #_DATESIZE;
154
+ height: 40px;
155
+ line-height: 38px;
156
+ text-align: right;
157
+ text-shadow: 0 1px 3px rgba(0, 0, 0, 0.5);
158
+ float:left;
159
+ }
160
+ #cptR-days-span, #cptR-hours-span, #cptR-minutes-span, #cptR-seconds-span {
161
+ color: #_COLORCPT;
162
+ font-size: 10px;
163
+ padding: 25px 5px 0 2px;
164
+ text-shadow: 0 1px 3px rgba(0, 0, 0, 0.5);
165
  }
166
 
167
+ ';
168
+ update_option('wp_maintenance_style', $wp_maintenanceStyles);
169
+ }
170
+
171
+ function wpm_admin_scripts() {
172
  wp_enqueue_script('media-upload');
173
  wp_enqueue_script('thickbox');
174
  wp_register_script('wpm-my-upload', WP_PLUGIN_URL.'/wp-maintenance/wpm-script.js', array('jquery','media-upload','thickbox'));
175
  wp_enqueue_script('wpm-my-upload');
176
+ wp_register_script('wpm-admin-settings', WP_PLUGIN_URL.'/wp-maintenance/wpm-admin-settings.js');
177
+ wp_enqueue_script('wpm-admin-settings');
178
  }
179
 
180
  add_action( 'admin_enqueue_scripts', 'mw_enqueue_color_picker' );
184
  wp_enqueue_script( 'my-script-handle', plugins_url('wpm-color-options.js', __FILE__ ), array( 'wp-color-picker' ), false, true );
185
  }
186
 
187
+ function wpm_admin_styles() {
188
  wp_enqueue_style('thickbox');
189
  }
 
 
 
 
190
 
191
  if (isset($_GET['page']) && $_GET['page'] == 'wp-maintenance/wp-maintenance.php') {
192
+ add_action('admin_print_scripts', 'wpm_admin_scripts');
193
+ add_action('admin_print_styles', 'wpm_admin_styles');
194
  add_action('admin_print_scripts', 'wpm_admin_scripts');
195
  }
196
 
197
  /* Mode Mainteance */
198
+ function wpm_maintenance_mode() {
199
 
200
  global $current_user;
201
 
240
  "#_DATESIZE" => $paramMMode['date_cpt_size'],
241
  "#_COLORCPT" => $paramMMode['color_cpt']
242
  );
243
+ $wpmStyle = str_replace(array_keys($styleRemplacements), array_values($styleRemplacements), get_option('wp_maintenance_style'));
244
 
245
  $content = '
246
  <!DOCTYPE html>
251
  $content .= '</title>
252
  <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
253
  <meta name="description" content="'.__('This site is down for maintenance', 'wp-maintenance').'" />
254
+ <style type="text/css">'.$wpmStyle.'</style>
255
  </head>
256
  <body><div id="wrapper">
257
  ';
297
  }
298
 
299
  }
300
+ add_action('get_header', 'wpm_maintenance_mode');
301
+
302
+ if(function_exists('register_deactivation_hook')) {
303
+ register_deactivation_hook(__FILE__, 'wpm_uninstall');
304
+ }
305
 
306
  //intègre le tout aux pages Admin de Wordpress
307
+ add_action("admin_menu", "wpm_add_admin");
308
 
309
  ?>
wpm-style.css DELETED
@@ -1,5 +0,0 @@
1
- #wp-admin-bar-wp-maintenance-active {
2
- background-color: #d00;
3
- background-image: -moz-linear-gradient(bottom, #f44, #d00 );
4
- background-image: -webkit-gradient(linear, left bottom, left top, from(#f44), to(#d00));
5
- }