CMP – Coming Soon & Maintenance Plugin by NiteoThemes - Version 3.1.2

Version Description

Download this release

Release Info

Developer niteo
Plugin Icon 128x128 CMP – Coming Soon & Maintenance Plugin by NiteoThemes
Version 3.1.2
Comparing to
See all releases

Code changes from version 3.1.1 to 3.1.2

cmp-settings.php CHANGED
@@ -22,9 +22,9 @@ if ( $_SERVER['REQUEST_METHOD'] == 'POST' ) {
22
 
23
  if ( isset($_POST['cmp_status']) ) {
24
  update_option('niteoCS_status', $this->sanitize_checkbox($_POST['cmp_status']) );
25
- } else {
26
 
27
- update_option('niteoCS_status', false);
 
28
  }
29
 
30
  if ( isset($_POST['niteoCS_select_theme']) && in_array($_POST['niteoCS_select_theme'], $this->cmp_themes_available())) {
@@ -119,7 +119,7 @@ if ( $_SERVER['REQUEST_METHOD'] == 'POST' ) {
119
  }
120
 
121
  if (isset($_POST['niteoCS_banner_video'])) {
122
- update_option('niteoCS_banner_video]', sanitize_text_field($_POST['niteoCS_banner_video']));
123
  }
124
 
125
  if (isset($_POST['niteoCS_youtube_url'])) {
@@ -541,8 +541,8 @@ add_thickbox();
541
  <fieldset class="cmp-status">
542
 
543
  <div class="toggle-wrapper">
544
- <input type="checkbox" id="cmp-status" class="toggle-checkbox" <?php checked( '1', get_option('niteoCS_status', false) ); ?> name="cmp_status">
545
- <label for="cmp-status" class="toggle"><span class="toggle_handler"></span></label>
546
  </div>
547
 
548
  </fieldset>
@@ -552,22 +552,22 @@ add_thickbox();
552
  <tr>
553
  <th><?php _e('Mode', 'cmp-coming-soon-maintenance');?></th>
554
  <td>
555
- <fieldset class="cmp-status switch<?php echo ($this->cmp_status() == 2) ? ' active' : '';?>">
556
- <input type="radio" name="cmp-activate" value="2" <?php checked( '2', get_option('niteoCS_activation', '2') ); ?> <?php disabled( '', get_option('niteoCS_status', '') ); ?>>&nbsp;<?php _e('Coming Soon & Landing Page', 'cmp-coming-soon-maintenance');?><br>
557
  <span class="info"><?php _e('Returns standard 200 HTTP OK response code to indexing robots. Set this option if you want to use our plugin as "Coming Soon" page.','cmp-coming-soon-maintenance')?></span>
558
 
559
  </fieldset>
560
 
561
- <fieldset class="cmp-status switch<?php echo ($this->cmp_status() == 1) ? ' active' : '';?>">
562
- <input type="radio" name="cmp-activate" value="1" <?php checked( '1', get_option('niteoCS_activation', '2') ); ?> <?php disabled( '', get_option('niteoCS_status', '') ); ?>>&nbsp;<?php _e('Maintanance Mode', 'cmp-coming-soon-maintenance');?><br>
563
  <span class="info"><?php _e('Returns 503 HTTP Service unavailable code to indexing robots. Set this option if your site is down due to maintanance and you want to display Maintanance page.','cmp-coming-soon-maintenance')?></span>
564
 
565
  </fieldset>
566
 
567
- <fieldset class="cmp-status switch<?php echo ($this->cmp_status() == 3) ? ' active' : '';?>">
568
- <input type="radio" name="cmp-activate" value="3" <?php checked( '3', get_option('niteoCS_activation', '2') ); ?> <?php disabled( '', get_option('niteoCS_status', '') ); ?>>&nbsp;<?php _e('Redirect Mode', 'cmp-coming-soon-maintenance');?><br>
569
  <span class="info redirect"><?php _e('Choose Redirect Mode if you want to redirect your website to another URL.','cmp-coming-soon-maintenance')?></span>
570
- <div class="redirect-inputs" <?php echo ( $this->cmp_status() == 3 ) ? 'style="display: block"' : 'style="display: none"';?>>
571
  <input type="text" id="niteoCS_URL_redirect" name="niteoCS_URL_redirect" value="<?php echo esc_url( $niteoCS_URL_redirect ); ?>" class="regular-text code"><br>
572
  <label for="niteoCS_redirect_time"><?php _e('Delay Time in Seconds', 'cmp-coming-soon-maintenance');?></label>
573
  <input type="text" id="niteoCS_redirect_time" name="niteoCS_redirect_time" value="<?php echo esc_attr( $niteoCS_redirect_time ); ?>" class="regular-text code"><br>
22
 
23
  if ( isset($_POST['cmp_status']) ) {
24
  update_option('niteoCS_status', $this->sanitize_checkbox($_POST['cmp_status']) );
 
25
 
26
+ } else if ( !isset($_POST['submit_theme']) ) {
27
+ update_option('niteoCS_status', '0');
28
  }
29
 
30
  if ( isset($_POST['niteoCS_select_theme']) && in_array($_POST['niteoCS_select_theme'], $this->cmp_themes_available())) {
119
  }
120
 
121
  if (isset($_POST['niteoCS_banner_video'])) {
122
+ update_option('niteoCS_banner_video', sanitize_text_field($_POST['niteoCS_banner_video']));
123
  }
124
 
125
  if (isset($_POST['niteoCS_youtube_url'])) {
541
  <fieldset class="cmp-status">
542
 
543
  <div class="toggle-wrapper">
544
+ <input type="checkbox" id="cmp-status" class="toggle-checkbox" <?php checked( '1', $this->cmp_active() ); ?> name="cmp_status">
545
+ <label for="cmp-status" class="toggle"><span class="toggle_handler"></span></label>
546
  </div>
547
 
548
  </fieldset>
552
  <tr>
553
  <th><?php _e('Mode', 'cmp-coming-soon-maintenance');?></th>
554
  <td>
555
+ <fieldset class="cmp-status switch<?php echo $this->cmp_mode() == 2 ? ' active' : '';?>">
556
+ <input type="radio" name="cmp-activate" value="2" <?php checked( '2', $this->cmp_mode() ); ?> <?php disabled( '0', $this->cmp_active() ); ?>>&nbsp;<?php _e('Coming Soon & Landing Page', 'cmp-coming-soon-maintenance');?><br>
557
  <span class="info"><?php _e('Returns standard 200 HTTP OK response code to indexing robots. Set this option if you want to use our plugin as "Coming Soon" page.','cmp-coming-soon-maintenance')?></span>
558
 
559
  </fieldset>
560
 
561
+ <fieldset class="cmp-status switch<?php echo $this->cmp_mode() == 1 ? ' active' : '';?>">
562
+ <input type="radio" name="cmp-activate" value="1" <?php checked( '1', $this->cmp_mode() ); ?> <?php disabled( '0', $this->cmp_active() ); ?>>&nbsp;<?php _e('Maintanance Mode', 'cmp-coming-soon-maintenance');?><br>
563
  <span class="info"><?php _e('Returns 503 HTTP Service unavailable code to indexing robots. Set this option if your site is down due to maintanance and you want to display Maintanance page.','cmp-coming-soon-maintenance')?></span>
564
 
565
  </fieldset>
566
 
567
+ <fieldset class="cmp-status switch<?php echo $this->cmp_mode() == 3 ? ' active' : '';?>">
568
+ <input type="radio" name="cmp-activate" value="3" <?php checked( '3', $this->cmp_mode() ); ?> <?php disabled( '0', $this->cmp_active() ); ?>>&nbsp;<?php _e('Redirect Mode', 'cmp-coming-soon-maintenance');?><br>
569
  <span class="info redirect"><?php _e('Choose Redirect Mode if you want to redirect your website to another URL.','cmp-coming-soon-maintenance')?></span>
570
+ <div class="redirect-inputs" <?php echo $this->cmp_mode() == 3 ? 'style="display: block"' : 'style="display: none"';?>>
571
  <input type="text" id="niteoCS_URL_redirect" name="niteoCS_URL_redirect" value="<?php echo esc_url( $niteoCS_URL_redirect ); ?>" class="regular-text code"><br>
572
  <label for="niteoCS_redirect_time"><?php _e('Delay Time in Seconds', 'cmp-coming-soon-maintenance');?></label>
573
  <input type="text" id="niteoCS_redirect_time" name="niteoCS_redirect_time" value="<?php echo esc_attr( $niteoCS_redirect_time ); ?>" class="regular-text code"><br>
css/preview-iframe.css CHANGED
@@ -92,7 +92,8 @@ h3 {
92
  z-index: 11000;
93
  width: 350px;
94
  max-width: 100%;
95
- height: 100%;
 
96
  left: 100%;
97
  top: 0;
98
  background-color: #fff;
@@ -100,7 +101,7 @@ h3 {
100
  -webkit-transform: translate3d(0,0,0);
101
  transform: translate3d(0,0,0);
102
  transition: -webkit-transform 300ms;
103
- -o-transition: transform 300mss;
104
  -o-transition: transform 300ms;
105
  transition: transform 300ms;
106
  transition: transform 300ms, -webkit-transform 300ms;
@@ -108,14 +109,102 @@ h3 {
108
 
109
  .open #preview-customize {
110
  -webkit-transform: translate3d(-100%,0,0);
111
- transform: translate3d(-100%,0,0);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
112
  }
113
 
114
  .customize-content {
115
- overflow-y: auto;
116
- height: 100vh;
 
117
  }
118
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
119
 
120
  #slider {
121
  position: relative;
@@ -229,11 +318,23 @@ h3 {
229
  .panel-wrapper {
230
  position: absolute;
231
  top: 135px;
232
- right: 350px;
233
- padding: 10px 10px 5px 10px;
234
  cursor: pointer;
235
  background: white;
236
- /* box-shadow: -10px 0px 25px -1px rgba(0, 0, 0, 0.05); */
 
 
 
 
 
 
 
 
 
 
 
 
 
237
  }
238
 
239
 
@@ -290,6 +391,12 @@ h3 {
290
  left: 0;
291
  }
292
 
 
 
 
 
 
 
293
  .animate {
294
  -webkit-animation-duration: 1s;
295
  animation-duration: 1s;
92
  z-index: 11000;
93
  width: 350px;
94
  max-width: 100%;
95
+ height: 100vh;
96
+ overflow-y: auto;
97
  left: 100%;
98
  top: 0;
99
  background-color: #fff;
101
  -webkit-transform: translate3d(0,0,0);
102
  transform: translate3d(0,0,0);
103
  transition: -webkit-transform 300ms;
104
+ -o-transition: transform 300ms;
105
  -o-transition: transform 300ms;
106
  transition: transform 300ms;
107
  transition: transform 300ms, -webkit-transform 300ms;
109
 
110
  .open #preview-customize {
111
  -webkit-transform: translate3d(-100%,0,0);
112
+ transform: translate3d(-100%,0,0);
113
+ box-shadow: -10px 0px 25px -1px rgba(0, 0, 0, 0.05);
114
+ }
115
+
116
+ .hamburger {
117
+ padding: 15px 15px 10px 15px;
118
+ cursor: pointer;
119
+ }
120
+
121
+ .hamburger-box {
122
+ position: relative;
123
+ display: inline-block;
124
+ width: 40px;
125
+ height: 40px;
126
+ }
127
+
128
+ .hamburger-inner {
129
+ top: 50%;
130
+ display: block;
131
+ margin-top: -2px;
132
+ }
133
+
134
+ .hamburger-inner, .hamburger-inner:after, .hamburger-inner:before {
135
+ position: absolute;
136
+ width: 40px;
137
+ height: 4px;
138
+ -o-transition-timing-function: ease;
139
+ transition-timing-function: ease;
140
+ -o-transition-duration: .15s;
141
+ transition-duration: .15s;
142
+ transition-property: -webkit-transform;
143
+ -o-transition-property: transform;
144
+ transition-property: transform;
145
+ transition-property: transform, -webkit-transform;
146
+ border-radius: 4px;
147
+ background-color: #000000;
148
+ }
149
+
150
+ .open .hamburger .hamburger-inner, .open .hamburger .hamburger-inner:after, .open .hamburger .hamburger-inner:before {
151
+ background-color: #000000;
152
+ }
153
+
154
+ .open .hamburger--arrowturn .hamburger-inner {
155
+ -webkit-transform: rotate(-180deg);
156
+ -ms-transform: rotate(-180deg);
157
+ transform: rotate(-180deg);
158
  }
159
 
160
  .customize-content {
161
+ display: flex;
162
+ flex-direction: column;
163
+ min-height: calc(100vh - 3em);
164
  }
165
 
166
+ .hamburger-inner, .hamburger-inner:after, .hamburger-inner:before {
167
+ position: absolute;
168
+ width: 40px;
169
+ height: 4px;
170
+ -o-transition-timing-function: ease;
171
+ transition-timing-function: ease;
172
+ -o-transition-duration: 300ms;
173
+ transition-duration: 300ms;
174
+ transition-property: -webkit-transform;
175
+ -o-transition-property: transform;
176
+ transition-property: transform;
177
+ transition-property: transform, -webkit-transform;
178
+ border-radius: 4px;
179
+ background-color: #000000;
180
+ }
181
+
182
+ .hamburger-inner:after, .hamburger-inner:before {
183
+ display: block;
184
+ content: "";
185
+ }
186
+
187
+ .hamburger-inner:before {
188
+ top: -10px;
189
+ }
190
+
191
+ .hamburger-inner:after {
192
+ bottom: -10px;
193
+ }
194
+
195
+ .open .hamburger .hamburger-inner, .open .hamburger .hamburger-inner:after, .open .hamburger .hamburger-inner:before {
196
+ background-color: #000000;
197
+ }
198
+
199
+ .open .hamburger--arrowturn .hamburger-inner:before {
200
+ -webkit-transform: translate3d(-8px,0,0) rotate(-45deg) scaleX(.7);
201
+ transform: translate3d(-8px,0,0) rotate(-45deg) scaleX(.7);
202
+ }
203
+
204
+ .open .hamburger--arrowturn .hamburger-inner:after {
205
+ -webkit-transform: translate3d(-8px,0,0) rotate(45deg) scaleX(.7);
206
+ transform: translate3d(-8px,0,0) rotate(45deg) scaleX(.7);
207
+ }
208
 
209
  #slider {
210
  position: relative;
318
  .panel-wrapper {
319
  position: absolute;
320
  top: 135px;
321
+ right: 0;
 
322
  cursor: pointer;
323
  background: white;
324
+ box-shadow: -10px 0px 25px -1px rgba(0, 0, 0, 0.05);
325
+ -webkit-transform: translate3d(0,0,0);
326
+ transform: translate3d(0,0,0);
327
+ transition: -webkit-transform 300ms;
328
+ -o-transition: transform 300ms;
329
+ -o-transition: transform 300ms;
330
+ transition: transform 300ms;
331
+ transition: transform 300ms, -webkit-transform 300ms;
332
+ }
333
+
334
+ .open .panel-wrapper {
335
+ -webkit-transform: translate3d(-350px,0,0);
336
+ transform: translate3d(-350px,0,0);
337
+ box-shadow: -10px 0px 25px -1px rgba(0, 0, 0, 0.05);
338
  }
339
 
340
 
391
  left: 0;
392
  }
393
 
394
+ .backlink {
395
+ color: #777;
396
+ font-weight: 600;
397
+ padding-bottom: 1em;
398
+ }
399
+
400
  .animate {
401
  -webkit-animation-duration: 1s;
402
  animation-duration: 1s;
inc/class-cmp-render_html.php CHANGED
@@ -8,6 +8,24 @@ class CMP_Coming_Soon_and_Maintenance_Render_HTML extends CMP_Coming_Soon_and_Ma
8
 
9
  // Render Background
10
  public function cmp_background( $niteoCS_banner, $themeslug ) {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
11
  $size = $this->isMobile() ? 'large' : 'full';
12
  $html = '';
13
  // change background to default image, if image preview background is set
@@ -221,6 +239,13 @@ class CMP_Coming_Soon_and_Maintenance_Render_HTML extends CMP_Coming_Soon_and_Ma
221
 
222
  // render slider
223
  public function cmp_slider( $themeslug ) {
 
 
 
 
 
 
 
224
  $niteoCS_banner = get_option('niteoCS_banner', '1');
225
  $slider_count = get_option('niteoCS_slider_count', '3');
226
  $slider_effect = get_option('niteoCS_slider_effect', 'true');
@@ -237,18 +262,22 @@ class CMP_Coming_Soon_and_Maintenance_Render_HTML extends CMP_Coming_Soon_and_Ma
237
  $theme = esc_attr( $_GET['theme'] );
238
  switch ( $theme ) {
239
  case 'fifty':
 
240
  $banner_ids = array(21, 22, 23);
241
  $slider_effect = 'slice';
242
  break;
243
  case 'stylo':
 
244
  $banner_ids = array(28, 29, 30, 31, 32);
245
  $slider_effect = 'true';
246
  break;
247
  case 'apollo':
 
248
  $banner_ids = array(35, 36, 37);
249
  $slider_effect = 'mask-transition';
250
  break;
251
  case 'vega':
 
252
  $banner_ids = array(52, 53);
253
  $slider_effect = 'true';
254
  break;
@@ -880,7 +909,7 @@ class CMP_Coming_Soon_and_Maintenance_Render_HTML extends CMP_Coming_Soon_and_Ma
880
  case 'eclipse':
881
  case 'apollo':
882
  case 'vega':
883
- $body = '<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Tincidunt augue interdum velit euismod in pellentesque massa placerat.</p><p>Pellentesque id nibh tortor id aliquet. Netus et malesuada fames ac turpis egestas maecenas pharetra convallis. Tincidunt lobortis feugiat vivamus at augue eget arcu.</p>';
884
  break;
885
 
886
  case 'countdown':
@@ -968,7 +997,7 @@ class CMP_Coming_Soon_and_Maintenance_Render_HTML extends CMP_Coming_Soon_and_Ma
968
  break;
969
 
970
  case 'apollo':
971
- $title = 'WEBSITE IS UNDER CONSTRUCTION!';
972
  break;
973
 
974
  case 'vega':
@@ -1131,7 +1160,7 @@ class CMP_Coming_Soon_and_Maintenance_Render_HTML extends CMP_Coming_Soon_and_Ma
1131
 
1132
  <?php
1133
  // check for premium themes special effects
1134
- if ( in_array( $this->cmp_selectedTheme(), $this->cmp_premium_themes_installed() ) ) {
1135
 
1136
  $effect = get_option('niteoCS_special_effect', 'disabled');
1137
 
@@ -1139,6 +1168,7 @@ class CMP_Coming_Soon_and_Maintenance_Render_HTML extends CMP_Coming_Soon_and_Ma
1139
  if ( isset($_GET['effect']) && is_numeric($_GET['effect'])) {
1140
  $effect = $_GET['effect'];
1141
  }
 
1142
  switch ( $effect ) {
1143
  case 'constellation':
1144
  case '1': ?>
@@ -1341,7 +1371,9 @@ class CMP_Coming_Soon_and_Maintenance_Render_HTML extends CMP_Coming_Soon_and_Ma
1341
  </script>
1342
 
1343
  <?php
1344
- // include background scripts
 
 
1345
  switch ( $background ) {
1346
  // VIDIM script for background video
1347
  case '5': ?>
@@ -1515,7 +1547,7 @@ class CMP_Coming_Soon_and_Maintenance_Render_HTML extends CMP_Coming_Soon_and_Ma
1515
  }
1516
 
1517
  // render redirect script if CMP is in redirect mode
1518
- if ( $this->cmp_status() == 3 ) {
1519
  $url = get_option('niteoCS_URL_redirect');
1520
  $time = get_option('niteoCS_redirect_time'); ?>
1521
 
8
 
9
  // Render Background
10
  public function cmp_background( $niteoCS_banner, $themeslug ) {
11
+
12
+ // change to slider, if theme preview specific themes
13
+ if ( isset($_GET['theme']) && !empty($_GET['theme']) && isset($_GET['background']) && $_GET['background'] == 1 ) {
14
+
15
+ $theme = esc_attr( $_GET['theme'] );
16
+ switch ( $theme ) {
17
+ case 'fifty':
18
+ case 'stylo':
19
+ case 'apollo':
20
+ case 'vega':
21
+ $this->cmp_slider();
22
+ return;
23
+
24
+ default:
25
+ break;
26
+ }
27
+ }
28
+
29
  $size = $this->isMobile() ? 'large' : 'full';
30
  $html = '';
31
  // change background to default image, if image preview background is set
239
 
240
  // render slider
241
  public function cmp_slider( $themeslug ) {
242
+
243
+ // change to background, if theme preview specific themes
244
+ if ( isset($_GET['background']) && $_GET['background'] != 1 ) {
245
+ echo $this->cmp_background();
246
+ return;
247
+ }
248
+
249
  $niteoCS_banner = get_option('niteoCS_banner', '1');
250
  $slider_count = get_option('niteoCS_slider_count', '3');
251
  $slider_effect = get_option('niteoCS_slider_effect', 'true');
262
  $theme = esc_attr( $_GET['theme'] );
263
  switch ( $theme ) {
264
  case 'fifty':
265
+ $niteoCS_banner = '0';
266
  $banner_ids = array(21, 22, 23);
267
  $slider_effect = 'slice';
268
  break;
269
  case 'stylo':
270
+ $niteoCS_banner = '0';
271
  $banner_ids = array(28, 29, 30, 31, 32);
272
  $slider_effect = 'true';
273
  break;
274
  case 'apollo':
275
+ $niteoCS_banner = '0';
276
  $banner_ids = array(35, 36, 37);
277
  $slider_effect = 'mask-transition';
278
  break;
279
  case 'vega':
280
+ $niteoCS_banner = '0';
281
  $banner_ids = array(52, 53);
282
  $slider_effect = 'true';
283
  break;
909
  case 'eclipse':
910
  case 'apollo':
911
  case 'vega':
912
+ $body = '<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Tincidunt augue interdum velit euismod in pellentesque massa placerat.</p>';
913
  break;
914
 
915
  case 'countdown':
997
  break;
998
 
999
  case 'apollo':
1000
+ $title = 'UNDER CONSTRUCTION!';
1001
  break;
1002
 
1003
  case 'vega':
1160
 
1161
  <?php
1162
  // check for premium themes special effects
1163
+ if ( in_array( $themeslug, $this->cmp_premium_themes_installed() ) ) {
1164
 
1165
  $effect = get_option('niteoCS_special_effect', 'disabled');
1166
 
1168
  if ( isset($_GET['effect']) && is_numeric($_GET['effect'])) {
1169
  $effect = $_GET['effect'];
1170
  }
1171
+
1172
  switch ( $effect ) {
1173
  case 'constellation':
1174
  case '1': ?>
1371
  </script>
1372
 
1373
  <?php
1374
+ // include background scripts
1375
+
1376
+
1377
  switch ( $background ) {
1378
  // VIDIM script for background video
1379
  case '5': ?>
1547
  }
1548
 
1549
  // render redirect script if CMP is in redirect mode
1550
+ if ( $this->cmp_mode() == 3 ) {
1551
  $url = get_option('niteoCS_URL_redirect');
1552
  $time = get_option('niteoCS_redirect_time'); ?>
1553
 
inc/cmp-update-process.php CHANGED
@@ -186,6 +186,11 @@ if ( version_compare( get_option('niteoCS_version'), CMP_VERSION ) < 0 ) {
186
  }
187
  }
188
 
 
 
 
 
 
189
  // bump version for next udpate check
190
  update_option( 'niteoCS_version', CMP_VERSION );
191
  }
186
  }
187
  }
188
 
189
+ // update CMP activation status from false to 0 after update 3.1.2
190
+ if ( get_option('niteoCS_status') == false ) {
191
+ update_option('niteoCS_status', '0');
192
+ }
193
+
194
  // bump version for next udpate check
195
  update_option( 'niteoCS_version', CMP_VERSION );
196
  }
js/preview-iframe.js CHANGED
@@ -2,13 +2,15 @@
2
  $( document ).ready(function() {
3
  var timeout;
4
  var slug;
5
-
6
  if ( typeof ga === 'undefined' ) {
7
  ga = function() {
8
  return false;
9
  }
10
  }
11
 
 
 
12
  $('iframe').one('load', function() {
13
  $('body').addClass('loaded');
14
  });
@@ -18,19 +20,13 @@ $( document ).ready(function() {
18
  $(this).addClass('loaded');
19
  });
20
 
21
- $('.panel.open').click(function(e){
22
  e.preventDefault();
23
- ga('send', 'event', 'Open Selector', 'Open Selector');
24
  $('body').toggleClass('open');
25
  });
26
 
27
- // $('iframe').click(function(e){
28
- // $('body').removeClass('open');
29
- // });
30
-
31
- slider();
32
-
33
-
34
  $('.theme-customizer a').click(function(e){
35
  e.preventDefault();
36
  var new_url = $(this).attr('href');
@@ -41,12 +37,11 @@ $( document ).ready(function() {
41
  var new_value = $(this).data(param);
42
 
43
  $('#theme-preview').removeClass('loaded');
44
- // // $('body').removeClass('open');
45
 
46
  $(this).siblings().removeClass('selected');
47
  $(this).addClass('selected');
48
 
49
- // ga('send', 'event', 'Change background', 'Change background to: ' + new_background);
50
 
51
  // // reload iframe and change browser URL history
52
  $('#theme-preview').attr('src', iframe_url);
@@ -130,8 +125,6 @@ function slider() {
130
  $('#submit-change').attr('href', newSubmitUrl);
131
  }
132
 
133
-
134
-
135
  $('a.control_prev').click(function (e) {
136
  e.preventDefault();
137
  moveLeft();
@@ -144,7 +137,7 @@ function slider() {
144
  clearTimeout(autoslide);
145
  });
146
 
147
- var autoslide = setInterval(function () {
148
  moveRight();
149
  }, 7000);
150
  }
@@ -155,7 +148,7 @@ $('#submit-change').click(function (e) {
155
  var newSlug = getUrlStringParameter('theme', newUrl);
156
  var premiumThemes = $('.buy-theme').data('premium');
157
  var customize = $(this).data('customize');
158
-
159
  // get buy url
160
  for (var i = 0, len = premiumThemes.length; i < len; i++) {
161
  if ( premiumThemes[i].name === newSlug) {
@@ -175,17 +168,13 @@ $('#submit-change').click(function (e) {
175
  $('.settings-section').removeClass('zoomIn').addClass('zoomOut');
176
 
177
  $.each(section, function( index, value ) {
178
- console.log(value);
179
  $('.settings-section.' + value ).removeClass('zoomOut').removeClass('not-active').addClass('zoomIn');
180
 
181
  });
182
 
183
-
184
-
185
  // change browser url history
186
  ChangeUrl(newUrl, newUrl);
187
 
188
-
189
  // change customizers href src to new theme
190
  $('.settings-section a').each(function(){
191
  var oldUrl = $(this).attr('href');
@@ -197,7 +186,9 @@ $('#submit-change').click(function (e) {
197
  // change select preview button url
198
  $('#theme-preview').attr('src', $(this).attr('href').replace('&selector=true', ''));
199
 
200
- $('.buy-theme').attr('href', buyUrl)
 
 
201
  });
202
 
203
 
2
  $( document ).ready(function() {
3
  var timeout;
4
  var slug;
5
+ var autoslide;
6
  if ( typeof ga === 'undefined' ) {
7
  ga = function() {
8
  return false;
9
  }
10
  }
11
 
12
+ slider();
13
+
14
  $('iframe').one('load', function() {
15
  $('body').addClass('loaded');
16
  });
20
  $(this).addClass('loaded');
21
  });
22
 
23
+ $('.panel-wrapper').click(function(e){
24
  e.preventDefault();
25
+ ga('send', 'event', 'Close or Open Selector', 'Close or Open Selector');
26
  $('body').toggleClass('open');
27
  });
28
 
29
+
 
 
 
 
 
 
30
  $('.theme-customizer a').click(function(e){
31
  e.preventDefault();
32
  var new_url = $(this).attr('href');
37
  var new_value = $(this).data(param);
38
 
39
  $('#theme-preview').removeClass('loaded');
 
40
 
41
  $(this).siblings().removeClass('selected');
42
  $(this).addClass('selected');
43
 
44
+ ga('send', 'event', 'Change ' + param, 'Change '+ param +' to: ' + new_value);
45
 
46
  // // reload iframe and change browser URL history
47
  $('#theme-preview').attr('src', iframe_url);
125
  $('#submit-change').attr('href', newSubmitUrl);
126
  }
127
 
 
 
128
  $('a.control_prev').click(function (e) {
129
  e.preventDefault();
130
  moveLeft();
137
  clearTimeout(autoslide);
138
  });
139
 
140
+ autoslide = setInterval(function () {
141
  moveRight();
142
  }, 7000);
143
  }
148
  var newSlug = getUrlStringParameter('theme', newUrl);
149
  var premiumThemes = $('.buy-theme').data('premium');
150
  var customize = $(this).data('customize');
151
+ clearTimeout(autoslide);
152
  // get buy url
153
  for (var i = 0, len = premiumThemes.length; i < len; i++) {
154
  if ( premiumThemes[i].name === newSlug) {
168
  $('.settings-section').removeClass('zoomIn').addClass('zoomOut');
169
 
170
  $.each(section, function( index, value ) {
 
171
  $('.settings-section.' + value ).removeClass('zoomOut').removeClass('not-active').addClass('zoomIn');
172
 
173
  });
174
 
 
 
175
  // change browser url history
176
  ChangeUrl(newUrl, newUrl);
177
 
 
178
  // change customizers href src to new theme
179
  $('.settings-section a').each(function(){
180
  var oldUrl = $(this).attr('href');
186
  // change select preview button url
187
  $('#theme-preview').attr('src', $(this).attr('href').replace('&selector=true', ''));
188
 
189
+ $('.buy-theme').attr('href', buyUrl);
190
+
191
+ ga('send', 'event', 'Change Theme', 'Change Theme to: ' + new_value);
192
  });
193
 
194
 
niteo-cmp.php CHANGED
@@ -3,7 +3,7 @@
3
  Plugin Name: CMP - Coming Soon & Maintenance Plugin
4
  Plugin URI: https://wordpress.org/plugins/cmp-coming-soon-maintenance/
5
  Description: Display customizable landing page for Coming Soon, Maintenance & Under Construction page.
6
- Version: 3.1.1
7
  Author: NiteoThemes
8
  Author URI: https://www.niteothemes.com
9
  Text Domain: cmp-coming-soon-maintenance
@@ -65,7 +65,7 @@ if ( ! class_exists( 'CMP_Coming_Soon_and_Maintenance' ) ) :
65
 
66
  private function constants() {
67
  // define constants
68
- $this->define( 'CMP_VERSION', '3.1.1' );
69
  $this->define( 'CMP_DEBUG', FALSE );
70
  $this->define( 'CMP_AUTHOR', 'NiteoThemes' );
71
  $this->define( 'CMP_AUTHOR_HOMEPAGE', 'https://niteothemes.com' );
@@ -225,27 +225,27 @@ if ( ! class_exists( 'CMP_Coming_Soon_and_Maintenance' ) ) :
225
 
226
  $premium_themes = array();
227
 
228
- array_push( $premium_themes, array('name' => 'agency', 'url' => 'https://niteothemes.com/downloads/cmp-agency-theme/', 'price' => '15') );
229
 
230
- array_push( $premium_themes, array('name' => 'stylo', 'url' => 'https://niteothemes.com/downloads/cmp-stylo-theme/', 'price' => '10') );
231
 
232
- array_push( $premium_themes, array('name' => 'fifty', 'url' => 'https://niteothemes.com/downloads/cmp-fifty-theme/', 'price' => '10') );
233
 
234
- array_push( $premium_themes, array('name' => 'vega', 'url' => 'https://niteothemes.com/downloads/cmp-vega-theme/', 'price' => '10') );
235
 
236
- array_push( $premium_themes, array('name' => 'apollo', 'url' => 'https://niteothemes.com/downloads/cmp-apollo-theme/', 'price' => '10') );
237
 
238
- array_push( $premium_themes, array('name' => 'element', 'url' => 'https://niteothemes.com/downloads/cmp-element-theme/', 'price' => '10') );
239
 
240
- array_push( $premium_themes, array('name' => 'hardwork_premium', 'url' => 'https://niteothemes.com/downloads/cmp-hardwork-premium/', 'price' => '10') );
241
 
242
- array_push( $premium_themes, array('name' => 'postery', 'url' => 'https://niteothemes.com/downloads/cmp-postery/', 'price' => '10') );
243
 
244
- array_push( $premium_themes, array('name' => 'frame', 'url' => 'https://niteothemes.com/downloads/cmp-frame-theme/', 'price' => '10') );
245
 
246
- array_push( $premium_themes, array('name' => 'eclipse', 'url' => 'https://niteothemes.com/downloads/cmp-eclipse-theme/', 'price' =>'0') );
247
 
248
- array_push( $premium_themes, array('name' => 'orbit', 'url' => 'https://niteothemes.com/downloads/cmp-orbit-theme/', 'price' => '0') );
249
 
250
  return $premium_themes;
251
  }
@@ -434,6 +434,27 @@ if ( ! class_exists( 'CMP_Coming_Soon_and_Maintenance' ) ) :
434
  require_once ('cmp-help.php');
435
  }
436
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
437
  /**
438
  * returns bundled plugin`s assets URL for Premium Themes
439
  *
@@ -454,7 +475,7 @@ if ( ! class_exists( 'CMP_Coming_Soon_and_Maintenance' ) ) :
454
  public function cmp_admin_override(){
455
 
456
  // if admin or CMP disabled, return
457
- if ( current_user_can('administrator') || $this->cmp_status() == 0 ) {
458
  return;
459
  }
460
 
@@ -521,8 +542,19 @@ if ( ! class_exists( 'CMP_Coming_Soon_and_Maintenance' ) ) :
521
  return;
522
  }
523
 
 
 
 
 
 
 
 
 
 
 
 
524
  // Render CMP Theme mode if is activated and not in immediate redirect mode
525
- if ( $this->cmp_status() == 1 || $this->cmp_status() == 2 || ( $this->cmp_status() == 3 && get_option('niteoCS_redirect_time') != 0 ) ) {
526
 
527
  // check if user logged in, page filters and access role
528
  if ( !is_user_logged_in() && $this->cmp_page_filter() ) {
@@ -589,7 +621,7 @@ if ( ! class_exists( 'CMP_Coming_Soon_and_Maintenance' ) ) :
589
  }
590
 
591
  // if maintanance mode send correct 503 headers
592
- if ( $this->cmp_status() == '1' ){
593
  header('HTTP/1.1 503 Service Temporarily Unavailable');
594
  header('Status: 503 Service Temporarily Unavailable');
595
  header('Retry-After: 86400'); // retry in a day
@@ -609,34 +641,10 @@ if ( ! class_exists( 'CMP_Coming_Soon_and_Maintenance' ) ) :
609
  }
610
  }
611
 
612
- // if CMP in redirect mode with 0 timeout
613
- if ( $this->cmp_status() == 3 && get_option('niteoCS_redirect_time') == 0 && !is_user_logged_in() && $this->cmp_page_filter() ) {
614
-
615
- $redirect_url = get_option('niteoCS_URL_redirect');
616
- // redirect to URL
617
- if ( $redirect_url != '') {
618
- header('Location: '.esc_url( $redirect_url ));
619
- die();
620
- }
621
- }
622
- }
623
-
624
-
625
- // return CMP activation status and it`s states
626
- public function cmp_status() {
627
-
628
- if ( !get_option('niteoCS_status') ||
629
- get_option('niteoCS_status') == '' ||
630
- get_option('niteoCS_status') == false ) {
631
- return '0';
632
-
633
- } else {
634
- return get_option( 'niteoCS_activation', '2' );
635
- }
636
  }
637
 
638
  // function to toggle CMP activation for admin menu icon
639
- public function cmp_ajax_toggle_activation () {
640
  // check for ajax payoload
641
  if ( isset( $_POST['payload'] ) && $_POST['payload'] == 'toggle_cmp_status' ) {
642
 
@@ -649,10 +657,11 @@ if ( ! class_exists( 'CMP_Coming_Soon_and_Maintenance' ) ) :
649
  return;
650
  }
651
 
652
- if ( get_option('niteoCS_status', '') == '' ) {
653
  update_option('niteoCS_status', '1');
 
654
  } else {
655
- update_option('niteoCS_status', '');
656
  }
657
 
658
  $this->cmp_purge_cache();
@@ -732,8 +741,9 @@ if ( ! class_exists( 'CMP_Coming_Soon_and_Maintenance' ) ) :
732
 
733
  if ( isset($_POST['cmp_status']) ) {
734
  update_option('niteoCS_status', $this->sanitize_checkbox($_POST['cmp_status']));
735
- } else {
736
- update_option('niteoCS_status', false);
 
737
  }
738
  }
739
 
@@ -745,7 +755,7 @@ if ( ! class_exists( 'CMP_Coming_Soon_and_Maintenance' ) ) :
745
  $class = '';
746
  $msg= '';
747
 
748
- switch ( get_option( 'niteoCS_activation', '2' ) ) {
749
  case '1':
750
  $msg = __('Maintenance Mode:','cmp-coming-soon-maintenance');
751
  $class = ' maintenance';
@@ -763,7 +773,7 @@ if ( ! class_exists( 'CMP_Coming_Soon_and_Maintenance' ) ) :
763
  }
764
 
765
  $msg = '<img src="'.plugins_url('/img/cmp.png', __FILE__).'" alt="CMP Logo" class="cmp-logo"><span class="cmp-status-msg ab-label">'.$msg.'</span>';
766
- $msg .='<div class="toggle-wrapper"><div id="cmp-status-menubar" class="toggle-checkbox"></div><div id="cmp-toggle-adminbar" class="status-' . esc_attr( get_option('niteoCS_status', false ) ) . '" data-security="'. esc_attr( $ajax_nonce ).'"><span class="toggle_handler"></span></div></div>';
767
 
768
  //Add the main siteadmin menu item
769
  $wp_admin_bar->add_menu( array(
3
  Plugin Name: CMP - Coming Soon & Maintenance Plugin
4
  Plugin URI: https://wordpress.org/plugins/cmp-coming-soon-maintenance/
5
  Description: Display customizable landing page for Coming Soon, Maintenance & Under Construction page.
6
+ Version: 3.1.2
7
  Author: NiteoThemes
8
  Author URI: https://www.niteothemes.com
9
  Text Domain: cmp-coming-soon-maintenance
65
 
66
  private function constants() {
67
  // define constants
68
+ $this->define( 'CMP_VERSION', '3.1.2' );
69
  $this->define( 'CMP_DEBUG', FALSE );
70
  $this->define( 'CMP_AUTHOR', 'NiteoThemes' );
71
  $this->define( 'CMP_AUTHOR_HOMEPAGE', 'https://niteothemes.com' );
225
 
226
  $premium_themes = array();
227
 
228
+ array_push( $premium_themes, array('name' => 'agency', 'url' => 'https://niteothemes.com/?filter=cmp-plugin-themes&utm_source=cmp&utm_medium=referral&utm_campaign=agency', 'price' => '15') );
229
 
230
+ array_push( $premium_themes, array('name' => 'stylo', 'url' => 'https://niteothemes.com/?filter=cmp-plugin-themes&utm_source=cmp&utm_medium=referral&utm_campaign=stylo', 'price' => '10') );
231
 
232
+ array_push( $premium_themes, array('name' => 'fifty', 'url' => 'https://niteothemes.com/?filter=cmp-plugin-themes&utm_source=cmp&utm_medium=referral&utm_campaign=fifty', 'price' => '10') );
233
 
234
+ array_push( $premium_themes, array('name' => 'vega', 'url' => 'https://niteothemes.com/?filter=cmp-plugin-themes&utm_source=cmp&utm_medium=referral&utm_campaign=vega', 'price' => '10') );
235
 
236
+ array_push( $premium_themes, array('name' => 'apollo', 'url' => 'https://niteothemes.com/?filter=cmp-plugin-themes&utm_source=cmp&utm_medium=referral&utm_campaign=apollo', 'price' => '10') );
237
 
238
+ array_push( $premium_themes, array('name' => 'element', 'url' => 'https://niteothemes.com/?filter=cmp-plugin-themes&utm_source=cmp&utm_medium=referral&utm_campaign=element', 'price' => '10') );
239
 
240
+ array_push( $premium_themes, array('name' => 'hardwork_premium', 'url' => 'https://niteothemes.com/?filter=cmp-plugin-themes&utm_source=cmp&utm_medium=referral&utm_campaign=hardwork_premium', 'price' => '10') );
241
 
242
+ array_push( $premium_themes, array('name' => 'postery', 'url' => 'https://niteothemes.com/?filter=cmp-plugin-themes&utm_source=cmp&utm_medium=referral&utm_campaign=postery', 'price' => '10') );
243
 
244
+ array_push( $premium_themes, array('name' => 'frame', 'url' => 'https://niteothemes.com/?filter=cmp-plugin-themes&utm_source=cmp&utm_medium=referral&utm_campaign=frame', 'price' => '10') );
245
 
246
+ array_push( $premium_themes, array('name' => 'eclipse', 'url' => 'https://niteothemes.com/?filter=cmp-plugin-themes&utm_source=cmp&utm_medium=referral&utm_campaign=eclipse', 'price' =>'0') );
247
 
248
+ array_push( $premium_themes, array('name' => 'orbit', 'url' => 'https://niteothemes.com/?filter=cmp-plugin-themes&utm_source=cmp&utm_medium=referral&utm_campaign=orbit', 'price' => '0') );
249
 
250
  return $premium_themes;
251
  }
434
  require_once ('cmp-help.php');
435
  }
436
 
437
+ /**
438
+ * Return CMP active status 0 or 1
439
+ *
440
+ * @since 3.1.2
441
+ * @return string
442
+ */
443
+ public function cmp_active() {
444
+ return get_option('niteoCS_status') === '0' ? '0': '1';
445
+ }
446
+
447
+ /**
448
+ * Return CMP Mode status
449
+ *
450
+ * @since 3.1.2
451
+ * @return string
452
+ */
453
+ public function cmp_mode() {
454
+ return get_option( 'niteoCS_activation', '2' );
455
+
456
+ }
457
+
458
  /**
459
  * returns bundled plugin`s assets URL for Premium Themes
460
  *
475
  public function cmp_admin_override(){
476
 
477
  // if admin or CMP disabled, return
478
+ if ( current_user_can('administrator') || $this->cmp_active() === '0' ) {
479
  return;
480
  }
481
 
542
  return;
543
  }
544
 
545
+ // if CMP in redirect mode with 0 timeout, die early with redirect
546
+ if ( $this->cmp_active() == '1' && $this->cmp_mode() == 3 && get_option('niteoCS_redirect_time') == 0 && !is_user_logged_in() && $this->cmp_page_filter() ) {
547
+
548
+ $redirect_url = get_option('niteoCS_URL_redirect');
549
+ // redirect to URL
550
+ if ( $redirect_url != '') {
551
+ header('Location: '.esc_url( $redirect_url ));
552
+ die();
553
+ }
554
+ }
555
+
556
  // Render CMP Theme mode if is activated and not in immediate redirect mode
557
+ if ( $this->cmp_active() == '1' ) {
558
 
559
  // check if user logged in, page filters and access role
560
  if ( !is_user_logged_in() && $this->cmp_page_filter() ) {
621
  }
622
 
623
  // if maintanance mode send correct 503 headers
624
+ if ( $this->cmp_mode() == '1' ){
625
  header('HTTP/1.1 503 Service Temporarily Unavailable');
626
  header('Status: 503 Service Temporarily Unavailable');
627
  header('Retry-After: 86400'); // retry in a day
641
  }
642
  }
643
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
644
  }
645
 
646
  // function to toggle CMP activation for admin menu icon
647
+ public function cmp_ajax_toggle_activation() {
648
  // check for ajax payoload
649
  if ( isset( $_POST['payload'] ) && $_POST['payload'] == 'toggle_cmp_status' ) {
650
 
657
  return;
658
  }
659
 
660
+ if ( $this->cmp_active() === '0' ) {
661
  update_option('niteoCS_status', '1');
662
+
663
  } else {
664
+ update_option('niteoCS_status', '0');
665
  }
666
 
667
  $this->cmp_purge_cache();
741
 
742
  if ( isset($_POST['cmp_status']) ) {
743
  update_option('niteoCS_status', $this->sanitize_checkbox($_POST['cmp_status']));
744
+
745
+ } else if ( !isset($_POST['submit_theme']) ) {
746
+ update_option('niteoCS_status', '0');
747
  }
748
  }
749
 
755
  $class = '';
756
  $msg= '';
757
 
758
+ switch ( $this->cmp_mode() ) {
759
  case '1':
760
  $msg = __('Maintenance Mode:','cmp-coming-soon-maintenance');
761
  $class = ' maintenance';
773
  }
774
 
775
  $msg = '<img src="'.plugins_url('/img/cmp.png', __FILE__).'" alt="CMP Logo" class="cmp-logo"><span class="cmp-status-msg ab-label">'.$msg.'</span>';
776
+ $msg .='<div class="toggle-wrapper"><div id="cmp-status-menubar" class="toggle-checkbox"></div><div id="cmp-toggle-adminbar" class="status-' . esc_attr( $this->cmp_active() ) . '" data-security="'. esc_attr( $ajax_nonce ).'"><span class="toggle_handler"></span></div></div>';
777
 
778
  //Add the main siteadmin menu item
779
  $wp_admin_bar->add_menu( array(
readme.txt CHANGED
@@ -4,7 +4,7 @@ Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=KV2JF
4
  Tags: coming soon, landing page, launch page, maintenance mode, under construction
5
  Requires at least: 3.0
6
  Tested up to: 5.0
7
- Stable tag: 3.1.1
8
  License: GPLv2 or later
9
  License URI: https://www.gnu.org/licenses/gpl-2.0.html
10
 
@@ -116,6 +116,13 @@ Packed with functions like Whitelist/Blacklist to enable CMP only on specific pa
116
  <p>Everyone loves supports and great feedback! If you find our plugin helpful, you can go to wordpress.org and rate it! alternatively you can click on Donate button :)</p>
117
 
118
  == Changelog ==
 
 
 
 
 
 
 
119
  <h4>CMP 3.1.1 - 03-Jan-19</h4>
120
  <ul>
121
  <li>Copyright message now supports 'target' attribute as requested by @frankoswaldo.</li>
4
  Tags: coming soon, landing page, launch page, maintenance mode, under construction
5
  Requires at least: 3.0
6
  Tested up to: 5.0
7
+ Stable tag: 3.1.2
8
  License: GPLv2 or later
9
  License URI: https://www.gnu.org/licenses/gpl-2.0.html
10
 
116
  <p>Everyone loves supports and great feedback! If you find our plugin helpful, you can go to wordpress.org and rate it! alternatively you can click on Donate button :)</p>
117
 
118
  == Changelog ==
119
+ <h4>CMP 3.1.2 - 05-Jan-19</h4>
120
+ <ul>
121
+ <li>Resolved issue with not playing background local and YouTube videos - thanks to @potitoale for reporting it!</li>
122
+ <li>Resolved bug, when CMP plugin was deactivated after new CMP theme upload.</li>
123
+ <li>CMP Coming Soon Mode is automatically activated after plugin activation.</li>
124
+ </ul>
125
+
126
  <h4>CMP 3.1.1 - 03-Jan-19</h4>
127
  <ul>
128
  <li>Copyright message now supports 'target' attribute as requested by @frankoswaldo.</li>