WP Maintenance - Version 0.3

Version Description

Cette version est stable.

=

Download this release

Release Info

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

Code changes from version 0.2 to 0.3

default.png CHANGED
Binary file
readme.txt CHANGED
@@ -3,7 +3,7 @@ Contributors: Florent73
3
  Donate link:
4
  Tags: wordpress maintenance plugin
5
  Requires at least: 2.0
6
- Tested up to: 3.3.1
7
  Stable tag: trunk
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
@@ -12,7 +12,7 @@ License URI: http://www.gnu.org/licenses/gpl-2.0.html
12
  Créer et personnaliser votre page de maintenance !
13
 
14
  == Description ==
15
- 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.
16
 
17
  Langues disponibles :
18
 
@@ -26,8 +26,9 @@ Langues disponibles :
26
  == Screenshots ==
27
  1. Vue générale
28
  2. Vue par les visiteurs de votre site (mais pas les admins)
29
- 3. Sélection de couleur
30
  4. Upload d'une image personnelle
 
31
 
32
  == Frequently Asked Questions ==
33
 
@@ -35,16 +36,19 @@ Ce plugin est-il gratuit ?
35
  Oui tout à fait.
36
 
37
  Puis-je modifier le code du plugin ?
38
- Merci de me soumettre les modifications souhaitées afin de mettre à jour le plugin.
39
 
40
  == Upgrade Notice ==
41
 
42
- = 0.2 =
43
- Cette version est stable. Plus de conflit de nom de fonction. ColorPicker Ajouté.
44
 
45
 
46
  == Changelog ==
47
 
 
 
 
48
  = 0.2 =
49
  * Ajout du ColorPicker.
50
 
3
  Donate link:
4
  Tags: wordpress maintenance plugin
5
  Requires at least: 2.0
6
+ Tested up to: 3.6
7
  Stable tag: trunk
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
12
  Créer et personnaliser votre page de maintenance !
13
 
14
  == Description ==
15
+ 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 avec une image, un compte à rebours.
16
 
17
  Langues disponibles :
18
 
26
  == Screenshots ==
27
  1. Vue générale
28
  2. Vue par les visiteurs de votre site (mais pas les admins)
29
+ 3. Sélection des couleurs
30
  4. Upload d'une image personnelle
31
+ 5. Paramètres du compte à rebours
32
 
33
  == Frequently Asked Questions ==
34
 
36
  Oui tout à fait.
37
 
38
  Puis-je modifier le code du plugin ?
39
+ Oui mais merci de me soumettre les modifications souhaitées afin de mettre à jour le plugin.
40
 
41
  == Upgrade Notice ==
42
 
43
+ = 0.3 =
44
+ Cette version est stable.
45
 
46
 
47
  == Changelog ==
48
 
49
+ = 0.3 =
50
+ * Refonte de l'admin et ajout d'un compte à rebours
51
+
52
  = 0.2 =
53
  * Ajout du ColorPicker.
54
 
screenshot-1.png CHANGED
Binary file
screenshot-2.png CHANGED
Binary file
screenshot-3.png CHANGED
Binary file
screenshot-4.png CHANGED
Binary file
screenshot-5.png CHANGED
Binary file
wp-maintenance-admin.php CHANGED
@@ -1,77 +1,224 @@
1
  <?php
2
 
3
- /* Update si changements */
4
- if($_POST['action'] == 'update') {
5
  update_option('wp_maintenance_settings', $_POST["wp_maintenance_settings"]);
6
  $options_saved = true;
7
  echo '<div id="message" class="updated fade"><p><strong>Options sauvegardées.</strong></p></div>';
8
  }
9
 
 
 
 
 
10
  ?>
 
11
  <div class="wrap">
12
- <div id="icon-themes" class="icon32" ><br></div>
13
- <h2>Paramètres de personnalisation WP Maintenance</h2>
14
- <form method="post" action="" name="valide_maintenance">
15
- <?php settings_fields('wp_maintenance_settings'); ?>
16
- <?php $paramMMode = get_option('wp_maintenance_settings'); ?>
17
-
18
- <div style="margin-left:25px;">
19
- <ul>
20
-
21
- <!-- CHOIX ACTIVATION MAINTENANCE -->
22
- <li><h3>Activer la maintenance :</h3>
23
- <input type= "radio" name="wp_maintenance_settings[active]" value="1" <?php if($paramMMode['active']==1) { echo ' checked'; } ?>>&nbsp;Oui&nbsp;&nbsp;&nbsp;
24
- <input type= "radio" name="wp_maintenance_settings[active]" value="0" <?php if($paramMMode['active']==0) { echo ' checked'; } ?>>&nbsp;Non
25
- </li>
26
- <li> &nbsp;</li>
27
-
28
- <!-- TEXTE PERSONNEL POUR LA PAGE -->
29
- <li><h3>Texte de la page maintenance :</h3>
30
- <TEXTAREA NAME="wp_maintenance_settings[text_maintenance]" COLS=70 ROWS=4><?php echo $paramMMode['text_maintenance'] ?></TEXTAREA>
31
- </li>
32
- <li> &nbsp;</li>
33
-
34
- <!-- COULEUR DU FOND DE PAGE -->
35
- <li><h3>Choix des couleurs :</h3>
36
- <div id="pmColor" style="position: relative;">
37
- <em>Couleur du fond</em> <br /><input type="text" value="<?php echo $paramMMode['color_bg']; ?>" name="wp_maintenance_settings[color_bg]" class="wpm-color-field" data-default-color="#f1f1f1" /> <br />
38
- <em>Couleur du texte</em> <br /><input type="text" value="<?php echo $paramMMode['color_txt']; ?>" name="wp_maintenance_settings[color_txt]" class="wpm-color-field" data-default-color="#888888" />
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
39
  </div>
40
- </li>
41
- <li> &nbsp;</li>
42
-
43
- <!-- UPLOADER UNE IMAGE -->
44
- <li><h3>Uploader une image :</h3>
45
- <?php if($paramMMode['image']) { ?>
46
- Image actuelle : <br /> <img src="<?php echo $paramMMode['image']; ?>" width="300" style="border:1px solid #333;padding:3px;" /><br />
47
- <?php } ?>
48
- <input id="upload_image" size="36" name="wp_maintenance_settings[image]" value="<?php echo $paramMMode['image']; ?>" type="text" /> <a href="#" id="upload_image_button" class="button" OnClick="this.blur();"><span> Sélectionnez / Uploader votre image </span></a>
49
- <br /><small>Entrez une url ou uploader une image.</small>
50
- </li>
51
- <li> &nbsp;</li>
52
-
53
- <!-- UTILISER UNE PAGE MAINTENANCE.PHP -->
54
- <li><h3>Page maintenance du thème :</h3>
55
- <small>Si ce paramètre est sur Oui, c'est la page maintenance.php de votre thème qui sera affichée</small> &nbsp;<br /><br />
56
- <input type= "radio" name="wp_maintenance_settings[pageperso]" value="1" <?php if($paramMMode['pageperso']==1) { echo ' checked'; } ?>>&nbsp;Oui&nbsp;&nbsp;&nbsp;
57
- <input type= "radio" name="wp_maintenance_settings[pageperso]" value="0" <?php if(!$paramMMode['pageperso'] or $paramMMode['pageperso']==0) { echo ' checked'; } ?>>&nbsp;Non
58
- </li>
59
-
60
- <li> &nbsp;</li>
61
- <li> &nbsp;</li>
62
- <li><a href="#" id="submitbutton" OnClick="document.forms['valide_maintenance'].submit();this.blur();" name="Save" class="button-primary"><span> Sauvegarder les Options </span></a></li>
63
- </ul>
64
- </div>
65
- </form>
66
- <!-- FAIRE UN DON SUR PAYPAL -->
67
- <div style="border:1px solid #F1F1F1;text-align: center;background-color:#F1F1F1;padding: 15px;">Si vous souhaitez me soutenir pour les développements actuels et futurs :
68
- <form action="https://www.paypal.com/cgi-bin/webscr" method="post">
69
- <input type="hidden" name="cmd" value="_s-xclick">
70
- <input type="hidden" name="hosted_button_id" value="ABGJLUXM5VP58">
71
- <input type="image" src="https://www.paypalobjects.com/fr_FR/FR/i/btn/btn_donate_SM.gif" border="0" name="submit" alt="PayPal - la solution de paiement en ligne la plus simple et la plus sécurisée !">
72
- <img alt="" border="0" src="https://www.paypalobjects.com/fr_FR/i/scr/pixel.gif" width="1" height="1">
73
- </form>
74
- </div>
75
- <!-- FIN FAIRE UN DON -->
76
- </div>
77
 
1
  <?php
2
 
3
+ /* Update des paramètres */
4
+ if($_POST['action'] == 'update' && $_POST["wp_maintenance_settings"]!='') {
5
  update_option('wp_maintenance_settings', $_POST["wp_maintenance_settings"]);
6
  $options_saved = true;
7
  echo '<div id="message" class="updated fade"><p><strong>Options sauvegardées.</strong></p></div>';
8
  }
9
 
10
+ // Récupère les paramètres sauvegardés
11
+ if(get_option('wp_maintenance_settings')) { extract(get_option('wp_maintenance_settings')); }
12
+ $paramMMode = get_option('wp_maintenance_settings');
13
+
14
  ?>
15
+ <style type="text/css">.postbox h3 { cursor:pointer; }</style>
16
  <div class="wrap">
17
+
18
+ <!-- TABS OPTIONS -->
19
+ <div id="icon-options-general" class="icon32"><br></div>
20
+ <h2 class="nav-tab-wrapper">
21
+ <a id="wpm-menu-general" class="nav-tab nav-tab-active" href="#general" onfocus="this.blur();">Général</a>
22
+ <a id="wpm-menu-couleurs" class="nav-tab" href="#couleurs" onfocus="this.blur();">Couleurs</a>
23
+ <a id="wpm-menu-image" class="nav-tab" href="#image" onfocus="this.blur();">Image</a>
24
+ <a id="wpm-menu-compte" class="nav-tab" href="#compte" onfocus="this.blur();">Compte à rebours</a>
25
+ <a id="wpm-menu-options" class="nav-tab" href="#options" onfocus="this.blur();">Options</a>
26
+ <a id="wpm-menu-apropos" class="nav-tab" href="#apropos" onfocus="this.blur();">A propos</a>
27
+ </h2>
28
+
29
+
30
+ <div style="margin-left:25px;margin-top: 15px;">
31
+ <form method="post" action="" name="valide_maintenance">
32
+ <input type="hidden" name="action" value="update" />
33
+
34
+ <!-- GENERAL -->
35
+ <div class="wpm-menu-general wpm-menu-group">
36
+ <div id="wpm-opt-general" >
37
+ <ul>
38
+ <!-- CHOIX ACTIVATION MAINTENANCE -->
39
+ <li>
40
+ <h3>Activer la maintenance :</h3>
41
+ <input type= "radio" name="wp_maintenance_settings[active]" value="1" <?php if($paramMMode['active']==1) { echo ' checked'; } ?>>&nbsp;Oui&nbsp;&nbsp;&nbsp;
42
+ <input type= "radio" name="wp_maintenance_settings[active]" value="0" <?php if($paramMMode['active']==0) { echo ' checked'; } ?>>&nbsp;Non
43
+ </li>
44
+ <!-- TEXTE PERSONNEL POUR LA PAGE -->
45
+ <li>
46
+ <h3>Titre et Texte de la page maintenance :</h3>
47
+ Titre : <br /><input type="text" name="wp_maintenance_settings[titre_maintenance]" value="<?php echo $paramMMode['titre_maintenance'] ?>" /><br />
48
+ Texte :<br /><TEXTAREA NAME="wp_maintenance_settings[text_maintenance]" COLS=70 ROWS=4><?php echo $paramMMode['text_maintenance'] ?></TEXTAREA>
49
+ </li>
50
+ <li> &nbsp;</li>
51
+
52
+ <li>
53
+ <a href="#general" id="submitbutton" OnClick="document.forms['valide_maintenance'].submit();this.blur();" name="Save" class="button-primary"><span> Sauvegarder ces paramètres </span></a>
54
+ </li>
55
+ </ul>
56
+ </div>
57
+ </div>
58
+ <!-- fin options 1 -->
59
+
60
+
61
+ <!-- Couleurs -->
62
+ <div class="wpm-menu-couleurs wpm-menu-group" style="display: none;">
63
+ <div id="wpm-opt-couleurs" >
64
+ <ul>
65
+ <!-- COULEUR DU FOND DE PAGE -->
66
+ <li><h3>Choix des couleurs des textes :</h3>
67
+ <div id="pmColor" style="position: relative;">
68
+ <em>Couleur du fond</em> <br /><input type="text" value="<?php echo $paramMMode['color_bg']; ?>" name="wp_maintenance_settings[color_bg]" class="wpm-color-field" data-default-color="#f1f1f1" /> <br />
69
+ <em>Couleur du texte</em> <br /><input type="text" value="<?php echo $paramMMode['color_txt']; ?>" name="wp_maintenance_settings[color_txt]" class="wpm-color-field" data-default-color="#888888" /> <br /> <br />
70
+ <h3>Choix des couleurs du compte à rebours :</h3>
71
+ <em>Couleur du texte du compteur</em> <br /><input type="text" value="<?php echo $paramMMode['color_cpt']; ?>" name="wp_maintenance_settings[color_cpt]" class="wpm-color-field" data-default-color="#FFFFFF" />
72
+ <br />
73
+ <em>Couleur du fond du compteur</em> <br /><input type="text" value="<?php echo $paramMMode['color_cpt_bg']; ?>" name="wp_maintenance_settings[color_cpt_bg]" class="wpm-color-field" data-default-color="#888888" />
74
+ </div>
75
+ </li>
76
+ <li> &nbsp;</li>
77
+
78
+ <li>
79
+ <a href="#couleurs" id="submitbutton" OnClick="document.forms['valide_maintenance'].submit();this.blur();" name="Save" class="button-primary"><span> Sauvegarder ces paramètres </span></a>
80
+ </li>
81
+ </ul>
82
+ </div>
83
+ </div>
84
+ <!-- fin options 2 -->
85
+
86
+ <!-- Onglet options 3 -->
87
+ <div class="wpm-menu-image wpm-menu-group" style="display: none;">
88
+ <div id="wpm-opt-image" >
89
+ <ul>
90
+ <!-- UPLOADER UNE IMAGE -->
91
+ <li><h3>Uploader une image :</h3>
92
+ <?php if($paramMMode['image']) { ?>
93
+ Image actuelle : <br /> <img src="<?php echo $paramMMode['image']; ?>" width="300" style="border:1px solid #333;padding:3px;" /><br />
94
+ <?php } ?>
95
+ <input id="upload_image" size="36" name="wp_maintenance_settings[image]" value="<?php echo $paramMMode['image']; ?>" type="text" /> <a href="#" id="upload_image_button" class="button" OnClick="this.blur();"><span> Sélectionnez / Uploader votre image </span></a>
96
+ <br /><small>Entrez une url ou uploader une image.</small>
97
+ </li>
98
+ <li> &nbsp;</li>
99
+
100
+ <li>
101
+ <a href="#image" id="submitbutton" OnClick="document.forms['valide_maintenance'].submit();this.blur();" name="Save" class="button-primary"><span> Sauvegarder ces paramètres </span></a>
102
+ </li>
103
+ </ul>
104
+ </div>
105
+ </div>
106
+ <!-- fin options 3 -->
107
+
108
+ <!-- Onglet options 4 -->
109
+ <div class="wpm-menu-compte wpm-menu-group" style="display: none;">
110
+ <div id="wpm-opt-compte" >
111
+ <ul>
112
+ <!-- ACTIVER COMPTEUR -->
113
+ <li><h3>Afficher un compte à rebours ?</h3>
114
+ <input type= "checkbox" name="wp_maintenance_settings[active_cpt]" value="1" <?php if($paramMMode['active_cpt']==1) { echo ' checked'; } ?>>&nbsp;Oui<br /><br />
115
+ <small>Entrez la date de lancement</small><br /> <input type="text" name="wp_maintenance_settings[date_cpt_jj]" value="<?php if($paramMMode['date_cpt_jj']!='') { echo $paramMMode['date_cpt_jj']; } else { echo date('d'); } ?>" size="2" maxlength="2" autocomplete="off" />&nbsp;
116
+ <select name=wp_maintenance_settings[date_cpt_mm]">
117
+ <?php
118
+ $ctpDate = array(
119
+ '01 '=> 'jan',
120
+ '02' => 'fév',
121
+ '03' => 'mar',
122
+ '04' => 'avr',
123
+ '05' => 'mai',
124
+ '06' => 'juin',
125
+ '07' => 'juil',
126
+ '08' => 'août',
127
+ '09' => 'sept',
128
+ '10' => 'oct',
129
+ '11' => 'nov',
130
+ '12' => 'déc'
131
+ );
132
+ foreach($ctpDate as $a => $b) {
133
+ if($paramMMode['date_cpt_mm']=='' && $a==date('m')) {
134
+ $addSelected = 'selected';
135
+ } elseif($paramMMode['date_cpt_mm']!='' && $paramMMode['date_cpt_mm']==$a) {
136
+ $addSelected = 'selected';
137
+ } else {
138
+ $addSelected = '';
139
+ }
140
+ echo '<option value="'.$a.'" '.$addSelected.'>'.$a.' - '.$b.'</option>';
141
+ }
142
+ ?>
143
+ </select>&nbsp;
144
+ <input type="text" name="wp_maintenance_settings[date_cpt_aa]" value="<?php if($paramMMode['date_cpt_aa']!='') { echo $paramMMode['date_cpt_aa']; } else { echo date('Y'); } ?>" size="4" maxlength="4" autocomplete="off" />&nbsp;à&nbsp;
145
+ <input type="text" name="wp_maintenance_settings[date_cpt_hh]" value="<?php if($paramMMode['date_cpt_hh']!='') { echo $paramMMode['date_cpt_hh']; } else { echo date('H'); } ?>" size="2" maxlength="2" autocomplete="off" />&nbsp;h&nbsp;<input type="text" name="wp_maintenance_settings[date_cpt_mn]" value="<?php if($paramMMode['date_cpt_mn']!='') { echo $paramMMode['date_cpt_mn']; } else { echo date('i'); } ?>" size="2" maxlength="2" autocomplete="off" />&nbsp;min&nbsp;
146
+ <input type="hidden" name=wp_maintenance_settings[date_cpt_ss]" value="<?php if($paramMMode['date_cpt_ss']!='') { echo $paramMMode['date_cpt_ss']; } else { echo date('s'); } ?>" />
147
+ <br /><br />
148
+ <input type= "checkbox" name="wp_maintenance_settings[active_cpt_s]" value="1" <?php if($paramMMode['active_cpt_s']==1) { echo ' checked'; } ?>>&nbsp;Afficher les secondes ?<br /><br />
149
+ Message de fin : <br /><TEXTAREA NAME="wp_maintenance_settings[message_cpt_fin]" COLS=70 ROWS=4><?php echo $paramMMode['message_cpt_fin'] ?></TEXTAREA><br />Taille de la police : <select name=wp_maintenance_settings[date_cpt_size]">
150
+ <?php
151
+ $ctpSize = array('18', '24', '36', '48', '52', '56', '60', '64', '68', '72', '76');
152
+ foreach($ctpSize as $c) {
153
+ if($paramMMode['date_cpt_size']==$c) {
154
+ $addsizeSelected = 'selected';
155
+ } else {
156
+ $addsizeSelected = '';
157
+ }
158
+ echo '<option value="'.$c.'" '.$addsizeSelected.'>'.$c.'px</option>';
159
+ }
160
+ ?>
161
+ </select>
162
+ </li>
163
+ <li> &nbsp;</li>
164
+ <li>
165
+ <a href="#4" id="submitbutton" OnClick="document.forms['valide_maintenance'].submit();this.blur();" name="Save" class="button-primary"><span> Sauvegarder ces paramètres </span></a>
166
+ </li>
167
+ </ul>
168
+ </div>
169
+ </div>
170
+ <!-- fin options 4 -->
171
+
172
+ <!-- Onglet options 5 -->
173
+ <div class="wpm-menu-options wpm-menu-group" style="display: none;">
174
+ <div id="wpm-opt-options" >
175
+ <ul>
176
+ <!-- UTILISER UNE PAGE MAINTENANCE.PHP -->
177
+ <li><h3>Page maintenance du thème :</h3>
178
+ Si ce paramètre est sur Oui, c'est la page maintenance.php de votre thème qui sera affichée&nbsp;<br /><br />
179
+ <input type= "radio" name="wp_maintenance_settings[pageperso]" value="1" <?php if($paramMMode['pageperso']==1) { echo ' checked'; } ?>>&nbsp;Oui&nbsp;&nbsp;&nbsp;
180
+ <input type= "radio" name="wp_maintenance_settings[pageperso]" value="0" <?php if(!$paramMMode['pageperso'] or $paramMMode['pageperso']==0) { echo ' checked'; } ?>>&nbsp;Non
181
+ </li>
182
+ <li> &nbsp;</li>
183
+
184
+ <li>
185
+ <a href="#options" id="submitbutton" OnClick="document.forms['valide_maintenance'].submit();this.blur();" name="Save" class="button-primary"><span> Sauvegarder ces paramètres </span></a>
186
+ </li>
187
+ </ul>
188
+ </div>
189
+ </div>
190
+ <!-- fin options 5 -->
191
+
192
+ </form>
193
+
194
+ <!-- Onglet options 6 -->
195
+ <div class="wpm-menu-apropos wpm-menu-group" style="display: none;">
196
+ <div id="wpm-opt-apropos" >
197
+ <ul>
198
+ <li>
199
+ Ce plugin a été développé gratuitement pour vous par <a href="http://www.restezconnectes.fr" target="_blank">Florent Maillefaud</a>. Il est libre de droits, vous pouvez le prendre, le modifier, le distribuer comme bon vous semble.<br /><br />
200
+ Il serait néanmoins souhaitable que je puisse avoir des retours sur vos éventuelles modifications afin d'améliorer ce plugin pour tous.
201
+ </li>
202
+ <li> &nbsp;</li>
203
+ <li>
204
+ <!-- FAIRE UN DON SUR PAYPAL -->
205
+ <div>Si vous souhaitez me soutenir pour mes développements actuels et futurs :<br />
206
+ <form action="https://www.paypal.com/cgi-bin/webscr" method="post" target="_blank">
207
+ <input type="hidden" name="cmd" value="_s-xclick">
208
+ <input type="hidden" name="hosted_button_id" value="ABGJLUXM5VP58">
209
+ <input type="image" src="https://www.paypalobjects.com/fr_FR/FR/i/btn/btn_donate_SM.gif" border="0" name="submit" alt="PayPal - la solution de paiement en ligne la plus simple et la plus sécurisée !">
210
+ <img alt="" border="0" src="https://www.paypalobjects.com/fr_FR/i/scr/pixel.gif" width="1" height="1">
211
+ </form>
212
+ </div>
213
+ <!-- FIN FAIRE UN DON -->
214
+ </li>
215
+ <li> &nbsp;</li>
216
+ </ul>
217
  </div>
218
+ </div>
219
+ <!-- fin options 6 -->
220
+
221
+ </div><!-- -->
222
+
223
+ </div><!-- wrap -->
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
224
 
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.2
10
  */
11
 
12
 
13
  /*
14
  Change Log
 
15
  16/02/2013 - Ajout ColorPicker
16
  12/02/2013 - Ajout fonctionnalité et débugage
17
  11/02/2013 - Modification nom de fonctions
@@ -82,6 +83,11 @@ function mw_enqueue_color_picker( $hook_suffix ) {
82
  function WpMaintenanceAdminStyles() {
83
  wp_enqueue_style('thickbox');
84
  }
 
 
 
 
 
85
 
86
  if (isset($_GET['page']) && $_GET['page'] == 'wp-maintenance/wp-maintenance.php') {
87
  add_action('admin_print_scripts', 'WpMaintenanceAdminScripts');
@@ -122,6 +128,11 @@ function maintenance_mode() {
122
  $img_width = 300;
123
  if($paramMMode['image']=="") { $paramMMode['image'] = WP_PLUGIN_URL.'/wp-maintenance/default.png'; $img_width = 256;}
124
 
 
 
 
 
 
125
  $content = '
126
  <!DOCTYPE html>
127
  <html lang="fr">
@@ -132,18 +143,120 @@ function maintenance_mode() {
132
  <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
133
  <meta name="description" content="Site en maintenance" />
134
  <style type="text/css">
135
- h1 { margin:auto;width: 700px;padding: 10px;text-align:center;color:'.$paramMMode['color_txt'].'; }
136
- body { background: '.$paramMMode['color_bg'].';line-height: 5; }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
137
  #maintenance { text-align:center; margin-top:25px;}
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
138
  </style>
139
  </head>
140
- <body>';
141
- if($paramMMode['image']) {
142
- $content .= '<div id="maintenance"><img src="'.$paramMMode['image'].'" width="'.$img_width.'px" /></div>';
143
- }
144
- $content .= '<h1>'.$paramMMode['text_maintenance'].'</h1>
145
- </body>
146
- </html>';
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
147
  }
148
  die($content);
149
  }
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.3
10
  */
11
 
12
 
13
  /*
14
  Change Log
15
+ 23/08/2013 - Refonte de l'admin et ajout d'un compte à rebours
16
  16/02/2013 - Ajout ColorPicker
17
  12/02/2013 - Ajout fonctionnalité et débugage
18
  11/02/2013 - Modification nom de fonctions
83
  function WpMaintenanceAdminStyles() {
84
  wp_enqueue_style('thickbox');
85
  }
86
+ function wpm_admin_scripts() {
87
+ wp_register_script('wpm-admin-settings', WP_PLUGIN_URL.'/wp-maintenance/wpm-admin-settings.js');
88
+ wp_enqueue_script('wpm-admin-settings');
89
+ }
90
+ add_action('admin_print_scripts', 'wpm_admin_scripts');
91
 
92
  if (isset($_GET['page']) && $_GET['page'] == 'wp-maintenance/wp-maintenance.php') {
93
  add_action('admin_print_scripts', 'WpMaintenanceAdminScripts');
128
  $img_width = 300;
129
  if($paramMMode['image']=="") { $paramMMode['image'] = WP_PLUGIN_URL.'/wp-maintenance/default.png'; $img_width = 256;}
130
 
131
+ /* Date compte à rebours / Convertie en format US */
132
+ $timestamp = strtotime($paramMMode['date_cpt_aa'].'/'.$paramMMode['date_cpt_mm'].'/'.$paramMMode['date_cpt_jj'].' '.$paramMMode['date_cpt_hh'].':'.$paramMMode['date_cpt_mn']);
133
+ $dateCpt = date('m/d/Y h:i A', $timestamp);
134
+
135
+
136
  $content = '
137
  <!DOCTYPE html>
138
  <html lang="fr">
143
  <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
144
  <meta name="description" content="Site en maintenance" />
145
  <style type="text/css">
146
+ h1 { margin-left:auto;margin-right:auto;width: 700px;padding: 10px;text-align:center;color:'.$paramMMode['color_txt'].'; }
147
+ body {
148
+ background: none repeat scroll 0 0 '.$paramMMode['color_bg'].';
149
+ color: '.$paramMMode['color_txt'].';
150
+ font: 12px/1.5em Arial,Helvetica,Sans-serif;
151
+ }
152
+ #header {
153
+ clear: both;
154
+ padding: 20px 0 10px;
155
+ position: relative;
156
+ }
157
+ .full {
158
+ margin: 0 auto;
159
+ width: 720px;
160
+ }
161
+ #logo {
162
+ text-align: center;
163
+ }
164
+ #main {
165
+ padding: 0px 50px;
166
+ }
167
+ #main .block {
168
+ font-size: 13px;
169
+ margin-bottom: 30px;
170
+ }
171
+ #main .block h3 {
172
+ line-height: 60px;
173
+ margin-bottom: 40px;
174
+ text-align: center;
175
+ }
176
+ #main #intro h3 {
177
+ font-size: 40px;
178
+ text-shadow: 0 10px 10px #FFFFFF;
179
+ }
180
+ #main #intro p {
181
+ font-family: Muli,sans-serif;
182
+ font-size: 16px;
183
+ line-height: 22px;
184
+ text-align: center;
185
+ }
186
+
187
  #maintenance { text-align:center; margin-top:25px;}
188
+ .cptR-rec_countdown {
189
+ position: relative;
190
+ font-family: "Ubuntu";
191
+ background:'.$paramMMode['color_cpt_bg'].';
192
+ display: inline-block;
193
+ line-height:'.$paramMMode['date_cpt_size'].'px;
194
+ min-width: 160px;
195
+ min-height: 60px;
196
+ padding: 30px 20px 5px 20px;
197
+ text-shadow: 0 1px 3px rgba(0, 0, 0, 0.5);
198
+ text-transform: uppercase;
199
+ text-align:center;
200
+ }
201
+
202
+ #cptR-day, #cptR-hours, #cptR-minutes, #cptR-seconds {
203
+ color: '.$paramMMode['color_cpt'].';
204
+ display: block;
205
+ font-size: '.$paramMMode['date_cpt_size'].';
206
+ height: 40px;
207
+ line-height: 38px;
208
+ text-align: right;
209
+ text-shadow: 0 1px 3px rgba(0, 0, 0, 0.5);
210
+ float:left;
211
+ }
212
+ #cptR-days-span, #cptR-hours-span, #cptR-minutes-span, #cptR-seconds-span {
213
+ color: '.$paramMMode['color_cpt'].';
214
+ font-size: 10px;
215
+ padding: 25px 5px 0 2px;
216
+ text-shadow: 0 1px 3px rgba(0, 0, 0, 0.5);
217
+ }
218
+
219
  </style>
220
  </head>
221
+ <body><div id="wrapper">
222
+ ';
223
+
224
+ if($paramMMode['image']) {
225
+ $content .= '<div id="header" class="full">
226
+ <div id="logo"><img src="'.$paramMMode['image'].'" width="'.$img_width.'px" /></div>
227
+ </div>
228
+ ';
229
+ }
230
+ $content .= '<div id="content" class="full"><div id="main">';
231
+ $content .= '<div id="intro" class="block"><h3>'.$paramMMode['titre_maintenance'].'</h3><p>'.$paramMMode['text_maintenance'].'</p></div>';
232
+ if( isset($paramMMode['message_cpt_fin']) && $paramMMode['message_cpt_fin']!='' && $paramMMode['date_cpt_aa']!='' && $paramMMode['active_cpt']==1) {
233
+ $content .='
234
+ <div style="margin-left:auto;margin-right:auto;text-align: center;margin-top:30px;">
235
+ <script language="JavaScript">
236
+ TargetDate = "'.$dateCpt.'";
237
+ BackColor = "'.$paramMMode['color_cpt_bg'].'";
238
+ FontSize = "'.$paramMMode['date_cpt_size'].'";
239
+ ForeColor = "'.$paramMMode['color_cpt'].'";
240
+ CountActive = true;
241
+ CountStepper = -1;
242
+ LeadingZero = true;
243
+ ';
244
+ $content .= " DisplayFormat = '<div id=\"cptR-day\">%%D%%<span id=\"cptR-days-span\">Jours</span></div><div id=\"cptR-hours\">%%H%%<span id=\"cptR-hours-span\">Heures</span></div><div id=\"cptR-minutes\">%%M%%<span id=\"cptR-minutes-span\">Minutes</span></div>";
245
+ if($paramMMode['active_cpt_s']==1) {
246
+ $content .= '<div id="cptR-seconds">%%S%%<span id="cptR-seconds-span">Secondes</span></div>';
247
+ }
248
+ $content .= "';
249
+ FinishMessage = '".$paramMMode['message_cpt_fin']."';
250
+ </script>";
251
+ $content .= '<script language="JavaScript" src="'.WP_PLUGIN_URL.'/wp-maintenance/wpm-cpt-script.js"></script>
252
+ </div>';
253
+ }
254
+ $content .= '
255
+ </div><!-- div main -->
256
+ </div><!-- div content -->
257
+ </div><!-- div wrapper -->
258
+ </body>
259
+ </html>';
260
  }
261
  die($content);
262
  }
wpm-admin-settings.js ADDED
@@ -0,0 +1,30 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ jQuery(document).ready(function($){
2
+
3
+ //Navigation Tabs
4
+ $('.nav-tab-wrapper .nav-tab').click(function(){
5
+ $('.nav-tab-wrapper .nav-tab').removeClass('nav-tab-active');
6
+ el = $(this);
7
+ elid = el.attr('id');
8
+ $('.wpm-menu-group').hide();
9
+ $('.'+elid).show();
10
+ el.addClass('nav-tab-active');
11
+ });
12
+ var navUrl = document.location.toString();
13
+ if (navUrl.match('#')) { //anchor-based navigation
14
+ var nav_tab = navUrl.split('#')[1].split(':');
15
+ var current_tab = 'a#wpm-menu-' + nav_tab[0];
16
+ $(current_tab).trigger('click');
17
+ if( nav_tab.length > 1 ){
18
+ section = $("#wpm-opt-"+nav_tab[1]);
19
+ if( section.length > 0 ){
20
+ section.children('h3').trigger('click');
21
+ //$('html, body').animate({ scrollTop: section.offset().top - 30 }); //sends user back to top of form
22
+ }
23
+ }
24
+ }else{
25
+ //set to general tab by default, so we can also add clicked subsections
26
+ document.location = navUrl+"#general";
27
+ }
28
+ $('.nav-tab-link').click(function(){ $($(this).attr('rel')).trigger('click'); }); //links to mimick tabs
29
+
30
+ });
wpm-cpt-script.js ADDED
@@ -0,0 +1,81 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*
2
+ Author: Robert Hashemian
3
+ http://www.hashemian.com/
4
+
5
+ You can use this code in any manner so long as the author's
6
+ name, Web address and this disclaimer is kept intact.
7
+ ********************************************************
8
+ Usage Sample:
9
+
10
+ <script language="JavaScript">
11
+ TargetDate = "12/31/2020 5:00 AM";
12
+ BackColor = "palegreen";
13
+ ForeColor = "navy";
14
+ CountActive = true;
15
+ CountStepper = -1;
16
+ LeadingZero = true;
17
+ DisplayFormat = "%%D%% Days, %%H%% Hours, %%M%% Minutes, %%S%% Seconds.";
18
+ FinishMessage = "It is finally here!";
19
+ </script>
20
+ <script language="JavaScript" src="http://scripts.hashemian.com/js/countdown.js"></script>
21
+ */
22
+
23
+ function calcage(secs, num1, num2) {
24
+ s = ((Math.floor(secs/num1))%num2).toString();
25
+ if (LeadingZero && s.length < 2)
26
+ s = "0" + s;
27
+ return "<b>" + s + "</b>";
28
+ }
29
+
30
+ function CountBack(secs) {
31
+ if (secs < 0) {
32
+ document.getElementById("cntdwn").innerHTML = FinishMessage;
33
+ return;
34
+ }
35
+ DisplayStr = DisplayFormat.replace(/%%D%%/g, calcage(secs,86400,100000));
36
+ DisplayStr = DisplayStr.replace(/%%H%%/g, calcage(secs,3600,24));
37
+ DisplayStr = DisplayStr.replace(/%%M%%/g, calcage(secs,60,60));
38
+ DisplayStr = DisplayStr.replace(/%%S%%/g, calcage(secs,1,60));
39
+
40
+ document.getElementById("cntdwn").innerHTML = DisplayStr;
41
+ if (CountActive)
42
+ setTimeout("CountBack(" + (secs+CountStepper) + ")", SetTimeOutPeriod);
43
+ }
44
+
45
+ function putspan(BackColor, ForeColor) {
46
+ document.write("<div class='cptR-rec_countdown'><span id='cntdwn' style='background-color:" + BackColor + "; color:" + ForeColor + ";font-size:" + FontSize + "px;'></span></div>");
47
+ }
48
+
49
+ if (typeof(BackColor)=="undefined")
50
+ BackColor = "";
51
+ if (typeof(ForeColor)=="undefined")
52
+ ForeColor= "black";
53
+ if (typeof(FontSize)=="undefined")
54
+ FontSize= "78";
55
+ if (typeof(TargetDate)=="undefined")
56
+ TargetDate = "12/31/2020 5:00 AM";
57
+ if (typeof(DisplayFormat)=="undefined")
58
+ DisplayFormat = "%%D%% Days, %%H%% Hours, %%M%% Minutes, %%S%% Seconds.";
59
+ if (typeof(CountActive)=="undefined")
60
+ CountActive = true;
61
+ if (typeof(FinishMessage)=="undefined")
62
+ FinishMessage = "";
63
+ if (typeof(CountStepper)!="number")
64
+ CountStepper = -1;
65
+ if (typeof(LeadingZero)=="undefined")
66
+ LeadingZero = true;
67
+
68
+
69
+ CountStepper = Math.ceil(CountStepper);
70
+ if (CountStepper == 0)
71
+ CountActive = false;
72
+ var SetTimeOutPeriod = (Math.abs(CountStepper)-1)*1000 + 990;
73
+ putspan(BackColor, ForeColor, FontSize);
74
+ var dthen = new Date(TargetDate);
75
+ var dnow = new Date();
76
+ if(CountStepper>0)
77
+ ddiff = new Date(dnow-dthen);
78
+ else
79
+ ddiff = new Date(dthen-dnow);
80
+ gsecs = Math.floor(ddiff.valueOf()/1000);
81
+ CountBack(gsecs);
wpm-script.js CHANGED
@@ -11,5 +11,5 @@ jQuery(document).ready(function() {
11
  jQuery('#upload_image').val(imgurl);
12
  tb_remove();
13
  }
14
-
15
  });
 
11
  jQuery('#upload_image').val(imgurl);
12
  tb_remove();
13
  }
 
14
  });
15
+