Version Description
= 0.2 = Cette version est stable. Plus de conflit de nom de fonction. ColorPicker Ajout.
Download this release
Release Info
Developer | Florent73 |
Plugin | WP Maintenance |
Version | 0.1 |
Comparing to | |
See all releases |
Version 0.1
- default.png +0 -0
- readme.txt +54 -0
- screenshot-1.png +0 -0
- screenshot-2.png +0 -0
- screenshot-3.png +0 -0
- screenshot-4.png +0 -0
- wp-maintenance-admin.php +67 -0
- wp-maintenance.php +157 -0
- wpm-color-options.js +18 -0
- wpm-script.js +15 -0
default.png
ADDED
Binary file
|
readme.txt
ADDED
@@ -0,0 +1,54 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
=== Plugin Name ===
|
2 |
+
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
|
10 |
+
|
11 |
+
|
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 |
+
|
19 |
+
* Français
|
20 |
+
|
21 |
+
== Installation ==
|
22 |
+
1. Ajouter le répertoire 'wp-maintenance' dans le répertoire '/wp-content/plugins/'.
|
23 |
+
1. Activer le plugin via le menu 'Plugins' dans WordPress.
|
24 |
+
1. Aller dans 'Réglages->WP Maintenance' dans l'interface d'administration pour sélectionner vos options.
|
25 |
+
|
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 |
+
|
34 |
+
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 ColorPiker.
|
50 |
+
|
51 |
+
= 0.1 =
|
52 |
+
* Première version du plugin.
|
53 |
+
|
54 |
+
|
screenshot-1.png
ADDED
Binary file
|
screenshot-2.png
ADDED
Binary file
|
screenshot-3.png
ADDED
Binary file
|
screenshot-4.png
ADDED
Binary file
|
wp-maintenance-admin.php
ADDED
@@ -0,0 +1,67 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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'; } ?>> Oui
|
24 |
+
<input type= "radio" name="wp_maintenance_settings[active]" value="0" <?php if($paramMMode['active']==0) { echo ' checked'; } ?>> Non
|
25 |
+
</li>
|
26 |
+
<li> </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> </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> </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> </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> <br /><br />
|
56 |
+
<input type= "radio" name="wp_maintenance_settings[pageperso]" value="1" <?php if($paramMMode['pageperso']==1) { echo ' checked'; } ?>> Oui
|
57 |
+
<input type= "radio" name="wp_maintenance_settings[pageperso]" value="0" <?php if(!$paramMMode['pageperso'] or $paramMMode['pageperso']==0) { echo ' checked'; } ?>> Non
|
58 |
+
</li>
|
59 |
+
|
60 |
+
<li> </li>
|
61 |
+
<li> </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 |
+
</div>
|
67 |
+
|
wp-maintenance.php
ADDED
@@ -0,0 +1,157 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/*
|
4 |
+
Plugin Name: WP Maintenance
|
5 |
+
Plugin URI: http://www.restezconnectes.fr/plugins/wp-maintenance.zip
|
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.1
|
10 |
+
*/
|
11 |
+
|
12 |
+
|
13 |
+
/*
|
14 |
+
Change Log
|
15 |
+
12/02/2013 - Ajout fonctionnalité et débugage
|
16 |
+
11/02/2013 - Modification nom de fonctions
|
17 |
+
24/01/2013 - Création du Plugin
|
18 |
+
*/
|
19 |
+
|
20 |
+
if(!defined('WP_CONTENT_URL')) { define('WP_CONTENT_URL', get_option( 'siteurl') . '/wp-content'); }
|
21 |
+
if(!defined('WP_CONTENT_DIR')) { define('WP_CONTENT_DIR', ABSPATH . 'wp-content'); }
|
22 |
+
if(!defined('WP_PLUGIN_URL')) { define('WP_PLUGIN_URL', WP_CONTENT_URL.'/plugins'); }
|
23 |
+
if(!defined('WP_PLUGIN_DIR')) { define('WP_PLUGIN_DIR', WP_CONTENT_DIR.'/plugins'); }
|
24 |
+
if(!defined( 'WPM_BASENAME')) { define( 'WPM_BASENAME', plugin_basename(__FILE__) ); }
|
25 |
+
|
26 |
+
/* Ajout réglages au plugin */
|
27 |
+
$wpmaintenance_dashboard = ( is_admin() ) ? 'options-general.php?page=wp-maintenance/wp-maintenance.php' : '';
|
28 |
+
define( 'WPM_SETTINGS', $wpmaintenance_dashboard);
|
29 |
+
|
30 |
+
// Add "Réglages" link on plugins page
|
31 |
+
add_filter( 'plugin_action_links_' . WPM_BASENAME, 'WpMaintenancePlugin_actions' );
|
32 |
+
function WpMaintenancePlugin_actions ( $links ) {
|
33 |
+
$settings_link = '<a href="'.WPM_SETTINGS.'">'.__('Réglages', 'wp-maintenance').'</a>';
|
34 |
+
array_unshift ( $links, $settings_link );
|
35 |
+
return $links;
|
36 |
+
}
|
37 |
+
|
38 |
+
/* Ajoute la version dnas les options */
|
39 |
+
define('WPM_VERSION', '0.1');
|
40 |
+
$option['wp_maintenance_version'] = WPM_VERSION;
|
41 |
+
add_option('wp_maintenance_version',$option);
|
42 |
+
|
43 |
+
//récupère le formulaire d'administration du plugin
|
44 |
+
function adminWpMaintenancePanel() {
|
45 |
+
include("wp-maintenance-admin.php");
|
46 |
+
}
|
47 |
+
|
48 |
+
function addWpMaintenanceAdmin() {
|
49 |
+
$hook = add_options_page("Options pour l'affichage de la page maintenance", "WP Maintenance", 10, __FILE__, "adminWpMaintenancePanel");
|
50 |
+
|
51 |
+
$wp_maintenanceAdminOptions = array(
|
52 |
+
'active' => 0,
|
53 |
+
'color_bg' => "#f1f1f1",
|
54 |
+
'color_txt' => '#888888',
|
55 |
+
'text_maintenance' => 'Ce site est en maintenance',
|
56 |
+
'image' => WP_PLUGIN_URL.'/wp-maintenance/default.png',
|
57 |
+
);
|
58 |
+
$getMaintenanceSettings = get_option('wp_maintenance_settings');
|
59 |
+
if (!empty($getMaintenanceSettings)) {
|
60 |
+
foreach ($getMaintenanceSettings as $key => $option) {
|
61 |
+
$wp_maintenanceAdminOptions[$key] = $option;
|
62 |
+
}
|
63 |
+
}
|
64 |
+
update_option('wp_maintenance_settings', $wp_maintenanceAdminOptions);
|
65 |
+
}
|
66 |
+
|
67 |
+
function WpMaintenanceAdminScripts() {
|
68 |
+
wp_enqueue_script('media-upload');
|
69 |
+
wp_enqueue_script('thickbox');
|
70 |
+
wp_register_script('wpm-my-upload', WP_PLUGIN_URL.'/wp-maintenance/wpm-script.js', array('jquery','media-upload','thickbox'));
|
71 |
+
wp_enqueue_script('wpm-my-upload');
|
72 |
+
}
|
73 |
+
|
74 |
+
function WpMaintenanceEnqueueColorPicker( $hook_suffix ) {
|
75 |
+
// first check that $hook_suffix is appropriate for your admin page
|
76 |
+
wp_enqueue_style( 'color-picker' );
|
77 |
+
wp_enqueue_script( 'wpm_color-picker', WP_PLUGIN_URL.'/wp-maintenance/wpm-color-options.js', array('jquery','color-picker'));
|
78 |
+
wp_enqueue_script('wpm_color-picker');
|
79 |
+
}
|
80 |
+
|
81 |
+
function WpMaintenanceAdminStyles() {
|
82 |
+
wp_enqueue_style('thickbox');
|
83 |
+
}
|
84 |
+
|
85 |
+
if (isset($_GET['page']) && $_GET['page'] == 'wp-maintenance/wp-maintenance.php') {
|
86 |
+
add_action('admin_print_scripts', 'WpMaintenanceAdminScripts');
|
87 |
+
add_action('admin_print_styles', 'WpMaintenanceAdminStyles');
|
88 |
+
add_action( 'admin_enqueue_scripts', 'WpMaintenanceEnqueueColorPicker' );
|
89 |
+
}
|
90 |
+
|
91 |
+
/* Mode Mainteance */
|
92 |
+
function maintenance_mode() {
|
93 |
+
|
94 |
+
global $current_user;
|
95 |
+
|
96 |
+
if(get_option('wp_maintenance_settings')) { extract(get_option('wp_maintenance_settings')); }
|
97 |
+
$paramMMode = get_option('wp_maintenance_settings');
|
98 |
+
|
99 |
+
get_currentuserinfo();
|
100 |
+
if(!$paramMMode['active']) { $paramMMode['active'] = 0 ;}
|
101 |
+
|
102 |
+
if ($current_user->user_level != 10 && $paramMMode['active']==1) {
|
103 |
+
|
104 |
+
$urlTpl = get_stylesheet_directory();
|
105 |
+
|
106 |
+
if($paramMMode['pageperso']==1) {
|
107 |
+
|
108 |
+
$urlTpl = get_stylesheet_directory();
|
109 |
+
$content = file_get_contents( $urlTpl. '/maintenance.php' );
|
110 |
+
|
111 |
+
} else {
|
112 |
+
|
113 |
+
$site_title = get_bloginfo( 'name', 'display' );
|
114 |
+
$site_description = get_bloginfo( 'description', 'display' );
|
115 |
+
|
116 |
+
/* Défninition des couleurs par défault */
|
117 |
+
if($paramMMode['color_bg']=="") { $paramMMode['color_bg'] = "#f1f1f1"; }
|
118 |
+
if($paramMMode['color_txt']=="") { $paramMMode['color_txt'] = "#888888"; }
|
119 |
+
|
120 |
+
/* Paramètre par défaut */
|
121 |
+
if($paramMMode['text_maintenance']=="") { $paramMMode['text_maintenance'] = 'Ce site est en maintenance'; }
|
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">
|
128 |
+
<head>
|
129 |
+
<title>';
|
130 |
+
$content .= $site_title." - ".$site_description;
|
131 |
+
$content .= '</title>
|
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 |
+
}
|
150 |
+
|
151 |
+
}
|
152 |
+
add_action('get_header', 'maintenance_mode');
|
153 |
+
|
154 |
+
//intègre le tout aux pages Admin de Wordpress
|
155 |
+
add_action("admin_menu", "addWpMaintenanceAdmin");
|
156 |
+
|
157 |
+
?>
|
wpm-color-options.js
ADDED
@@ -0,0 +1,18 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
var wpmOptions = {
|
2 |
+
// you can declare a default color here,
|
3 |
+
// or in the data-default-color attribute on the input
|
4 |
+
defaultColor: false,
|
5 |
+
// a callback to fire whenever the color changes to a valid color
|
6 |
+
change: function(event, ui){},
|
7 |
+
// a callback to fire when the input is emptied or an invalid color
|
8 |
+
clear: function() {},
|
9 |
+
// hide the color picker controls on load
|
10 |
+
hide: true,
|
11 |
+
// show a group of common colors beneath the square
|
12 |
+
// or, supply an array of colors to customize further
|
13 |
+
palettes: true
|
14 |
+
};
|
15 |
+
|
16 |
+
jQuery(document).ready(function($){
|
17 |
+
$('.wpm-color-field').wpColorPicker(wpmOptions);
|
18 |
+
});
|
wpm-script.js
ADDED
@@ -0,0 +1,15 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
jQuery(document).ready(function() {
|
2 |
+
|
3 |
+
jQuery('#upload_image_button').click(function() {
|
4 |
+
formfield = jQuery('#upload_image').attr('name');
|
5 |
+
tb_show('', 'media-upload.php?type=image&TB_iframe=true');
|
6 |
+
return false;
|
7 |
+
});
|
8 |
+
|
9 |
+
window.send_to_editor = function(html) {
|
10 |
+
imgurl = jQuery('img',html).attr('src');
|
11 |
+
jQuery('#upload_image').val(imgurl);
|
12 |
+
tb_remove();
|
13 |
+
}
|
14 |
+
|
15 |
+
});
|