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

Version Description

Download this release

Release Info

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

Code changes from version 3.9.6 to 3.9.7

cmp-advanced.php CHANGED
@@ -210,6 +210,18 @@ if ( $_SERVER['REQUEST_METHOD'] == 'POST' ) {
210
  } else {
211
  update_option('niteoCS_mode_change_notification', '0');
212
  }
 
 
 
 
 
 
 
 
 
 
 
 
213
  }
214
 
215
  if ( isset( $_POST['niteoCS_custom_login_url'] ) ) {
@@ -248,6 +260,8 @@ $cmp_mode_change_notif = get_option('niteoCS_mode_change_notification', '0');
248
  $countdown_email = get_option('niteoCS_countdown_email_address', get_option( 'admin_email' ));
249
  $mode_change_email = get_option('niteoCS_mode_change_email_address', get_option( 'admin_email' ));
250
  $cmp_cookie_notice_comp = get_option('cmp_cookie_notice_comp', '1');
 
 
251
  ?>
252
 
253
  <div class="wrap cmp-coming-soon-maintenance cmp-advanced">
@@ -501,6 +515,37 @@ $cmp_cookie_notice_comp = get_option('cmp_cookie_notice_comp', '1');
501
  </tbody>
502
  </table>
503
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
504
  </div>
505
 
506
  <!-- NOTIFICATIONS -->
210
  } else {
211
  update_option('niteoCS_mode_change_notification', '0');
212
  }
213
+
214
+ if ( isset($_POST['niteoCS-rss-status']) ) {
215
+ update_option('niteoCS_rss_status', $this->sanitize_checkbox($_POST['niteoCS-rss-status']) );
216
+ } else {
217
+ update_option('niteoCS_rss_status', '0');
218
+ }
219
+
220
+ if ( isset($_POST['niteoCS-restapi-status']) ) {
221
+ update_option('niteoCS_rest_api_status', $this->sanitize_checkbox($_POST['niteoCS-restapi-status']) );
222
+ } else {
223
+ update_option('niteoCS_rest_api_status', '0');
224
+ }
225
  }
226
 
227
  if ( isset( $_POST['niteoCS_custom_login_url'] ) ) {
260
  $countdown_email = get_option('niteoCS_countdown_email_address', get_option( 'admin_email' ));
261
  $mode_change_email = get_option('niteoCS_mode_change_email_address', get_option( 'admin_email' ));
262
  $cmp_cookie_notice_comp = get_option('cmp_cookie_notice_comp', '1');
263
+ $cmp_rss = get_option('niteoCS_rss_status', '1');
264
+ $cmp_rest_api = get_option('niteoCS_rest_api_status', '1');
265
  ?>
266
 
267
  <div class="wrap cmp-coming-soon-maintenance cmp-advanced">
515
  </tbody>
516
  </table>
517
 
518
+ </div>
519
+ <div class="table-wrapper general cmp-bypass">
520
+ <h3 class="no-icon"><?php _e('RSS & REST API', 'cmp-coming-soon-maintenance');?></h3>
521
+ <table class="general">
522
+ <tbody>
523
+ <tr>
524
+ <th><?php _e('RSS', 'cmp-coming-soon-maintenance');?></th>
525
+ <td>
526
+ <fieldset>
527
+ <label for="cmp-rss-status">
528
+ <input type="checkbox" name="niteoCS-rss-status" id="cmp-rss-status" value="1" <?php checked('1', $cmp_rss);?>><?php _e('Allow RSS', 'cmp-coming-soon-maintenance');?>
529
+ </label>
530
+ </fieldset>
531
+ </td>
532
+ </tr>
533
+ <tr>
534
+ <th><?php _e('REST API', 'cmp-coming-soon-maintenance');?></th>
535
+ <td>
536
+ <fieldset>
537
+ <label for="cmp-restapi-status">
538
+ <input type="checkbox" name="niteoCS-restapi-status" id="cmp-restapi-status" value="1" <?php checked('1', $cmp_rest_api);?>><?php _e('Allow REST API', 'cmp-coming-soon-maintenance');?>
539
+ </label>
540
+ </fieldset>
541
+ </td>
542
+ </tr>
543
+
544
+ <?php echo $this->render_settings->submit(); ?>
545
+
546
+ </tbody>
547
+ </table>
548
+
549
  </div>
550
 
551
  <!-- NOTIFICATIONS -->
cmp-sidebar.php CHANGED
@@ -35,7 +35,7 @@ if ( !file_exists( CMP_PLUGIN_DIR . 'img/thumbnails/'. $slug . '_thumbnail.jpg'
35
 
36
  <div class="clp-widget widget" style="padding: 0;">
37
  <h3 ><?php _e('Check out our other plugins!', 'cmp-coming-soon-maintenance');?></h3>
38
- <a href="https://wordpress.org/plugins/clp-custom-login-page/" target="_blank"><img src="<?php echo plugins_url('/img/clp-banner.jpg', __FILE__);?>" alt="CLP - Custom Login Page" style="max-width:100%;vertical-align:top"></a>
39
  <p style="padding: 0 2em"><a href="https://wordpress.org/plugins/clp-custom-login-page/" target="_blank" style="text-decoration:none">CLP - Custom Login Page</a> - <?php _e('Awesome plugin to customize WordPress Login Page!', 'cmp-coming-soon-maintenance');?></p>
40
  </div>
41
 
35
 
36
  <div class="clp-widget widget" style="padding: 0;">
37
  <h3 ><?php _e('Check out our other plugins!', 'cmp-coming-soon-maintenance');?></h3>
38
+ <a href="https://wordpress.org/plugins/clp-custom-login-page/" target="_blank"><img src="<?php echo plugins_url('/img/clp-banner.png', __FILE__);?>" alt="CLP - Custom Login Page" style="max-width:100%;vertical-align:top"></a>
39
  <p style="padding: 0 2em"><a href="https://wordpress.org/plugins/clp-custom-login-page/" target="_blank" style="text-decoration:none">CLP - Custom Login Page</a> - <?php _e('Awesome plugin to customize WordPress Login Page!', 'cmp-coming-soon-maintenance');?></p>
40
  </div>
41
 
img/clp-banner.jpg DELETED
Binary file
img/clp-banner.png ADDED
Binary file
inc/class-cmp-render_html.php CHANGED
@@ -329,6 +329,13 @@ class CMP_Coming_Soon_and_Maintenance_Render_HTML extends CMP_Coming_Soon_and_Ma
329
  * @return html
330
  **/
331
  public function cmp_wp_head() {
 
 
 
 
 
 
 
332
 
333
  // Plugin Name: Insert Headers and Footers
334
  if ( class_exists('InsertHeadersAndFooters') ) {
329
  * @return html
330
  **/
331
  public function cmp_wp_head() {
332
+
333
+
334
+
335
+ // Plugin Name: LiteSpeed Cache
336
+ if ( class_exists('LiteSpeed\Core') ) {
337
+ define( 'LITESPEED_IS_HTML', true );
338
+ }
339
 
340
  // Plugin Name: Insert Headers and Footers
341
  if ( class_exists('InsertHeadersAndFooters') ) {
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.9.6
7
  Author: NiteoThemes
8
  Author URI: https://www.niteothemes.com
9
  Text Domain: cmp-coming-soon-maintenance
@@ -63,7 +63,7 @@ if ( ! class_exists( 'CMP_Coming_Soon_and_Maintenance' ) ) :
63
 
64
  // define constants
65
  private function constants() {
66
- $this->define( 'CMP_VERSION', '3.9.6' );
67
  $this->define( 'CMP_DEBUG', FALSE );
68
  $this->define( 'CMP_AUTHOR', 'NiteoThemes' );
69
  $this->define( 'CMP_AUTHOR_HOMEPAGE', 'https://niteothemes.com' );
@@ -107,10 +107,11 @@ if ( ! class_exists( 'CMP_Coming_Soon_and_Maintenance' ) ) :
107
  add_action( 'wp_ajax_cmp_ajax_export_settings', array( $this, 'cmp_ajax_export_settings' ) );
108
  add_action( 'wp_ajax_cmp_ajax_import_settings', array( $this, 'cmp_ajax_import_settings' ) );
109
  add_action( 'wp_ajax_nopriv_cmp_disable_comingsoon_ajax', array( $this, 'cmp_disable_comingsoon_ajax' ) );
110
- add_action( 'admin_head', array( $this,'cmp_admin_css') );
111
- add_action( 'after_setup_theme', array( $this,'cmp_create_translation'), 10 );
112
- add_action( 'after_setup_theme', array( $this,'cmp_register_wpml_strings'), 20 );
113
- add_filter('upload_mimes', array( $this, 'cmp_allow_font_mimes' ));
 
114
  add_filter( 'plugin_action_links_' . plugin_basename(__FILE__), array( $this,'add_action_links' ) );
115
 
116
  register_activation_hook( __FILE__, array( $this, 'cmp_activate' ) );
@@ -119,6 +120,16 @@ if ( ! class_exists( 'CMP_Coming_Soon_and_Maintenance' ) ) :
119
  require_once( dirname( __FILE__) . '/inc/class-cmp-render_html.php' );
120
  }
121
 
 
 
 
 
 
 
 
 
 
 
122
  /**
123
  * Define constant if not already set.
124
  *
@@ -242,13 +253,13 @@ if ( ! class_exists( 'CMP_Coming_Soon_and_Maintenance' ) ) :
242
  }
243
  }
244
 
245
- public function cmp_register_string( $name, $group, $string, $multiline = false ) {
246
 
247
  if ( function_exists('pll_register_string') ) {
248
  pll_register_string( $name, $string, $group, $multiline );
249
 
250
  } else if ( defined( 'ICL_SITEPRESS_VERSION' ) ) {
251
- do_action( 'wpml_register_single_string', $name, $group, $string );
252
  }
253
  }
254
 
@@ -2223,9 +2234,12 @@ if ( ! class_exists( 'CMP_Coming_Soon_and_Maintenance' ) ) :
2223
  public function cmp_page_filter() {
2224
  global $wp;
2225
 
2226
- $current_url = trailingslashit( (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] === 'on' ? "https" : "http") . "://$_SERVER[HTTP_HOST]$_SERVER[REQUEST_URI]" );
 
 
2227
 
2228
  $custom_login_url = get_option('niteoCS_custom_login_url', '');
 
2229
  // return early if login page or ajax call
2230
  if ( fnmatch( '*wp-login.php*', $current_url ) || wp_doing_ajax() ) {
2231
  return false;
@@ -2243,6 +2257,11 @@ if ( ! class_exists( 'CMP_Coming_Soon_and_Maintenance' ) ) :
2243
  }
2244
  }
2245
 
 
 
 
 
 
2246
  // get current page IDs
2247
  if ( is_front_page() && is_home() ) {
2248
  // default homepage
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.9.7
7
  Author: NiteoThemes
8
  Author URI: https://www.niteothemes.com
9
  Text Domain: cmp-coming-soon-maintenance
63
 
64
  // define constants
65
  private function constants() {
66
+ $this->define( 'CMP_VERSION', '3.9.7' );
67
  $this->define( 'CMP_DEBUG', FALSE );
68
  $this->define( 'CMP_AUTHOR', 'NiteoThemes' );
69
  $this->define( 'CMP_AUTHOR_HOMEPAGE', 'https://niteothemes.com' );
107
  add_action( 'wp_ajax_cmp_ajax_export_settings', array( $this, 'cmp_ajax_export_settings' ) );
108
  add_action( 'wp_ajax_cmp_ajax_import_settings', array( $this, 'cmp_ajax_import_settings' ) );
109
  add_action( 'wp_ajax_nopriv_cmp_disable_comingsoon_ajax', array( $this, 'cmp_disable_comingsoon_ajax' ) );
110
+ add_action( 'admin_head', array( $this, 'cmp_admin_css') );
111
+ add_action( 'after_setup_theme', array( $this, 'cmp_create_translation'), 10 );
112
+ add_action( 'after_setup_theme', array( $this, 'cmp_register_wpml_strings'), 20 );
113
+ add_action( 'rest_api_init', array( $this, 'restrict_rest_api'), 0 );
114
+ add_filter( 'upload_mimes', array( $this, 'cmp_allow_font_mimes' ));
115
  add_filter( 'plugin_action_links_' . plugin_basename(__FILE__), array( $this,'add_action_links' ) );
116
 
117
  register_activation_hook( __FILE__, array( $this, 'cmp_activate' ) );
120
  require_once( dirname( __FILE__) . '/inc/class-cmp-render_html.php' );
121
  }
122
 
123
+ /**
124
+ * Disable REST API if required
125
+ */
126
+ function restrict_rest_api() {
127
+ if ( !get_option('niteoCS_rest_api_status', '1') ){
128
+ echo '{"code":"json_disabled","message":"JSON API is disabled by CMP – Coming Soon & Maintenance Plugin."}';
129
+ die();
130
+ }
131
+ }
132
+
133
  /**
134
  * Define constant if not already set.
135
  *
253
  }
254
  }
255
 
256
+ public function cmp_register_string( $group, $name, $string, $multiline = false ) {
257
 
258
  if ( function_exists('pll_register_string') ) {
259
  pll_register_string( $name, $string, $group, $multiline );
260
 
261
  } else if ( defined( 'ICL_SITEPRESS_VERSION' ) ) {
262
+ do_action( 'wpml_register_single_string', $group, $name, $string );
263
  }
264
  }
265
 
2234
  public function cmp_page_filter() {
2235
  global $wp;
2236
 
2237
+ $uri = isset($_SERVER['HTTP_HOST']) ? $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'] : '';
2238
+
2239
+ $current_url = trailingslashit( (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] === 'on' ? "https" : "http") . "://" . $uri );
2240
 
2241
  $custom_login_url = get_option('niteoCS_custom_login_url', '');
2242
+
2243
  // return early if login page or ajax call
2244
  if ( fnmatch( '*wp-login.php*', $current_url ) || wp_doing_ajax() ) {
2245
  return false;
2257
  }
2258
  }
2259
 
2260
+ // allow / block RSS
2261
+ if ( get_option('niteoCS_rss_status', '1') && is_feed() ) {
2262
+ return false;
2263
+ }
2264
+
2265
  // get current page IDs
2266
  if ( is_front_page() && is_home() ) {
2267
  // default homepage
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.6
8
- Stable tag: 3.9.6
9
  License: GPLv2 or later
10
  License URI: https://www.gnu.org/licenses/gpl-2.0.html
11
 
@@ -160,6 +160,13 @@ 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 3.9.6 - 07-Jan-21</h4>
164
  <ul>
165
  <li>Resolved issue with displaying Language Switcher even with settings set to off if WPML plugin was enabled.</li>
5
  Requires at least: 3.0
6
  Requires PHP: 5.6
7
  Tested up to: 5.6
8
+ Stable tag: 3.9.7
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 3.9.7 - 07-Jan-21</h4>
164
+ <ul>
165
+ <li>Resolved PHP Warning when "HTTP_HOST" array key was not present. - @seath thanks for reporting it.</li>
166
+ <li>Added support for Litespeed Cache optimization plugin. - requested by @artgoddess</li>
167
+ <li>New option to allow or block RSS feed and REST API - requested by @artgoddess</li>
168
+ </ul>
169
+
170
  <h4>CMP 3.9.6 - 07-Jan-21</h4>
171
  <ul>
172
  <li>Resolved issue with displaying Language Switcher even with settings set to off if WPML plugin was enabled.</li>