Version Description
- Added the ability to switch on and off while keeping the plugin active
- Added the ability to send different HTTP headers (503 or 200)
- Added the ability to simply customize the default text, or display the default page
- Tweaked the page slightly to be a little prettier
Download this release
Release Info
Developer | jkmassel |
Plugin | underConstruction |
Version | 1.03 |
Comparing to | |
See all releases |
Code changes from version 1.02 to 1.03
- defaultMessage.php +72 -50
- readme.txt +36 -7
- screenshot-1.png +0 -0
- screenshot-2.png +0 -0
- screenshot-3.png +0 -0
- screenshot-4.png +0 -0
- ucOptions.php +260 -0
- underConstruction.php +215 -66
- underconstruction.dev.js +23 -0
- underconstruction.min.js +1 -0
defaultMessage.php
CHANGED
@@ -1,58 +1,80 @@
|
|
1 |
-
<?php
|
2 |
/*
|
3 |
This file is part of underConstruction.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
4 |
|
5 |
-
|
6 |
-
|
7 |
-
|
8 |
-
|
9 |
-
|
10 |
-
underConstruction is distributed in the hope that it will be useful,
|
11 |
-
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
12 |
-
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
13 |
-
GNU General Public License for more details.
|
14 |
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
?>
|
19 |
-
<!DOCTYPE
|
20 |
<html xmlns="http://www.w3.org/1999/xhtml">
|
21 |
-
<head>
|
22 |
-
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
|
23 |
-
<title>
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
-
|
54 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
55 |
</html>
|
56 |
-
<?php
|
|
|
57 |
/* EOF */
|
58 |
-
?>
|
1 |
+
<?php
|
2 |
/*
|
3 |
This file is part of underConstruction.
|
4 |
+
underConstruction is free software: you can redistribute it and/or modify
|
5 |
+
it under the terms of the GNU General Public License as published by
|
6 |
+
the Free Software Foundation, either version 3 of the License, or
|
7 |
+
(at your option) any later version.
|
8 |
+
underConstruction is distributed in the hope that it will be useful,
|
9 |
+
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
10 |
+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
11 |
+
GNU General Public License for more details.
|
12 |
+
You should have received a copy of the GNU General Public License
|
13 |
+
along with underConstruction. If not, see <http://www.gnu.org/licenses/>.
|
14 |
+
*/
|
15 |
|
16 |
+
function displayDefaultComingSoonPage()
|
17 |
+
{
|
18 |
+
displayComingSoonPage(trim(get_bloginfo('title')).' is coming soon', get_bloginfo('url'), 'is coming soon');
|
19 |
+
}
|
|
|
|
|
|
|
|
|
|
|
20 |
|
21 |
+
function displayComingSoonPage($title, $headerText, $bodyText)
|
22 |
+
{
|
23 |
+
|
24 |
?>
|
25 |
+
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
|
26 |
<html xmlns="http://www.w3.org/1999/xhtml">
|
27 |
+
<head>
|
28 |
+
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
|
29 |
+
<title>
|
30 |
+
<?php echo $title; ?>
|
31 |
+
</title>
|
32 |
+
<style type="text/css">
|
33 |
+
|
34 |
+
.headerText {
|
35 |
+
width: 550px;
|
36 |
+
margin-top: 10%;
|
37 |
+
margin-right: auto;
|
38 |
+
margin-left: auto;
|
39 |
+
font-size: 28px;
|
40 |
+
font-weight: normal;
|
41 |
+
display: block;
|
42 |
+
text-align: center;
|
43 |
+
}
|
44 |
+
|
45 |
+
.bodyText {
|
46 |
+
width: 550px;
|
47 |
+
margin-top: 15px;
|
48 |
+
margin-right: auto;
|
49 |
+
margin-left: auto;
|
50 |
+
font-size: 14px;
|
51 |
+
font-weight: normal;
|
52 |
+
display: block;
|
53 |
+
text-align: center;
|
54 |
+
}
|
55 |
+
|
56 |
+
body {
|
57 |
+
margin-left: 0px;
|
58 |
+
margin-top: 0px;
|
59 |
+
margin-right: 0px;
|
60 |
+
margin-bottom: 0px;
|
61 |
+
background-color: #222222;
|
62 |
+
color: #FFF;
|
63 |
+
font-family: Arial, Helvetica, sans-serif;
|
64 |
+
}
|
65 |
+
</style>
|
66 |
+
</head>
|
67 |
+
<body>
|
68 |
+
<span class="headerText">
|
69 |
+
<?php echo $headerText; ?>
|
70 |
+
</span>
|
71 |
+
<br/>
|
72 |
+
<span class="bodyText">
|
73 |
+
<?php echo $bodyText; ?>
|
74 |
+
</span>
|
75 |
+
</body>
|
76 |
</html>
|
77 |
+
<?php
|
78 |
+
}
|
79 |
/* EOF */
|
80 |
+
?>
|
readme.txt
CHANGED
@@ -1,12 +1,12 @@
|
|
1 |
=== underConstruction ===
|
2 |
Contributors: Jeremy Massel
|
3 |
-
Donate link: http://
|
4 |
Tags: construction, under construction, private, preview, security, coming soon
|
5 |
Requires at least: 2.7
|
6 |
-
Tested up to: 2.
|
7 |
-
Stable tag: 1.
|
8 |
|
9 |
-
Creates a 'Coming Soon' page that will show for all users who are not logged in
|
10 |
|
11 |
== Description ==
|
12 |
|
@@ -17,23 +17,52 @@ Creates a 'Coming Soon' page that will show for all users who are not logged in.
|
|
17 |
|
18 |
1. Upload the folder to the `/wp-content/plugins/` directory
|
19 |
2. Activate the plugin through the 'Plugins' menu in WordPress
|
20 |
-
3. If you want to change the look of the page that is displayed, click Settings->Under Construction and
|
21 |
|
22 |
== Frequently Asked Questions ==
|
23 |
|
24 |
= What kind of HTML can I put in? =
|
25 |
-
|
26 |
You enter the contents of the entire HTML file. You can include inline styles, or links to external style sheets and external images.
|
27 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
28 |
== Changelog ==
|
29 |
|
|
|
|
|
|
|
|
|
|
|
|
|
30 |
= 1.02 =
|
31 |
* Fixed a bug where clearing the text wouldn't cause it to revert to the default.
|
|
|
32 |
= 1.01 =
|
33 |
* Fixed a bug where deactivation would trigger an error
|
|
|
34 |
= 1.0 =
|
35 |
* First version
|
36 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
37 |
== Screenshots ==
|
38 |
1. The default page that is displayed (this can be overridden)
|
39 |
-
2. The editing screen
|
|
|
|
1 |
=== underConstruction ===
|
2 |
Contributors: Jeremy Massel
|
3 |
+
Donate link: http://masseltech.com/donate/
|
4 |
Tags: construction, under construction, private, preview, security, coming soon
|
5 |
Requires at least: 2.7
|
6 |
+
Tested up to: 2.9.2
|
7 |
+
Stable tag: 1.03
|
8 |
|
9 |
+
Creates a 'Coming Soon' page that will show for all users who are not logged in
|
10 |
|
11 |
== Description ==
|
12 |
|
17 |
|
18 |
1. Upload the folder to the `/wp-content/plugins/` directory
|
19 |
2. Activate the plugin through the 'Plugins' menu in WordPress
|
20 |
+
3. If you want to change the look of the page that is displayed, click Settings->Under Construction and change the settings there.
|
21 |
|
22 |
== Frequently Asked Questions ==
|
23 |
|
24 |
= What kind of HTML can I put in? =
|
|
|
25 |
You enter the contents of the entire HTML file. You can include inline styles, or links to external style sheets and external images.
|
26 |
|
27 |
+
= I have an idea for your plugin! =
|
28 |
+
That's great. I'm always open to user input, and I'd like to add anything I think will be useful to a lot of people. Visit the homepage for this plugin and leave a comment, and I'll add the functionality as soon as I can.
|
29 |
+
|
30 |
+
= I found a bug! =
|
31 |
+
Oops. That's sure awkward. If you find a problem with this plugin that you can reproduce, if you wouldn't mind leaving a message on the homepage for this plugin with how you made it break, I'd really like to try and fix it! Also, this is incompatible with a couple plugins out there, specifically ones that change the default login url.
|
32 |
+
|
33 |
+
= This plugin has helped me a lot, how can I support it? =
|
34 |
+
I've had a few people ask me this. If you like it, please go to WordPress.org and rate it! Then more people can enjoy it. If you REALLY like it, you can always buy me a coffee. :) There's a donate link on my site.
|
35 |
+
|
36 |
+
= You didn't answer my question here =
|
37 |
+
Sorry, I get a lot of questions. But visit the homepage for this plugin and leave me a comment. They go right to my inbox, and well I might not be able to for a few days, I promise I'll get back to you.
|
38 |
+
|
39 |
== Changelog ==
|
40 |
|
41 |
+
= 1.03 =
|
42 |
+
* Added the ability to switch on and off while keeping the plugin active
|
43 |
+
* Added the ability to send different HTTP headers (503 or 200)
|
44 |
+
* Added the ability to simply customize the default text, or display the default page
|
45 |
+
* Tweaked the page slightly to be a little prettier
|
46 |
+
|
47 |
= 1.02 =
|
48 |
* Fixed a bug where clearing the text wouldn't cause it to revert to the default.
|
49 |
+
|
50 |
= 1.01 =
|
51 |
* Fixed a bug where deactivation would trigger an error
|
52 |
+
|
53 |
= 1.0 =
|
54 |
* First version
|
55 |
|
56 |
+
== Upgrade Notice ==
|
57 |
+
|
58 |
+
= 1.03 =
|
59 |
+
* Added the ability to switch on and off while keeping the plugin active
|
60 |
+
* Added the ability to send different HTTP headers (503 or 200)
|
61 |
+
* Added the ability to simply customize the default text, or display the default page
|
62 |
+
* Tweaked the page slightly to be a little prettier
|
63 |
+
|
64 |
== Screenshots ==
|
65 |
1. The default page that is displayed (this can be overridden)
|
66 |
+
2. The editing screen with the default page selected
|
67 |
+
3. The editing screen with the custom text option selected
|
68 |
+
4. The editing screen with the custom HTML option selected
|
screenshot-1.png
CHANGED
Binary file
|
screenshot-2.png
CHANGED
Binary file
|
screenshot-3.png
ADDED
Binary file
|
screenshot-4.png
ADDED
Binary file
|
ucOptions.php
ADDED
@@ -0,0 +1,260 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
if (isset($_GET['turnOnUnderConstructionMode']))
|
3 |
+
{
|
4 |
+
update_option('underConstructionActivationStatus', 1);
|
5 |
+
|
6 |
+
}
|
7 |
+
|
8 |
+
if (isset($_GET['turnOffUnderConstructionMode']))
|
9 |
+
{
|
10 |
+
update_option('underConstructionActivationStatus', 0);
|
11 |
+
|
12 |
+
}
|
13 |
+
|
14 |
+
|
15 |
+
// ======================================
|
16 |
+
// process display options
|
17 |
+
// ======================================
|
18 |
+
|
19 |
+
if (isset($_POST['display_options']))
|
20 |
+
{
|
21 |
+
if ($_POST['display_options'] == 0) //they want to just use the default
|
22 |
+
{
|
23 |
+
update_option('underConstructionDisplayOption', 0);
|
24 |
+
}
|
25 |
+
|
26 |
+
if ($_POST['display_options'] == 1) //they want to use the default with custom text
|
27 |
+
{
|
28 |
+
$values = array('pageTitle'=>'', 'headerText'=>'', 'bodyText'=>'');
|
29 |
+
|
30 |
+
if (isset($_POST['pageTitle']))
|
31 |
+
{
|
32 |
+
$values['pageTitle'] = attribute_escape($_POST['pageTitle']);
|
33 |
+
}
|
34 |
+
|
35 |
+
if (isset($_POST['headerText']))
|
36 |
+
{
|
37 |
+
$values['headerText'] = attribute_escape($_POST['headerText']);
|
38 |
+
}
|
39 |
+
|
40 |
+
if (isset($_POST['bodyText']))
|
41 |
+
{
|
42 |
+
$values['bodyText'] = attribute_escape($_POST['bodyText']);
|
43 |
+
}
|
44 |
+
|
45 |
+
|
46 |
+
update_option('underConstructionCustomText', $values);
|
47 |
+
update_option('underConstructionDisplayOption', 1);
|
48 |
+
}
|
49 |
+
|
50 |
+
if ($_POST['display_options'] == 2) //they want to use their own HTML
|
51 |
+
{
|
52 |
+
if (isset($_POST['ucHTML']))
|
53 |
+
{
|
54 |
+
update_option('underConstructionHTML', attribute_escape($_POST['ucHTML']));
|
55 |
+
update_option('underConstructionDisplayOption', 2);
|
56 |
+
}
|
57 |
+
}
|
58 |
+
}
|
59 |
+
|
60 |
+
// ======================================
|
61 |
+
// process http status codes
|
62 |
+
// ======================================
|
63 |
+
if (isset($_POST['activate']))
|
64 |
+
{
|
65 |
+
if ($_POST['activate'] == 0)
|
66 |
+
{
|
67 |
+
update_option('underConstructionActivationStatus', 0);
|
68 |
+
}
|
69 |
+
|
70 |
+
if ($_POST['activate'] == 1)
|
71 |
+
{
|
72 |
+
update_option('underConstructionActivationStatus', 1);
|
73 |
+
}
|
74 |
+
}
|
75 |
+
|
76 |
+
// ======================================
|
77 |
+
// process on/off status
|
78 |
+
// ======================================
|
79 |
+
if (isset($_POST['http_status']))
|
80 |
+
{
|
81 |
+
if ($_POST['http_status'] == 200)
|
82 |
+
{
|
83 |
+
update_option('underConstructionHTTPStatus', 200);
|
84 |
+
}
|
85 |
+
|
86 |
+
if ($_POST['http_status'] == 503)
|
87 |
+
{
|
88 |
+
update_option('underConstructionHTTPStatus', 503);
|
89 |
+
}
|
90 |
+
}
|
91 |
+
|
92 |
+
|
93 |
+
|
94 |
+
|
95 |
+
?>
|
96 |
+
<div class="wrap">
|
97 |
+
<div id="icon-options-general" class="icon32">
|
98 |
+
<br/>
|
99 |
+
</div>
|
100 |
+
<form method="post" action="<?php echo $GLOBALS['PHP_SELF'] . '?page=' . $this->mainOptionsPage; ?>">
|
101 |
+
<h2>
|
102 |
+
Under Construction
|
103 |
+
</h2>
|
104 |
+
<table>
|
105 |
+
<tr>
|
106 |
+
<td>
|
107 |
+
<h3>
|
108 |
+
Activate or Deactivate
|
109 |
+
</h3>
|
110 |
+
</td>
|
111 |
+
</tr>
|
112 |
+
<tr>
|
113 |
+
<td>
|
114 |
+
<fieldset>
|
115 |
+
<legend class="screen-reader-text">
|
116 |
+
<span>
|
117 |
+
Activate or Deactivate
|
118 |
+
</span>
|
119 |
+
</legend>
|
120 |
+
<label title="activate">
|
121 |
+
<input type="radio" name="activate" value="1"<?php if ($this->pluginIsActive()) { echo ' checked="checked"'; } ?>>
|
122 |
+
on
|
123 |
+
</label>
|
124 |
+
<br/>
|
125 |
+
<label title="deactivate">
|
126 |
+
<input type="radio" name="activate" value="0"<?php if (!$this->pluginIsActive()) { echo ' checked="checked"'; } ?>>
|
127 |
+
off
|
128 |
+
</label>
|
129 |
+
</fieldset>
|
130 |
+
</td>
|
131 |
+
</tr>
|
132 |
+
<tr>
|
133 |
+
<td>
|
134 |
+
<h3>
|
135 |
+
HTTP Status Code
|
136 |
+
</h3>
|
137 |
+
<p>
|
138 |
+
You can choose to send the standard HTTP status code with the under construction page, or send a 503 "Service Unavailable" status code. This will tell Google that
|
139 |
+
this page isn't ready yet, and cause your site not to be listed until this plugin is disabled
|
140 |
+
</p>
|
141 |
+
</td>
|
142 |
+
</tr>
|
143 |
+
<tr>
|
144 |
+
<td>
|
145 |
+
<fieldset>
|
146 |
+
<legend class="screen-reader-text">
|
147 |
+
<span>
|
148 |
+
HTTP Status Code
|
149 |
+
</span>
|
150 |
+
</legend>
|
151 |
+
<label title="HTTP200">
|
152 |
+
<input type="radio" name="http_status" value="200"<?php if ($this->httpStatusCodeIs(200)) { echo ' checked="checked"'; } ?>>
|
153 |
+
HTTP
|
154 |
+
200
|
155 |
+
-
|
156 |
+
|
157 |
+
ok
|
158 |
+
</label>
|
159 |
+
<br/>
|
160 |
+
<label title="HTTP503">
|
161 |
+
<input type="radio" name="http_status" value="503"<?php if ($this->httpStatusCodeIs(503)) { echo ' checked="checked"'; } ?>>
|
162 |
+
HTTP
|
163 |
+
503
|
164 |
+
-
|
165 |
+
|
166 |
+
Service Unavailable
|
167 |
+
</label>
|
168 |
+
</fieldset>
|
169 |
+
</td>
|
170 |
+
</tr>
|
171 |
+
<tr>
|
172 |
+
<td>
|
173 |
+
<h3>
|
174 |
+
Display Options
|
175 |
+
</h3>
|
176 |
+
</td>
|
177 |
+
</tr>
|
178 |
+
<tr>
|
179 |
+
<td>
|
180 |
+
<fieldset>
|
181 |
+
<legend class="screen-reader-text">
|
182 |
+
<span>
|
183 |
+
Display Options
|
184 |
+
</span>
|
185 |
+
</legend>
|
186 |
+
<label title="defaultPage">
|
187 |
+
<input type="radio" name="display_options" value="0" id="displayOption0"<?php if ($this->displayStatusCodeIs(0)) { echo ' checked="checked"'; } ?>>
|
188 |
+
Display the default under construction page
|
189 |
+
</label>
|
190 |
+
<br/>
|
191 |
+
<label title="HTTP503">
|
192 |
+
<input type="radio" name="display_options" value="1" id="displayOption1"<?php if ($this->displayStatusCodeIs(1)) { echo ' checked="checked"'; } ?>>
|
193 |
+
Display the default under construction page
|
194 |
+
,
|
195 |
+
|
196 |
+
but use custom text
|
197 |
+
</label>
|
198 |
+
<br/>
|
199 |
+
<label title="HTTP503">
|
200 |
+
<input type="radio" name="display_options" value="2" id="displayOption2"<?php if ($this->displayStatusCodeIs(2)) { echo ' checked="checked"'; } ?>>
|
201 |
+
Display a custom page using your own HTML
|
202 |
+
</label>
|
203 |
+
</fieldset>
|
204 |
+
</td>
|
205 |
+
</tr>
|
206 |
+
</table>
|
207 |
+
<div id="customText"<?php if (!$this->displayStatusCodeIs(1)) { echo ' style="display: none;"'; } ?>>
|
208 |
+
<h3>
|
209 |
+
Display Custom Text
|
210 |
+
</h3>
|
211 |
+
<p>
|
212 |
+
The text here will replace the text on the default page
|
213 |
+
</p>
|
214 |
+
<table>
|
215 |
+
<tr valign="top">
|
216 |
+
<th scope="row">
|
217 |
+
<label for="pageTitle">
|
218 |
+
Page Title
|
219 |
+
</label>
|
220 |
+
</th>
|
221 |
+
<td>
|
222 |
+
<input name="pageTitle" type="text" id="pageTitle" value="<?php echo $this->getCustomPageTitle(); ?>" class="regular-text" size="50">
|
223 |
+
</td>
|
224 |
+
</tr>
|
225 |
+
<tr valign="top">
|
226 |
+
<th scope="row">
|
227 |
+
<label for="headerText">
|
228 |
+
Header Text
|
229 |
+
</label>
|
230 |
+
</th>
|
231 |
+
<td>
|
232 |
+
<input name="headerText" type="text" id="headerText" value="<?php echo $this->getCustomHeaderText(); ?>" class="regular-text" size="50">
|
233 |
+
</td>
|
234 |
+
</tr>
|
235 |
+
<tr valign="top">
|
236 |
+
<th scope="row">
|
237 |
+
<label for="bodyText">
|
238 |
+
Body Text
|
239 |
+
</label>
|
240 |
+
</th>
|
241 |
+
<td>
|
242 |
+
<?php echo '<textarea rows="2" cols="44" name="bodyText" id="bodyText" class="regular-text">'.trim($this->getCustomBodyText()).'</textarea>'; ?>
|
243 |
+
</td>
|
244 |
+
</tr>
|
245 |
+
</table>
|
246 |
+
</div>
|
247 |
+
<div id="customHTML"<?php if (!$this->displayStatusCodeIs(2)) { echo ' style="display: none;"'; } ?>>
|
248 |
+
<h3>
|
249 |
+
Under Construction Page HTML
|
250 |
+
</h3>
|
251 |
+
<p>
|
252 |
+
Put in this area the HTML you want to show up on your front page
|
253 |
+
</p>
|
254 |
+
<?php echo '<textarea name="ucHTML" rows="15" cols="75">'.$this->getCustomHTML().'</textarea>'; ?>
|
255 |
+
</div>
|
256 |
+
<p class="submit">
|
257 |
+
<input type="submit" name="Submit" class="button-primary" value="Save Changes" id="submitChangesToUnderConstructionPlugin" />
|
258 |
+
</p>
|
259 |
+
</form>
|
260 |
+
</div>
|
underConstruction.php
CHANGED
@@ -1,95 +1,244 @@
|
|
1 |
-
<?php
|
2 |
/*
|
3 |
Plugin Name: Under Construction
|
4 |
-
Plugin URI: http://
|
5 |
Description: Makes it so your site can only be accessed by users who log in. Useful for developing a site on a live server, without the world being able to see it
|
6 |
-
Version: 1.
|
7 |
Author: Jeremy Massel
|
8 |
Author URI: http://www.masseltech.com/
|
9 |
*/
|
10 |
|
11 |
/*
|
12 |
This file is part of underConstruction.
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
You should have received a copy of the GNU General Public License
|
25 |
-
along with underConstruction. If not, see <http://www.gnu.org/licenses/>.
|
26 |
*/
|
27 |
|
28 |
?>
|
29 |
-
<?php
|
30 |
-
|
31 |
-
add_action('get_header', 'uc_overrideWP');
|
32 |
-
add_action('admin_menu', 'uc_adminMenu');
|
33 |
-
register_deactivation_hook(__FILE__, 'uc_remove');
|
34 |
-
|
35 |
-
function uc_overrideWP()
|
36 |
{
|
37 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
38 |
{
|
39 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
40 |
{
|
41 |
-
|
42 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
43 |
}
|
44 |
else
|
45 |
{
|
46 |
-
|
47 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
48 |
}
|
49 |
}
|
50 |
-
}
|
51 |
|
52 |
-
|
53 |
-
{
|
54 |
-
add_options_page('Under Construction Message', 'Under Construction', 8, basename(__FILE__) , 'uc_changeMessage');
|
55 |
}
|
56 |
|
57 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
58 |
{
|
59 |
-
|
60 |
-
|
61 |
-
|
62 |
-
|
63 |
-
|
64 |
-
|
65 |
-
|
66 |
-
}
|
67 |
-
|
68 |
-
?>
|
69 |
-
<div class="wrap">
|
70 |
-
<div id="icon-options-general" class="icon32">
|
71 |
-
<br/>
|
72 |
-
</div>
|
73 |
-
<h2>Under Construction</h2>
|
74 |
-
<form method="post" action="<?php echo $GLOBALS['PHP_SELF'] . '?page=underConstruction.php'; ?>">
|
75 |
-
<h3>Under Construction Page HTML</h3>
|
76 |
-
<p>Put in this area the HTML you want to show up on your front page</p>
|
77 |
-
<textarea name="ucHTML" rows="15" cols="75"><?php if(get_option('underConstructionHTML')){echo ucGetHTML();}?></textarea>
|
78 |
|
79 |
-
<p class="submit">
|
80 |
-
<input type="submit" name="Submit" class="button-primary" value="Save Changes" id="submitCalendarAdd"/>
|
81 |
-
</p>
|
82 |
-
</form>
|
83 |
-
</div>
|
84 |
-
<?php
|
85 |
-
}
|
86 |
|
87 |
-
|
88 |
-
|
89 |
-
|
90 |
}
|
91 |
|
92 |
-
|
93 |
-
|
94 |
-
}
|
95 |
?>
|
1 |
+
<?php
|
2 |
/*
|
3 |
Plugin Name: Under Construction
|
4 |
+
Plugin URI: http://masseltech.com/plugins/underconstruction/
|
5 |
Description: Makes it so your site can only be accessed by users who log in. Useful for developing a site on a live server, without the world being able to see it
|
6 |
+
Version: 1.03
|
7 |
Author: Jeremy Massel
|
8 |
Author URI: http://www.masseltech.com/
|
9 |
*/
|
10 |
|
11 |
/*
|
12 |
This file is part of underConstruction.
|
13 |
+
underConstruction is free software: you can redistribute it and/or modify
|
14 |
+
it under the terms of the GNU General Public License as published by
|
15 |
+
the Free Software Foundation, either version 3 of the License, or
|
16 |
+
(at your option) any later version.
|
17 |
+
underConstruction is distributed in the hope that it will be useful,
|
18 |
+
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
19 |
+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
20 |
+
GNU General Public License for more details.
|
21 |
+
You should have received a copy of the GNU General Public License
|
22 |
+
along with underConstruction. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
|
|
|
23 |
*/
|
24 |
|
25 |
?>
|
26 |
+
<?php
|
27 |
+
class underConstruction
|
|
|
|
|
|
|
|
|
|
|
28 |
{
|
29 |
+
var $installedFolder = "";
|
30 |
+
var $mainOptionsPage = "underConstructionMainOptions";
|
31 |
+
|
32 |
+
function __construct()
|
33 |
+
{
|
34 |
+
$this->installedFolder = basename(dirname(__FILE__));
|
35 |
+
}
|
36 |
+
|
37 |
+
function underConstruction()
|
38 |
+
{
|
39 |
+
$this->__construct();
|
40 |
+
}
|
41 |
+
|
42 |
+
function getMainOptionsPage()
|
43 |
+
{
|
44 |
+
return $this->mainOptionsPage;
|
45 |
+
}
|
46 |
+
|
47 |
+
function underConstructionAdminInit()
|
48 |
{
|
49 |
+
/* Register our script. */
|
50 |
+
wp_register_script('underConstructionJS', WP_PLUGIN_URL.'/'.$this->installedFolder.'/underconstruction.min.js');
|
51 |
+
}
|
52 |
+
|
53 |
+
function uc_changeMessage()
|
54 |
+
{
|
55 |
+
require_once ('ucOptions.php');
|
56 |
+
}
|
57 |
+
|
58 |
+
function uc_adminMenu()
|
59 |
+
{
|
60 |
+
/* Register our plugin page */
|
61 |
+
$page = add_options_page('Under Construction Settings', 'Under Construction', 8, $this->mainOptionsPage, array($this, 'uc_changeMessage'));
|
62 |
+
|
63 |
+
/* Using registered $page handle to hook script load */
|
64 |
+
add_action('admin_print_scripts-'.$page, array($this, 'underConstructionEnqueueScripts'));
|
65 |
+
|
66 |
+
}
|
67 |
+
|
68 |
+
function underConstructionEnqueueScripts()
|
69 |
+
{
|
70 |
+
/*
|
71 |
+
* It will be called only on your plugin admin page, enqueue our script here
|
72 |
+
*/
|
73 |
+
wp_enqueue_script('scriptaculous');
|
74 |
+
wp_enqueue_script('underConstructionJS');
|
75 |
+
}
|
76 |
+
|
77 |
+
function uc_overrideWP()
|
78 |
+
{
|
79 |
+
if ($this->pluginIsActive())
|
80 |
{
|
81 |
+
if (!is_user_logged_in())
|
82 |
+
{
|
83 |
+
//send a 503 if the setting requires it
|
84 |
+
if (get_option('underConstructionHTTPStatus') == 503)
|
85 |
+
{
|
86 |
+
header('HTTP/1.1 503 Service Unavailable');
|
87 |
+
}
|
88 |
+
|
89 |
+
if ($this->displayStatusCodeIs(0)) //they want the default!
|
90 |
+
{
|
91 |
+
require_once ('defaultMessage.php');
|
92 |
+
displayDefaultComingSoonPage();
|
93 |
+
die();
|
94 |
+
}
|
95 |
+
|
96 |
+
if ($this->displayStatusCodeIs(1)) //they want the default with custom text!
|
97 |
+
{
|
98 |
+
require_once ('defaultMessage.php');
|
99 |
+
displayComingSoonPage($this->getCustomPageTitle(), $this->getCustomHeaderText(), $this->getCustomBodyText());
|
100 |
+
die();
|
101 |
+
}
|
102 |
+
|
103 |
+
if ($this->displayStatusCodeIs(2)) //they want custom HTML!
|
104 |
+
{
|
105 |
+
echo html_entity_decode($this->getCustomHTML());
|
106 |
+
die();
|
107 |
+
}
|
108 |
+
}
|
109 |
+
}
|
110 |
+
}
|
111 |
+
|
112 |
+
function getCustomHTML()
|
113 |
+
{
|
114 |
+
return stripslashes(get_option('underConstructionHTML'));
|
115 |
+
}
|
116 |
+
|
117 |
+
function uc_remove()
|
118 |
+
{
|
119 |
+
delete_option('underConstructionHTML');
|
120 |
+
}
|
121 |
+
|
122 |
+
function pluginIsActive()
|
123 |
+
{
|
124 |
+
|
125 |
+
if (!get_option('underConstructionActivationStatus')) //if it's not set yet
|
126 |
+
{
|
127 |
+
return false;
|
128 |
+
}
|
129 |
+
|
130 |
+
if (get_option('underConstructionActivationStatus') == 1)
|
131 |
+
{
|
132 |
+
return true;
|
133 |
}
|
134 |
else
|
135 |
{
|
136 |
+
return false;
|
137 |
+
}
|
138 |
+
}
|
139 |
+
|
140 |
+
function httpStatusCodeIs($status)
|
141 |
+
{
|
142 |
+
if (!get_option('underConstructionHTTPStatus')) //if it's not set yet
|
143 |
+
{
|
144 |
+
update_option('underConstructionHTTPStatus', 200); //set it
|
145 |
+
}
|
146 |
+
|
147 |
+
if (get_option('underConstructionHTTPStatus') == $status)
|
148 |
+
{
|
149 |
+
return true;
|
150 |
+
}
|
151 |
+
else
|
152 |
+
{
|
153 |
+
return false;
|
154 |
+
}
|
155 |
+
|
156 |
+
}
|
157 |
+
|
158 |
+
function displayStatusCodeIs($status)
|
159 |
+
{
|
160 |
+
if (!get_option('underConstructionDisplayOption')) //if it's not set yet
|
161 |
+
{
|
162 |
+
update_option('underConstructionDisplayOption', 0); //set it
|
163 |
+
}
|
164 |
+
|
165 |
+
if (get_option('underConstructionDisplayOption') == $status)
|
166 |
+
{
|
167 |
+
return true;
|
168 |
+
}
|
169 |
+
else
|
170 |
+
{
|
171 |
+
return false;
|
172 |
+
}
|
173 |
+
}
|
174 |
+
|
175 |
+
function getCustomPageTitle()
|
176 |
+
{
|
177 |
+
if (get_option('underConstructionCustomText') != false)
|
178 |
+
{
|
179 |
+
$fields = get_option('underConstructionCustomText');
|
180 |
+
return stripslashes($fields['pageTitle']);
|
181 |
+
}
|
182 |
+
else
|
183 |
+
{
|
184 |
+
return 'empty';
|
185 |
+
}
|
186 |
+
}
|
187 |
+
|
188 |
+
function getCustomHeaderText()
|
189 |
+
{
|
190 |
+
if (get_option('underConstructionCustomText') != false)
|
191 |
+
{
|
192 |
+
$fields = get_option('underConstructionCustomText');
|
193 |
+
return stripslashes($fields['headerText']);
|
194 |
+
}
|
195 |
+
else
|
196 |
+
{
|
197 |
+
return 'empty';
|
198 |
+
}
|
199 |
+
}
|
200 |
+
|
201 |
+
function getCustomBodyText()
|
202 |
+
{
|
203 |
+
if (get_option('underConstructionCustomText') != false)
|
204 |
+
{
|
205 |
+
$fields = get_option('underConstructionCustomText');
|
206 |
+
return stripslashes($fields['bodyText']);
|
207 |
+
}
|
208 |
+
else
|
209 |
+
{
|
210 |
+
return 'empty';
|
211 |
}
|
212 |
}
|
|
|
213 |
|
214 |
+
|
|
|
|
|
215 |
}
|
216 |
|
217 |
+
$underConstructionPlugin = new underConstruction();
|
218 |
+
|
219 |
+
add_action('template_redirect', array($underConstructionPlugin, 'uc_overrideWP'));
|
220 |
+
register_deactivation_hook(__FILE__, array($underConstructionPlugin, 'uc_remove'));
|
221 |
+
|
222 |
+
add_action('admin_init', array($underConstructionPlugin, 'underConstructionAdminInit'));
|
223 |
+
add_action('admin_menu', array($underConstructionPlugin, 'uc_adminMenu'));
|
224 |
+
|
225 |
+
|
226 |
+
function underConstructionPluginLinks($links, $file)
|
227 |
{
|
228 |
+
global $underConstructionPlugin;
|
229 |
+
if ($file == basename(dirname(__FILE__)).'/'.basename(__FILE__) && function_exists("admin_url"))
|
230 |
+
{
|
231 |
+
//add settings page
|
232 |
+
$manage_link = '<a href="'.admin_url('options-general.php?page='.$underConstructionPlugin->getMainOptionsPage()).'">'.__('Settings').'</a>';
|
233 |
+
array_unshift($links, $manage_link);
|
234 |
+
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
235 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
236 |
|
237 |
+
|
238 |
+
}
|
239 |
+
return $links;
|
240 |
}
|
241 |
|
242 |
+
add_filter('plugin_action_links', 'underConstructionPluginLinks', 10, 2);
|
243 |
+
|
|
|
244 |
?>
|
underconstruction.dev.js
ADDED
@@ -0,0 +1,23 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
document.observe("dom:loaded", function()
|
2 |
+
{
|
3 |
+
Event.observe('displayOption0', 'click', displayOption0Checked);
|
4 |
+
Event.observe('displayOption1', 'click', displayOption1Checked);
|
5 |
+
Event.observe('displayOption2', 'click', displayOption2Checked);
|
6 |
+
});
|
7 |
+
function displayOption0Checked()
|
8 |
+
{
|
9 |
+
document.getElementById('customText').style.display = 'none';
|
10 |
+
document.getElementById('customHTML').style.display = 'none';
|
11 |
+
}
|
12 |
+
|
13 |
+
function displayOption1Checked()
|
14 |
+
{
|
15 |
+
document.getElementById('customText').style.display = 'block';
|
16 |
+
document.getElementById('customHTML').style.display = 'none';
|
17 |
+
}
|
18 |
+
|
19 |
+
function displayOption2Checked()
|
20 |
+
{
|
21 |
+
document.getElementById('customText').style.display = 'none';
|
22 |
+
document.getElementById('customHTML').style.display = 'block';
|
23 |
+
}
|
underconstruction.min.js
ADDED
@@ -0,0 +1 @@
|
|
|
1 |
+
document.observe("dom:loaded",function(){Event.observe("displayOption0","click",displayOption0Checked);Event.observe("displayOption1","click",displayOption1Checked);Event.observe("displayOption2","click",displayOption2Checked)});function displayOption0Checked(){document.getElementById("customText").style.display="none";document.getElementById("customHTML").style.display="none"}function displayOption1Checked(){document.getElementById("customText").style.display="block";document.getElementById("customHTML").style.display="none"}function displayOption2Checked(){document.getElementById("customText").style.display="none";document.getElementById("customHTML").style.display="block"};
|