Site Offline or Coming Soon - Version 1.6.3

Version Description

  • Added an admin dashboard notice for when the site offline/maintenance mode is enabled.
  • Fixed some minor HTML errors in the admin interface.
  • Separated the site offline enable/disable button section in the admin interface.
  • Added the messsage "The Site is Currently in Offline Mode" to the admin login screen (when the feature is enabled).
  • Added an option to reset the site offline message box content to default.
  • Updated the default message for when the maintenance mode feature is enabled.
Download this release

Release Info

Developer wpecommerce
Plugin Icon 128x128 Site Offline or Coming Soon
Version 1.6.3
Comparing to
See all releases

Code changes from version 1.6.2 to 1.6.3

Files changed (4) hide show
  1. content.htm +65 -84
  2. main.php +74 -52
  3. readme.txt +16 -6
  4. site-offline-options.php +37 -35
content.htm CHANGED
@@ -1,92 +1,73 @@
1
  <!DOCTYPE html>
2
  <html>
3
- <head>
4
- <title>Site Is Offline</title>
5
- <style type="text/css">
6
- body
7
- {
8
- font-size:16px;
9
- font-family: 'Kameron', Georgia,serif;
10
- }
11
- #cont
12
- {
13
- position:relative;
14
- width:100%;
15
- margin-top:20%;
16
- }
17
- .align-center
18
- {
19
- text-align:center;
20
- }
21
- .align-left
22
- {
23
- float:left;
24
- }
25
- .align-right
26
- {
27
- float:right;
28
- }
29
-
30
- .notice{
31
- background-color: rgb(203, 232, 107);
32
- padding:10px;
33
- }
34
- .warning{
35
- background-color: #BE2817;
36
- padding:10px;
37
- word-wrap: break-word;
38
- }
39
 
40
- div#list .green,div#list .red
41
- {
42
-
43
- width:400px;
44
- }
45
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
46
 
47
-
48
- </style>
49
-
50
- <script type="text/javascript">
51
- WebFontConfig = {
52
- google: { families: [ 'Kameron:400,700' ] }
53
- };
54
- (function() {
55
- var wf = document.createElement('script');
56
- wf.src = ('https:' == document.location.protocol ? 'https' : 'http') +
57
- '://ajax.googleapis.com/ajax/libs/webfont/1/webfont.js';
58
- wf.type = 'text/javascript';
59
- wf.async = 'true';
60
- var s = document.getElementsByTagName('script')[0];
61
- s.parentNode.insertBefore(wf, s);
62
- })(); </script>
63
-
64
-
65
- </head>
66
- <body>
67
- <div id="cont">
68
- <span class="content">
69
- <h1 class="align-center">Site is offline for maintenance</h1>
70
- <div id="list">
71
-
72
- <ul class="green align-left">
73
- <li><p class="notice">We have added two new features</p></li>
74
- </ul>
75
-
76
- <ul class="red align-right">
77
- <li><p class="warning">Our site is down</p></li>
78
- </ul>
79
-
80
- </div>
81
-
82
- </span>
83
-
84
- </div>
85
-
86
-
87
-
88
-
89
- </body>
90
  </html>
91
 
92
 
1
  <!DOCTYPE html>
2
  <html>
3
+ <head>
4
+ <title>Site Is Offline</title>
5
+ <style type="text/css">
6
+ body
7
+ {
8
+ font-size:16px;
9
+ font-family: 'Kameron', Georgia,serif;
10
+ }
11
+ #cont
12
+ {
13
+ position:relative;
14
+ width:100%;
15
+ margin-top:20%;
16
+ }
17
+ .align-center{
18
+ text-align:center;
19
+ }
20
+ .center-msg-box{
21
+ max-width: 600px;
22
+ margin-left: auto !important;
23
+ margin-right: auto !important;
24
+ }
25
+ .blue-box{
26
+ margin: 10px 0 15px;
27
+ background-color: #F0F9FF;
28
+ border-color: #1166BB;
29
+ color: #1166BB;
30
+ border-radius: 3px 3px 3px 3px;
31
+ border-style: solid;
32
+ border-width: 1px;
33
+ padding: 0 0 0 1em;
34
+ line-height: 20px;
35
+ }
 
 
 
36
 
37
+ div#list .green,div#list .red
38
+ {
39
+ width:400px;
40
+ }
41
+ </style>
42
 
43
+ <script type="text/javascript">
44
+ WebFontConfig = {
45
+ google: {families: ['Kameron:400,700']}
46
+ };
47
+ (function() {
48
+ var wf = document.createElement('script');
49
+ wf.src = ('https:' == document.location.protocol ? 'https' : 'http') +
50
+ '://ajax.googleapis.com/ajax/libs/webfont/1/webfont.js';
51
+ wf.type = 'text/javascript';
52
+ wf.async = 'true';
53
+ var s = document.getElementsByTagName('script')[0];
54
+ s.parentNode.insertBefore(wf, s);
55
+ })();
56
+ </script>
57
+ </head>
58
+ <body>
59
+ <div id="cont">
60
+ <div class="content">
61
+ <h1 class="align-center">Site is offline for maintenance</h1>
62
+ <div class="blue-box center-msg-box">
63
+ <p class="align-center">We are currently undergoing scheduled maintenance</p>
64
+ <p class="align-center">Sorry for the inconvenience.</p>
65
+ <p class="align-center">Please try back soon.</p>
66
+ </div>
67
+ </div>
68
 
69
+ </div>
70
+ </body>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
71
  </html>
72
 
73
 
main.php CHANGED
@@ -1,73 +1,95 @@
1
  <?php
2
  /*
3
- Plugin Name: Site Offline or Coming Soon
4
- Version: 1.6.2
5
- Plugin URI: http://wp-ecommerce.net/
6
- Author: wpecommerce
7
- Author URI: http://wp-ecommerce.net/
8
- Description: Make safe changes to your site by enabling site offline mode with this plugin you'll be able to navigate your site normally but your regular visitor will se a site offline or coming soon page
9
- */
10
 
11
- function cp_siteoffline_activate()
12
- {
13
- $options = array(
14
- 'enabled' => false,
15
- 'content' => NULL,
16
- 'version' => 1.0
17
- );
18
- if ( get_option('sp_siteoffline_options') === false )
19
- add_option('sp_siteoffline_options',$options);
20
- }
21
- function cp_siteoffline_options_page()
22
- {
23
- add_submenu_page( 'options-general.php', 'Site Offline Mode Options', 'Site Offline Mode', 'manage_options', __FILE__, 'cp_siteoffline_options_page_content' );
24
  }
25
- function cp_siteoffline_options_page_content()
26
- {
27
-
28
- $options = get_option('sp_siteoffline_options');
29
-
30
-
31
- if (!empty($_POST['cp_siteoffline_content'])){
32
- $options['content'] = stripslashes($_POST['cp_siteoffline_content']);
33
-
34
- }
35
- if ( !empty($_POST['cp_siteoffline_enabled']) )
36
- {
37
- if ( $_POST['cp_siteoffline_enabled'] == 'true' )
38
- $options['enabled'] = true;
39
- else
40
- $options['enabled'] = false;
41
- }
42
- update_option('sp_siteoffline_options',$options);
43
- include_once('site-offline-options.php');
44
  }
45
- function cp_siteoffline_message()
46
- {
 
 
 
 
 
 
 
 
 
 
 
47
  $options = get_option('sp_siteoffline_options');
48
- if ( $options['enabled'] === false ) return;
49
- if ( !current_user_can('edit_posts') )
50
- {
 
 
 
 
 
51
  $protocol = "HTTP/1.0";
52
- if("HTTP/1.1" == $_SERVER["SERVER_PROTOCOL"]){
53
  $protocol = "HTTP/1.1";
54
  }
55
  header("$protocol 503 Service Unavailable", true, 503);
56
  header("Retry-After: 3600");
57
- echo $options['content'];
 
 
58
  exit();
59
  }
60
  }
61
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
62
  /* The most effective would be init hook but then if the user logout, user may need to disable or
63
  * delete the plugin for a succesful login again.
64
  * No effect would be on admin dashboard, so user can login by going to siturl.com/wp-admin
65
  * if the user have manage_options capabaility he can easily navigate,test,make changes without letting the general public know.
66
- * */
67
- add_action('init','cp_siteoffline_activate');
68
- add_action('admin_menu','cp_siteoffline_options_page');
69
- if (!is_admin())
70
- add_action('send_headers','cp_siteoffline_message');
 
71
 
 
 
 
72
 
73
- ?>
1
  <?php
2
  /*
3
+ Plugin Name: Site Offline or Coming Soon
4
+ Version: 1.6.3
5
+ Plugin URI: http://wp-ecommerce.net/
6
+ Author: wpecommerce
7
+ Author URI: http://wp-ecommerce.net/
8
+ Description: Make safe changes to your site by enabling site offline mode with this plugin you'll be able to navigate your site normally but your regular visitor will se a site offline or coming soon page
9
+ */
10
 
11
+ function cp_siteoffline_activate() {
12
+ $options = array(
13
+ 'enabled' => false,
14
+ 'content' => NULL,
15
+ 'version' => 1.0
16
+ );
17
+ if (get_option('sp_siteoffline_options') === false)
18
+ add_option('sp_siteoffline_options', $options);
 
 
 
 
 
19
  }
20
+
21
+ function cp_siteoffline_options_page() {
22
+ add_submenu_page('options-general.php', 'Site Offline Mode Options', 'Site Offline Mode', 'manage_options', __FILE__, 'cp_siteoffline_options_page_content');
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
23
  }
24
+
25
+ function cp_siteoffline_options_page_content() {
26
+ if (isset($_POST['cpso_save_settings'])) {
27
+ $options = array();
28
+ $site_offline_front_end_conent = htmlentities(stripslashes($_POST['cp_siteoffline_content']) , ENT_COMPAT, "UTF-8");
29
+ $options['content'] = $site_offline_front_end_conent;//stripslashes($_POST['cp_siteoffline_content']);
30
+ if ($_POST['cp_siteoffline_enabled'] == 'true')
31
+ $options['enabled'] = true;
32
+ else
33
+ $options['enabled'] = false;
34
+ update_option('sp_siteoffline_options', $options);
35
+ }
36
+
37
  $options = get_option('sp_siteoffline_options');
38
+ include_once('site-offline-options.php');
39
+ }
40
+
41
+ function cp_siteoffline_message() {
42
+ $options = get_option('sp_siteoffline_options');
43
+ if ($options['enabled'] === false)
44
+ return;
45
+ if (!current_user_can('edit_posts')) {
46
  $protocol = "HTTP/1.0";
47
+ if ("HTTP/1.1" == $_SERVER["SERVER_PROTOCOL"]) {
48
  $protocol = "HTTP/1.1";
49
  }
50
  header("$protocol 503 Service Unavailable", true, 503);
51
  header("Retry-After: 3600");
52
+ $site_offline_front_end_conent = html_entity_decode($options['content'], ENT_COMPAT,"UTF-8");
53
+ echo $site_offline_front_end_conent;
54
+ //echo $options['content'];
55
  exit();
56
  }
57
  }
58
 
59
+ function cpso_maintenance_mode_check_msg()
60
+ {
61
+ $options = get_option('sp_siteoffline_options');
62
+ $offline_mode_enabled = $options['enabled'];
63
+ if($offline_mode_enabled){
64
+ $msg = '<p>The Maintenance Mode is active. Please don\'t forget to <a href="options-general.php?page=site-is-offline-plugin/main.php">deactivate it</a> as soon as you are done.</p>';
65
+ echo '<div class="updated fade">'.$msg.'</div>';
66
+ }
67
+ }
68
+
69
+ function cpso_login_form_msg()
70
+ {
71
+ $msg = '';
72
+ $options = get_option('sp_siteoffline_options');
73
+ $offline_mode_enabled = $options['enabled'];
74
+ if($offline_mode_enabled){
75
+ $msg = '<div id="login_error"><p>The Site is Currently in Offline Mode.</p></div>';
76
+ }
77
+ return $msg;
78
+ }
79
+
80
  /* The most effective would be init hook but then if the user logout, user may need to disable or
81
  * delete the plugin for a succesful login again.
82
  * No effect would be on admin dashboard, so user can login by going to siturl.com/wp-admin
83
  * if the user have manage_options capabaility he can easily navigate,test,make changes without letting the general public know.
84
+ * */
85
+ add_action('init', 'cp_siteoffline_activate');
86
+ add_action('admin_menu', 'cp_siteoffline_options_page');
87
+ if (!is_admin()) {
88
+ add_action('send_headers', 'cp_siteoffline_message');
89
+ }
90
 
91
+ if (is_admin()) {
92
+ add_action('admin_notices', 'cpso_maintenance_mode_check_msg');
93
+ }
94
 
95
+ add_filter('login_message', 'cpso_login_form_msg');
readme.txt CHANGED
@@ -1,10 +1,10 @@
1
  === Site Offline or Coming Soon ===
2
  Contributors: wpecommerce
3
  Donate link: http://wp-ecommerce.net/
4
- Tags: coming soon,site is down,maintenance,teaser,offline,google,premium,post,page,google,admin,aweber,opt-in,form,mail chimp,administration, construction,mode,unavailable
5
  Requires at least: 3.0
6
  Tested up to: 3.8
7
- Stable tag: 1.6.2
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
@@ -16,9 +16,11 @@ Use this plugin to enable/disable site offline mode. If Site offline Mode is ena
16
 
17
  = Site Offline Plugin Features =
18
 
19
- * Easily activate maintenance mode for your website
20
- * Display customized message to visitors while your site is undergoing normal/scheduled maintenance
21
- * Perform maintenance work on the back-end and front-end while logged in as an administrator
 
 
22
 
23
  = Site Offline Plugin Usage =
24
 
@@ -49,6 +51,14 @@ Yes.
49
 
50
  == Changelog ==
51
 
 
 
 
 
 
 
 
 
52
  = 1.6.2 =
53
  * Plugin now sends the correct header status when a website is in maintenance mode
54
 
@@ -59,4 +69,4 @@ Yes.
59
  * Plugin is now compatible with WordPress 3.6
60
 
61
  == Upgrade Notice ==
62
- none
1
  === Site Offline or Coming Soon ===
2
  Contributors: wpecommerce
3
  Donate link: http://wp-ecommerce.net/
4
+ Tags: coming soon,site is down,maintenance, maintenance mode, offline, google, post, page, google, admin, aweber, mailchimp, administration, construction, mode, unavailable,
5
  Requires at least: 3.0
6
  Tested up to: 3.8
7
+ Stable tag: 1.6.3
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
16
 
17
  = Site Offline Plugin Features =
18
 
19
+ * Easily activate maintenance mode for your website.
20
+ * Display customized message to visitors while your site is undergoing normal/scheduled maintenance.
21
+ * Perform maintenance work on the back-end and front-end while logged in as an administrator.
22
+ * Admin dashboard notice. This allows the admin to easily notice when the site is in maintenance mode.
23
+ * The login screen will show a "site offline" message when you keep the site in offline mode.
24
 
25
  = Site Offline Plugin Usage =
26
 
51
 
52
  == Changelog ==
53
 
54
+ = 1.6.3 =
55
+ * Added an admin dashboard notice for when the site offline/maintenance mode is enabled.
56
+ * Fixed some minor HTML errors in the admin interface.
57
+ * Separated the site offline enable/disable button section in the admin interface.
58
+ * Added the messsage "The Site is Currently in Offline Mode" to the admin login screen (when the feature is enabled).
59
+ * Added an option to reset the site offline message box content to default.
60
+ * Updated the default message for when the maintenance mode feature is enabled.
61
+
62
  = 1.6.2 =
63
  * Plugin now sends the correct header status when a website is in maintenance mode
64
 
69
  * Plugin is now compatible with WordPress 3.6
70
 
71
  == Upgrade Notice ==
72
+ None
site-offline-options.php CHANGED
@@ -1,48 +1,50 @@
1
  <?php if (!current_user_can('manage_options')) wp_die('You do not have sufficient permissions to access this page') ?>
2
 
3
  <div class="wrap">
4
- <div>
5
- <h3 style="margin:5px;"><a href="http://wp-ecommerce.net/wp-coming-soon-plugin-easily-create-a-coming-soon-page-for-your-wordpress-blog-2328" target="_blank">Premium Version: WordPress Site offline/Coming Soon Plus Plugin</a></h3>
 
 
6
  </div>
7
- <div id="icon-options-general" class="icon32"><br /></div>
8
-
9
- <h2><?php _e('Site Offline Plugin Options'); ?></h2>
10
- <form method="POST" action="">
11
- <fieldset>
12
- <div id="poststuff" class="metabox-holder">
13
- <div class="meta-box-sortables">
14
 
15
- <!-- General -->
16
- <div class="postbox">
17
- <div class="handlediv" title="<?php _e('Click to toggle'); ?>">
18
- <br/>
19
- </div>
20
- <h3 class="hndle"><span><?php _e('Content/HTML Code'); ?></span></h3>
21
 
22
- <div class="inside">
23
- <p>Enabled: <label><input type="radio" value="true" name="cp_siteoffline_enabled" <?php echo ($options['enabled'] === true ? 'checked' : '' ); ?> />Yes</label> <label><input type="radio" value="false" name="cp_siteoffline_enabled" <?php echo ($options['enabled'] === false ? 'checked' : '' ); ?> /> No</label></p>
24
- <p><textarea spellcheck='false' rows='22' name="cp_siteoffline_content"><?php
25
- if ( $options['content'] === NULL )
26
- include('content.htm');
27
- else
28
- echo $options['content'];
29
- ?></textarea></p>
30
-
31
- </fieldset>
32
- <p><input type="submit" value="<?php _e('Save Changes'); ?>" class="button button-primary"/></p>
33
- </form>
34
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
35
 
36
- </div>
37
-
38
- </div>
39
-
40
- </div>
41
- </div>
42
  <style>
43
  textarea[name='cp_siteoffline_content']
44
  {
45
- font-family:Monaco,Consolas,monospace;
46
- width:100%;
47
  }
48
  </style>
1
  <?php if (!current_user_can('manage_options')) wp_die('You do not have sufficient permissions to access this page') ?>
2
 
3
  <div class="wrap">
4
+ <div id="poststuff"><div id="post-body">
5
+
6
+ <div class="premium_plugin_notice">
7
+ <h3 style="margin:5px;"><a href="http://wp-ecommerce.net/wp-coming-soon-plugin-easily-create-a-coming-soon-page-for-your-wordpress-blog-2328" target="_blank">Premium Version: WordPress Site offline/Coming Soon Plus Plugin</a></h3>
8
  </div>
9
+ <div id="icon-options-general" class="icon32"><br /></div>
 
 
 
 
 
 
10
 
11
+ <h2><?php _e('Site Offline Plugin Options'); ?></h2>
12
+ <form method="POST" action="">
 
 
 
 
13
 
14
+ <div class="postbox">
15
+ <h3><label for="title">Activate/Deactivate Site Offline Mode</label></h3>
16
+ <div class="inside">
17
+ <p>Enabled: <label><input type="radio" value="true" name="cp_siteoffline_enabled" <?php echo ($options['enabled'] === true ? 'checked' : '' ); ?> />Yes</label> <label><input type="radio" value="false" name="cp_siteoffline_enabled" <?php echo ($options['enabled'] === false ? 'checked' : '' ); ?> /> No</label></p>
18
+
19
+ <input type="submit" name="cpso_save_settings" value="<?php _e('Save Changes'); ?>" class="button button-primary"/>
20
+ </div></div><!-- end of .inside and .postbox -->
 
 
 
 
 
21
 
22
+ <div class="postbox">
23
+ <h3><label for="title">Site Offline Message/Content</label></h3>
24
+ <div class="inside">
25
+
26
+ <p><textarea spellcheck='false' rows='22' name="cp_siteoffline_content">
27
+ <?php
28
+ if ($options['content'] === NULL || empty($options['content'])){
29
+ include('content.htm');
30
+ }
31
+ else{
32
+ echo $options['content'];
33
+ }
34
+ ?>
35
+ </textarea>
36
+ </p>
37
 
38
+ </div></div><!-- end of .poststuff -->
39
+ <input type="submit" name="cpso_save_settings" value="<?php _e('Save Changes'); ?>" class="button button-primary"/>
40
+ </form>
41
+
42
+ </div></div><!-- end of .poststuff and post-body -->
43
+ </div><!-- end of .wrap -->
44
  <style>
45
  textarea[name='cp_siteoffline_content']
46
  {
47
+ font-family:Monaco,Consolas,monospace;
48
+ width:100%;
49
  }
50
  </style>