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

Version Description

Download this release

Release Info

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

Code changes from version 4.0.6 to 4.0.7

inc/cmp-update-process.php CHANGED
@@ -266,20 +266,34 @@ if ( version_compare($pre_update_version, CMP_VERSION ) < 0 ) {
266
  }
267
  // add rss social media in 3.9.4 update
268
  if ( !$this->niteo_in_array_r( 'rss', $socialmedia, true ) ) {
269
- $discord = array(
270
  'name' => 'rss',
271
  'url' => '',
272
  'active' => '1',
273
  'hidden' => '1',
274
  'order' => 26,
275
  );
276
- array_push( $socialmedia, $discord );
 
 
 
 
 
 
 
 
 
 
 
 
 
277
  $update = true;
278
  }
279
 
280
  if ( $update == true ) {
281
  update_option('niteoCS_socialmedia', json_encode( $socialmedia) );
282
  }
 
283
  }
284
 
285
  if ( version_compare( $pre_update_version, '3.6' ) < 0 ) {
266
  }
267
  // add rss social media in 3.9.4 update
268
  if ( !$this->niteo_in_array_r( 'rss', $socialmedia, true ) ) {
269
+ $rss = array(
270
  'name' => 'rss',
271
  'url' => '',
272
  'active' => '1',
273
  'hidden' => '1',
274
  'order' => 26,
275
  );
276
+ array_push( $socialmedia, $rss );
277
+ $update = true;
278
+ }
279
+
280
+ // add rss social media in 4.0.7 update
281
+ if ( !$this->niteo_in_array_r( 'tiktok', $socialmedia, true ) ) {
282
+ $tiktok = array(
283
+ 'name' => 'tiktok',
284
+ 'url' => '',
285
+ 'active' => '1',
286
+ 'hidden' => '1',
287
+ 'order' => 27,
288
+ );
289
+ array_push( $socialmedia, $tiktok );
290
  $update = true;
291
  }
292
 
293
  if ( $update == true ) {
294
  update_option('niteoCS_socialmedia', json_encode( $socialmedia) );
295
  }
296
+
297
  }
298
 
299
  if ( version_compare( $pre_update_version, '3.6' ) < 0 ) {
inc/render/graphic-background.php CHANGED
@@ -75,19 +75,19 @@ switch ( $niteoCS_banner ) {
75
  default:
76
  break;
77
  }
 
 
78
  // get raw url from response
79
  if ( isset( $unsplash['response'] ) && $unsplash['response'] == '200' ) {
80
  $body = json_decode ($unsplash['body'], true );
81
-
82
  if ( isset( $body[0] ) ) {
83
  foreach ( $body as $item ) {
84
- $unsplash_download = $item['links']['download_location'];
85
  }
86
-
87
  } else {
88
- $unsplash_download = $body['links']['download_location'];
89
  }
90
-
91
  switch ( $themeslug ) {
92
  case 'element':
93
  $width = 1;
@@ -105,6 +105,7 @@ switch ( $niteoCS_banner ) {
105
  <div id="background-image" class="image-unsplash"></div>
106
 
107
  <script>
 
108
  var unsplash_download = '<?php echo esc_url( $unsplash_download );?>';
109
 
110
  var width = document.getElementById('background-wrapper').offsetWidth * <?php echo esc_attr( $width );?>;
@@ -118,34 +119,35 @@ switch ( $niteoCS_banner ) {
118
  }
119
 
120
  var dimension = 'w=' + width;
 
121
  if ( width < height ) {
122
  dimension = 'h=' + height;
123
  }
124
 
125
- var unsplash_url = '<?php echo esc_url( $unsplash_download );?>?client_id=41f043163758cf2e898e8a868bc142c20bc3f5966e7abac4779ee684088092ab';
126
 
127
- fetch(unsplash_url, {
 
 
 
 
 
 
128
  method: 'GET',
 
129
  })
130
  .then((res) => {
131
  return res.json();
132
  })
133
  .then((data) => {
134
 
135
- var image = document.getElementById('background-image');
136
-
137
- var container = document.getElementById("background-wrapper");
138
-
139
- if ( container == null ) {
140
- container = document.getElementById("banner-wrapper");
141
- }
142
-
143
  var unsplashImg = new Image();
144
 
145
  unsplashImg.onload = function() {
 
 
146
  image.className = 'image loaded';
147
  body.classList.add('loaded');
148
- image.style.backgroundImage = `url("${unsplashImg.src}")`;
149
  }
150
 
151
  unsplashImg.src = `${data.url}&fit=crop&${dimension}`;
75
  default:
76
  break;
77
  }
78
+
79
+
80
  // get raw url from response
81
  if ( isset( $unsplash['response'] ) && $unsplash['response'] == '200' ) {
82
  $body = json_decode ($unsplash['body'], true );
 
83
  if ( isset( $body[0] ) ) {
84
  foreach ( $body as $item ) {
85
+ $unsplash_download = $item['links']['download_location'];
86
  }
 
87
  } else {
88
+ $unsplash_download = $body['links']['download_location'];
89
  }
90
+
91
  switch ( $themeslug ) {
92
  case 'element':
93
  $width = 1;
105
  <div id="background-image" class="image-unsplash"></div>
106
 
107
  <script>
108
+
109
  var unsplash_download = '<?php echo esc_url( $unsplash_download );?>';
110
 
111
  var width = document.getElementById('background-wrapper').offsetWidth * <?php echo esc_attr( $width );?>;
119
  }
120
 
121
  var dimension = 'w=' + width;
122
+
123
  if ( width < height ) {
124
  dimension = 'h=' + height;
125
  }
126
 
127
+ var image = document.getElementById('background-image');
128
 
129
+ var container = document.getElementById("background-wrapper");
130
+
131
+ if ( container == null ) {
132
+ container = document.getElementById("banner-wrapper");
133
+ }
134
+
135
+ fetch(unsplash_download, {
136
  method: 'GET',
137
+ headers: {'Authorization': 'Client-ID 41f043163758cf2e898e8a868bc142c20bc3f5966e7abac4779ee684088092ab'}
138
  })
139
  .then((res) => {
140
  return res.json();
141
  })
142
  .then((data) => {
143
 
 
 
 
 
 
 
 
 
144
  var unsplashImg = new Image();
145
 
146
  unsplashImg.onload = function() {
147
+ var src = unsplashImg.src;
148
+ image.style.backgroundImage = `url("${src}")`;
149
  image.className = 'image loaded';
150
  body.classList.add('loaded');
 
151
  }
152
 
153
  unsplashImg.src = `${data.url}&fit=crop&${dimension}`;
inc/render/social-icons.php CHANGED
@@ -58,6 +58,9 @@ if ( get_option('niteoCS_socialmedia') ) {
58
  case 'github':
59
  $name = 'GitHub';
60
  break;
 
 
 
61
  case 'rss':
62
  $icon = 'fas fa-rss';
63
  $href = $href ? $href : get_bloginfo('rss2_url');
58
  case 'github':
59
  $name = 'GitHub';
60
  break;
61
+ case 'tiktok':
62
+ $name = 'TikTok';
63
+ break;
64
  case 'rss':
65
  $icon = 'fas fa-rss';
66
  $href = $href ? $href : get_bloginfo('rss2_url');
inc/settings/settings-social-media.php CHANGED
@@ -57,6 +57,9 @@ defined( 'ABSPATH' ) or die( 'No script kiddies please!' );
57
  case 'youtube':
58
  $title = __('YouTube', 'cmp-coming-soon-maintenance');
59
  break;
 
 
 
60
  case 'rss':
61
  $title = __('RSS', 'cmp-coming-soon-maintenance');
62
  $icon = 'fas fa-rss';
57
  case 'youtube':
58
  $title = __('YouTube', 'cmp-coming-soon-maintenance');
59
  break;
60
+ case 'tiktok':
61
+ $title = __('TikTok', 'cmp-coming-soon-maintenance');
62
+ break;
63
  case 'rss':
64
  $title = __('RSS', 'cmp-coming-soon-maintenance');
65
  $icon = 'fas fa-rss';
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: 4.0.6
7
  Author: NiteoThemes
8
  Author URI: https://www.niteothemes.com
9
  Text Domain: cmp-coming-soon-maintenance
@@ -62,7 +62,7 @@ if ( ! class_exists( 'CMP_Coming_Soon_and_Maintenance' ) ) :
62
 
63
  // define constants
64
  private function constants() {
65
- $this->define( 'CMP_VERSION', '4.0.6' );
66
  $this->define( 'CMP_DEBUG', FALSE );
67
  $this->define( 'CMP_AUTHOR', 'NiteoThemes' );
68
  $this->define( 'CMP_AUTHOR_HOMEPAGE', 'https://niteothemes.com' );
@@ -121,12 +121,10 @@ if ( ! class_exists( 'CMP_Coming_Soon_and_Maintenance' ) ) :
121
  add_filter( 'rest_authentication_errors', array( $this, 'restrict_rest_api'), 0, 1 );
122
  }
123
 
124
- if ( function_exists( 'stats_footer' ) ) {
125
- add_action( 'cmp_footer', 'stats_footer', 101 );
126
- }
127
-
128
  }
129
 
 
130
  /**
131
  * Define constant if not already set.
132
  *
@@ -760,16 +758,16 @@ if ( ! class_exists( 'CMP_Coming_Soon_and_Maintenance' ) ) :
760
  *
761
  * @access public
762
  */
763
- public function cmp_admin_override() {
764
- // if admin is logged in or CMP is disabled, or not on page filter
765
- if ( $this->cmp_active() === '0' || $this->cmp_roles_filter() || !$this->cmp_page_filter() ) {
766
- return;
767
- }
768
 
769
- wp_logout();
770
- wp_redirect( get_bloginfo('url') );
771
- exit();
772
- }
773
 
774
  // function to display CMP landing page
775
  public function cmp_displayPage() {
@@ -3125,6 +3123,12 @@ if ( ! class_exists( 'CMP_Coming_Soon_and_Maintenance' ) ) :
3125
 
3126
  }
3127
 
 
 
 
 
 
 
3128
  }
3129
 
3130
 
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: 4.0.8
7
  Author: NiteoThemes
8
  Author URI: https://www.niteothemes.com
9
  Text Domain: cmp-coming-soon-maintenance
62
 
63
  // define constants
64
  private function constants() {
65
+ $this->define( 'CMP_VERSION', '4.0.8' );
66
  $this->define( 'CMP_DEBUG', FALSE );
67
  $this->define( 'CMP_AUTHOR', 'NiteoThemes' );
68
  $this->define( 'CMP_AUTHOR_HOMEPAGE', 'https://niteothemes.com' );
121
  add_filter( 'rest_authentication_errors', array( $this, 'restrict_rest_api'), 0, 1 );
122
  }
123
 
124
+ add_action( 'init', array( $this, 'jetpack_stats_compatibility' ) );
 
 
 
125
  }
126
 
127
+
128
  /**
129
  * Define constant if not already set.
130
  *
758
  *
759
  * @access public
760
  */
761
+ // public function cmp_admin_override() {
762
+ // // if admin is logged in or CMP is disabled, or not on page filter
763
+ // if ( $this->cmp_active() === '0' || $this->cmp_roles_filter() || !$this->cmp_page_filter() ) {
764
+ // return;
765
+ // }
766
 
767
+ // wp_logout();
768
+ // wp_redirect( get_bloginfo('url') );
769
+ // exit();
770
+ // }
771
 
772
  // function to display CMP landing page
773
  public function cmp_displayPage() {
3123
 
3124
  }
3125
 
3126
+ function jetpack_stats_compatibility() {
3127
+ if ( function_exists( 'stats_footer' ) ) {
3128
+ add_action( 'cmp_footer', 'stats_footer', 101 );
3129
+ }
3130
+ }
3131
+
3132
  }
3133
 
3134
 
readme.txt CHANGED
@@ -5,7 +5,7 @@ Tags: coming soon, coming soon page, launch page, maintenance mode, under constr
5
  Requires at least: 3.0
6
  Requires PHP: 5.6
7
  Tested up to: 5.7
8
- Stable tag: 4.0.6
9
  License: GPLv2 or later
10
  License URI: https://www.gnu.org/licenses/gpl-2.0.html
11
 
@@ -160,6 +160,15 @@ https://www.youtube.com/watch?v=uxuJfHzwdtE
160
  <p>Nothing is better than a good feedback! Please go to <a href="https://wordpress.org/support/plugin/cmp-coming-soon-maintenance/reviews/">Plugin reviews</a> and rate it! Alternatively you can click on a Donate button too!:)</p>
161
 
162
  == Changelog ==
 
 
 
 
 
 
 
 
 
163
  <h4>CMP 4.0.6 - 10-Mar-21</h4>
164
  <ul>
165
  <li>Removed PHP notice.</li>
5
  Requires at least: 3.0
6
  Requires PHP: 5.6
7
  Tested up to: 5.7
8
+ Stable tag: 4.0.8
9
  License: GPLv2 or later
10
  License URI: https://www.gnu.org/licenses/gpl-2.0.html
11
 
160
  <p>Nothing is better than a good feedback! Please go to <a href="https://wordpress.org/support/plugin/cmp-coming-soon-maintenance/reviews/">Plugin reviews</a> and rate it! Alternatively you can click on a Donate button too!:)</p>
161
 
162
  == Changelog ==
163
+ <h4>CMP 4.0.8 - 16-Mar-21</h4>
164
+ <ul>
165
+ <li>Resolved Unsplash Image loading, broken since API Unsplash changes.</li>
166
+ <li>New Social Icon for TikTok.</li>
167
+ </ul>
168
+ <h4>CMP 4.0.7 - 11-Mar-21</h4>
169
+ <ul>
170
+ <li>Updated Jetpack compatibility with stats counter.</li>
171
+ </ul>
172
  <h4>CMP 4.0.6 - 10-Mar-21</h4>
173
  <ul>
174
  <li>Removed PHP notice.</li>