Site Offline or Coming Soon - Version 1.0

Version Description

Download this release

Release Info

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

Version 1.0

Files changed (5) hide show
  1. content.htm +92 -0
  2. index.php +0 -0
  3. main.php +68 -0
  4. readme.txt +12 -0
  5. site-offline-options.php +44 -0
content.htm ADDED
@@ -0,0 +1,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
+ {
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
+
index.php ADDED
File without changes
main.php ADDED
@@ -0,0 +1,68 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*
3
+ Plugin Name: Site Offline
4
+ Plugin URI: http://twitter.com/cloudplugins
5
+ Description: Make safe changes to your site by enabling site offline mode with this plugin.
6
+ Version: 1.0
7
+ Author: Muneeb
8
+ Author URI: http://twitter.com/cloudplugins
9
+ License: GPLv2 or later
10
+ CopyRight (c) 2011 Muneeb ur Rehman
11
+ */
12
+
13
+ function cp_siteoffline_activate()
14
+ {
15
+ $options = array(
16
+ 'enabled' => false,
17
+ 'content' => NULL,
18
+ 'version' => 1.0
19
+ );
20
+ if ( get_option('sp_siteoffline_options') === false )
21
+ add_option('sp_siteoffline_options',$options);
22
+ }
23
+ function cp_siteoffline_options_page()
24
+ {
25
+ add_submenu_page( 'options-general.php', 'Site Offline Mode Options', 'Site Offline Mode', 'manage_options', __FILE__, 'cp_siteoffline_options_page_content' );
26
+ }
27
+ function cp_siteoffline_options_page_content()
28
+ {
29
+
30
+ $options = get_option('sp_siteoffline_options');
31
+
32
+
33
+ if (!empty($_POST['cp_siteoffline_content'])){
34
+ $options['content'] = stripslashes($_POST['cp_siteoffline_content']);
35
+
36
+ }
37
+ if ( !empty($_POST['cp_siteoffline_enabled']) )
38
+ {
39
+ if ( $_POST['cp_siteoffline_enabled'] == 'true' )
40
+ $options['enabled'] = true;
41
+ else
42
+ $options['enabled'] = false;
43
+ }
44
+ update_option('sp_siteoffline_options',$options);
45
+ include_once('site-offline-options.php');
46
+ }
47
+ function cp_siteoffline_message()
48
+ {
49
+ $options = get_option('sp_siteoffline_options');
50
+ if ( $options['enabled'] === false ) return;
51
+ if ( !current_user_can('manage_options') ){
52
+ echo $options['content'];
53
+ exit();
54
+ }
55
+ }
56
+
57
+ /* The most effective would be init hook but then if the user logout, user may need to disable or
58
+ * delete the plugin for a succesful login again.
59
+ * No effect would be on admin dashboard, so user can login by going to siturl.com/wp-admin
60
+ * if the user have manage_options capabaility he can easily navigate,test,make changes without letting the general public know.
61
+ * */
62
+ add_action('init','cp_siteoffline_activate');
63
+ add_action('admin_menu','cp_siteoffline_options_page');
64
+ if (!is_admin())
65
+ add_action('send_headers','cp_siteoffline_message');
66
+
67
+
68
+ ?>
readme.txt ADDED
@@ -0,0 +1,12 @@
 
 
 
 
 
 
 
 
 
 
 
 
1
+ === Plugin Name ===
2
+ Contributors: Muneeb
3
+ Tags: coming soon,site is down,maintenance,teaser,offline,google
4
+ Requires at least: 3.0
5
+ Tested up to: 3.2
6
+ Stable tag: 1.0
7
+
8
+ == Description ==
9
+
10
+ Use this plugin to enable/disable site offline mode. When Site offline Mode is enabled regular visitors of your site will see a page(you can edit that page by going to settings->Site Offline Mode) and you as a admin can make and test safe changes to your site. Very helpful for those developers who need coming soon pages for there sites.
11
+
12
+ I'm a WordPress Developer If you want to hire me or have any questions,feedback Please contact me - <a href="https://spreadsheets.google.com/spreadsheet/viewform?formkey=dDNmd2l6djZieS01LU9DSkFZZnFsUEE6MQ" >Click Here to contact me</a>
site-offline-options.php ADDED
@@ -0,0 +1,44 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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="icon-options-general" class="icon32"><br /></div>
5
+ <h2><?php _e('Site Offline Plugin Options'); ?></h2>
6
+ <form method="POST" action="">
7
+ <fieldset>
8
+ <div id="poststuff" class="metabox-holder">
9
+ <div class="meta-box-sortables">
10
+
11
+ <!-- General -->
12
+ <div class="postbox">
13
+ <div class="handlediv" title="<?php _e('Click to toggle'); ?>">
14
+ <br/>
15
+ </div>
16
+ <h3 class="hndle"><span><?php _e('Content/HTML Code'); ?></span></h3>
17
+
18
+ <div class="inside">
19
+ <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>
20
+ <p><textarea spellcheck='false' rows='22' name="cp_siteoffline_content"><?php
21
+ if ( $options['content'] === NULL )
22
+ include('content.htm');
23
+ else
24
+ echo $options['content'];
25
+ ?></textarea></p>
26
+
27
+ </fieldset>
28
+ <p><input type="submit" value="<?php _e('Save Changes'); ?>" class="button button-primary"/></p>
29
+ </form>
30
+
31
+
32
+ </div>
33
+
34
+ </div>
35
+
36
+ </div>
37
+ </div>
38
+ <style>
39
+ textarea[name='cp_siteoffline_content']
40
+ {
41
+ font-family:Monaco,Consolas,monospace;
42
+ width:100%;
43
+ }
44
+ </style>