Under Construction - Version 2.45

Version Description

  • 2017/08/21
  • support is now available directly from the Support tab
  • added notification when UCP is enabled and End Date is in the past resulting in UCP not being shown
  • retry-after header is now properly set
  • minor improvements
Download this release

Release Info

Developer WebFactory
Plugin Icon 128x128 Under Construction
Version 2.45
Comparing to
See all releases

Code changes from version 2.40 to 2.45

css/ucp-admin.css CHANGED
@@ -19,10 +19,23 @@
19
  padding-top: 0;
20
  }
21
 
22
- #ucp_support p {
23
  font-size: 14px;
24
  }
25
 
 
 
 
 
 
 
 
 
 
 
 
 
 
26
  .form-table th {
27
  padding: 15px 10px 20px 0;
28
  }
@@ -31,6 +44,28 @@
31
  width: 100px;
32
  }
33
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
34
  .settings_page_ucp h1:hover img {
35
  transform: rotate(360deg);
36
  }
@@ -422,3 +457,25 @@ License: creativecommons.org/licenses/by-nc-sa/3.0/
422
  Any+Time is a trademark of Andrew M. Andrews III */
423
 
424
  .AnyTime-pkr *{border:0;font:inherit;font-size:x-small;font-style:normal;font-weight:400;list-style-type:none;margin:0;padding:0;white-space:nowrap;-moz-box-sizing:border-box;-webkit-box-sizing:border-box;box-sizing:border-box}.AnyTime-win{background-color:#F0F0F1;border:3px solid silver;display:inline-block;font:normal normal normal xx-small/normal sans-serif;-moz-border-radius:6px;-webkit-border-radius:6px;border-radius:6px}.AnyTime-pkr,.AnyTime-pkr *{text-align:center}.AnyTime-pkr .AnyTime-cloak{background-color:#D7D7D7;opacity:.7;position:absolute;filter:alpha(opacity=70)}.AnyTime-pkr .AnyTime-hdr{background-color:#D0D0D1;color:#606062;font-family:Arial,Helvetica,sans-serif;font-size:medium;font-weight:400;-moz-border-radius:2px;-webkit-border-radius:2px;border-radius:2px}.AnyTime-pkr .AnyTime-x-btn{background-color:#FCFCFF;border:1px solid #F99;color:#FF9F9F;cursor:default;float:right;margin:.25em .25em 0 0;width:1.5em;-moz-border-radius:.4em;-webkit-border-radius:.4em;border-radius:.4em}.AnyTime-pkr .AnyTime-btn{background-color:#FCFCFE;border:1px solid #999;color:#606062;cursor:default;font-family:Arial,Helvetica,sans-serif;margin:0 .1em .1em 0;padding:.2em .3em;-moz-border-radius:.1em;-webkit-border-radius:.1em;border-radius:.1em}.AnyTime-pkr .AnyTime-body{margin:0 1em 1em 0}.AnyTime-pkr .AnyTime-date{display:inline-block;margin-left:1em;vertical-align:top}.AnyTime-pkr .AnyTime-lbl{color:#606063;font-family:Arial,Helvetica,sans-serif;font-size:100%;font-weight:400;font-style:normal;margin-top:.8em}.AnyTime-pkr .AnyTime-yrs{width:20em}.AnyTime-pkr .AnyTime-yrs-past-btn,.AnyTime-pkr .AnyTime-yrs-ahead-btn{display:inline-block;width:2.4em}.AnyTime-pkr .AnyTime-yr-prior-btn,.AnyTime-pkr .AnyTime-yr-cur-btn,.AnyTime-pkr .AnyTime-yr-next-btn{display:inline-block;width:4.8em}.AnyTime-pkr .AnyTime-mons{width:20em}.AnyTime-pkr .AnyTime-mons:after{content:"";display:table;clear:both}.AnyTime-pkr .AnyTime-mon-btn{float:left;width:3.2em}.AnyTime-pkr .AnyTime-mon7-btn{clear:left}.AnyTime-pkr .AnyTime-dom-table{background-color:#F0F0F1;border:1px solid #E3E3E4;border-spacing:1px;width:20em}.AnyTime-pkr th.AnyTime-dow{background-color:#C0C0C1;color:#fff;font-family:Arial,Helvetica,sans-serif;font-size:95%;font-weight:400;font-style:normal;padding:.1em .3em}.AnyTime-pkr .AnyTime-dom-btn{text-align:right;padding-right:.5em}.AnyTime-pkr .AnyTime-dom-btn-empty,.AnyTime-pkr .AnyTime-min-ten-btn-empty,.AnyTime-pkr .AnyTime-min-one-btn-empty,.AnyTime-pkr .AnyTime-sec-ten-btn-empty,.AnyTime-pkr .AnyTime-sec-one-btn-empty{background-color:#F3F3F4;border:1px solid #C0C0c1}.AnyTime-pkr .AnyTime-time,.AnyTime-pkr .AnyTime-hrs-am,.AnyTime-pkr .AnyTime-hrs-pm,.AnyTime-pkr .AnyTime-mins-tens,.AnyTime-pkr .AnyTime-mins-ones,.AnyTime-pkr .AnyTime-secs-tens,.AnyTime-pkr .AnyTime-secs-ones{display:inline-block}.AnyTime-pkr .AnyTime-hrs,.AnyTime-pkr .AnyTime-mins,.AnyTime-pkr .AnyTime-secs,.AnyTime-pkr .AnyTime-offs{display:inline-block;margin-left:1em}.AnyTime-pkr .AnyTime-hr-btn{text-align:right;width:3.5em}.AnyTime-pkr .AnyTime-min-ten-btn,.AnyTime-pkr .AnyTime-min-one-btn{width:2em}.AnyTime-pkr .AnyTime-sec-ten-btn,.AnyTime-pkr .AnyTime-sec-one-btn{width:2em}.AnyTime-pkr .AnyTime-off-cur-btn{display:inline-block;overflow:hidden}.AnyTime-pkr .AnyTime-off-select-btn{display:inline-block;vertical-align:top;width:2em}.AnyTime-pkr .AnyTime-yr-selector{position:absolute}.AnyTime-pkr .AnyTime-body-yr-selector{margin:.8em 1em}.AnyTime-pkr .AnyTime-yr-mil,.AnyTime-pkr .AnyTime-yr-cent,.AnyTime-pkr .AnyTime-yr-dec,.AnyTime-pkr .AnyTime-yr-yr,.AnyTime-pkr .AnyTime-yr-era{display:inline-block;vertical-align:top}.AnyTime-pkr .AnyTime-mil-btn,.AnyTime-pkr .AnyTime-cent-btn,.AnyTime-pkr .AnyTime-dec-btn,.AnyTime-pkr .AnyTime-yr-btn{width:2em}.AnyTime-pkr .AnyTime-era-btn{margin-left:1em}.AnyTime-pkr .AnyTime-off-selector{margin:1em 2em;position:absolute}.AnyTime-pkr .AnyTime-body-off-selector{margin:.8em 1em;overflow-x:hidden;overflow-y:auto;white-space:nowrap}.AnyTime-pkr .AnyTime-off-off-btn{text-align:left}.AnyTime-pkr .AnyTime-cur-btn{border:1px solid #333334;background-color:#C0C0C1;color:#FCFCFE;font-weight:700}.AnyTime-pkr .AnyTime-out-btn{background-color:#F0F0F1;border:1px solid #C0C0c1}.AnyTime-pkr .AnyTime-focus-btn{border:1px dashed #000}
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
19
  padding-top: 0;
20
  }
21
 
22
+ .settings_page_ucp p {
23
  font-size: 14px;
24
  }
25
 
26
+ .settings_page_ucp code {
27
+ line-height: 1.7;
28
+ }
29
+
30
+ .settings_page_ucp h2:first-child {
31
+ margin-top: 0;
32
+ }
33
+
34
+ .settings_page_ucp h2 {
35
+ border-bottom: 1px solid #dddddd;
36
+ margin: 50px 0 0px 0;
37
+ }
38
+
39
  .form-table th {
40
  padding: 15px 10px 20px 0;
41
  }
44
  width: 100px;
45
  }
46
 
47
+ p.submit {
48
+ padding-bottom: 0;
49
+ }
50
+
51
+ .button.loading {
52
+ pointer-events: none;
53
+ cursor: default !important;
54
+ opacity: 0.6;
55
+ }
56
+
57
+ .button span {
58
+ display: none;
59
+ }
60
+
61
+ .button.loading span {
62
+ -webkit-animation: ucp-spin 2s infinite linear;
63
+ animation: ucp-spin 2s infinite linear;
64
+ padding: 0;
65
+ margin: 3px 7px 0 0;
66
+ display: inherit;
67
+ }
68
+
69
  .settings_page_ucp h1:hover img {
70
  transform: rotate(360deg);
71
  }
457
  Any+Time is a trademark of Andrew M. Andrews III */
458
 
459
  .AnyTime-pkr *{border:0;font:inherit;font-size:x-small;font-style:normal;font-weight:400;list-style-type:none;margin:0;padding:0;white-space:nowrap;-moz-box-sizing:border-box;-webkit-box-sizing:border-box;box-sizing:border-box}.AnyTime-win{background-color:#F0F0F1;border:3px solid silver;display:inline-block;font:normal normal normal xx-small/normal sans-serif;-moz-border-radius:6px;-webkit-border-radius:6px;border-radius:6px}.AnyTime-pkr,.AnyTime-pkr *{text-align:center}.AnyTime-pkr .AnyTime-cloak{background-color:#D7D7D7;opacity:.7;position:absolute;filter:alpha(opacity=70)}.AnyTime-pkr .AnyTime-hdr{background-color:#D0D0D1;color:#606062;font-family:Arial,Helvetica,sans-serif;font-size:medium;font-weight:400;-moz-border-radius:2px;-webkit-border-radius:2px;border-radius:2px}.AnyTime-pkr .AnyTime-x-btn{background-color:#FCFCFF;border:1px solid #F99;color:#FF9F9F;cursor:default;float:right;margin:.25em .25em 0 0;width:1.5em;-moz-border-radius:.4em;-webkit-border-radius:.4em;border-radius:.4em}.AnyTime-pkr .AnyTime-btn{background-color:#FCFCFE;border:1px solid #999;color:#606062;cursor:default;font-family:Arial,Helvetica,sans-serif;margin:0 .1em .1em 0;padding:.2em .3em;-moz-border-radius:.1em;-webkit-border-radius:.1em;border-radius:.1em}.AnyTime-pkr .AnyTime-body{margin:0 1em 1em 0}.AnyTime-pkr .AnyTime-date{display:inline-block;margin-left:1em;vertical-align:top}.AnyTime-pkr .AnyTime-lbl{color:#606063;font-family:Arial,Helvetica,sans-serif;font-size:100%;font-weight:400;font-style:normal;margin-top:.8em}.AnyTime-pkr .AnyTime-yrs{width:20em}.AnyTime-pkr .AnyTime-yrs-past-btn,.AnyTime-pkr .AnyTime-yrs-ahead-btn{display:inline-block;width:2.4em}.AnyTime-pkr .AnyTime-yr-prior-btn,.AnyTime-pkr .AnyTime-yr-cur-btn,.AnyTime-pkr .AnyTime-yr-next-btn{display:inline-block;width:4.8em}.AnyTime-pkr .AnyTime-mons{width:20em}.AnyTime-pkr .AnyTime-mons:after{content:"";display:table;clear:both}.AnyTime-pkr .AnyTime-mon-btn{float:left;width:3.2em}.AnyTime-pkr .AnyTime-mon7-btn{clear:left}.AnyTime-pkr .AnyTime-dom-table{background-color:#F0F0F1;border:1px solid #E3E3E4;border-spacing:1px;width:20em}.AnyTime-pkr th.AnyTime-dow{background-color:#C0C0C1;color:#fff;font-family:Arial,Helvetica,sans-serif;font-size:95%;font-weight:400;font-style:normal;padding:.1em .3em}.AnyTime-pkr .AnyTime-dom-btn{text-align:right;padding-right:.5em}.AnyTime-pkr .AnyTime-dom-btn-empty,.AnyTime-pkr .AnyTime-min-ten-btn-empty,.AnyTime-pkr .AnyTime-min-one-btn-empty,.AnyTime-pkr .AnyTime-sec-ten-btn-empty,.AnyTime-pkr .AnyTime-sec-one-btn-empty{background-color:#F3F3F4;border:1px solid #C0C0c1}.AnyTime-pkr .AnyTime-time,.AnyTime-pkr .AnyTime-hrs-am,.AnyTime-pkr .AnyTime-hrs-pm,.AnyTime-pkr .AnyTime-mins-tens,.AnyTime-pkr .AnyTime-mins-ones,.AnyTime-pkr .AnyTime-secs-tens,.AnyTime-pkr .AnyTime-secs-ones{display:inline-block}.AnyTime-pkr .AnyTime-hrs,.AnyTime-pkr .AnyTime-mins,.AnyTime-pkr .AnyTime-secs,.AnyTime-pkr .AnyTime-offs{display:inline-block;margin-left:1em}.AnyTime-pkr .AnyTime-hr-btn{text-align:right;width:3.5em}.AnyTime-pkr .AnyTime-min-ten-btn,.AnyTime-pkr .AnyTime-min-one-btn{width:2em}.AnyTime-pkr .AnyTime-sec-ten-btn,.AnyTime-pkr .AnyTime-sec-one-btn{width:2em}.AnyTime-pkr .AnyTime-off-cur-btn{display:inline-block;overflow:hidden}.AnyTime-pkr .AnyTime-off-select-btn{display:inline-block;vertical-align:top;width:2em}.AnyTime-pkr .AnyTime-yr-selector{position:absolute}.AnyTime-pkr .AnyTime-body-yr-selector{margin:.8em 1em}.AnyTime-pkr .AnyTime-yr-mil,.AnyTime-pkr .AnyTime-yr-cent,.AnyTime-pkr .AnyTime-yr-dec,.AnyTime-pkr .AnyTime-yr-yr,.AnyTime-pkr .AnyTime-yr-era{display:inline-block;vertical-align:top}.AnyTime-pkr .AnyTime-mil-btn,.AnyTime-pkr .AnyTime-cent-btn,.AnyTime-pkr .AnyTime-dec-btn,.AnyTime-pkr .AnyTime-yr-btn{width:2em}.AnyTime-pkr .AnyTime-era-btn{margin-left:1em}.AnyTime-pkr .AnyTime-off-selector{margin:1em 2em;position:absolute}.AnyTime-pkr .AnyTime-body-off-selector{margin:.8em 1em;overflow-x:hidden;overflow-y:auto;white-space:nowrap}.AnyTime-pkr .AnyTime-off-off-btn{text-align:left}.AnyTime-pkr .AnyTime-cur-btn{border:1px solid #333334;background-color:#C0C0C1;color:#FCFCFE;font-weight:700}.AnyTime-pkr .AnyTime-out-btn{background-color:#F0F0F1;border:1px solid #C0C0c1}.AnyTime-pkr .AnyTime-focus-btn{border:1px dashed #000}
460
+
461
+ /* icon spin */
462
+ @-webkit-keyframes ucp-spin {
463
+ 0% {
464
+ -webkit-transform: rotate(0deg);
465
+ transform: rotate(0deg);
466
+ }
467
+ 100% {
468
+ -webkit-transform: rotate(359deg);
469
+ transform: rotate(359deg);
470
+ }
471
+ }
472
+ @keyframes ucp-spin {
473
+ 0% {
474
+ -webkit-transform: rotate(0deg);
475
+ transform: rotate(0deg);
476
+ }
477
+ 100% {
478
+ -webkit-transform: rotate(359deg);
479
+ transform: rotate(359deg);
480
+ }
481
+ }
js/ucp-admin.js CHANGED
@@ -96,6 +96,44 @@ jQuery(document).ready(function($) {
96
  return false;
97
  });
98
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
99
  // select theme via thumb
100
  $('.ucp-thumb').on('click', function(e) {
101
  e.preventDefault();
96
  return false;
97
  });
98
 
99
+ // send support message
100
+ $('#send-support-message').on('click', function(e) {
101
+ e.preventDefault();
102
+ button = $(this);
103
+
104
+ if ($('#support_email').val().length < 5 || $('#support_email').is(':invalid')) {
105
+ alert('We need your email address, don\'t you think?');
106
+ $('#support_email').select().focus();
107
+ return false;
108
+ }
109
+
110
+ if ($('#support_message').val().length < 15) {
111
+ alert('An empty message won\'t do anybody any good.');
112
+ $('#support_message').select().focus();
113
+ return false;
114
+ }
115
+
116
+ button.addClass('loading');
117
+ $.post(ajaxurl, { support_email: $('#support_email').val(),
118
+ support_message: $('#support_message').val(),
119
+ support_info: $('#support_info:checked').val(),
120
+ _ajax_nonce: ucp.nonce_submit_support_message,
121
+ action: 'ucp_submit_support_message'},
122
+ function(data) {
123
+ if (data.success) {
124
+ alert('Message sent! Our agents will get back to you ASAP.');
125
+ } else {
126
+ alert(data.message);
127
+ }
128
+ }).fail(function() {
129
+ alert('Something is not right. Please reload the page and try again');
130
+ }).always(function() {
131
+ button.removeClass('loading');
132
+ });
133
+
134
+ return false;
135
+ });
136
+
137
  // select theme via thumb
138
  $('.ucp-thumb').on('click', function(e) {
139
  e.preventDefault();
readme.txt CHANGED
@@ -3,11 +3,11 @@ Contributors: WebFactory, UnderConstructionPage
3
  Tags: maintenance mode, maintenance page, coming soon page, landing page, under construction
4
  Requires at least: 4.0
5
  Tested up to: 4.8
6
- Stable tag: 2.40
7
  License: GPLv2 or later
8
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
9
 
10
- Create an Under Construction, Maintenance Mode or Landing Page that takes 5 seconds to setup, while you're doing maintenance work on your site.
11
 
12
 
13
  == Description ==
@@ -52,6 +52,16 @@ A simple, no-nonsense plugin for all those situations when you have to hide the
52
  * Whitelisted Users - users who see the site, instead of maintenance page
53
 
54
 
 
 
 
 
 
 
 
 
 
 
55
  == Installation ==
56
 
57
  Follow the usual routine;
@@ -64,7 +74,7 @@ Follow the usual routine;
64
  Or if needed, upload manually;
65
 
66
  1. Download the plugin.
67
- 2. Unzip it and upload to _wp-content/plugin/_
68
  3. Open WordPress admin - Plugins and click "Activate" next to the plugin
69
  4. Activate & open plugin's settings page located under the Settings menu
70
 
@@ -105,11 +115,18 @@ Or if needed, upload manually;
105
 
106
  == Changelog ==
107
 
 
 
 
 
 
 
 
108
  = 2.40 =
109
  * 2017/08/07
110
  * new social icon - Telegram
111
  * removed autoresponders survey
112
- * we've crossed the 100k users mark & 515k downloads on August 5th
113
 
114
  = 2.35 =
115
  * 2017/07/24
3
  Tags: maintenance mode, maintenance page, coming soon page, landing page, under construction
4
  Requires at least: 4.0
5
  Tested up to: 4.8
6
+ Stable tag: 2.45
7
  License: GPLv2 or later
8
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
9
 
10
+ The fastest & simplest Under Construction Page, Maintenance Mode & Coming Soon WordPress plugin.
11
 
12
 
13
  == Description ==
52
  * Whitelisted Users - users who see the site, instead of maintenance page
53
 
54
 
55
+ **What are others saying about the Under Construction Page plugin**
56
+
57
+ * John Fraskos from <a href="https://codestag.com/setting-wordpress-theme-easily-create-construction-page/">Codestag</a> says it's "very friendly and easy to use"
58
+ * <a href="http://wppluginsify.com/interface-elements/professional-construction-page/">WP Pluginsify</a> wrote a review
59
+ * <a href="https://www.wpmayor.com/set-construction-page-wordpress/">WP Major</a> wrote a review too
60
+ * Erik from <a href="http://nopassiveincome.com/under-construction-page-plugin-review/">NoPassiveIncome</a> points out: "plugin is so easy and quick to use"
61
+ * <a href="https://planetwp.com/underconstruction-page-plugin/">Planet WP</a> gave it 5/5 stars
62
+ * <a href="https://firstsiteguide.com/under-construction-page-review/">FirstSiteGuide</a> says: "a perfect choice"
63
+
64
+
65
  == Installation ==
66
 
67
  Follow the usual routine;
74
  Or if needed, upload manually;
75
 
76
  1. Download the plugin.
77
+ 2. Unzip it and upload to _/wp-content/plugins/_
78
  3. Open WordPress admin - Plugins and click "Activate" next to the plugin
79
  4. Activate & open plugin's settings page located under the Settings menu
80
 
115
 
116
  == Changelog ==
117
 
118
+ = 2.45 =
119
+ * 2017/08/21
120
+ * support is now available directly from the Support tab
121
+ * added notification when UCP is enabled and End Date is in the past resulting in UCP not being shown
122
+ * retry-after header is now properly set
123
+ * minor improvements
124
+
125
  = 2.40 =
126
  * 2017/08/07
127
  * new social icon - Telegram
128
  * removed autoresponders survey
129
+ * we've crossed the 100k users mark on August 5th & 515k downloads
130
 
131
  = 2.35 =
132
  * 2017/07/24
themes/ambulance/style.css CHANGED
@@ -3,7 +3,7 @@
3
  * Ambulance theme CSS
4
  * (c) Web factory Ltd, 2015 - 2017
5
  */
6
-
7
 
8
  html {
9
  height: 100%;
3
  * Ambulance theme CSS
4
  * (c) Web factory Ltd, 2015 - 2017
5
  */
6
+
7
 
8
  html {
9
  height: 100%;
under-construction.php CHANGED
@@ -2,9 +2,9 @@
2
  /*
3
  Plugin Name: Under Construction
4
  Plugin URI: https://underconstructionpage.com/
5
- Description: Hide your site behind a great looking under construction page while you do maintenance work.
6
  Author: Web factory Ltd
7
- Version: 2.40
8
  Author URI: http://www.webfactoryltd.com/
9
  Text Domain: under-construction-page
10
  Domain Path: lang
@@ -90,6 +90,7 @@ class UCP {
90
  add_action('wp_ajax_ucp_dismiss_pointer', array(__CLASS__, 'dismiss_pointer_ajax'));
91
  add_action('wp_ajax_ucp_dismiss_survey', array(__CLASS__, 'dismiss_survey_ajax'));
92
  add_action('wp_ajax_ucp_submit_survey', array(__CLASS__, 'submit_survey_ajax'));
 
93
  } else {
94
  // main plugin logic
95
  add_action('wp', array(__CLASS__, 'display_construction_page'), 0, 1);
@@ -209,24 +210,28 @@ class UCP {
209
  // fetch and display the construction page if it's enabled or preview requested
210
  static function display_construction_page() {
211
  $options = self::get_options();
212
- $request_uri = strtolower(@parse_url($_SERVER['REQUEST_URI'], PHP_URL_PATH));
213
 
214
  // some URLs have to be accessible at all times
215
- if ($request_uri == '/wp-admin' ||
216
  $request_uri == '/feed/' ||
217
  $request_uri == '/feed/rss/' ||
218
  $request_uri == '/feed/rss2/' ||
219
  $request_uri == '/feed/rdf/' ||
220
  $request_uri == '/feed/atom/' ||
221
- $request_uri == '/wp-admin/' ||
222
  $request_uri == '/admin/' ||
223
  $request_uri == '/wp-login.php') {
224
- return true;
225
  }
226
 
227
  if (true == self::is_construction_mode_enabled(false)
228
  || (is_user_logged_in() && isset($_GET['ucp_preview']))) {
229
  header(self::wp_get_server_protocol() . ' 503 Service Unavailable');
 
 
 
 
 
230
  echo self::get_template($options['theme']);
231
  exit;
232
  }
@@ -273,6 +278,7 @@ class UCP {
273
  'open_survey' => $open_survey,
274
  'nonce_dismiss_survey' => wp_create_nonce('ucp_dismiss_survey'),
275
  'nonce_submit_survey' => wp_create_nonce('ucp_submit_survey'),
 
276
  'deactivate_confirmation' => __('Are you sure you want to deactivate UnderConstruction plugin?' . "\n" . 'If you are removing it because of a problem please contact our support. They will be more than happy to help.', 'under-construction-page'));
277
 
278
  if ('settings_page_ucp' == $hook) {
@@ -337,6 +343,37 @@ class UCP {
337
  } // dismiss_survey_ajax
338
 
339
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
340
  // submit survey
341
  static function submit_survey_ajax() {
342
  check_ajax_referer('ucp_submit_survey');
@@ -634,6 +671,7 @@ class UCP {
634
  // displays various notices in admin header
635
  static function admin_notices() {
636
  $notices = get_option(UCP_NOTICES_KEY);
 
637
  $meta = self::get_meta();
638
 
639
  if (empty($notices['dismiss_rate']) &&
@@ -641,12 +679,17 @@ class UCP {
641
  $rate_url = 'https://wordpress.org/support/plugin/under-construction-page/reviews/?rate=5#new-post';
642
  $dismiss_url = add_query_arg(array('action' => 'ucp_dismiss_notice', 'notice' => 'rate', 'redirect' => urlencode($_SERVER['REQUEST_URI'])), admin_url('admin.php'));
643
 
644
- echo '<div id="ucp_rate_notice" class="notice-info notice is-dismissible"><p>Hi! We saw you\'ve been using <b class="ucp-logo" style="font-weight: bold;">UnderConstructionPage</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!';
645
 
646
  echo '<br><a target="_blank" href="' . esc_url($rate_url) . '" style="vertical-align: baseline; margin-top: 15px;" class="button-primary">' . __('Help make the plugin better by rating it', 'under-construction-page') . '</a>';
647
  echo '&nbsp;&nbsp;&nbsp;&nbsp;<a href="' . esc_url($dismiss_url) . '">' . __('I\'ve already rated the plugin', 'under-construction-page') . '</a>';
648
  echo '</p></div>';
649
  }
 
 
 
 
 
650
  } // notices
651
 
652
 
@@ -911,6 +954,10 @@ class UCP {
911
  $options['whitelisted_users'] = empty($options['whitelisted_users'])? array(): $options['whitelisted_users'];
912
  $options = self::check_var_isset($options, array('status' => 0, 'linkback' => 0, 'login_button' => 0));
913
 
 
 
 
 
914
  if (!empty($options['ga_tracking_id']) && preg_match('/^UA-\d{3,}-\d{1,3}$/', $options['ga_tracking_id']) === 0) {
915
  add_settings_error('ucp', 'ga_tracking_id', __('Please enter a valid Google Analytics Tracking ID, or leave empty to disable tracking.', 'under-construction-page'));
916
  }
@@ -1036,6 +1083,8 @@ class UCP {
1036
  echo '</td></tr>';
1037
 
1038
  echo '</table>';
 
 
1039
  } // tab_main
1040
 
1041
 
@@ -1199,6 +1248,8 @@ class UCP {
1199
  echo '</td></tr>';
1200
 
1201
  echo '</table>';
 
 
1202
  } // tab_content
1203
 
1204
 
@@ -1281,6 +1332,8 @@ class UCP {
1281
  echo '</td></tr>';
1282
 
1283
  echo '</table>';
 
 
1284
  } // tab_design
1285
 
1286
 
@@ -1322,6 +1375,8 @@ class UCP {
1322
  echo '</td></tr>';
1323
 
1324
  echo '</table>';
 
 
1325
  } // tab_access
1326
 
1327
 
@@ -1343,9 +1398,44 @@ class UCP {
1343
 
1344
  echo '<p><b>I have disabled UCP but the under construction page is still visible. How do I remove it?</b><br>Open your site and force refresh browser cache (Ctrl or Shift + F5). If that doesn\'t help it means you have a caching plugin installed. Purge/delete cache in that plugin or disable it.<br>If that fails too contact your hosting provider and ask to empty the site cache for you.</p>';
1345
 
1346
- echo '<h2><br>How to get support?</h2>';
 
 
1347
 
1348
- echo '<p>We do our very best to keep <span class="ucp-logo">UnderConstructionPage</span> bug free and compatible with all plugins and themes. If you run into a problem head over to the <a target="_blank" href="http://wordpress.org/support/plugin/under-construction-page">official support forum</a>, open a new thread, and we\'ll help you ASAP.</p>';
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1349
  } // tab_support
1350
 
1351
 
@@ -1398,14 +1488,18 @@ class UCP {
1398
 
1399
  echo '</div>'; // ucp_tabs
1400
 
 
 
 
 
 
 
 
1401
  echo '<p class="submit">';
1402
  echo get_submit_button(__('Save Changes', 'under-construction-page'), 'primary large', 'submit', false);
1403
  echo ' &nbsp; &nbsp; <a id="ucp_preview" href="' . get_home_url() . '/?ucp_preview" class="button button-large button-secondary" target="_blank">' . __('Preview', 'under-construction-page') . '</a>';
1404
  echo '</p>';
1405
-
1406
- echo '</form>'; // ucp_tabs
1407
- echo '</div>'; // wrap
1408
- } // options_page
1409
 
1410
 
1411
  // reset all pointers to default state - visible
2
  /*
3
  Plugin Name: Under Construction
4
  Plugin URI: https://underconstructionpage.com/
5
+ Description: Put your site behind a great looking under construction page while you do maintenance work.
6
  Author: Web factory Ltd
7
+ Version: 2.45
8
  Author URI: http://www.webfactoryltd.com/
9
  Text Domain: under-construction-page
10
  Domain Path: lang
90
  add_action('wp_ajax_ucp_dismiss_pointer', array(__CLASS__, 'dismiss_pointer_ajax'));
91
  add_action('wp_ajax_ucp_dismiss_survey', array(__CLASS__, 'dismiss_survey_ajax'));
92
  add_action('wp_ajax_ucp_submit_survey', array(__CLASS__, 'submit_survey_ajax'));
93
+ add_action('wp_ajax_ucp_submit_support_message', array(__CLASS__, 'submit_support_message_ajax'));
94
  } else {
95
  // main plugin logic
96
  add_action('wp', array(__CLASS__, 'display_construction_page'), 0, 1);
210
  // fetch and display the construction page if it's enabled or preview requested
211
  static function display_construction_page() {
212
  $options = self::get_options();
213
+ $request_uri = trailingslashit(strtolower(@parse_url($_SERVER['REQUEST_URI'], PHP_URL_PATH)));
214
 
215
  // some URLs have to be accessible at all times
216
+ if ($request_uri == '/wp-admin/' ||
217
  $request_uri == '/feed/' ||
218
  $request_uri == '/feed/rss/' ||
219
  $request_uri == '/feed/rss2/' ||
220
  $request_uri == '/feed/rdf/' ||
221
  $request_uri == '/feed/atom/' ||
 
222
  $request_uri == '/admin/' ||
223
  $request_uri == '/wp-login.php') {
224
+ return;
225
  }
226
 
227
  if (true == self::is_construction_mode_enabled(false)
228
  || (is_user_logged_in() && isset($_GET['ucp_preview']))) {
229
  header(self::wp_get_server_protocol() . ' 503 Service Unavailable');
230
+ if ($options['end_date'] && $options['end_date'] != '0000-00-00 00:00') {
231
+ header('Retry-After: ' . date('D, d M Y H:i:s T', strtotime($options['end_date'])));
232
+ } else {
233
+ header('Retry-After: ' . DAY_IN_SECONDS);
234
+ }
235
  echo self::get_template($options['theme']);
236
  exit;
237
  }
278
  'open_survey' => $open_survey,
279
  'nonce_dismiss_survey' => wp_create_nonce('ucp_dismiss_survey'),
280
  'nonce_submit_survey' => wp_create_nonce('ucp_submit_survey'),
281
+ 'nonce_submit_support_message' => wp_create_nonce('ucp_submit_support_message'),
282
  'deactivate_confirmation' => __('Are you sure you want to deactivate UnderConstruction plugin?' . "\n" . 'If you are removing it because of a problem please contact our support. They will be more than happy to help.', 'under-construction-page'));
283
 
284
  if ('settings_page_ucp' == $hook) {
343
  } // dismiss_survey_ajax
344
 
345
 
346
+ // send support message
347
+ static function submit_support_message_ajax() {
348
+ check_ajax_referer('ucp_submit_support_message');
349
+
350
+ $email = sanitize_text_field($_POST['support_email']);
351
+ if (!is_email($email)) {
352
+ wp_send_json_error('Please double-check your email address.');
353
+ }
354
+
355
+ $message = stripslashes(sanitize_text_field($_POST['support_message']));
356
+ $subject = 'UCP Support';
357
+ $body = $message;
358
+ if (!empty($_POST['support_info'])) {
359
+ $theme = wp_get_theme();
360
+ $body .= "\r\n\r\nSite details:\r\n";
361
+ $body .= ' WordPress version: ' . get_bloginfo('version') . "\r\n";
362
+ $body .= ' UCP version: ' . self::$version . "\r\n";
363
+ $body .= ' Site URL: ' . get_bloginfo('url') . "\r\n";
364
+ $body .= ' WordPress URL: ' . get_bloginfo('wpurl') . "\r\n";
365
+ $body .= ' Theme: ' . $theme->get('Name') . ' v' . $theme->get('Version') . "\r\n";
366
+ }
367
+ $headers = 'From: ' . $email . "\r\n" . 'Reply-To: ' . $email;
368
+
369
+ if (true === wp_mail('ucp@webfactoryltd.com', $subject, $body, $headers)) {
370
+ wp_send_json_success();
371
+ } else {
372
+ wp_send_json_error('Something is not right with your wp_mail() function. Email as at ucp@webfactoryltd.com.');
373
+ }
374
+ } // submit_support_message
375
+
376
+
377
  // submit survey
378
  static function submit_survey_ajax() {
379
  check_ajax_referer('ucp_submit_survey');
671
  // displays various notices in admin header
672
  static function admin_notices() {
673
  $notices = get_option(UCP_NOTICES_KEY);
674
+ $options = self::get_options();
675
  $meta = self::get_meta();
676
 
677
  if (empty($notices['dismiss_rate']) &&
679
  $rate_url = 'https://wordpress.org/support/plugin/under-construction-page/reviews/?rate=5#new-post';
680
  $dismiss_url = add_query_arg(array('action' => 'ucp_dismiss_notice', 'notice' => 'rate', 'redirect' => urlencode($_SERVER['REQUEST_URI'])), admin_url('admin.php'));
681
 
682
+ echo '<div id="ucp_rate_notice" class="notice-info notice"><p>Hi! We saw you\'ve been using <b class="ucp-logo" style="font-weight: bold;">UnderConstructionPage</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!';
683
 
684
  echo '<br><a target="_blank" href="' . esc_url($rate_url) . '" style="vertical-align: baseline; margin-top: 15px;" class="button-primary">' . __('Help make the plugin better by rating it', 'under-construction-page') . '</a>';
685
  echo '&nbsp;&nbsp;&nbsp;&nbsp;<a href="' . esc_url($dismiss_url) . '">' . __('I\'ve already rated the plugin', 'under-construction-page') . '</a>';
686
  echo '</p></div>';
687
  }
688
+
689
+ if (self::is_plugin_page() && self::is_construction_mode_enabled(true) && !empty($options['end_date']) && $options['end_date'] != '0000-00-00 00:00' && $options['end_date'] < current_time('mysql')) {
690
+ echo '<div id="ucp_end_date_notice" class="notice-error notice"><p>Under construction mode is enabled but the <a href="#end_date" class="change_tab" data-tab="0">end date</a> is set to a past date so the <b>under construction page will not be shown</b>. Either move the <a href="#end_date" class="change_tab" data-tab="0">end date</a> to a future date or disable it.</p></div>';
691
+ }
692
+
693
  } // notices
694
 
695
 
954
  $options['whitelisted_users'] = empty($options['whitelisted_users'])? array(): $options['whitelisted_users'];
955
  $options = self::check_var_isset($options, array('status' => 0, 'linkback' => 0, 'login_button' => 0));
956
 
957
+ if ($options['end_date'] == '0000-00-00 00:00') {
958
+ $options['end_date'] = '';
959
+ }
960
+
961
  if (!empty($options['ga_tracking_id']) && preg_match('/^UA-\d{3,}-\d{1,3}$/', $options['ga_tracking_id']) === 0) {
962
  add_settings_error('ucp', 'ga_tracking_id', __('Please enter a valid Google Analytics Tracking ID, or leave empty to disable tracking.', 'under-construction-page'));
963
  }
1083
  echo '</td></tr>';
1084
 
1085
  echo '</table>';
1086
+
1087
+ self::footer_buttons();
1088
  } // tab_main
1089
 
1090
 
1248
  echo '</td></tr>';
1249
 
1250
  echo '</table>';
1251
+
1252
+ self::footer_buttons();
1253
  } // tab_content
1254
 
1255
 
1332
  echo '</td></tr>';
1333
 
1334
  echo '</table>';
1335
+
1336
+ self::footer_buttons();
1337
  } // tab_design
1338
 
1339
 
1375
  echo '</td></tr>';
1376
 
1377
  echo '</table>';
1378
+
1379
+ self::footer_buttons();
1380
  } // tab_access
1381
 
1382
 
1398
 
1399
  echo '<p><b>I have disabled UCP but the under construction page is still visible. How do I remove it?</b><br>Open your site and force refresh browser cache (Ctrl or Shift + F5). If that doesn\'t help it means you have a caching plugin installed. Purge/delete cache in that plugin or disable it.<br>If that fails too contact your hosting provider and ask to empty the site cache for you.</p>';
1400
 
1401
+ echo '<h2 id="contact">' . __('Contact Support', 'under-construction-page') . '</h2>';
1402
+ $user = wp_get_current_user();
1403
+ $theme = wp_get_theme();
1404
 
1405
+ echo '<table class="form-table">';
1406
+ echo '<tr valign="top">
1407
+ <th scope="row"><label for="support_email">Your Email Address</label></th>
1408
+ <td><input id="support_email" type="email" class="regular-text" name="support_email" value="' . $user->user_email . '" placeholder="name@domain.com">';
1409
+ echo '<p class="description">We will reply to this email, so please, double-check it.</p>';
1410
+ echo '</td></tr>';
1411
+
1412
+ echo '<tr valign="top">
1413
+ <th scope="row"><label for="support_message">Message</label></th>
1414
+ <td><textarea rows="5" cols="75" id="support_message" class="" name="support_message" placeholder="Let us know how we can help you"></textarea>';
1415
+ echo '<p class="description">Please be as descriptive as possible. It will help us to provide faster &amp; better support.</p>';
1416
+ echo '</td></tr>';
1417
+
1418
+ echo '<tr valign="top">
1419
+ <th scope="row"><label for="support_info">Send Extra Site Info to Support Agents</label></th>
1420
+ <td><div class="onoffswitch">
1421
+ <input type="checkbox" value="1" checked name="support_info" class="onoffswitch-checkbox" id="support_info">
1422
+ <label class="onoffswitch-label" for="support_info">
1423
+ <span class="onoffswitch-inner"></span>
1424
+ <span class="onoffswitch-switch"></span>
1425
+ </label>
1426
+ </div>';
1427
+ echo '<p class="description">Our support agents need this info to provide faster &amp; better support. Only the following data will be added to your message;</p>';
1428
+ echo '<p>WordPress version: <code>' . get_bloginfo('version') . '</code><br>';
1429
+ echo 'UCP version: <code>' . self::$version . '</code><br>';
1430
+ echo 'Site URL: <code>' . get_bloginfo('url') . '</code><br>';
1431
+ echo 'WordPress URL: <code>' . get_bloginfo('wpurl') . '</code><br>';
1432
+ echo 'Theme: <code>' . $theme->get('Name') . ' v' . $theme->get('Version') . '</code></p>';
1433
+ echo '</td></tr>';
1434
+ echo '<tr valign="top">
1435
+ <td colspan="2">';
1436
+ echo '<a id="send-support-message" href="#" class="js-action button button-primary"><span class="dashicons dashicons-update"></span>Send Message to Support</a>';
1437
+ echo '</td></tr>';
1438
+ echo '</table>';
1439
  } // tab_support
1440
 
1441
 
1488
 
1489
  echo '</div>'; // ucp_tabs
1490
 
1491
+ echo '</form>'; // ucp_tabs
1492
+ echo '</div>'; // wrap
1493
+ } // options_page
1494
+
1495
+
1496
+ // save and preview buttons
1497
+ static function footer_buttons() {
1498
  echo '<p class="submit">';
1499
  echo get_submit_button(__('Save Changes', 'under-construction-page'), 'primary large', 'submit', false);
1500
  echo ' &nbsp; &nbsp; <a id="ucp_preview" href="' . get_home_url() . '/?ucp_preview" class="button button-large button-secondary" target="_blank">' . __('Preview', 'under-construction-page') . '</a>';
1501
  echo '</p>';
1502
+ } // footer_buttons
 
 
 
1503
 
1504
 
1505
  // reset all pointers to default state - visible