Version Description
Download this release
Release Info
Developer | smartcat |
Plugin | WP Construction Mode |
Version | 1.0 |
Comparing to | |
See all releases |
Version 1.0
- form.php +110 -0
- readme.txt +26 -0
- screenshot-1.png +0 -0
- under-construction.php +107 -0
- under_construction.png +0 -0
form.php
ADDED
@@ -0,0 +1,110 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<style>
|
2 |
+
.wrap{
|
3 |
+
padding: 20px;
|
4 |
+
background-color: #4c4f53;
|
5 |
+
background: -webkit-linear-gradient(130deg, rgba(75, 60, 80, 0) 60%, #4a434f 100%) 0 0 fixed, -webkit-linear-gradient(top, #83a7ab 0%, #23263c 100%) 0 0 fixed;
|
6 |
+
background: linear-gradient(130deg, rgba(75, 60, 80, 0) 60%, #4a434f 100%) 0 0 fixed, linear-gradient(to bottom, #83a7ab 0%, #23263c 100%) 0 0 fixed;
|
7 |
+
background-size: 100% 1800px, 1400px 1400px, 1600px 1600px, 100% 100%, 100% 100%, 100% 100%;
|
8 |
+
font-family: calibri;
|
9 |
+
}
|
10 |
+
#poststuff{
|
11 |
+
|
12 |
+
|
13 |
+
}
|
14 |
+
.construction-form{
|
15 |
+
padding: 20px;
|
16 |
+
}
|
17 |
+
.construction-form .title label{
|
18 |
+
color: #ffffff;
|
19 |
+
}
|
20 |
+
.construction-form select{
|
21 |
+
padding: 5px 8px;
|
22 |
+
border-radius: 15px;
|
23 |
+
}
|
24 |
+
.construction-form textarea{
|
25 |
+
border-radius: 15px;
|
26 |
+
padding: 20px;
|
27 |
+
}
|
28 |
+
.plugin-title{
|
29 |
+
color: #ffffff;
|
30 |
+
border-top: 1px solid #ffffff;
|
31 |
+
border-bottom: 1px solid #ffffff;
|
32 |
+
padding: 10px 0;
|
33 |
+
width: 80%;
|
34 |
+
}
|
35 |
+
</style>
|
36 |
+
|
37 |
+
|
38 |
+
<div class="wrap">
|
39 |
+
<div class="icon32" id="icon-edit-pages"></div>
|
40 |
+
|
41 |
+
|
42 |
+
<div id="poststuff" width="65%" class="alignleft">
|
43 |
+
<h1 class="plugin-title">WP Construction / Maintenance Mode</h1>
|
44 |
+
<div id="post-body">
|
45 |
+
<div id="post-body-content" class="form-wrap">
|
46 |
+
<form name="post_form" class="construction-form" method="post" action="" enctype="multipart/form-data">
|
47 |
+
<div id="titlediv">
|
48 |
+
<div class="form-field title">
|
49 |
+
<label for="title"><?php _e('Set Under Construction') ?></label>
|
50 |
+
<select name="set_opt" id="set_opt">
|
51 |
+
<option value="No" <?php echo ($set_opt == 'No') ? 'selected=selected' : ''; ?>>No</option>
|
52 |
+
<option value="Yes" <?php echo ($set_opt == 'Yes') ? 'selected=selected' : ''; ?>>Yes</option>
|
53 |
+
</select>
|
54 |
+
</div>
|
55 |
+
</div>
|
56 |
+
<div id="titlediv">
|
57 |
+
<div class="form-field title">
|
58 |
+
<label for="title"><?php _e('Set To Specific Page') ?> </label>
|
59 |
+
<select name="set_page" id="set_page">
|
60 |
+
<option value="all"><?php _e('Entire Website') ?></option>
|
61 |
+
<?php
|
62 |
+
$pages = get_pages();
|
63 |
+
foreach($pages as $page){
|
64 |
+
$option = "<option value= '" . $page->ID . "'";
|
65 |
+
if(get_option("set_page")== $page->ID)
|
66 |
+
$option .= "selected";
|
67 |
+
$option .= ">";
|
68 |
+
$option .= $page->post_title;
|
69 |
+
$option .= '</option>';
|
70 |
+
echo $option;
|
71 |
+
}
|
72 |
+
?>
|
73 |
+
|
74 |
+
</select>
|
75 |
+
</div>
|
76 |
+
</div>
|
77 |
+
<div id="titlediv">
|
78 |
+
<div class="form-field title">
|
79 |
+
<label for="title"><?php _e('Message') ?></label>
|
80 |
+
<textarea name="set_msg" id="set_msg" cols="20" rows="3" style="width: 50%"><?php echo $set_msg; ?></textarea>
|
81 |
+
</div>
|
82 |
+
</div>
|
83 |
+
<div style="margin-top:15px;">
|
84 |
+
<input type="submit" name="submit" value="Submit" class="button button-primary" />
|
85 |
+
<input type="hidden" name="act" value="save" />
|
86 |
+
</form>
|
87 |
+
|
88 |
+
</div>
|
89 |
+
|
90 |
+
</div>
|
91 |
+
|
92 |
+
</div>
|
93 |
+
|
94 |
+
</div>
|
95 |
+
<div class="alignleft" style="width: 30%;background:#edeae6 ">
|
96 |
+
<h2 style="color: #B0CB1F;background: #414141;text-align: center;padding: 10px 0;margin-top: 10px;">Plugin Details</h2>
|
97 |
+
<p style="text-align: center;padding: 10px">
|
98 |
+
<?php _e("Use this plugin to set your entire website or specific pages offline for anyone who is not an admin.")?>
|
99 |
+
<br>
|
100 |
+
<?php _e("This is perfect for building a site on a live domain, or if you want to make changes on a page on a live site, you can set the specific page offline")?>
|
101 |
+
<br>
|
102 |
+
<?php _e("Set your own custom message. Future updates will allow for more customization. To request specific changes, please visit my website and submit your feedback")?>
|
103 |
+
</p>
|
104 |
+
<p style="text-align: center">
|
105 |
+
<a href="http://smartcatdesign.net/under-construction-maintenance-mode-free-wordpress-plugin/" target="_blank" class="button button-primary">Plugin Site</a>
|
106 |
+
</p>
|
107 |
+
<p style='text-align: center'>
|
108 |
+
<img src='http://smartcatdesign.net/wp-content/uploads/2013/03/logo-medium.png' style="max-width: 100%"/>
|
109 |
+
</p>
|
110 |
+
</div>
|
readme.txt
ADDED
@@ -0,0 +1,26 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
=== WP Construction Mode ===
|
2 |
+
Contributors: smartcat
|
3 |
+
Donate link: http://smartcatdesign.net
|
4 |
+
Tags: construction,maintenance,page,admin, under construction, under maintenance, coming soon, administrator, custom message
|
5 |
+
Requires at least: 3.2
|
6 |
+
Tested up to: 3.81
|
7 |
+
Stable tag: 1.0
|
8 |
+
License: GPLv2 or later
|
9 |
+
|
10 |
+
Set entire website or specific page under construction or maintenance for all viewers except Admin
|
11 |
+
== Description ==
|
12 |
+
|
13 |
+
Set entire website or specific page under construction or maintenance. Admin can still view the site, perfect for developing new websites or pages
|
14 |
+
|
15 |
+
== Installation ==
|
16 |
+
|
17 |
+
1. Upload 'wp-construction-maintenance' to the '/wp-content/plugins/' directory
|
18 |
+
2. Activate the plugin through the 'Plugins' menu in WordPress
|
19 |
+
3. Click on Under Construction in the WordPress Dashboard sidebar
|
20 |
+
4. You can choose your option and enter your custom message
|
21 |
+
5. Click on "Submit" button.
|
22 |
+
|
23 |
+
|
24 |
+
== Screenshots ==
|
25 |
+
|
26 |
+
1. Under Construction
|
screenshot-1.png
ADDED
Binary file
|
under-construction.php
ADDED
@@ -0,0 +1,107 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/*
|
3 |
+
Plugin Name: WP Construction Mode
|
4 |
+
Plugin URI: http://smartcatdesign.net/under-construction-maintenance-mode-free-wordpress-plugin/
|
5 |
+
Description: Display a customizable Under Construction or Coming Soon page for all users who are not logged in. Perfect for developing on a live server!
|
6 |
+
Version: 1.0
|
7 |
+
Author: SmartCat
|
8 |
+
Author URI: http://smartcatdesign.net
|
9 |
+
License: GPL v2
|
10 |
+
*/
|
11 |
+
register_activation_hook(__FILE__, 'under_construction_install');
|
12 |
+
|
13 |
+
function under_construction_install() {
|
14 |
+
global $wp_version;
|
15 |
+
if (version_compare($wp_version, "3.2.1", "<")) {
|
16 |
+
deactivate_plugins(basename(__FILE__));
|
17 |
+
wp_die("This plugin requires WordPress version 3.2.1 or higher.");
|
18 |
+
}
|
19 |
+
set_under_construction();
|
20 |
+
}
|
21 |
+
|
22 |
+
add_action('admin_menu', 'under_construction_menu');
|
23 |
+
add_action('admin_head', 'admin_action');
|
24 |
+
|
25 |
+
function admin_action(){
|
26 |
+
$set_opt = get_option('set_opt');
|
27 |
+
if($set_opt == 'Yes'){ ?>
|
28 |
+
<div style="background: #333;color: #CC0000;text-align: center"><?php _e("Under Construction Mode is ON"); ?></div>
|
29 |
+
<?php }
|
30 |
+
}
|
31 |
+
|
32 |
+
function under_construction_menu() {
|
33 |
+
add_menu_page('Under Construction', 'Under Construction', 'administrator', 'under-construction.php', 'under_construction_action', plugins_url('under_construction.png', __FILE__));
|
34 |
+
}
|
35 |
+
|
36 |
+
function under_construction_action() {
|
37 |
+
$option_name1 = 'set_opt';
|
38 |
+
$option_name2 = 'set_msg';
|
39 |
+
if (isset($_REQUEST['act'])) {
|
40 |
+
switch ($_REQUEST['act']) {
|
41 |
+
case "save":
|
42 |
+
set_under_construction();
|
43 |
+
echo '<div class="updated below-h2" id="message" style="position:relative; clear:both;"><p>Under Construction: ' . $_REQUEST['set_opt'] . '</p></div>';
|
44 |
+
break;
|
45 |
+
default:
|
46 |
+
}
|
47 |
+
}
|
48 |
+
$set_opt = get_option($option_name1);
|
49 |
+
$set_msg = get_option($option_name2);
|
50 |
+
require_once('form.php');
|
51 |
+
}
|
52 |
+
|
53 |
+
function set_under_construction() {
|
54 |
+
$option_name1 = 'set_opt';
|
55 |
+
$option_name2 = 'set_msg';
|
56 |
+
$option_name3 = 'set_page';
|
57 |
+
$new_value1 = ($_REQUEST['set_opt'] == "") ? 'No' : $_REQUEST['set_opt'];
|
58 |
+
if (get_option($option_name1) !== false) {
|
59 |
+
update_option($option_name1, $new_value1);
|
60 |
+
} else {
|
61 |
+
$deprecated = null;
|
62 |
+
$autoload = 'no';
|
63 |
+
add_option($option_name1, $new_value1, $deprecated, $autoload);
|
64 |
+
}
|
65 |
+
|
66 |
+
|
67 |
+
$new_value2 = ($_REQUEST['set_msg'] == "") ? 'Page is currently under construction. ' : $_REQUEST['set_msg'];
|
68 |
+
if (get_option($option_name2) !== false) {
|
69 |
+
update_option($option_name2, $new_value2);
|
70 |
+
} else {
|
71 |
+
$deprecated = null;
|
72 |
+
$autoload = 'no';
|
73 |
+
add_option($option_name2, $new_value2, $deprecated, $autoload);
|
74 |
+
}
|
75 |
+
|
76 |
+
$new_value3 = ($_REQUEST['set_page'] == "") ? 'Website is Under Construction' : $_REQUEST['set_page'];
|
77 |
+
if (get_option($option_name3) !== false) {
|
78 |
+
update_option($option_name3, $new_value3);
|
79 |
+
} else {
|
80 |
+
$deprecated = null;
|
81 |
+
$autoload = 'no';
|
82 |
+
add_option($option_name3, $new_value3, $deprecated, $autoload);
|
83 |
+
}
|
84 |
+
}
|
85 |
+
|
86 |
+
function show_uc() {
|
87 |
+
$option_name1 = 'set_opt';
|
88 |
+
$option_name2 = 'set_msg';
|
89 |
+
$option_name3 = 'set_page';
|
90 |
+
$set_opt = get_option($option_name1);
|
91 |
+
$set_msg = get_option($option_name2);
|
92 |
+
$set_page = get_option($option_name3);
|
93 |
+
$current_user = wp_get_current_user();
|
94 |
+
|
95 |
+
if ($set_opt == 'Yes' && !user_can($current_user, 'administrator')) {
|
96 |
+
if($set_page == get_the_ID()){
|
97 |
+
echo "<div style='margin:0 auto; text-align:center;font-size:30px;padding-top:30px;'>" . $set_msg . "</div>";
|
98 |
+
exit(0);
|
99 |
+
}else if($set_page == "all"){
|
100 |
+
echo "<div style='margin:0 auto; text-align:center;font-size:30px;padding-top:30px;'>" . $set_msg . "</div>";
|
101 |
+
exit(0);
|
102 |
+
}
|
103 |
+
}
|
104 |
+
}
|
105 |
+
|
106 |
+
add_action('wp_head', 'show_uc');
|
107 |
+
?>
|
under_construction.png
ADDED
Binary file
|