Under Construction - Version 2.65

Version Description

  • 2017/10/17
  • fixed CORS issue on FontAwesome
  • all times are now GMT+0
  • removed survey
  • review request notification adjusted
  • added notification on front-end for whitelisted users when UCP is enabled
Download this release

Release Info

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

Code changes from version 2.60 to 2.65

Files changed (3) hide show
  1. readme.txt +10 -2
  2. themes/fonts/.htaccess +14 -0
  3. under-construction.php +45 -12
readme.txt CHANGED
@@ -4,11 +4,11 @@ Tags: maintenance mode, maintenance page, coming soon page, landing page, under
4
  Requires at least: 4.0
5
  Requires PHP: 5.2
6
  Tested up to: 4.8
7
- Stable tag: 2.60
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
11
- The fastest & simplest Under Construction Page, Maintenance Mode & Coming Soon WordPress plugin.
12
 
13
 
14
  == Description ==
@@ -120,6 +120,14 @@ Or if needed, upload manually;
120
 
121
  == Changelog ==
122
 
 
 
 
 
 
 
 
 
123
  = 2.60 =
124
  * 2017/10/02
125
  * continuing with UX improvements
4
  Requires at least: 4.0
5
  Requires PHP: 5.2
6
  Tested up to: 4.8
7
+ Stable tag: 2.65
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
11
+ The fastest & simplest Under Construction Page, Landing Page, Maintenance Mode & Coming Soon WordPress plugin. Super-easy to use!
12
 
13
 
14
  == Description ==
120
 
121
  == Changelog ==
122
 
123
+ = 2.65 =
124
+ * 2017/10/17
125
+ * fixed CORS issue on FontAwesome
126
+ * all times are now GMT+0
127
+ * removed survey
128
+ * review request notification adjusted
129
+ * added notification on front-end for whitelisted users when UCP is enabled
130
+
131
  = 2.60 =
132
  * 2017/10/02
133
  * continuing with UX improvements
themes/fonts/.htaccess ADDED
@@ -0,0 +1,14 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Due to an increased number of CORS related issues caused by people opening their sites from
2
+ # site.com while having WP configured on www.site.com (and vice-versa) we've implemented this
3
+ # temporary, far-from-ideal fix to make sure FontAwesome still gets loaded.
4
+ # We're working on a different solution that won't use "*".
5
+ # For all security snowflake experts out there - keep your shirt on. Rule is applied to only
6
+ # 6 files. Nobody will die ...
7
+ #
8
+ # Gordan @ WebFactory, 2017/10/10
9
+
10
+ <IfModule mod_headers.c>
11
+ <FilesMatch "\.(woff|woff2|otf|eot|svg|ttf)$">
12
+ Header set Access-Control-Allow-Origin "*"
13
+ </FilesMatch>
14
+ </IfModule>
under-construction.php CHANGED
@@ -4,7 +4,7 @@
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.60
8
  Author URI: http://www.webfactoryltd.com/
9
  Text Domain: under-construction-page
10
  Domain Path: lang
@@ -107,6 +107,8 @@ class UCP {
107
  add_action('do_feed_rss', array(__CLASS__, 'disable_feed'), 0, 1);
108
  add_action('do_feed_rss2', array(__CLASS__, 'disable_feed'), 0, 1);
109
  add_action('do_feed_atom', array(__CLASS__, 'disable_feed'), 0, 1);
 
 
110
  } // if not admin
111
 
112
  // admin bar notice for frontend & backend
@@ -115,7 +117,7 @@ class UCP {
115
  add_action('admin_head', array(__CLASS__, 'admin_bar_style'));
116
  } // init
117
 
118
-
119
  // check if user has the minimal WP version required by UCP
120
  static function check_wp_version($min_version) {
121
  if (!version_compare(get_bloginfo('version'), $min_version, '>=')) {
@@ -203,7 +205,7 @@ class UCP {
203
 
204
  if (!is_array($meta) || empty($meta)) {
205
  $meta['first_version'] = self::get_plugin_version();
206
- $meta['first_install'] = current_time('timestamp');
207
  update_option(UCP_META_KEY, $meta);
208
  }
209
 
@@ -279,7 +281,8 @@ class UCP {
279
  $meta = self::get_meta();
280
 
281
  // survey is shown min 5min after install
282
- if (empty($surveys['usage']) && current_time('timestamp') - $meta['first_install'] > 300) {
 
283
  $open_survey = true;
284
  } else {
285
  $open_survey = false;
@@ -434,7 +437,7 @@ class UCP {
434
  $response = wp_remote_get(esc_url_raw($url), $request_params);
435
  }
436
 
437
- $surveys[$vars['survey']] = current_time('timestamp');
438
  update_option(UCP_SURVEYS_KEY, $surveys);
439
 
440
  wp_send_json_success();
@@ -697,7 +700,7 @@ class UCP {
697
  return false;
698
  } elseif (in_array($current_user->ID, $options['whitelisted_users'])) {
699
  return false;
700
- } elseif (strlen($options['end_date']) === 16 && $options['end_date'] !== '0000-00-00 00:00' && $options['end_date'] < current_time('Y-m-d H:i')) {
701
  return false;
702
  } else {
703
  return true;
@@ -719,22 +722,42 @@ class UCP {
719
  return in_array($user_role, $roles);
720
  } // user_has_role
721
 
 
 
 
 
 
 
 
 
 
 
 
 
 
722
 
723
  // displays various notices in admin header
724
  static function admin_notices() {
725
  $notices = get_option(UCP_NOTICES_KEY);
726
  $options = self::get_options();
727
  $meta = self::get_meta();
 
 
 
 
 
 
728
 
729
  if (empty($notices['dismiss_rate']) &&
730
- (current_time('timestamp') - $meta['first_install']) > (DAY_IN_SECONDS * 2)) {
731
  $rate_url = 'https://wordpress.org/support/plugin/under-construction-page/reviews/?rate=5#new-post';
732
  $dismiss_url = add_query_arg(array('action' => 'ucp_dismiss_notice', 'notice' => 'rate', 'redirect' => urlencode($_SERVER['REQUEST_URI'])), admin_url('admin.php'));
733
 
734
- 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!';
735
 
736
  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>';
737
  echo '&nbsp;&nbsp;&nbsp;&nbsp;<a href="' . esc_url($dismiss_url) . '">' . __('I\'ve already rated the plugin', 'under-construction-page') . '</a>';
 
738
  echo '</p></div>';
739
  }
740
 
@@ -757,6 +780,10 @@ class UCP {
757
  if ($_GET['notice'] == 'rate') {
758
  $notices['dismiss_rate'] = true;
759
  }
 
 
 
 
760
 
761
  update_option(UCP_NOTICES_KEY, $notices);
762
 
@@ -860,7 +887,7 @@ class UCP {
860
  // show under construction notice on WP login form
861
  static function login_message($message) {
862
  if (self::is_construction_mode_enabled(true)) {
863
- $message .= '<div class="message">' . __('Under construction mode is <b>enabled</b>.', 'under-construction-page') . '</div>';
864
  }
865
 
866
  return $message;
@@ -1022,6 +1049,10 @@ class UCP {
1022
 
1023
  // empty cache in 3rd party plugins
1024
  if ($options != $old_options) {
 
 
 
 
1025
  if (function_exists('w3tc_pgcache_flush')) {
1026
  w3tc_pgcache_flush();
1027
  }
@@ -1473,6 +1504,8 @@ class UCP {
1473
  echo '</ul>';
1474
 
1475
  echo '<div style="display: none;" id="tab_support_faq" class="ucp-tab-content">';
 
 
1476
  echo '<p><b>How can I work on my site while construction mode is enabled?</b><br>Make sure your user role (probably admin) is selected under <a class="change_tab" data-tab="3" href="#whitelisted-roles">Access - Whitelisted User Roles</a> and open the site while logged in.</p>';
1477
 
1478
  echo '<p><b>How can I log in / access WordPress admin after construction mode has been enabled?</b><br>Enable the <a class="change_tab" data-tab="2" href="#login_button_wrap">Login Button</a> option under Content, and a login link will be shown in the lower right corner of the under construction page.</p>';
@@ -1537,8 +1570,8 @@ class UCP {
1537
  echo '<div class="ucp-tab-content">';
1538
  echo '<h3 class="ucp-pro-logo"><img src="' . UCP_PLUGIN_URL . 'images/ucp_pro_logo.png" alt="UnderConstructionPage PRO" title="UnderConstructionPage">UnderConstructionPage<span>pro</span></h3>';
1539
 
1540
- echo '<div id="ucp-earlybird"><span>Build <b>landing pages, coming soon pages, maintenance &amp; under construction pages</b> faster &amp; easier!<br>UCP PRO comes out on October 23rd. Get on the earlybird list - <b>get it cheaper &amp; a week before others</b>.</span>';
1541
- echo '<p><input value="' . $user->user_email .'" type="email" placeholder="Your best email address" class="skip-save regular-text" id="ucp-earlybird-email"> <select id="ucp-earlybird-type"><option value="0">- How do you use UCP? Please select -</option><option value="solo-use">I use it only on one site</option><option value="multi-site">I use it on multiple sites I own</option><option value="webmaster">I use it on multiple sites I build/maintain for others</option></select> <a href="#" class="button button-primary button-large" id="ucp-earlybird-submit">I want the discount! Put me on the Earlybird List!</a></p>';
1542
  echo '</div>';
1543
 
1544
  echo '<h3 class="ucp-small-title">Some of the features available in the PRO version</h3>';
@@ -1637,7 +1670,7 @@ class UCP {
1637
  unset($pointers['welcome']);
1638
  update_option(UCP_POINTERS_KEY, $pointers);
1639
  }
1640
-
1641
  echo '<div class="wrap">
1642
  <h1 class="ucp-logo"><img src="' . UCP_PLUGIN_URL . 'images/ucp_logo.png" alt="UnderConstructionPage" title="UnderConstructionPage">UnderConstructionPage</h1>';
1643
 
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.65
8
  Author URI: http://www.webfactoryltd.com/
9
  Text Domain: under-construction-page
10
  Domain Path: lang
107
  add_action('do_feed_rss', array(__CLASS__, 'disable_feed'), 0, 1);
108
  add_action('do_feed_rss2', array(__CLASS__, 'disable_feed'), 0, 1);
109
  add_action('do_feed_atom', array(__CLASS__, 'disable_feed'), 0, 1);
110
+
111
+ add_action('wp_footer', array(__CLASS__, 'whitelisted_notice'));
112
  } // if not admin
113
 
114
  // admin bar notice for frontend & backend
117
  add_action('admin_head', array(__CLASS__, 'admin_bar_style'));
118
  } // init
119
 
120
+
121
  // check if user has the minimal WP version required by UCP
122
  static function check_wp_version($min_version) {
123
  if (!version_compare(get_bloginfo('version'), $min_version, '>=')) {
205
 
206
  if (!is_array($meta) || empty($meta)) {
207
  $meta['first_version'] = self::get_plugin_version();
208
+ $meta['first_install'] = time();
209
  update_option(UCP_META_KEY, $meta);
210
  }
211
 
281
  $meta = self::get_meta();
282
 
283
  // survey is shown min 5min after install
284
+ // no active surveys at the moment
285
+ if (0 && empty($surveys['usage']) && time() - $meta['first_install'] > 300) {
286
  $open_survey = true;
287
  } else {
288
  $open_survey = false;
437
  $response = wp_remote_get(esc_url_raw($url), $request_params);
438
  }
439
 
440
+ $surveys[$vars['survey']] = time();
441
  update_option(UCP_SURVEYS_KEY, $surveys);
442
 
443
  wp_send_json_success();
700
  return false;
701
  } elseif (in_array($current_user->ID, $options['whitelisted_users'])) {
702
  return false;
703
+ } elseif (strlen($options['end_date']) === 16 && $options['end_date'] !== '0000-00-00 00:00' && $options['end_date'] < current_time('mysql')) {
704
  return false;
705
  } else {
706
  return true;
722
  return in_array($user_role, $roles);
723
  } // user_has_role
724
 
725
+
726
+ // frontend notification when UCP is enabled but current user is whitelisted
727
+ static function whitelisted_notice() {
728
+ $notices = get_option(UCP_NOTICES_KEY);
729
+ $dismiss_url = add_query_arg(array('action' => 'ucp_dismiss_notice', 'notice' => 'whitelisted', 'redirect' => urlencode($_SERVER['REQUEST_URI'])), admin_url('admin.php'));
730
+
731
+ if (empty($notices['dismiss_whitelisted']) &&
732
+ is_user_logged_in() &&
733
+ self::is_construction_mode_enabled(true) &&
734
+ !self::is_construction_mode_enabled(false))
735
+ echo '<div style="background-color: #333; line-height: 140%; font-size: 14px; position: fixed; display: block; top: 50px; z-index: 99999; color: #fefefe; padding: 20px 35px 20px 20px; width: 500px; border: thin solid #fefefe; left: -1px;"><a style="color: #ea1919; font-weight: 900; text-decoration: none; position: absolute; top: 7px; right: 10px;" href="' . $dismiss_url . '" alt="Dismiss notice" title="Dismiss notice">X</a><b>Under Construction Mode is enabled</b> but you are whitelisted so you see the normal site.<br><a href="' . get_home_url() . '/?ucp_preview" style="text-decoration: underline; color: #fefefe;">Preview UnderConstructionPage</a><br><a href="' . admin_url('options-general.php?page=ucp') . '" style="text-decoration: underline; color: #fefefe;">Configure UnderConstructionPage</a></div>';
736
+ } // whitelisted_notification
737
+
738
 
739
  // displays various notices in admin header
740
  static function admin_notices() {
741
  $notices = get_option(UCP_NOTICES_KEY);
742
  $options = self::get_options();
743
  $meta = self::get_meta();
744
+ $current_user = wp_get_current_user();
745
+
746
+ $name = '';
747
+ if(!empty($current_user->user_firstname)) {
748
+ $name = ' ' . $current_user->user_firstname;
749
+ }
750
 
751
  if (empty($notices['dismiss_rate']) &&
752
+ (time() - $meta['first_install']) > (DAY_IN_SECONDS * 1.5)) {
753
  $rate_url = 'https://wordpress.org/support/plugin/under-construction-page/reviews/?rate=5#new-post';
754
  $dismiss_url = add_query_arg(array('action' => 'ucp_dismiss_notice', 'notice' => 'rate', 'redirect' => urlencode($_SERVER['REQUEST_URI'])), admin_url('admin.php'));
755
 
756
+ echo '<div id="ucp_rate_notice" class="notice-info notice"><p>Hi' . $name . '!<br>We saw you\'ve been using the <b class="ucp-logo" style="font-weight: bold;">UnderConstructionPage</b> plugin for a few days (that\'s awesome!) 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. It helps us out a lot!';
757
 
758
  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>';
759
  echo '&nbsp;&nbsp;&nbsp;&nbsp;<a href="' . esc_url($dismiss_url) . '">' . __('I\'ve already rated the plugin', 'under-construction-page') . '</a>';
760
+ echo '<br><br><b>Thank you very much! The UCP team</b>';
761
  echo '</p></div>';
762
  }
763
 
780
  if ($_GET['notice'] == 'rate') {
781
  $notices['dismiss_rate'] = true;
782
  }
783
+
784
+ if ($_GET['notice'] == 'whitelisted') {
785
+ $notices['dismiss_whitelisted'] = true;
786
+ }
787
 
788
  update_option(UCP_NOTICES_KEY, $notices);
789
 
887
  // show under construction notice on WP login form
888
  static function login_message($message) {
889
  if (self::is_construction_mode_enabled(true)) {
890
+ $message .= '<div class="message">' . __('Under Construction Mode is <b>enabled</b>.', 'under-construction-page') . '</div>';
891
  }
892
 
893
  return $message;
1049
 
1050
  // empty cache in 3rd party plugins
1051
  if ($options != $old_options) {
1052
+ $notices = get_option(UCP_NOTICES_KEY);
1053
+ unset($notices['dismiss_whitelisted']);
1054
+ update_option(UCP_NOTICES_KEY, $notices);
1055
+
1056
  if (function_exists('w3tc_pgcache_flush')) {
1057
  w3tc_pgcache_flush();
1058
  }
1504
  echo '</ul>';
1505
 
1506
  echo '<div style="display: none;" id="tab_support_faq" class="ucp-tab-content">';
1507
+ echo '<p><b>How can I check if construction mode is really enabled on my site?</b><br>If the under construction status is green in the admin bar (the very top of the page, above this text), then it\'s enabled. But we made a tool specifically for these kinds of situations so you can double-check everything. <a href="https://underconstructionpage.com/under-construction-tester/?url=' . urlencode(get_home_url()) . '" target="_blank">Run under construction mode tester</a>.</p>';
1508
+
1509
  echo '<p><b>How can I work on my site while construction mode is enabled?</b><br>Make sure your user role (probably admin) is selected under <a class="change_tab" data-tab="3" href="#whitelisted-roles">Access - Whitelisted User Roles</a> and open the site while logged in.</p>';
1510
 
1511
  echo '<p><b>How can I log in / access WordPress admin after construction mode has been enabled?</b><br>Enable the <a class="change_tab" data-tab="2" href="#login_button_wrap">Login Button</a> option under Content, and a login link will be shown in the lower right corner of the under construction page.</p>';
1570
  echo '<div class="ucp-tab-content">';
1571
  echo '<h3 class="ucp-pro-logo"><img src="' . UCP_PLUGIN_URL . 'images/ucp_pro_logo.png" alt="UnderConstructionPage PRO" title="UnderConstructionPage">UnderConstructionPage<span>pro</span></h3>';
1572
 
1573
+ echo '<div id="ucp-earlybird"><span>Build <b>landing pages, coming soon pages, maintenance &amp; under construction pages</b> faster &amp; easier!<br>UCP PRO comes out on October 30th. Get on the earlybird list - <b>get it cheaper &amp; a week before others</b>.</span>';
1574
+ echo '<p><input value="" type="email" placeholder="Your best email address" class="skip-save regular-text" id="ucp-earlybird-email"> <select id="ucp-earlybird-type"><option value="0">- How do you use UCP? Please select -</option><option value="solo-use">I use it only on one site</option><option value="multi-site">I use it on multiple sites I own</option><option value="webmaster">I use it on multiple sites I build/maintain for others</option></select> <a href="#" class="button button-primary button-large" id="ucp-earlybird-submit">I want the discount! Put me on the Earlybird List!</a></p>';
1575
  echo '</div>';
1576
 
1577
  echo '<h3 class="ucp-small-title">Some of the features available in the PRO version</h3>';
1670
  unset($pointers['welcome']);
1671
  update_option(UCP_POINTERS_KEY, $pointers);
1672
  }
1673
+
1674
  echo '<div class="wrap">
1675
  <h1 class="ucp-logo"><img src="' . UCP_PLUGIN_URL . 'images/ucp_logo.png" alt="UnderConstructionPage" title="UnderConstructionPage">UnderConstructionPage</h1>';
1676