Under Construction - Version 1.30

Version Description

  • 2016/11/29
  • we've crossed the 20k users mark & 100k downloads ;)
  • added notice on login form when Maintenance is enabled
  • 1 new theme
  • GUI overhaul started
  • added Dribbble social icon
Download this release

Release Info

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

Code changes from version 1.25 to 1.30

css/ucp-admin.css CHANGED
@@ -5,9 +5,13 @@
5
  */
6
 
7
 
 
 
 
 
8
  div.ucp-thumb {
9
  width: 250px;
10
- margin: 0 20px 0 0;
11
  display: inline-block;
12
  }
13
 
@@ -37,6 +41,98 @@ input[type=url]:invalid {
37
  box-shadow: 0 0 2px rgba(234,25,25,1);
38
  }
39
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
40
 
41
  /* on/off switch */
42
 
5
  */
6
 
7
 
8
+ .settings_page_ucp h1 {
9
+ font-weight: 500;
10
+ }
11
+
12
  div.ucp-thumb {
13
  width: 250px;
14
+ margin: 0 20px 30px 0;
15
  display: inline-block;
16
  }
17
 
41
  box-shadow: 0 0 2px rgba(234,25,25,1);
42
  }
43
 
44
+ .settings_page_ucp #wp-content-editor-tools {
45
+ background-color: #ffffff;
46
+ }
47
+
48
+ /* tabs */
49
+
50
+ .settings_page_ucp .ui-tabs { max-width: 100%; position: relative; padding: 0px; zoom: 1; margin-top:20px } /* position: relative prevents IE scroll bug (element with position: relative inside container with overflow: auto appear as "fixed") */
51
+
52
+ .settings_page_ucp .ui-tabs .ui-tabs-nav { margin: 0; padding: 0; }
53
+ .settings_page_ucp .ui-tabs .ui-tabs-nav li { list-style: none; position: relative; top: 1px; margin: 0 .2em 1px 0; border-bottom: 0 !important; padding: 0; white-space: nowrap; }
54
+ .settings_page_ucp .ui-tabs .ui-tabs-nav li a { text-decoration: none; }
55
+ .settings_page_ucp .ui-tabs .ui-tabs-nav li.ui-tabs-selected { margin-bottom: 0; border-bottom: 1px solid #F1F1F1 !important; }
56
+ .settings_page_ucp .ui-tabs ul.ui-tabs-nav li.ui-state-active { border-top: 3px solid #e0632f; background: #ffffff; }
57
+ .settings_page_ucp .ui-tabs .ui-tabs-nav li.ui-tabs-selected a, .settings_page_ucp .ui-tabs .ui-tabs-nav li.ui-state-disabled a, .settings_page_ucp .ui-tabs .ui-tabs-nav li.ui-state-processing a { cursor: text; }
58
+ .settings_page_ucp .ui-tabs .ui-tabs-nav li a, .settings_page_ucp .ui-tabs.ui-tabs-collapsible .ui-tabs-nav li.ui-tabs-selected a { cursor: pointer; } /* first selector in group seems obsolete, but required to overcome bug in Opera applying cursor: text overall if defined elsewhere... */
59
+ .settings_page_ucp .ui-tabs .ui-tabs-panel { display: block; border-width: 0; padding: 20px; background: #ffffff; }
60
+ .settings_page_ucp .ui-tabs .ui-tabs-hide { display: none !important; }
61
+
62
+ .settings_page_ucp .ui-tabs .ui-tabs-nav li a {
63
+ font-size: 14px;
64
+ font-weight: 600;
65
+ line-height: 32px;
66
+ color: #AAAAAA;
67
+ padding: 0 5px;
68
+ display: block;
69
+ letter-spacing: 1px;
70
+ }
71
+
72
+ .settings_page_ucp .ui-tabs ul.ui-tabs-nav li.ui-state-active {
73
+ border-top: 3px solid #e0632f;
74
+ }
75
+
76
+ .settings_page_ucp .ui-tabs ul.ui-tabs-nav li.ui-state-active .icon {
77
+ color: #e0632f;
78
+ }
79
+
80
+ .settings_page_ucp .ui-tabs-nav:after {
81
+ content: '';
82
+ clear: both;
83
+ display: block;
84
+ }
85
+
86
+ .settings_page_ucp .ui-tabs-anchor, .nav-tab {
87
+ outline: none !important;
88
+ }
89
+
90
+ .settings_page_ucp .ui-tabs ul.ui-tabs-nav li {
91
+ border: none;
92
+ color: #AAAAAA;
93
+ display: inline-block;
94
+ font-size: 12px;
95
+ line-height: 16px;
96
+ margin: 5px 5px -5px 5px;
97
+ text-decoration: none;
98
+ text-shadow: none;
99
+ background: rgba(255, 255, 255, 0.61);
100
+ padding: 15px 25px;
101
+ text-align: center;
102
+ letter-spacing: .5px;
103
+ }
104
+
105
+ .settings_page_ucp .ui-tabs ul.ui-tabs-nav li .label {
106
+ display: block;
107
+ margin-top: -10px;
108
+ }
109
+
110
+ .settings_page_ucp .ui-tabs ul.ui-tabs-nav li:first-child {
111
+ margin-left: 0;
112
+ }
113
+
114
+ .settings_page_ucp ul.ui-tabs-nav{
115
+ padding-bottom: 0;
116
+ width: 100%;
117
+ box-sizing: border-box;
118
+ border-bottom: 0px !important;
119
+ }
120
+
121
+ .settings_page_ucp .ui-state-hover a, .settings_page_ucp .ui-state-active a, .settings_page_ucp li.ui-state-hover, .settings_page_ucp li.ui-state-hover a {
122
+ color: #000000 !important;
123
+ }
124
+
125
+ .settings_page_ucp li.ui-state-hover {
126
+ background-color: #ffffff !important;
127
+ }
128
+
129
+ .settings_page_ucp .ui-tabs-nav a:focus {
130
+ box-shadow: none;
131
+ -webkit-box-shadow: none;
132
+ }
133
+
134
+
135
+ /* tabs */
136
 
137
  /* on/off switch */
138
 
images/forklift.png ADDED
Binary file
js/ucp-admin.js CHANGED
@@ -5,5 +5,34 @@
5
  */
6
 
7
 
8
- jQuery(document).ready(function() {
9
- });
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
5
  */
6
 
7
 
8
+ jQuery(document).ready(function($) {
9
+ old_settings = $('#ucp_form').serialize();
10
+
11
+ $('#ucp_tabs').tabs({
12
+ activate: function(event, ui) {
13
+ Cookies.set('ucp_tabs_selected', $('#ucp_tabs').tabs('option', 'active'), { expires: 180 });
14
+ },
15
+ active: $('#ucp_tabs').tabs({ active: Cookies.get('ucp_tabs_selected') })
16
+ }).show();
17
+
18
+ $(document).on('click', '#ucp_preview', function(e) {
19
+ if ($('#ucp_form').serialize() != old_settings) {
20
+ if (!confirm('There are unsaved changes that will not be visible in the preview. Please save changes first.\nContinue?')) {
21
+ e.preventDefault();
22
+ return false;
23
+ }
24
+ }
25
+
26
+ return true;
27
+ });
28
+
29
+ $(document).on('click', '.change_tab', function(e) {
30
+ $('#ucp_tabs').tabs('option', 'active', $(this).data('tab'));
31
+
32
+ // get the link anchor and scroll to it
33
+ target = this.href.split('#')[1];
34
+ if (target) {
35
+ $.scrollTo('#' + target, 500, {offset: {top:-50, left:0}});
36
+ }
37
+ });
38
+ }); // on ready
js/ucp-jquery-plugins.js ADDED
@@ -0,0 +1,17 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*
2
+ * Under Construction
3
+ * jQuery plugins
4
+ * (c) Web factory Ltd, 2015 - 2016
5
+ */
6
+
7
+ /**
8
+ * Copyright (c) 2007-2012 Ariel Flesler - aflesler(at)gmail(dot)com | http://flesler.blogspot.com
9
+ * Dual licensed under MIT and GPL.
10
+ * @author Ariel Flesler
11
+ * @version 1.4.3.1
12
+ */
13
+ ;(function($){var h=$.scrollTo=function(a,b,c){$(window).scrollTo(a,b,c)};h.defaults={axis:'xy',duration:parseFloat($.fn.jquery)>=1.3?0:1,limit:true};h.window=function(a){return $(window)._scrollable()};$.fn._scrollable=function(){return this.map(function(){var a=this,isWin=!a.nodeName||$.inArray(a.nodeName.toLowerCase(),['iframe','#document','html','body'])!=-1;if(!isWin)return a;var b=(a.contentWindow||a).document||a.ownerDocument||a;return/webkit/i.test(navigator.userAgent)||b.compatMode=='BackCompat'?b.body:b.documentElement})};$.fn.scrollTo=function(e,f,g){if(typeof f=='object'){g=f;f=0}if(typeof g=='function')g={onAfter:g};if(e=='max')e=9e9;g=$.extend({},h.defaults,g);f=f||g.duration;g.queue=g.queue&&g.axis.length>1;if(g.queue)f/=2;g.offset=both(g.offset);g.over=both(g.over);return this._scrollable().each(function(){if(e==null)return;var d=this,$elem=$(d),targ=e,toff,attr={},win=$elem.is('html,body');switch(typeof targ){case'number':case'string':if(/^([+-]=)?\d+(\.\d+)?(px|%)?$/.test(targ)){targ=both(targ);break}targ=$(targ,this);if(!targ.length)return;case'object':if(targ.is||targ.style)toff=(targ=$(targ)).offset()}$.each(g.axis.split(''),function(i,a){var b=a=='x'?'Left':'Top',pos=b.toLowerCase(),key='scroll'+b,old=d[key],max=h.max(d,a);if(toff){attr[key]=toff[pos]+(win?0:old-$elem.offset()[pos]);if(g.margin){attr[key]-=parseInt(targ.css('margin'+b))||0;attr[key]-=parseInt(targ.css('border'+b+'Width'))||0}attr[key]+=g.offset[pos]||0;if(g.over[pos])attr[key]+=targ[a=='x'?'width':'height']()*g.over[pos]}else{var c=targ[pos];attr[key]=c.slice&&c.slice(-1)=='%'?parseFloat(c)/100*max:c}if(g.limit&&/^\d+$/.test(attr[key]))attr[key]=attr[key]<=0?0:Math.min(attr[key],max);if(!i&&g.queue){if(old!=attr[key])animate(g.onAfterFirst);delete attr[key]}});animate(g.onAfter);function animate(a){$elem.animate(attr,f,g.easing,a&&function(){a.call(this,e,g)})}}).end()};h.max=function(a,b){var c=b=='x'?'Width':'Height',scroll='scroll'+c;if(!$(a).is('html,body'))return a[scroll]-$(a)[c.toLowerCase()]();var d='client'+c,html=a.ownerDocument.documentElement,body=a.ownerDocument.body;return Math.max(html[scroll],body[scroll])-Math.min(html[d],body[d])};function both(a){return typeof a=='object'?a:{top:a,left:a}}})(jQuery);
14
+
15
+
16
+ /*! js-cookie v2.1.3 | MIT */
17
+ !function(a){var b=!1;if("function"==typeof define&&define.amd&&(define(a),b=!0),"object"==typeof exports&&(module.exports=a(),b=!0),!b){var c=window.Cookies,d=window.Cookies=a();d.noConflict=function(){return window.Cookies=c,d}}}(function(){function a(){for(var a=0,b={};a<arguments.length;a++){var c=arguments[a];for(var d in c)b[d]=c[d]}return b}function b(c){function d(b,e,f){var g;if("undefined"!=typeof document){if(arguments.length>1){if(f=a({path:"/"},d.defaults,f),"number"==typeof f.expires){var h=new Date;h.setMilliseconds(h.getMilliseconds()+864e5*f.expires),f.expires=h}try{g=JSON.stringify(e),/^[\{\[]/.test(g)&&(e=g)}catch(i){}return e=c.write?c.write(e,b):encodeURIComponent(e+"").replace(/%(23|24|26|2B|3A|3C|3E|3D|2F|3F|40|5B|5D|5E|60|7B|7D|7C)/g,decodeURIComponent),b=encodeURIComponent(b+""),b=b.replace(/%(23|24|26|2B|5E|60|7C)/g,decodeURIComponent),b=b.replace(/[\(\)]/g,escape),document.cookie=b+"="+e+(f.expires?"; expires="+f.expires.toUTCString():"")+(f.path?"; path="+f.path:"")+(f.domain?"; domain="+f.domain:"")+(f.secure?"; secure":"")}b||(g={});for(var j=document.cookie?document.cookie.split("; "):[],k=/(%[0-9A-Z]{2})+/g,l=0;l<j.length;l++){var m=j[l].split("="),n=m.slice(1).join("=");'"'===n.charAt(0)&&(n=n.slice(1,-1));try{var o=m[0].replace(k,decodeURIComponent);if(n=c.read?c.read(n,o):c(n,o)||n.replace(k,decodeURIComponent),this.json)try{n=JSON.parse(n)}catch(i){}if(b===o){g=n;break}b||(g[o]=n)}catch(i){}}return g}}return d.set=d,d.get=function(a){return d.call(d,a)},d.getJSON=function(){return d.apply({json:!0},[].slice.call(arguments))},d.defaults={},d.remove=function(b,c){d(b,"",a(c,{expires:-1}))},d.withConverter=b,d}return b(function(){})});
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.25
7
  License: GPLv2 or later
8
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
9
 
@@ -29,6 +29,7 @@ A simple, no-nonsense plugin for all those situations when you have to hide the
29
  * LinkedIn
30
  * YouTube
31
  * Pinterest
 
32
 
33
 
34
  == Installation ==
@@ -55,10 +56,19 @@ Or if needed, upload manually;
55
  3. Plain Text theme
56
  4. Under Construction theme
57
  5. Things Went Dark theme
 
58
 
59
 
60
  == Changelog ==
61
 
 
 
 
 
 
 
 
 
62
  = 1.25 =
63
  * 2016/10/24
64
  * fixed fatal cache busting bug reported by @jonofgahh
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.30
7
  License: GPLv2 or later
8
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
9
 
29
  * LinkedIn
30
  * YouTube
31
  * Pinterest
32
+ * Dribbble
33
 
34
 
35
  == Installation ==
56
  3. Plain Text theme
57
  4. Under Construction theme
58
  5. Things Went Dark theme
59
+ 6. Forklift at Work theme
60
 
61
 
62
  == Changelog ==
63
 
64
+ = 1.30 =
65
+ * 2016/11/29
66
+ * we've crossed the 20k users mark & 100k downloads ;)
67
+ * added notice on login form when Maintenance is enabled
68
+ * 1 new theme
69
+ * GUI overhaul started
70
+ * added Dribbble social icon
71
+
72
  = 1.25 =
73
  * 2016/10/24
74
  * fixed fatal cache busting bug reported by @jonofgahh
themes/forklift/forklift.png ADDED
Binary file
themes/forklift/index.php ADDED
@@ -0,0 +1,57 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*
3
+ * Under Construction
4
+ * Forklift 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]forklift.png" alt="Forklift at Work" title="Forklift at Work">
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
+ [social-icons]
52
+ </div>
53
+ </div>
54
+
55
+ </div>
56
+ </body>
57
+ </html>
themes/forklift/style.css ADDED
@@ -0,0 +1,75 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*
2
+ * Under Construction
3
+ * Forklift 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: #414042;
19
+ background: #fd6439 ; /* Old browsers */
20
+ background: -moz-linear-gradient(-45deg, #fd6439 0%,#fd6438 67%,#000000 139%); /* FF3.6-15 */
21
+ background: -webkit-linear-gradient(-45deg, #fd6439 0%,#fd6438 67%,#000000 139%); /* Chrome10-25,Safari5.1-6 */
22
+ background: linear-gradient(135deg, #fd6439 0%,#fd6438 67%,#000000 139%); /* W3C, IE10+, FF16+, Chrome26+, Opera12+, Safari7+ */
23
+ filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#fd6439', 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
+ border-bottom: 1px solid rgba(0, 0, 0, 0.24);
32
+ }
33
+
34
+ #hero-image img {
35
+ max-width: 80%;
36
+ }
37
+
38
+ h1 {
39
+ font-size: 34px;
40
+ color: #414042;
41
+ font-family: "Roboto", sans-serif;
42
+ font-weight: 900;
43
+ margin: 60px 0 30px 0;
44
+ text-align: center;
45
+ }
46
+
47
+ .content {
48
+ text-align: center;
49
+ font-family: "Helvetica", "Arial", sans-serif;
50
+ }
51
+
52
+ #social {
53
+ text-align: center;
54
+ margin-top: 30px;
55
+ }
56
+
57
+ #social a i {
58
+ color: #414042;
59
+ margin: 10px;
60
+ box-sizing: content-box;
61
+ }
62
+
63
+ #social a:hover i {
64
+ color: #000000;
65
+ }
66
+
67
+ @media(max-width:767px){
68
+ h1 {
69
+ font-size: 30px;
70
+ margin: 10px 0 30px 0;
71
+ }
72
+ #hero-image img {
73
+ max-width: 95%;
74
+ }
75
+ }
under-construction.php CHANGED
@@ -1,15 +1,15 @@
1
  <?php
2
  /*
3
  Plugin Name: Under Construction
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.25
8
  Author URI: http://www.webfactoryltd.com/
9
  Text Domain: under-construction-page
10
  Domain Path: lang
11
 
12
- Copyright 2015 - 2016 Web factory Ltd (email : ucp@webfactoryltd.com)
13
 
14
  This program is free software; you can redistribute it and/or modify
15
  it under the terms of the GNU General Public License, version 2, as
@@ -85,8 +85,11 @@ class UCP {
85
  // AJAX endpoints
86
  add_action('wp_ajax_ucp_dismiss_pointer', array(__CLASS__, 'dismiss_pointer_ajax'));
87
  } else {
88
- // main logic
89
  add_action('wp', array(__CLASS__, 'display_construction_page'), 0, 1);
 
 
 
90
 
91
  // disable feeds
92
  add_action('do_feed_rdf', array(__CLASS__, 'disable_feed'), 1, 1);
@@ -188,11 +191,19 @@ class UCP {
188
  } // get_meta
189
 
190
 
191
- // fetch and display construction the page if it's enabled
192
  static function display_construction_page() {
193
  $options = self::get_options();
194
-
195
- if (true == self::is_construction_mode_enabled(false)) {
 
 
 
 
 
 
 
 
196
  header(wp_get_server_protocol() . ' 503 Service Unavailable');
197
  echo self::get_template($options['theme']);
198
  exit;
@@ -220,6 +231,9 @@ class UCP {
220
 
221
  if ('settings_page_ucp' == $hook) {
222
  wp_enqueue_style('ucp-admin', UCP_PLUGIN_URL . 'css/ucp-admin.css', array(), self::$version);
 
 
 
223
  wp_enqueue_script('ucp-admin', UCP_PLUGIN_URL . 'js/ucp-admin.js', array('jquery'), self::$version, true);
224
  }
225
 
@@ -297,6 +311,9 @@ class UCP {
297
  if (!empty($options['social_pinterest'])) {
298
  $out .= '<a href="' . $options['social_pinterest'] . '" target="_blank"><i class="fa fa-pinterest-square fa-3x"></i></a>';
299
  }
 
 
 
300
 
301
  return $out;
302
  } // generate_social_icons
@@ -332,10 +349,10 @@ class UCP {
332
 
333
 
334
  // checks if construction mode is enabled for the current visitor
335
- static function is_construction_mode_enabled($global = false) {
336
  $options = self::get_options();
337
 
338
- if ($global) {
339
  if ($options['status']) {
340
  return true;
341
  } else {
@@ -380,7 +397,7 @@ class UCP {
380
 
381
  if (empty($notices['dismiss_rate']) &&
382
  (current_time('timestamp') - $meta['first_install']) > (DAY_IN_SECONDS * 3)) {
383
- $rate_url = 'https://wordpress.org/support/plugin/under-construction-page/reviews/#new-post';
384
  $dismiss_url = add_query_arg(array('action' => 'ucp_dismiss_notice', 'notice' => 'rate', 'redirect' => urlencode($_SERVER['REQUEST_URI'])), admin_url('admin.php'));
385
 
386
  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!';
@@ -437,6 +454,18 @@ class UCP {
437
  'meta' => array('class' => $class)
438
  ));
439
  } // admin_bar_notice
 
 
 
 
 
 
 
 
 
 
 
 
440
 
441
 
442
  // add settings link to plugins page
@@ -462,7 +491,7 @@ class UCP {
462
 
463
  // create the admin menu item
464
  static function admin_menu() {
465
- add_options_page('Under Construction', 'Under Construction', 'manage_options', 'ucp', array(__CLASS__, 'options_page'));
466
  } // admin_menu
467
 
468
 
@@ -485,6 +514,7 @@ class UCP {
485
  'social_linkedin' => '',
486
  'social_youtube' => '',
487
  'social_pinterest' => '',
 
488
  'roles' => array('administrator')
489
  );
490
 
@@ -507,6 +537,7 @@ class UCP {
507
  case 'social_linkedin':
508
  case 'social_youtube':
509
  case 'social_pinterest':
 
510
  $options[$key] = trim($value);
511
  break;
512
  } // switch
@@ -515,6 +546,7 @@ class UCP {
515
  $options['roles'] = (array) $options['roles'];
516
  $options = self::check_var_isset($options, array('status' => 0));
517
 
 
518
  if ($options['status'] != $old_options['status']) {
519
  if (function_exists('w3tc_pgcache_flush')) {
520
  w3tc_pgcache_flush();
@@ -523,6 +555,13 @@ class UCP {
523
  global $file_prefix;
524
  wp_cache_clean_cache($file_prefix);
525
  }
 
 
 
 
 
 
 
526
  }
527
 
528
  return array_merge($old_options, $options);
@@ -587,34 +626,16 @@ class UCP {
587
  return $out;
588
  }
589
  } // create_select_options
590
-
591
 
592
- // output the whole options page
593
- static function options_page() {
594
- if (!current_user_can('manage_options')) {
595
- wp_die('You do not have sufficient permissions to access this page.');
596
- }
597
-
598
  $options = self::get_options();
599
  $default_options = self::default_options();
600
-
601
- echo '<div class="wrap">
602
- <h1>Under Construction</h1>';
603
-
604
- echo '<form action="options.php" method="post">';
605
- settings_fields(UCP_OPTIONS_KEY);
606
-
607
- echo '<table class="form-table"><tbody>';
608
-
609
  $status[] = array('val' => '0', 'label' => 'Disabled - site is working normally');
610
  $status[] = array('val' => '1', 'label' => 'Enabled - site is in under construction mode');
611
-
612
- $tmp_roles = get_editable_roles();
613
- foreach ($tmp_roles as $tmp_role => $details) {
614
- $name = translate_user_role($details['name']);
615
- $roles[] = array('val' => $tmp_role, 'label' => $name);
616
- }
617
- $roles[] = array('val' => 'guest', 'label' => 'Guest (not logged in user)');
618
 
619
  echo '<tr valign="top">
620
  <th scope="row"><label for="status">Status</label></th>
@@ -624,27 +645,21 @@ class UCP {
624
  <span class="onoffswitch-inner"></span>
625
  <span class="onoffswitch-switch"></span>
626
  </label>
627
- </div>
628
- ';
629
 
630
- 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>';
631
  echo '</td></tr>';
632
-
633
- $img = plugins_url('/images/', __FILE__);
634
- echo '<tr valign="top">
635
- <th scope="row">Theme</th>
636
- <td>
637
- <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>
638
 
639
- <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>
640
-
641
- <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>
 
 
 
 
642
 
643
- <div class="ucp-thumb"><label for="layout-4"><img src="' . $img . 'dark.png" alt="Things Went Dark" title="Things Went Dark" /></label><br /><input ' . self::checked('dark', $options['theme']) . ' type="radio" id="layout-4" name="' . UCP_OPTIONS_KEY . '[theme]" value="dark" /> Things Went Dark</div>
644
 
645
- <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>
646
- </td></tr>';
647
-
648
  echo '<tr valign="top">
649
  <th scope="row"><label for="title">Title</label></th>
650
  <td><input type="text" id="title" class="regular-text" name="' . UCP_OPTIONS_KEY . '[title]" value="' . $options['title'] . '" />';
@@ -707,7 +722,58 @@ class UCP {
707
  <td><input id="social_pinterest" type="url" class="regular-text code" name="' . UCP_OPTIONS_KEY . '[social_pinterest]" value="' . $options['social_pinterest'] . '" placeholder="Pinterest profile URL">';
708
  echo '<p class="description">Complete URL, with http prefix, to Pinterest profile.</p>';
709
  echo '</td></tr>';
710
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
711
  echo '<tr valign="top" id="whitelisted-roles">
712
  <th scope="row">Whitelisted User Roles</th>
713
  <td>';
@@ -717,11 +783,77 @@ class UCP {
717
  }
718
  echo '<p class="description">Selected user roles will <b>not</b> be affected by the under construction mode and will always see the "normal" site. Default: administrator.</p>';
719
  echo '</td></tr>';
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
720
 
721
- echo '</tbody></table>';
 
 
 
 
722
 
723
- echo get_submit_button('Save Changes');
724
- echo '</form></div>';
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
725
  } // options_page
726
 
727
 
1
  <?php
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: 1.30
8
  Author URI: http://www.webfactoryltd.com/
9
  Text Domain: under-construction-page
10
  Domain Path: lang
11
 
12
+ Copyright 2015 - 2016 Web factory Ltd (email: ucp@webfactoryltd.com)
13
 
14
  This program is free software; you can redistribute it and/or modify
15
  it under the terms of the GNU General Public License, version 2, as
85
  // AJAX endpoints
86
  add_action('wp_ajax_ucp_dismiss_pointer', array(__CLASS__, 'dismiss_pointer_ajax'));
87
  } else {
88
+ // main plugin logic
89
  add_action('wp', array(__CLASS__, 'display_construction_page'), 0, 1);
90
+
91
+ // show under construction notice on login form
92
+ add_filter('login_message', array(__CLASS__, 'login_message'));
93
 
94
  // disable feeds
95
  add_action('do_feed_rdf', array(__CLASS__, 'disable_feed'), 1, 1);
191
  } // get_meta
192
 
193
 
194
+ // fetch and display the construction page if it's enabled or preview requested
195
  static function display_construction_page() {
196
  $options = self::get_options();
197
+
198
+ // some URLs have to be accessible at all times
199
+ if ($_SERVER['REQUEST_URI'] == '/wp-admin' ||
200
+ $_SERVER['REQUEST_URI'] == '/wp-admin/' ||
201
+ $_SERVER['REQUEST_URI'] == '/wp-login.php') {
202
+ return true;
203
+ }
204
+
205
+ if (true == self::is_construction_mode_enabled(false)
206
+ || (is_user_logged_in() && isset($_GET['ucp_preview']))) {
207
  header(wp_get_server_protocol() . ' 503 Service Unavailable');
208
  echo self::get_template($options['theme']);
209
  exit;
231
 
232
  if ('settings_page_ucp' == $hook) {
233
  wp_enqueue_style('ucp-admin', UCP_PLUGIN_URL . 'css/ucp-admin.css', array(), self::$version);
234
+
235
+ wp_enqueue_script('jquery-ui-tabs');
236
+ wp_enqueue_script('ucp-jquery-plugins', UCP_PLUGIN_URL . 'js/ucp-jquery-plugins.js', array('jquery'), self::$version, true);
237
  wp_enqueue_script('ucp-admin', UCP_PLUGIN_URL . 'js/ucp-admin.js', array('jquery'), self::$version, true);
238
  }
239
 
311
  if (!empty($options['social_pinterest'])) {
312
  $out .= '<a href="' . $options['social_pinterest'] . '" target="_blank"><i class="fa fa-pinterest-square fa-3x"></i></a>';
313
  }
314
+ if (!empty($options['social_dribbble'])) {
315
+ $out .= '<a href="' . $options['social_dribbble'] . '" target="_blank"><i class="fa fa-dribbble fa-3x"></i></a>';
316
+ }
317
 
318
  return $out;
319
  } // generate_social_icons
349
 
350
 
351
  // checks if construction mode is enabled for the current visitor
352
+ static function is_construction_mode_enabled($settings_only = false) {
353
  $options = self::get_options();
354
 
355
+ if ($settings_only) {
356
  if ($options['status']) {
357
  return true;
358
  } else {
397
 
398
  if (empty($notices['dismiss_rate']) &&
399
  (current_time('timestamp') - $meta['first_install']) > (DAY_IN_SECONDS * 3)) {
400
+ $rate_url = 'https://wordpress.org/support/plugin/under-construction-page/reviews/?rate=5#new-post';
401
  $dismiss_url = add_query_arg(array('action' => 'ucp_dismiss_notice', 'notice' => 'rate', 'redirect' => urlencode($_SERVER['REQUEST_URI'])), admin_url('admin.php'));
402
 
403
  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!';
454
  'meta' => array('class' => $class)
455
  ));
456
  } // admin_bar_notice
457
+
458
+
459
+ // show under construction notice on WP login form
460
+ static function login_message($message) {
461
+ $options = get_option('wf_mm');
462
+
463
+ if (self::is_construction_mode_enabled(true)) {
464
+ $message .= '<div class="message">Under Construction mode is <b>enabled</b>.</div>';
465
+ }
466
+
467
+ return $message;
468
+ } // login_notice
469
 
470
 
471
  // add settings link to plugins page
491
 
492
  // create the admin menu item
493
  static function admin_menu() {
494
+ add_options_page('Under Construction', 'Under Construction', 'manage_options', 'ucp', array(__CLASS__, 'main_page'));
495
  } // admin_menu
496
 
497
 
514
  'social_linkedin' => '',
515
  'social_youtube' => '',
516
  'social_pinterest' => '',
517
+ 'social_dribbble' => '',
518
  'roles' => array('administrator')
519
  );
520
 
537
  case 'social_linkedin':
538
  case 'social_youtube':
539
  case 'social_pinterest':
540
+ case 'social_dribbble':
541
  $options[$key] = trim($value);
542
  break;
543
  } // switch
546
  $options['roles'] = (array) $options['roles'];
547
  $options = self::check_var_isset($options, array('status' => 0));
548
 
549
+ // empty cache in 3rd party plugins
550
  if ($options['status'] != $old_options['status']) {
551
  if (function_exists('w3tc_pgcache_flush')) {
552
  w3tc_pgcache_flush();
555
  global $file_prefix;
556
  wp_cache_clean_cache($file_prefix);
557
  }
558
+ if (function_exists('wp_cache_clear_cache')) {
559
+ wp_cache_clear_cache();
560
+ }
561
+ if (class_exists('Endurance_Page_Cache')) {
562
+ $epc = new Endurance_Page_Cache;
563
+ $epc->purge_all();
564
+ }
565
  }
566
 
567
  return array_merge($old_options, $options);
626
  return $out;
627
  }
628
  } // create_select_options
 
629
 
630
+
631
+ static function tab_main() {
 
 
 
 
632
  $options = self::get_options();
633
  $default_options = self::default_options();
634
+
 
 
 
 
 
 
 
 
635
  $status[] = array('val' => '0', 'label' => 'Disabled - site is working normally');
636
  $status[] = array('val' => '1', 'label' => 'Enabled - site is in under construction mode');
637
+
638
+ echo '<table class="form-table">';
 
 
 
 
 
639
 
640
  echo '<tr valign="top">
641
  <th scope="row"><label for="status">Status</label></th>
645
  <span class="onoffswitch-inner"></span>
646
  <span class="onoffswitch-switch"></span>
647
  </label>
648
+ </div>';
 
649
 
650
+ echo '<p class="description">By enabling construction mode all users (<a class="change_tab" data-tab="3" 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>';
651
  echo '</td></tr>';
 
 
 
 
 
 
652
 
653
+ echo '</table>';
654
+ } // tab_main
655
+
656
+
657
+ static function tab_content() {
658
+ $options = self::get_options();
659
+ $default_options = self::default_options();
660
 
661
+ echo '<table class="form-table">';
662
 
 
 
 
663
  echo '<tr valign="top">
664
  <th scope="row"><label for="title">Title</label></th>
665
  <td><input type="text" id="title" class="regular-text" name="' . UCP_OPTIONS_KEY . '[title]" value="' . $options['title'] . '" />';
722
  <td><input id="social_pinterest" type="url" class="regular-text code" name="' . UCP_OPTIONS_KEY . '[social_pinterest]" value="' . $options['social_pinterest'] . '" placeholder="Pinterest profile URL">';
723
  echo '<p class="description">Complete URL, with http prefix, to Pinterest profile.</p>';
724
  echo '</td></tr>';
725
+
726
+ echo '<tr valign="top">
727
+ <th scope="row"><label for="social_dribbble">Dribbble Profile</label></th>
728
+ <td><input id="social_dribbble" type="url" class="regular-text code" name="' . UCP_OPTIONS_KEY . '[social_dribbble]" value="' . $options['social_dribbble'] . '" placeholder="Dribbble profile URL">';
729
+ echo '<p class="description">Complete URL, with http prefix, to Dribbble profile.</p>';
730
+ echo '</td></tr>';
731
+
732
+ echo '</table>';
733
+ } // tab_content
734
+
735
+
736
+ static function tab_design() {
737
+ $options = self::get_options();
738
+ $default_options = self::default_options();
739
+
740
+ $img = UCP_PLUGIN_URL . 'images/';
741
+
742
+ echo '<table class="form-table">';
743
+ echo '<tr valign="top">
744
+ <th scope="row">Theme</th>
745
+ <td>
746
+ <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>
747
+
748
+ <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>
749
+
750
+ <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>
751
+
752
+ <div class="ucp-thumb"><label for="layout-4"><img src="' . $img . 'dark.png" alt="Things Went Dark" title="Things Went Dark" /></label><br /><input ' . self::checked('dark', $options['theme']) . ' type="radio" id="layout-4" name="' . UCP_OPTIONS_KEY . '[theme]" value="dark" /> Things Went Dark</div>
753
+
754
+ <div class="ucp-thumb"><label for="layout-5"><img src="' . $img . 'forklift.png" alt="Forklift at Work" title="Forklift at Work" /></label><br /><input ' . self::checked('forklift', $options['theme']) . ' type="radio" id="layout-5" name="' . UCP_OPTIONS_KEY . '[theme]" value="forklift" /> Forklift at Work</div>
755
+
756
+ <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>
757
+ </td></tr>';
758
+
759
+ echo '</table>';
760
+ } // tab_design
761
+
762
+
763
+ static function tab_access() {
764
+ $options = self::get_options();
765
+ $default_options = self::default_options();
766
+
767
+ $tmp_roles = get_editable_roles();
768
+ foreach ($tmp_roles as $tmp_role => $details) {
769
+ $name = translate_user_role($details['name']);
770
+ $roles[] = array('val' => $tmp_role, 'label' => $name);
771
+ }
772
+ //$roles[] = array('val' => 'guest', 'label' => 'Guest (not logged in user)');
773
+ // todo stupid?
774
+
775
+ echo '<table class="form-table">';
776
+
777
  echo '<tr valign="top" id="whitelisted-roles">
778
  <th scope="row">Whitelisted User Roles</th>
779
  <td>';
783
  }
784
  echo '<p class="description">Selected user roles will <b>not</b> be affected by the under construction mode and will always see the "normal" site. Default: administrator.</p>';
785
  echo '</td></tr>';
786
+
787
+ echo '</table>';
788
+ } // tab_access
789
+
790
+
791
+ // todo next version
792
+ static function tab_emails() {
793
+ $options = self::get_options();
794
+ $default_options = self::default_options();
795
+ } // tab_emails
796
+
797
+
798
+ // todo next version
799
+ static function tab_advanced() {
800
+ $options = self::get_options();
801
+ $default_options = self::default_options();
802
+ } // tab_advanced
803
+
804
+
805
+ // output the whole options page
806
+ static function main_page() {
807
+ if (!current_user_can('manage_options')) {
808
+ wp_die('You do not have sufficient permissions to access this page.');
809
+ }
810
+
811
+ $options = self::get_options();
812
+ $default_options = self::default_options();
813
 
814
+ echo '<div class="wrap">
815
+ <h1>Under Construction</h1>';
816
+
817
+ echo '<form action="options.php" method="post" id="ucp_form">';
818
+ settings_fields(UCP_OPTIONS_KEY);
819
 
820
+ $tabs = array();
821
+ $tabs[] = array('id' => 'ucp_main', 'icon' => 'dashicons-admin-settings', 'class' => '', 'label' => 'Main', 'callback' => array(__CLASS__, 'tab_main'));
822
+ $tabs[] = array('id' => 'ucp_design', 'icon' => 'dashicons-admin-customizer', 'class' => '', 'label' => 'Design', 'callback' => array(__CLASS__, 'tab_design'));
823
+ $tabs[] = array('id' => 'ucp_content', 'icon' => 'dashicons-format-aside', 'class' => '', 'label' => 'Content', 'callback' => array(__CLASS__, 'tab_content'));
824
+ $tabs[] = array('id' => 'ucp_access', 'icon' => 'dashicons-shield', 'class' => '', 'label' => 'Access', 'callback' => array(__CLASS__, 'tab_access'));
825
+
826
+ // todo next version
827
+ //$tabs[] = array('id' => 'ucp_emails', 'class' => '', 'label' => 'Emails', 'callback' => array(__CLASS__, 'tab_emails'));
828
+ //$tabs[] = array('id' => 'ucp_advanced', 'class' => '', 'label' => 'Advanced', 'callback' => array(__CLASS__, 'tab_advanced'));
829
+ $tabs = apply_filters('ucp_tabs', $tabs);
830
+
831
+ echo '<div id="ucp_tabs" class="ui-tabs" style="display: none;">';
832
+ echo '<ul>';
833
+ foreach ($tabs as $tab) {
834
+ if(!empty($tab['label'])){
835
+ echo '<li><a href="#' . $tab['id'] . '" class="' . $tab['class'] . '"><span class="icon"><span class="dashicons ' . $tab['icon'] . '"></span></span><span class="label">' . $tab['label'] . '</span></a></li>';
836
+ }
837
+ }
838
+ echo '</ul>';
839
+
840
+ foreach ($tabs as $tab) {
841
+ if(is_callable($tab['callback'])) {
842
+ echo '<div style="display: none;" id="' . $tab['id'] . '">';
843
+ call_user_func($tab['callback']);
844
+ echo '</div>';
845
+ }
846
+ } // foreach
847
+
848
+ echo '</div>'; // ucp_tabs
849
+
850
+ echo '<p class="submit">';
851
+ echo get_submit_button('Save Changes', 'primary large', 'submit', false);
852
+ echo ' &nbsp; &nbsp; <a id="ucp_preview" href="' . get_home_url() . '/?ucp_preview" class="button button-large button-secondary" target="_blank">Preview</a>';
853
+ echo '</p>';
854
+
855
+ echo '</form>'; // ucp_tabs
856
+ echo '</div>'; // wrap
857
  } // options_page
858
 
859