underConstruction - Version 1.04

Version Description

  • Made UC a bit more of a 'good citizen' in terms of storing it's options. No options will be left behind when deleting the plugin now, and when deactivating, all options are compressed to one archive record. If reactivating the plugin, the options will be returned to how they were before deactivation.
  • Fixed a bug where the custom text fields might say "empty" by default
  • Ensured compatibility with 3.0-alpha
  • Added a warning message if javascript is disabled in the management screen.
Download this release

Release Info

Developer jkmassel
Plugin Icon 128x128 underConstruction
Version 1.04
Comparing to
See all releases

Code changes from version 1.03 to 1.04

Files changed (3) hide show
  1. readme.txt +24 -3
  2. ucOptions.php +7 -0
  3. underConstruction.php +52 -9
readme.txt CHANGED
@@ -1,10 +1,10 @@
1
  === underConstruction ===
2
  Contributors: Jeremy Massel
3
- Donate link: http://masseltech.com/donate/
4
  Tags: construction, under construction, private, preview, security, coming soon
5
  Requires at least: 2.7
6
- Tested up to: 2.9.2
7
- Stable tag: 1.03
8
 
9
  Creates a 'Coming Soon' page that will show for all users who are not logged in
10
 
@@ -38,6 +38,12 @@ Sorry, I get a lot of questions. But visit the homepage for this plugin and leav
38
 
39
  == Changelog ==
40
 
 
 
 
 
 
 
41
  = 1.03 =
42
  * Added the ability to switch on and off while keeping the plugin active
43
  * Added the ability to send different HTTP headers (503 or 200)
@@ -55,12 +61,27 @@ Sorry, I get a lot of questions. But visit the homepage for this plugin and leav
55
 
56
  == Upgrade Notice ==
57
 
 
 
 
 
 
 
 
58
  = 1.03 =
59
  * Added the ability to switch on and off while keeping the plugin active
60
  * Added the ability to send different HTTP headers (503 or 200)
61
  * Added the ability to simply customize the default text, or display the default page
62
  * Tweaked the page slightly to be a little prettier
63
 
 
 
 
 
 
 
 
 
64
  == Screenshots ==
65
  1. The default page that is displayed (this can be overridden)
66
  2. The editing screen with the default page selected
1
  === underConstruction ===
2
  Contributors: Jeremy Massel
3
+ Donate link: http://truthmedia.com/engage/giving
4
  Tags: construction, under construction, private, preview, security, coming soon
5
  Requires at least: 2.7
6
+ Tested up to: 3.0
7
+ Stable tag: 1.04
8
 
9
  Creates a 'Coming Soon' page that will show for all users who are not logged in
10
 
38
 
39
  == Changelog ==
40
 
41
+ = 1.04 =
42
+ * Made UC a bit more of a 'good citizen' in terms of storing it's options. No options will be left behind when deleting the plugin now, and when deactivating, all options are compressed to one archive record. If reactivating the plugin, the options will be returned to how they were before deactivation.
43
+ * Fixed a bug where the custom text fields might say "empty" by default
44
+ * Ensured compatibility with 3.0-alpha
45
+ * Added a warning message if javascript is disabled in the management screen.
46
+
47
  = 1.03 =
48
  * Added the ability to switch on and off while keeping the plugin active
49
  * Added the ability to send different HTTP headers (503 or 200)
61
 
62
  == Upgrade Notice ==
63
 
64
+ = 1.04 =
65
+ * Fixed a bug where options may not be deleted after deleting plugin.
66
+ * Improved options storage.
67
+ * Fixed a bug where the custom text fields might say "empty" by default.
68
+ * Ensured compatibility with 3.0-alpha.
69
+ * Added a warning message if javascript is disabled in the management screen.
70
+
71
  = 1.03 =
72
  * Added the ability to switch on and off while keeping the plugin active
73
  * Added the ability to send different HTTP headers (503 or 200)
74
  * Added the ability to simply customize the default text, or display the default page
75
  * Tweaked the page slightly to be a little prettier
76
 
77
+ = 1.02 =
78
+ * Fixed a bug where clearing the text wouldn't cause it to revert to the default.
79
+
80
+ = 1.01 =
81
+ * Fixed a bug where deactivation would trigger an error
82
+
83
+ = 1.0 =
84
+ * First version
85
  == Screenshots ==
86
  1. The default page that is displayed (this can be overridden)
87
  2. The editing screen with the default page selected
ucOptions.php CHANGED
@@ -93,6 +93,13 @@ if (isset($_POST['http_status']))
93
 
94
 
95
  ?>
 
 
 
 
 
 
 
96
  <div class="wrap">
97
  <div id="icon-options-general" class="icon32">
98
  <br/>
93
 
94
 
95
  ?>
96
+ <noscript>
97
+ <div class='updated' id='javascriptWarn'>
98
+ <p>
99
+ JavaScript appears to be disabled in your browser. For this plugin to work correctly, please enable JavaScript or switch to a more modern browser
100
+ </p>
101
+ </div>
102
+ </noscript>
103
  <div class="wrap">
104
  <div id="icon-options-general" class="icon32">
105
  <br/>
underConstruction.php CHANGED
@@ -1,9 +1,9 @@
1
  <?php
2
  /*
3
  Plugin Name: Under Construction
4
- Plugin URI: http://masseltech.com/plugins/underconstruction/
5
  Description: Makes it so your site can only be accessed by users who log in. Useful for developing a site on a live server, without the world being able to see it
6
- Version: 1.03
7
  Author: Jeremy Massel
8
  Author URI: http://www.masseltech.com/
9
  */
@@ -113,10 +113,45 @@ class underConstruction
113
  {
114
  return stripslashes(get_option('underConstructionHTML'));
115
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
116
 
117
- function uc_remove()
118
  {
 
 
 
 
 
 
 
 
 
 
 
 
119
  delete_option('underConstructionHTML');
 
 
 
 
120
  }
121
 
122
  function pluginIsActive()
@@ -181,7 +216,7 @@ class underConstruction
181
  }
182
  else
183
  {
184
- return 'empty';
185
  }
186
  }
187
 
@@ -194,7 +229,7 @@ class underConstruction
194
  }
195
  else
196
  {
197
- return 'empty';
198
  }
199
  }
200
 
@@ -207,7 +242,7 @@ class underConstruction
207
  }
208
  else
209
  {
210
- return 'empty';
211
  }
212
  }
213
 
@@ -217,11 +252,21 @@ class underConstruction
217
  $underConstructionPlugin = new underConstruction();
218
 
219
  add_action('template_redirect', array($underConstructionPlugin, 'uc_overrideWP'));
220
- register_deactivation_hook(__FILE__, array($underConstructionPlugin, 'uc_remove'));
 
 
 
 
 
221
 
222
  add_action('admin_init', array($underConstructionPlugin, 'underConstructionAdminInit'));
223
  add_action('admin_menu', array($underConstructionPlugin, 'uc_adminMenu'));
224
 
 
 
 
 
 
225
 
226
  function underConstructionPluginLinks($links, $file)
227
  {
@@ -231,8 +276,6 @@ function underConstructionPluginLinks($links, $file)
231
  //add settings page
232
  $manage_link = '<a href="'.admin_url('options-general.php?page='.$underConstructionPlugin->getMainOptionsPage()).'">'.__('Settings').'</a>';
233
  array_unshift($links, $manage_link);
234
-
235
-
236
 
237
 
238
  }
1
  <?php
2
  /*
3
  Plugin Name: Under Construction
4
+ Plugin URI: http://www.masseltech.com/
5
  Description: Makes it so your site can only be accessed by users who log in. Useful for developing a site on a live server, without the world being able to see it
6
+ Version: 1.04
7
  Author: Jeremy Massel
8
  Author URI: http://www.masseltech.com/
9
  */
113
  {
114
  return stripslashes(get_option('underConstructionHTML'));
115
  }
116
+
117
+
118
+ function uc_activate()
119
+ {
120
+ if (get_option('underConstructionArchive'))
121
+ {
122
+ //get all the options back from the archive
123
+ $options = get_option('underConstructionArchive');
124
+
125
+ //put them back where they belong
126
+ update_option('underConstructionHTML', $options['underConstructionHTML']);
127
+ update_option('underConstructionActivationStatus', $options['underConstructionActivationStatus']);
128
+ update_option('underConstructionCustomText', $options['underConstructionCustomText']);
129
+ update_option('underConstructionDisplayOption', $options['underConstructionDisplayOption']);
130
+ update_option('underConstructionHTTPStatus', $options['underConstructionHTTPStatus']);
131
+
132
+ delete_option('underConstructionArchive');
133
+ }
134
+ }
135
 
136
+ function uc_deactivate()
137
  {
138
+ //get all the options. store them in an array
139
+ $options = array();
140
+ $options['underConstructionHTML'] = get_option('underConstructionHTML');
141
+ $options['underConstructionActivationStatus'] = get_option('underConstructionActivationStatus');
142
+ $options['underConstructionCustomText'] = get_option('underConstructionCustomText');
143
+ $options['underConstructionDisplayOption'] = get_option('underConstructionDisplayOption');
144
+ $options['underConstructionHTTPStatus'] = get_option('underConstructionHTTPStatus');
145
+
146
+ //store the options all in one record, in case we ever reactivate the plugin
147
+ update_option('underConstructionArchive', $options);
148
+
149
+ //delete the separate ones
150
  delete_option('underConstructionHTML');
151
+ delete_option('underConstructionActivationStatus');
152
+ delete_option('underConstructionCustomText');
153
+ delete_option('underConstructionDisplayOption');
154
+ delete_option('underConstructionHTTPStatus');
155
  }
156
 
157
  function pluginIsActive()
216
  }
217
  else
218
  {
219
+ return '';
220
  }
221
  }
222
 
229
  }
230
  else
231
  {
232
+ return '';
233
  }
234
  }
235
 
242
  }
243
  else
244
  {
245
+ return '';
246
  }
247
  }
248
 
252
  $underConstructionPlugin = new underConstruction();
253
 
254
  add_action('template_redirect', array($underConstructionPlugin, 'uc_overrideWP'));
255
+
256
+
257
+ register_activation_hook(__FILE__, array($underConstructionPlugin, 'uc_activate'));
258
+ register_deactivation_hook(__FILE__, array($underConstructionPlugin, 'uc_deactivate'));
259
+ register_uninstall_hook(__FILE__, 'underConstructionPlugin_delete');
260
+
261
 
262
  add_action('admin_init', array($underConstructionPlugin, 'underConstructionAdminInit'));
263
  add_action('admin_menu', array($underConstructionPlugin, 'uc_adminMenu'));
264
 
265
+ function underConstructionPlugin_delete()
266
+ {
267
+ delete_option('underConstructionArchive');
268
+ }
269
+
270
 
271
  function underConstructionPluginLinks($links, $file)
272
  {
276
  //add settings page
277
  $manage_link = '<a href="'.admin_url('options-general.php?page='.$underConstructionPlugin->getMainOptionsPage()).'">'.__('Settings').'</a>';
278
  array_unshift($links, $manage_link);
 
 
279
 
280
 
281
  }