Version Description
- 2016/10/10
- minor fixes
- 1 new theme
Download this release
Release Info
Developer | WebFactory |
Plugin | Under Construction |
Version | 1.22 |
Comparing to | |
See all releases |
Code changes from version 1.20 to 1.22
- css/ucp-admin.css +59 -1
- css/ucp-toolbar.css +22 -0
- images/under_construction.png +0 -0
- readme.txt +7 -1
- themes/under_construction/index.php +67 -0
- themes/under_construction/style.css +74 -0
- themes/under_construction/under_construction.png +0 -0
- under-construction.php +103 -25
css/ucp-admin.css
CHANGED
@@ -27,5 +27,63 @@ div.ucp-thumb input {
|
|
27 |
|
28 |
.ucp-list {
|
29 |
list-style-type: circle;
|
30 |
-
list-style-position:
|
|
|
31 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
27 |
|
28 |
.ucp-list {
|
29 |
list-style-type: circle;
|
30 |
+
list-style-position: outside;
|
31 |
+
margin-left: 14px;
|
32 |
}
|
33 |
+
|
34 |
+
input[type=url]:invalid {
|
35 |
+
border-color: #EA1919;
|
36 |
+
-webkit-box-shadow: 0 0 2px rgba(234,25,25,1);
|
37 |
+
box-shadow: 0 0 2px rgba(234,25,25,1);
|
38 |
+
}
|
39 |
+
|
40 |
+
|
41 |
+
/* on/off switch */
|
42 |
+
|
43 |
+
.onoffswitch {
|
44 |
+
position: relative; width: 90px;
|
45 |
+
-webkit-user-select:none; -moz-user-select:none; -ms-user-select: none;
|
46 |
+
}
|
47 |
+
.onoffswitch .onoffswitch-checkbox {
|
48 |
+
display: none;
|
49 |
+
}
|
50 |
+
.onoffswitch-label {
|
51 |
+
display: block; overflow: hidden; cursor: pointer;
|
52 |
+
border: 2px solid #999999; border-radius: 20px;
|
53 |
+
}
|
54 |
+
.onoffswitch-inner {
|
55 |
+
display: block; width: 200%; margin-left: -100%;
|
56 |
+
transition: margin 0.3s ease-in 0s;
|
57 |
+
}
|
58 |
+
.onoffswitch-inner:before, .onoffswitch-inner:after {
|
59 |
+
display: block; float: left; width: 50%; height: 30px; padding: 0; line-height: 30px;
|
60 |
+
font-size: 14px; color: white; font-family: Trebuchet, Arial, sans-serif; font-weight: bold;
|
61 |
+
box-sizing: border-box;
|
62 |
+
}
|
63 |
+
.onoffswitch-inner:before {
|
64 |
+
content: "ON";
|
65 |
+
padding-left: 10px;
|
66 |
+
background-color: #008EC2; color: #FFFFFF;
|
67 |
+
}
|
68 |
+
.onoffswitch-inner:after {
|
69 |
+
content: "OFF";
|
70 |
+
padding-right: 10px;
|
71 |
+
background-color: #EEEEEE; color: #999999;
|
72 |
+
text-align: right;
|
73 |
+
}
|
74 |
+
.onoffswitch-switch {
|
75 |
+
display: block; width: 18px; margin: 6px;
|
76 |
+
background: #FFFFFF;
|
77 |
+
position: absolute; top: 0; bottom: 0;
|
78 |
+
right: 56px;
|
79 |
+
border: 2px solid #999999; border-radius: 20px;
|
80 |
+
transition: all 0.3s ease-in 0s;
|
81 |
+
}
|
82 |
+
.onoffswitch-checkbox:checked + .onoffswitch-label .onoffswitch-inner {
|
83 |
+
margin-left: 0;
|
84 |
+
}
|
85 |
+
.onoffswitch-checkbox:checked + .onoffswitch-label .onoffswitch-switch {
|
86 |
+
right: 0px;
|
87 |
+
}
|
88 |
+
|
89 |
+
/* on/off switch */
|
css/ucp-toolbar.css
ADDED
@@ -0,0 +1,22 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
/*
|
2 |
+
* Under Construction
|
3 |
+
* WP toolbar CSS
|
4 |
+
* (c) Web factory Ltd, 2015 - 2016
|
5 |
+
*/
|
6 |
+
|
7 |
+
|
8 |
+
#wp-admin-bar-construction-mode.ucp-enabled .dashicons {
|
9 |
+
color: #02CA02;
|
10 |
+
font-family: dashicons;
|
11 |
+
font-size: 14px;
|
12 |
+
}
|
13 |
+
|
14 |
+
#wp-admin-bar-construction-mode.ucp-disabled .dashicons {
|
15 |
+
color: #EA1919;
|
16 |
+
font-family: dashicons;
|
17 |
+
font-size: 14px;
|
18 |
+
}
|
19 |
+
|
20 |
+
#wp-admin-bar-construction-mode strong {
|
21 |
+
font-weight: bold;
|
22 |
+
}
|
images/under_construction.png
ADDED
Binary file
|
readme.txt
CHANGED
@@ -3,7 +3,7 @@ Contributors: WebFactory
|
|
3 |
Tags: under construction page, coming soon page, maintenance, maintenance page, coming soon, maintenance mode, under construction mode, coming soon mode, site unavailable, under construction, landing page
|
4 |
Requires at least: 4.0
|
5 |
Tested up to: 4.6
|
6 |
-
Stable tag: 1.
|
7 |
License: GPLv2 or later
|
8 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
9 |
|
@@ -49,10 +49,16 @@ Or if needed, upload manually;
|
|
49 |
1. Under Construction settings screen
|
50 |
2. Mad Designer theme
|
51 |
3. Plain Text theme
|
|
|
52 |
|
53 |
|
54 |
== Changelog ==
|
55 |
|
|
|
|
|
|
|
|
|
|
|
56 |
= 1.20 =
|
57 |
* 2016/09/27
|
58 |
* complete rewrite of the plugin
|
3 |
Tags: under construction page, coming soon page, maintenance, maintenance page, coming soon, maintenance mode, under construction mode, coming soon mode, site unavailable, under construction, landing page
|
4 |
Requires at least: 4.0
|
5 |
Tested up to: 4.6
|
6 |
+
Stable tag: 1.22
|
7 |
License: GPLv2 or later
|
8 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
9 |
|
49 |
1. Under Construction settings screen
|
50 |
2. Mad Designer theme
|
51 |
3. Plain Text theme
|
52 |
+
4. Under Construction theme
|
53 |
|
54 |
|
55 |
== Changelog ==
|
56 |
|
57 |
+
= 1.22 =
|
58 |
+
* 2016/10/10
|
59 |
+
* minor fixes
|
60 |
+
* 1 new theme
|
61 |
+
|
62 |
= 1.20 =
|
63 |
* 2016/09/27
|
64 |
* complete rewrite of the plugin
|
themes/under_construction/index.php
ADDED
@@ -0,0 +1,67 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/*
|
3 |
+
* Under Construction
|
4 |
+
* Under construction theme
|
5 |
+
* (c) Web factory Ltd, 2015 - 2016
|
6 |
+
*/
|
7 |
+
|
8 |
+
|
9 |
+
// this is an include only WP file
|
10 |
+
if (!defined('ABSPATH')) {
|
11 |
+
die;
|
12 |
+
}
|
13 |
+
?>
|
14 |
+
<!DOCTYPE html>
|
15 |
+
<html lang="en">
|
16 |
+
<head>
|
17 |
+
<meta charset="utf-8">
|
18 |
+
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
19 |
+
<meta name="viewport" content="width=device-width, initial-scale=1">
|
20 |
+
<title>[title]</title>
|
21 |
+
<meta name="description" content="[description]" />
|
22 |
+
<meta name="generator" content="Under Construction plugin for WordPress">
|
23 |
+
<link rel="stylesheet" href="[theme-url-common]css/bootstrap.min.css?v=[version]" type="text/css">
|
24 |
+
<link rel="stylesheet" href="[theme-url]style.css?v=[version]" type="text/css">
|
25 |
+
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Roboto:400,900">
|
26 |
+
<link rel="stylesheet" href="[theme-url-common]css/font-awesome.min.css?v=[version]" type="text/css">
|
27 |
+
</head>
|
28 |
+
|
29 |
+
<body>
|
30 |
+
<div class="container">
|
31 |
+
<div class="row">
|
32 |
+
<div class="col-xs-12 col-md-12 col-lg-12">
|
33 |
+
<h1>[heading1]</h1>
|
34 |
+
</div>
|
35 |
+
</div>
|
36 |
+
</div>
|
37 |
+
|
38 |
+
<div id="hero-image">
|
39 |
+
<img src="[theme-url]under_construction.png" alt="Construction work in progress" title="Construction work in progress">
|
40 |
+
</div>
|
41 |
+
<div class="container">
|
42 |
+
|
43 |
+
<div class="row">
|
44 |
+
<div class="col-xs-12 col-md-8 col-md-offset-2 col-lg-offset-2 col-lg-8">
|
45 |
+
<p class="content">[content]</p>
|
46 |
+
</div>
|
47 |
+
</div>
|
48 |
+
|
49 |
+
<div class="row" id="social">
|
50 |
+
<div class="col-xs-12 col-md-12 col-lg-12">
|
51 |
+
<?php
|
52 |
+
if (!empty($options['social_facebook'])) {
|
53 |
+
echo '<a href="' . $options['social_facebook'] . '" target="_blank"><i class="fa fa-facebook-square fa-3x"></i></a>';
|
54 |
+
}
|
55 |
+
if (!empty($options['social_twitter'])) {
|
56 |
+
echo '<a href="' . $options['social_twitter'] . '" target="_blank"><i class="fa fa-twitter-square fa-3x"></i></a>';
|
57 |
+
}
|
58 |
+
if (!empty($options['social_google'])) {
|
59 |
+
echo '<a href="' . $options['social_google'] . '" target="_blank"><i class="fa fa-google-plus-square fa-3x"></i></a>';
|
60 |
+
}
|
61 |
+
?>
|
62 |
+
</div>
|
63 |
+
</div>
|
64 |
+
|
65 |
+
</div>
|
66 |
+
</body>
|
67 |
+
</html>
|
themes/under_construction/style.css
ADDED
@@ -0,0 +1,74 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
/*
|
2 |
+
* Under Construction
|
3 |
+
* Mad Designer theme CSS
|
4 |
+
* (c) Web factory Ltd, 2015 - 2016
|
5 |
+
*/
|
6 |
+
|
7 |
+
|
8 |
+
html {
|
9 |
+
height: 100%;
|
10 |
+
padding: 0;
|
11 |
+
margin: 0;
|
12 |
+
}
|
13 |
+
|
14 |
+
body {
|
15 |
+
font-weight: 400;
|
16 |
+
font-size: 14px;
|
17 |
+
line-height: 120%;
|
18 |
+
color: #222222;
|
19 |
+
background: #d2d3d5; /* Old browsers */
|
20 |
+
background: -moz-linear-gradient(-45deg, #d2d3d5 0%, #e4e5e7 44%, #fafafa 80%); /* FF3.6-15 */
|
21 |
+
background: -webkit-linear-gradient(-45deg, #d2d3d5 0%,#e4e5e7 44%,#fafafa 80%); /* Chrome10-25,Safari5.1-6 */
|
22 |
+
background: linear-gradient(135deg, #d2d3d5 0%,#e4e5e7 44%,#fafafa 80%); /* W3C, IE10+, FF16+, Chrome26+, Opera12+, Safari7+ */
|
23 |
+
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#d2d3d5', endColorstr='#fafafa',GradientType=1 ); /* IE6-9 fallback on horizontal gradient */
|
24 |
+
padding: 0;
|
25 |
+
margin: 0;
|
26 |
+
}
|
27 |
+
|
28 |
+
#hero-image {
|
29 |
+
text-align: center;
|
30 |
+
margin: 20px auto 40px auto;
|
31 |
+
}
|
32 |
+
|
33 |
+
#hero-image img {
|
34 |
+
max-width: 80%;
|
35 |
+
}
|
36 |
+
|
37 |
+
h1 {
|
38 |
+
font-size: 34px;
|
39 |
+
color: #222222;
|
40 |
+
font-family: "Roboto", sans-serif;
|
41 |
+
font-weight: 900;
|
42 |
+
margin: 20px 0 30px 0;
|
43 |
+
text-align: center;
|
44 |
+
}
|
45 |
+
|
46 |
+
.content {
|
47 |
+
text-align: center;
|
48 |
+
font-family: "Helvetica", "Arial", sans-serif;
|
49 |
+
}
|
50 |
+
|
51 |
+
#social {
|
52 |
+
text-align: center;
|
53 |
+
margin-top: 30px;
|
54 |
+
}
|
55 |
+
|
56 |
+
#social a i {
|
57 |
+
color: #23272a;
|
58 |
+
margin: 10px;
|
59 |
+
box-sizing: content-box;
|
60 |
+
}
|
61 |
+
|
62 |
+
#social a:hover i {
|
63 |
+
color: #e78967;
|
64 |
+
}
|
65 |
+
|
66 |
+
@media(max-width:767px){
|
67 |
+
h1 {
|
68 |
+
font-size: 30px;
|
69 |
+
margin: 10px 0 30px 0;
|
70 |
+
}
|
71 |
+
#hero-image img {
|
72 |
+
max-width: 95%;
|
73 |
+
}
|
74 |
+
}
|
themes/under_construction/under_construction.png
ADDED
Binary file
|
under-construction.php
CHANGED
@@ -4,7 +4,7 @@
|
|
4 |
Plugin URI: https://wordpress.org/plugins/under-construction-page/
|
5 |
Description: Hide your site behind a great looking under construction page while you do maintenance work.
|
6 |
Author: Web factory Ltd
|
7 |
-
Version: 1.
|
8 |
Author URI: http://www.webfactoryltd.com/
|
9 |
Text Domain: under-construction-page
|
10 |
Domain Path: lang
|
@@ -37,6 +37,7 @@ define('UCP_PLUGIN_URL', plugin_dir_url(__FILE__));
|
|
37 |
define('UCP_OPTIONS_KEY', 'ucp_options');
|
38 |
define('UCP_META_KEY', 'ucp_meta');
|
39 |
define('UCP_POINTERS_KEY', 'ucp_pointers');
|
|
|
40 |
|
41 |
// main plugin class
|
42 |
class UCP {
|
@@ -75,7 +76,8 @@ class UCP {
|
|
75 |
add_filter('plugin_row_meta', array(__CLASS__, 'plugin_meta_links'), 10, 2);
|
76 |
|
77 |
// manages admin header notifications
|
78 |
-
add_action('admin_notices', array(__CLASS__, '
|
|
|
79 |
|
80 |
// enqueue admin scripts
|
81 |
add_action('admin_enqueue_scripts', array(__CLASS__, 'admin_enqueue_scripts'));
|
@@ -101,7 +103,7 @@ class UCP {
|
|
101 |
// check if user has the minimal WP version required by UCP
|
102 |
static function check_wp_version($min_version) {
|
103 |
if (!version_compare(get_bloginfo('version'), $min_version, '>=')) {
|
104 |
-
add_action('admin_notices', array(__CLASS__, '
|
105 |
return false;
|
106 |
} else {
|
107 |
return true;
|
@@ -110,7 +112,7 @@ class UCP {
|
|
110 |
|
111 |
|
112 |
// display error message if WP version is too low
|
113 |
-
static function
|
114 |
echo '<div class="error"><p>' . sprintf('Under Construction plugin <b>requires WordPress version 4.0</b> or higher to function properly. You are using WordPress version %s. Please <a href="%s">update it</a>.', get_bloginfo('version'), admin_url('update-core.php')) . '</p></div>';
|
115 |
} // notice_min_wp_version_error
|
116 |
|
@@ -209,6 +211,8 @@ class UCP {
|
|
209 |
|
210 |
// enqueue CSS and JS scripts in admin
|
211 |
static function admin_enqueue_scripts($hook) {
|
|
|
|
|
212 |
$js_localize = array('undocumented_error' => __('An undocumented error has occured. Please refresh the page and try again.', 'under-construction-page'),
|
213 |
'plugin_name' => __('Under Construction', 'under-construction-page'),
|
214 |
'settings_url' => admin_url('options-general.php?page=ucp'),
|
@@ -225,7 +229,7 @@ class UCP {
|
|
225 |
}
|
226 |
|
227 |
$pointers = get_option(UCP_POINTERS_KEY);
|
228 |
-
if ($pointers) {
|
229 |
$pointers['_nonce_dismiss_pointer'] = wp_create_nonce('ucp_dismiss_pointer');
|
230 |
wp_enqueue_script('wp-pointer');
|
231 |
wp_enqueue_script('ucp-pointers', plugins_url('js/ucp-admin-pointers.js', __FILE__), array('jquery'), self::$version, true);
|
@@ -337,11 +341,52 @@ class UCP {
|
|
337 |
|
338 |
|
339 |
// displays various notices in admin header
|
340 |
-
static function
|
341 |
-
|
|
|
342 |
echo '<div id="message" class="error"><p>Caution: Under Construction mode is <strong>enabled</strong>! Edit <a href="' . admin_url('options-general.php?page=ucp') . '" title="Under Construction Settings">settings</a> to disable it.</p></div>';
|
343 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
344 |
} // notices
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
345 |
|
346 |
|
347 |
// add admin bar notice when construction is enabled
|
@@ -349,13 +394,20 @@ class UCP {
|
|
349 |
global $wp_admin_bar;
|
350 |
|
351 |
if (self::is_construction_mode_enabled(true)) {
|
352 |
-
$
|
353 |
-
|
354 |
-
|
355 |
-
|
356 |
-
|
357 |
-
));
|
358 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
359 |
} // admin_bar_notice
|
360 |
|
361 |
|
@@ -425,7 +477,9 @@ class UCP {
|
|
425 |
break;
|
426 |
} // switch
|
427 |
} // foreach
|
|
|
428 |
$options['roles'] = (array) $options['roles'];
|
|
|
429 |
|
430 |
if ($options['status'] != $old_options['status']) {
|
431 |
global $file_prefix;
|
@@ -442,14 +496,14 @@ class UCP {
|
|
442 |
|
443 |
|
444 |
// checkbox helper function
|
445 |
-
static function checked($value, $
|
446 |
$out = '';
|
447 |
|
448 |
-
if (!is_array($
|
449 |
-
$
|
450 |
}
|
451 |
|
452 |
-
if (in_array($value, $
|
453 |
$out = ' checked="checked" ';
|
454 |
}
|
455 |
|
@@ -461,6 +515,18 @@ class UCP {
|
|
461 |
} // checked
|
462 |
|
463 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
464 |
// helper function for creating dropdowns
|
465 |
static function create_select_options($options, $selected = null, $output = true) {
|
466 |
$out = "\n";
|
@@ -518,9 +584,15 @@ class UCP {
|
|
518 |
|
519 |
echo '<tr valign="top">
|
520 |
<th scope="row"><label for="status">Status</label></th>
|
521 |
-
<td><
|
522 |
-
|
523 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
524 |
echo '<p class="description">By enabling construction mode all users (<a href="#whitelisted-roles">except selected ones</a>) will not be able to access the site\'s content. They will only see the under construction page.</p>';
|
525 |
echo '</td></tr>';
|
526 |
|
@@ -528,8 +600,12 @@ class UCP {
|
|
528 |
echo '<tr valign="top">
|
529 |
<th scope="row">Theme</th>
|
530 |
<td>
|
531 |
-
<div class="ucp-thumb"><label for="layout-1"><img src="' . $img . 'mad_designer.png" alt="Mad Designer" title="Mad Designer" /></label><br /><input ' . checked('mad_designer', $options['theme']
|
532 |
-
|
|
|
|
|
|
|
|
|
533 |
<div class="ucp-thumb"><a href="https://twitter.com/intent/tweet?text=' . urlencode('@webfactoryltd I need more themes for Under Construction #wordpress plugin. When are they coming out?') . '&url=https://wordpress.org/plugins/under-construction-page/" target="_blank"><img src="' . $img . 'more_coming_soon.png" alt="Need more themes?" title="Need more themes?" /></a><br />Click for More Themes</div>
|
534 |
</td></tr>';
|
535 |
|
@@ -562,19 +638,19 @@ class UCP {
|
|
562 |
|
563 |
echo '<tr valign="top">
|
564 |
<th scope="row"><label for="social_facebook">Facebook Page</label></th>
|
565 |
-
<td><input id="social_facebook" type="
|
566 |
echo '<p class="description">Complete URL, with http prefix, to Facebook page.</p>';
|
567 |
echo '</td></tr>';
|
568 |
|
569 |
echo '<tr valign="top">
|
570 |
<th scope="row"><label for="social_twitter">Twitter Username</label></th>
|
571 |
-
<td><input id="social_twitter" type="
|
572 |
echo '<p class="description">Complete URL, with http prefix, to Twitter profile page.</p>';
|
573 |
echo '</td></tr>';
|
574 |
|
575 |
echo '<tr valign="top">
|
576 |
<th scope="row"><label for="social_google">Google Page</label></th>
|
577 |
-
<td><input id="social_google" type="
|
578 |
echo '<p class="description">Complete URL, with http prefix, to Google+ page.</p>';
|
579 |
echo '</td></tr>';
|
580 |
|
@@ -612,6 +688,7 @@ class UCP {
|
|
612 |
// clean up on deactivation
|
613 |
static function deactivate() {
|
614 |
delete_option(UCP_POINTERS_KEY);
|
|
|
615 |
} // deactivate
|
616 |
|
617 |
|
@@ -620,6 +697,7 @@ class UCP {
|
|
620 |
delete_option(UCP_OPTIONS_KEY);
|
621 |
delete_option(UCP_META_KEY);
|
622 |
delete_option(UCP_POINTERS_KEY);
|
|
|
623 |
} // uninstall
|
624 |
} // class UCP
|
625 |
|
4 |
Plugin URI: https://wordpress.org/plugins/under-construction-page/
|
5 |
Description: Hide your site behind a great looking under construction page while you do maintenance work.
|
6 |
Author: Web factory Ltd
|
7 |
+
Version: 1.22
|
8 |
Author URI: http://www.webfactoryltd.com/
|
9 |
Text Domain: under-construction-page
|
10 |
Domain Path: lang
|
37 |
define('UCP_OPTIONS_KEY', 'ucp_options');
|
38 |
define('UCP_META_KEY', 'ucp_meta');
|
39 |
define('UCP_POINTERS_KEY', 'ucp_pointers');
|
40 |
+
define('UCP_NOTICES_KEY', 'ucp_notices');
|
41 |
|
42 |
// main plugin class
|
43 |
class UCP {
|
76 |
add_filter('plugin_row_meta', array(__CLASS__, 'plugin_meta_links'), 10, 2);
|
77 |
|
78 |
// manages admin header notifications
|
79 |
+
add_action('admin_notices', array(__CLASS__, 'admin_notices'));
|
80 |
+
add_action('admin_action_ucp_dismiss_notice', array(__CLASS__, 'dismiss_notice'));
|
81 |
|
82 |
// enqueue admin scripts
|
83 |
add_action('admin_enqueue_scripts', array(__CLASS__, 'admin_enqueue_scripts'));
|
103 |
// check if user has the minimal WP version required by UCP
|
104 |
static function check_wp_version($min_version) {
|
105 |
if (!version_compare(get_bloginfo('version'), $min_version, '>=')) {
|
106 |
+
add_action('admin_notices', array(__CLASS__, 'notice_min_wp_version'));
|
107 |
return false;
|
108 |
} else {
|
109 |
return true;
|
112 |
|
113 |
|
114 |
// display error message if WP version is too low
|
115 |
+
static function notice_min_wp_version() {
|
116 |
echo '<div class="error"><p>' . sprintf('Under Construction plugin <b>requires WordPress version 4.0</b> or higher to function properly. You are using WordPress version %s. Please <a href="%s">update it</a>.', get_bloginfo('version'), admin_url('update-core.php')) . '</p></div>';
|
117 |
} // notice_min_wp_version_error
|
118 |
|
211 |
|
212 |
// enqueue CSS and JS scripts in admin
|
213 |
static function admin_enqueue_scripts($hook) {
|
214 |
+
wp_enqueue_style('ucp-toolbar', UCP_PLUGIN_URL . 'css/ucp-toolbar.css', array(), self::$version);
|
215 |
+
|
216 |
$js_localize = array('undocumented_error' => __('An undocumented error has occured. Please refresh the page and try again.', 'under-construction-page'),
|
217 |
'plugin_name' => __('Under Construction', 'under-construction-page'),
|
218 |
'settings_url' => admin_url('options-general.php?page=ucp'),
|
229 |
}
|
230 |
|
231 |
$pointers = get_option(UCP_POINTERS_KEY);
|
232 |
+
if ($pointers && 'settings_page_ucp' != $hook) {
|
233 |
$pointers['_nonce_dismiss_pointer'] = wp_create_nonce('ucp_dismiss_pointer');
|
234 |
wp_enqueue_script('wp-pointer');
|
235 |
wp_enqueue_script('ucp-pointers', plugins_url('js/ucp-admin-pointers.js', __FILE__), array('jquery'), self::$version, true);
|
341 |
|
342 |
|
343 |
// displays various notices in admin header
|
344 |
+
static function admin_notices() {
|
345 |
+
// temporary disabled, todo
|
346 |
+
if (0 && self::is_construction_mode_enabled(true)) {
|
347 |
echo '<div id="message" class="error"><p>Caution: Under Construction mode is <strong>enabled</strong>! Edit <a href="' . admin_url('options-general.php?page=ucp') . '" title="Under Construction Settings">settings</a> to disable it.</p></div>';
|
348 |
}
|
349 |
+
|
350 |
+
$notices = get_option(UCP_NOTICES_KEY);
|
351 |
+
$meta = self::get_meta();
|
352 |
+
|
353 |
+
if (empty($notices['dismiss_rate']) &&
|
354 |
+
(current_time('timestamp') - $meta['first_install']) > (DAY_IN_SECONDS * 3)) {
|
355 |
+
$rate_url = 'https://wordpress.org/support/plugin/under-construction-page/reviews/#new-post';
|
356 |
+
$dismiss_url = add_query_arg(array('action' => 'ucp_dismiss_notice', 'notice' => 'rate', 'redirect' => urlencode($_SERVER['REQUEST_URI'])), admin_url('admin.php'));
|
357 |
+
|
358 |
+
echo '<div id="ucp_rate_notice" class="notice-info notice"><p>Hi! We saw you\'ve been using <b>Under Construction</b> plugin for a few days and wanted to ask for your help to <b>make the plugin better</b>.<br>We just need a minute of your time to rate the plugin. Thank you!';
|
359 |
+
|
360 |
+
echo '<br><a target="_blank" href="' . esc_url($rate_url) . '" style="vertical-align: baseline; margin-top: 15px;" class="button-primary">Help us out & rate the plugin</a>';
|
361 |
+
echo ' <a href="' . esc_url($dismiss_url) . '">I\'ve already rated the plugin</a>';
|
362 |
+
echo '</p></div>';
|
363 |
+
}
|
364 |
} // notices
|
365 |
+
|
366 |
+
|
367 |
+
// handle dismiss button for notices
|
368 |
+
static function dismiss_notice() {
|
369 |
+
if (empty($_GET['notice'])) {
|
370 |
+
wp_redirect(admin_url());
|
371 |
+
exit;
|
372 |
+
}
|
373 |
+
|
374 |
+
$notices = get_option(UCP_NOTICES_KEY, array());
|
375 |
+
|
376 |
+
if ($_GET['notice'] == 'rate') {
|
377 |
+
$notices['dismiss_rate'] = true;
|
378 |
+
}
|
379 |
+
|
380 |
+
update_option(UCP_NOTICES_KEY, $notices);
|
381 |
+
|
382 |
+
if (!empty($_GET['redirect'])) {
|
383 |
+
wp_redirect($_GET['redirect']);
|
384 |
+
} else {
|
385 |
+
wp_redirect(admin_url());
|
386 |
+
}
|
387 |
+
|
388 |
+
exit;
|
389 |
+
} // dismiss_notice
|
390 |
|
391 |
|
392 |
// add admin bar notice when construction is enabled
|
394 |
global $wp_admin_bar;
|
395 |
|
396 |
if (self::is_construction_mode_enabled(true)) {
|
397 |
+
$title = '<span class="dashicons dashicons-admin-generic"></span> <span class="ab-label">Under Construction mode is <strong>enabled</strong></span>';
|
398 |
+
$class = 'ucp-enabled';
|
399 |
+
} else {
|
400 |
+
$title = '<span class="dashicons dashicons-admin-generic"></span> <span class="ab-label">Under Construction mode is disabled</span>';
|
401 |
+
$class = 'ucp-disabled';
|
|
|
402 |
}
|
403 |
+
|
404 |
+
$wp_admin_bar->add_menu(array(
|
405 |
+
'parent' => '',
|
406 |
+
'id' => 'construction-mode',
|
407 |
+
'title' => $title,
|
408 |
+
'href' => admin_url('options-general.php?page=ucp'),
|
409 |
+
'meta' => array('class' => $class)
|
410 |
+
));
|
411 |
} // admin_bar_notice
|
412 |
|
413 |
|
477 |
break;
|
478 |
} // switch
|
479 |
} // foreach
|
480 |
+
|
481 |
$options['roles'] = (array) $options['roles'];
|
482 |
+
$options = self::check_var_isset($options, array('status' => 0));
|
483 |
|
484 |
if ($options['status'] != $old_options['status']) {
|
485 |
global $file_prefix;
|
496 |
|
497 |
|
498 |
// checkbox helper function
|
499 |
+
static function checked($value, $current, $echo = false) {
|
500 |
$out = '';
|
501 |
|
502 |
+
if (!is_array($current)) {
|
503 |
+
$current = (array) $current;
|
504 |
}
|
505 |
|
506 |
+
if (in_array($value, $current)) {
|
507 |
$out = ' checked="checked" ';
|
508 |
}
|
509 |
|
515 |
} // checked
|
516 |
|
517 |
|
518 |
+
// helper function for $_POST checkbox handling
|
519 |
+
static function check_var_isset($values, $variables) {
|
520 |
+
foreach ($variables as $key => $value) {
|
521 |
+
if (!isset($values[$key])) {
|
522 |
+
$values[$key] = $value;
|
523 |
+
}
|
524 |
+
}
|
525 |
+
|
526 |
+
return $values;
|
527 |
+
} // check_var_isset
|
528 |
+
|
529 |
+
|
530 |
// helper function for creating dropdowns
|
531 |
static function create_select_options($options, $selected = null, $output = true) {
|
532 |
$out = "\n";
|
584 |
|
585 |
echo '<tr valign="top">
|
586 |
<th scope="row"><label for="status">Status</label></th>
|
587 |
+
<td><div class="onoffswitch">
|
588 |
+
<input ' . self::checked(1, $options['status']) . ' type="checkbox" value="1" name="' . UCP_OPTIONS_KEY . '[status]" class="onoffswitch-checkbox" id="status">
|
589 |
+
<label class="onoffswitch-label" for="status">
|
590 |
+
<span class="onoffswitch-inner"></span>
|
591 |
+
<span class="onoffswitch-switch"></span>
|
592 |
+
</label>
|
593 |
+
</div>
|
594 |
+
';
|
595 |
+
|
596 |
echo '<p class="description">By enabling construction mode all users (<a href="#whitelisted-roles">except selected ones</a>) will not be able to access the site\'s content. They will only see the under construction page.</p>';
|
597 |
echo '</td></tr>';
|
598 |
|
600 |
echo '<tr valign="top">
|
601 |
<th scope="row">Theme</th>
|
602 |
<td>
|
603 |
+
<div class="ucp-thumb"><label for="layout-1"><img src="' . $img . 'mad_designer.png" alt="Mad Designer" title="Mad Designer" /></label><br /><input ' . self::checked('mad_designer', $options['theme']) . ' type="radio" id="layout-1" name="' . UCP_OPTIONS_KEY . '[theme]" value="mad_designer" /> Mad Designer</div>
|
604 |
+
|
605 |
+
<div class="ucp-thumb"><label for="layout-2"><img src="' . $img . 'plain_text.png" alt="Plain Text" title="Plain Text" /></label><br /><input ' . self::checked('plain_text', $options['theme']) . ' type="radio" id="layout-2" name="' . UCP_OPTIONS_KEY . '[theme]" value="plain_text" /> Plain Text</div>
|
606 |
+
|
607 |
+
<div class="ucp-thumb"><label for="layout-3"><img src="' . $img . 'under_construction.png" alt="Under Construction" title="Under Construction" /></label><br /><input ' . self::checked('under_construction', $options['theme']) . ' type="radio" id="layout-3" name="' . UCP_OPTIONS_KEY . '[theme]" value="under_construction" /> Under Construction</div>
|
608 |
+
|
609 |
<div class="ucp-thumb"><a href="https://twitter.com/intent/tweet?text=' . urlencode('@webfactoryltd I need more themes for Under Construction #wordpress plugin. When are they coming out?') . '&url=https://wordpress.org/plugins/under-construction-page/" target="_blank"><img src="' . $img . 'more_coming_soon.png" alt="Need more themes?" title="Need more themes?" /></a><br />Click for More Themes</div>
|
610 |
</td></tr>';
|
611 |
|
638 |
|
639 |
echo '<tr valign="top">
|
640 |
<th scope="row"><label for="social_facebook">Facebook Page</label></th>
|
641 |
+
<td><input id="social_facebook" type="url" class="regular-text code" name="' . UCP_OPTIONS_KEY . '[social_facebook]" value="' . $options['social_facebook'] . '" placeholder="Facebook business or personal page URL">';
|
642 |
echo '<p class="description">Complete URL, with http prefix, to Facebook page.</p>';
|
643 |
echo '</td></tr>';
|
644 |
|
645 |
echo '<tr valign="top">
|
646 |
<th scope="row"><label for="social_twitter">Twitter Username</label></th>
|
647 |
+
<td><input id="social_twitter" type="url" class="regular-text code" name="' . UCP_OPTIONS_KEY . '[social_twitter]" value="' . $options['social_twitter'] . '" placeholder="Twitter profile URL">';
|
648 |
echo '<p class="description">Complete URL, with http prefix, to Twitter profile page.</p>';
|
649 |
echo '</td></tr>';
|
650 |
|
651 |
echo '<tr valign="top">
|
652 |
<th scope="row"><label for="social_google">Google Page</label></th>
|
653 |
+
<td><input id="social_google" type="url" class="regular-text code" name="' . UCP_OPTIONS_KEY . '[social_google]" value="' . $options['social_google'] . '" placeholder="Google+ page URL">';
|
654 |
echo '<p class="description">Complete URL, with http prefix, to Google+ page.</p>';
|
655 |
echo '</td></tr>';
|
656 |
|
688 |
// clean up on deactivation
|
689 |
static function deactivate() {
|
690 |
delete_option(UCP_POINTERS_KEY);
|
691 |
+
delete_option(UCP_NOTICES_KEY);
|
692 |
} // deactivate
|
693 |
|
694 |
|
697 |
delete_option(UCP_OPTIONS_KEY);
|
698 |
delete_option(UCP_META_KEY);
|
699 |
delete_option(UCP_POINTERS_KEY);
|
700 |
+
delete_option(UCP_NOTICES_KEY);
|
701 |
} // uninstall
|
702 |
} // class UCP
|
703 |
|