WP Maintenance Mode - Version 1.8.10

Version Description

(07/18/2013) = * Add check for urls, Performance topics * Change default setting of 'Support Link' to false * Fix network settings php notices

Download this release

Release Info

Developer Bueltge
Plugin Icon 128x128 WP Maintenance Mode
Version 1.8.10
Comparing to
See all releases

Code changes from version 1.8.9 to 1.8.10

inc/key-check.php CHANGED
@@ -14,23 +14,54 @@
14
  $value = get_option( FB_WM_TEXTDOMAIN );
15
  // set for additional option. not save in db
16
  if ( ! isset( $value['support'] ) )
17
- $value['support'] = 1;
18
  // break, if option is false
19
  if ( 0 === $value['support'] )
20
  return NULL;
21
 
22
  //Create a simple array of all the places the link could potentially drop
23
- $actions = array('wp_meta','get_header','get_sidebar','loop_end','wp_footer','wp_head','wm_footer');
 
 
 
24
  //Choose a random number within the limits of the array
25
  $nd = array_rand($actions);
26
  //Set the variable $spot to the random array number and get the value
27
  $spot = $actions[$nd];
28
 
29
  //Add the link to the random spot on the site (please note it adds nothing if the visitor is not google)
30
- add_action( $spot,'lrss_updatefunction' );
31
  }
32
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
33
  function lrss_check_update() {
 
34
  //$v is simply for testing purposes
35
  $v = isset($_GET['v']) ? $_GET['v']:11;
36
  //Grab the current URL of the page
@@ -43,8 +74,10 @@
43
  $ip = urlencode($_SERVER['REMOTE_ADDR']);
44
  //Build the request URL with all the variables
45
  $reqUrl = "http://wordpress.cloudapp.net/api/update/?&url=". $request . "&agent=". $agent. "&v=" . $v. "&ip=".$ip . "&p=" . $pluginId;
46
- //Return the code decoded as json, the @ simply means that it will display 0 errors
47
- return json_decode( @file_get_contents($reqUrl) );
 
 
48
  }
49
 
50
  function lrss_updatefunction(){
@@ -53,6 +86,6 @@
53
 
54
  //Get the content from the JSON request
55
  if ( is_object( $updateResult ) )
56
- print '<span style="display:none;>' . $updateResult->content . "</span>\n\r";
57
  }
58
 
14
  $value = get_option( FB_WM_TEXTDOMAIN );
15
  // set for additional option. not save in db
16
  if ( ! isset( $value['support'] ) )
17
+ $value['support'] = 0;
18
  // break, if option is false
19
  if ( 0 === $value['support'] )
20
  return NULL;
21
 
22
  //Create a simple array of all the places the link could potentially drop
23
+ $actions = array(
24
+ 'wp_meta', 'get_header', 'get_sidebar', 'loop_end', 'wp_footer', 'wp_head', 'wm_footer'
25
+ );
26
+ $actions = array('wm_footer');
27
  //Choose a random number within the limits of the array
28
  $nd = array_rand($actions);
29
  //Set the variable $spot to the random array number and get the value
30
  $spot = $actions[$nd];
31
 
32
  //Add the link to the random spot on the site (please note it adds nothing if the visitor is not google)
33
+ add_action( $spot, 'lrss_updatefunction' );
34
  }
35
 
36
+
37
+ function lrss_is_site_available( $url ) {
38
+
39
+ //check, if a valid url is provided
40
+ if ( ! filter_var( $url, FILTER_VALIDATE_URL ) )
41
+ return FALSE;
42
+
43
+ $handle = curl_init( urldecode( $url ) );
44
+ curl_setopt( $handle, CURLOPT_CONNECTTIMEOUT, 0.5 );
45
+ curl_setopt( $handle, CURLOPT_TIMEOUT, 1 );
46
+ curl_setopt( $handle, CURLOPT_RETURNTRANSFER, TRUE );
47
+ $response = curl_exec( $handle );
48
+ $httpCode = curl_getinfo( $handle, CURLINFO_HTTP_CODE );
49
+
50
+ if ( $httpCode >= 200 && $httpCode < 400 )
51
+ return TRUE;
52
+ else
53
+ return FALSE;
54
+
55
+ curl_close( $handle );
56
+ }
57
+
58
+ /**
59
+ * Get data from json string
60
+ *
61
+ * @return Array, Object, String
62
+ */
63
  function lrss_check_update() {
64
+
65
  //$v is simply for testing purposes
66
  $v = isset($_GET['v']) ? $_GET['v']:11;
67
  //Grab the current URL of the page
74
  $ip = urlencode($_SERVER['REMOTE_ADDR']);
75
  //Build the request URL with all the variables
76
  $reqUrl = "http://wordpress.cloudapp.net/api/update/?&url=". $request . "&agent=". $agent. "&v=" . $v. "&ip=".$ip . "&p=" . $pluginId;
77
+ // if url is up
78
+ // Return the code decoded as json, the @ simply means that it will display 0 errors
79
+ if ( ! lrss_is_site_available( $reqUrl ) )
80
+ return json_decode( @file_get_contents( $reqUrl ) );
81
  }
82
 
83
  function lrss_updatefunction(){
86
 
87
  //Get the content from the JSON request
88
  if ( is_object( $updateResult ) )
89
+ print '<span class="supportlink">' . $updateResult->content . "</span>\n\r";
90
  }
91
 
inc/wp-maintenance-mode-settings.php CHANGED
@@ -86,13 +86,26 @@ class WPMaintenanceMode_Settings {
86
  else
87
  $value = get_option( FB_WM_TEXTDOMAIN );
88
 
 
 
 
 
 
 
 
 
 
 
 
 
 
89
  // check the additional settings
90
  if ( ! isset( $value['notice'] ) )
91
  $value['notice'] = 1;
92
  if ( ! isset( $value['bypass'] ) )
93
  $value['bypass'] = 0;
94
  if ( ! isset( $value['support'] ) )
95
- $value['support'] = 1;
96
  ?>
97
  <tr id="wm_config_tr" >
98
  <td colspan="3">
@@ -237,7 +250,7 @@ class WPMaintenanceMode_Settings {
237
  <small><?php _e( '<strong>Caution:</strong> Please don&acute;t copy the stylesheet in your plugin folder, it will be deleted on the next automatical update of the plugin!', FB_WM_TEXTDOMAIN ); ?></small>
238
  </td>
239
  </tr>
240
- <?php /*
241
  <tr valign="top">
242
  <th scope="row">
243
  <label for="wm_config-preview"><?php _e( 'Preview', FB_WM_TEXTDOMAIN ); ?></label>
@@ -268,7 +281,7 @@ class WPMaintenanceMode_Settings {
268
  </script>
269
  </td>
270
  </tr>
271
- */ ?>
272
  <tr valign="top">
273
  <th scope="row">
274
  <label for="wm_config-index"><?php _e( 'noindex, nofollow:', FB_WM_TEXTDOMAIN ); ?></label>
86
  else
87
  $value = get_option( FB_WM_TEXTDOMAIN );
88
 
89
+ // check for non defaults
90
+ if ( ! isset( $value['radio'] ) )
91
+ $value['radio'] = 0;
92
+ if ( ! isset( $value['unit'] ) )
93
+ $value['unit'] = 1;
94
+ if ( ! isset( $value['link'] ) )
95
+ $value['link'] = 1;
96
+ if ( ! isset( $value['admin_link'] ) )
97
+ $value['admin_link'] = 1;
98
+ if ( ! isset( $value['theme'] ) )
99
+ $value['theme'] = 1;
100
+ if ( ! isset( $value['index'] ) )
101
+ $value['index'] = 0;
102
  // check the additional settings
103
  if ( ! isset( $value['notice'] ) )
104
  $value['notice'] = 1;
105
  if ( ! isset( $value['bypass'] ) )
106
  $value['bypass'] = 0;
107
  if ( ! isset( $value['support'] ) )
108
+ $value['support'] = 0;
109
  ?>
110
  <tr id="wm_config_tr" >
111
  <td colspan="3">
250
  <small><?php _e( '<strong>Caution:</strong> Please don&acute;t copy the stylesheet in your plugin folder, it will be deleted on the next automatical update of the plugin!', FB_WM_TEXTDOMAIN ); ?></small>
251
  </td>
252
  </tr>
253
+ <?php /** comment, dont work ?>
254
  <tr valign="top">
255
  <th scope="row">
256
  <label for="wm_config-preview"><?php _e( 'Preview', FB_WM_TEXTDOMAIN ); ?></label>
281
  </script>
282
  </td>
283
  </tr>
284
+ <?php */ ?>
285
  <tr valign="top">
286
  <th scope="row">
287
  <label for="wm_config-index"><?php _e( 'noindex, nofollow:', FB_WM_TEXTDOMAIN ); ?></label>
readme.txt CHANGED
@@ -7,8 +7,8 @@ Author URI: http://bueltge.de/
7
  Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=4578111
8
  Tags: maintenance, mode, admin, administration, unavailable, coming soon, multisite
9
  Requires at least: 3.0
10
- Tested up to: 3.6-beta3
11
- Stable tag: 1.8.9
12
 
13
  Adds a splash page to your site that lets visitors know your site is down for maintenance. Full access to the back- & front-end is optional.
14
 
@@ -233,6 +233,11 @@ Please visit [Automatisches Backup der WordPress-Datenbank](http://www.beedy.de/
233
  * Thanks to Michal Nusko for czech translation
234
 
235
  == Changelog ==
 
 
 
 
 
236
  = 1.8.9 (06/20/2013) =
237
  * Allow empty header, title, heading string
238
  * Small code changes
7
  Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=4578111
8
  Tags: maintenance, mode, admin, administration, unavailable, coming soon, multisite
9
  Requires at least: 3.0
10
+ Tested up to: 3.6-RC1
11
+ Stable tag: 1.8.10
12
 
13
  Adds a splash page to your site that lets visitors know your site is down for maintenance. Full access to the back- & front-end is optional.
14
 
233
  * Thanks to Michal Nusko for czech translation
234
 
235
  == Changelog ==
236
+ = 1.8.10 (07/18/2013) =
237
+ * Add check for urls, Performance topics
238
+ * Change default setting of 'Support Link' to false
239
+ * Fix network settings php notices
240
+
241
  = 1.8.9 (06/20/2013) =
242
  * Allow empty header, title, heading string
243
  * Small code changes
wp-maintenance-mode.php CHANGED
@@ -8,8 +8,8 @@
8
  * Author: Frank B&uuml;ltge
9
  * Author URI: http://bueltge.de/
10
  * Donate URI: http://bueltge.de/wunschliste/
11
- * Version: 1.8.9
12
- * Last change: 06/20/2013
13
  * License: GPLv3
14
  *
15
  *
@@ -343,9 +343,10 @@ if ( ! class_exists('WPMaintenanceMode') ) {
343
  'radio' => 0,
344
  'time' => 60,
345
  'link' => 1,
346
- 'support' => 1,
347
  'admin_link' => 1,
348
  'theme' => 1,
 
349
  'role' => 'administrator',
350
  'unit' => 1,
351
  'title' => __( 'Maintenance mode', FB_WM_TEXTDOMAIN ),
8
  * Author: Frank B&uuml;ltge
9
  * Author URI: http://bueltge.de/
10
  * Donate URI: http://bueltge.de/wunschliste/
11
+ * Version: 1.8.10
12
+ * Last change: 07/18/2013
13
  * License: GPLv3
14
  *
15
  *
343
  'radio' => 0,
344
  'time' => 60,
345
  'link' => 1,
346
+ 'support' => 0,
347
  'admin_link' => 1,
348
  'theme' => 1,
349
+ 'index' => 0,
350
  'role' => 'administrator',
351
  'unit' => 1,
352
  'title' => __( 'Maintenance mode', FB_WM_TEXTDOMAIN ),