Check and Enable GZIP compression - Version 1.0.2

Version Description

  • Added a fix for when checkgzipcompression is not available.
Download this release

Release Info

Developer Richards Toolbox
Plugin Icon Check and Enable GZIP compression
Version 1.0.2
Comparing to
See all releases

Code changes from version 1.0.1 to 1.0.2

class.richards-toolbox.php CHANGED
@@ -2,7 +2,10 @@
2
 
3
  class Richards_Toolbox {
4
  function checkGZIPCompression($url) {
5
- $result = file_get_contents('http://checkgzipcompression.com/js/checkgzip.json?url=' . $url);
 
 
 
6
  return json_decode($result);
7
  }
8
 
2
 
3
  class Richards_Toolbox {
4
  function checkGZIPCompression($url) {
5
+ $result = @file_get_contents('http://checkgzipcompression.com/js/checkgzip.json?url=' . $url);
6
+ if(!$result) {
7
+ return false;
8
+ }
9
  return json_decode($result);
10
  }
11
 
gzip-page.php CHANGED
@@ -13,7 +13,7 @@
13
  ?>
14
 
15
  <div class="wrap">
16
- <?php if(!$gzipCheck->error) : ?>
17
  <h2><?php echo $gzipCheck->result->gzipenabled ? "You're blessed! It's GZIP Enabled.": "GZIP is not enabled :("; ?></h2>
18
  <p><?php echo $gzipCheck->result->summary; ?></p>
19
  <?php if( $gzipCheck->result->gzipenabled != 1 && $canEnableCheck->result->gzipenabled == 1) : ?>
13
  ?>
14
 
15
  <div class="wrap">
16
+ <?php if($gzipCheck !== false && !$gzipCheck->error) : ?>
17
  <h2><?php echo $gzipCheck->result->gzipenabled ? "You're blessed! It's GZIP Enabled.": "GZIP is not enabled :("; ?></h2>
18
  <p><?php echo $gzipCheck->result->summary; ?></p>
19
  <?php if( $gzipCheck->result->gzipenabled != 1 && $canEnableCheck->result->gzipenabled == 1) : ?>
readme.txt CHANGED
@@ -57,8 +57,12 @@ Just about all the large websites worldwide use GZIP compression. For and actual
57
 
58
  == Changelog ==
59
 
 
 
 
 
60
  = 1.0.1 =
61
- * Added a fix for the htaccess rules
62
 
63
  = 1.0 =
64
  * Plugin is mature enough for v1.0 ;)
57
 
58
  == Changelog ==
59
 
60
+ = 1.0.2 =
61
+ * Added a fix for when checkgzipcompression is not available.
62
+
63
+
64
  = 1.0.1 =
65
+ * Added a fix for the htaccess rules.
66
 
67
  = 1.0 =
68
  * Plugin is mature enough for v1.0 ;)
richards-toolbox.php CHANGED
@@ -2,10 +2,10 @@
2
  /*
3
  Plugin Name: Check and Enable GZIP compression
4
  Plugin URI: http://checkgzipcompression.com
5
- Description: This handy tool checks if you have GZIP compression enabled, and makes it possible to turn on GZIP compression. Every time you run this check, your domain name will be sent to http://checkgzipcompression.com. We wont sent any other private information.
6
  Author: Richard's Toolbox
7
  Text Domain: richards-toolbox
8
- Version: 1.0.1
9
  Author URI: http://richardstoolbox.com
10
  */
11
 
@@ -23,10 +23,12 @@ function richard_toolbox_notices() {
23
  $tb = new Richards_Toolbox();
24
  $siteUrl = get_site_url();
25
  $gzipCheck = $tb->checkGZIPCompression($siteUrl);
26
- if(!$gzipCheck->result->gzipenabled && !$gzipCheck->error && !$hideError) {
27
- echo '<div class="error"><p><strong>GZIP compression is disabled. Please go to the <a href="'.admin_url('tools.php?page=richards-toolbox-gzip').'">plugin admin page</a> to enable GZIP compression and make your site '.$gzipCheck->result->percentagesaved.'% smaller!</strong> | <a href="'.admin_url('tools.php?page=richards-toolbox-gzip&rt_gzip_error_ignore').'">Remove alert</a></p></div>';
28
- } elseif($gzipCheck->result->gzipenabled && !$gzipCheck->error && !$hideSuccess) {
29
- echo '<div class="updated"><p><strong>GZIP compression is enabled. Good job!</strong> | <a href="'.$siteUrl.'/wp-admin/tools.php?page=richards-toolbox-gzip&rt_gzip_success_ignore">Remove alert</a></p></div>';
 
 
30
  }
31
  }
32
  }
2
  /*
3
  Plugin Name: Check and Enable GZIP compression
4
  Plugin URI: http://checkgzipcompression.com
5
+ Description: This handy tool checks if you have GZIP compression enabled, and makes it possible to turn on GZIP compression. Every time you run this check, your domain name will be sent to http://checkgzipcompression.com. We won't sent any other private information.
6
  Author: Richard's Toolbox
7
  Text Domain: richards-toolbox
8
+ Version: 1.0.2
9
  Author URI: http://richardstoolbox.com
10
  */
11
 
23
  $tb = new Richards_Toolbox();
24
  $siteUrl = get_site_url();
25
  $gzipCheck = $tb->checkGZIPCompression($siteUrl);
26
+ if($gzipCheck !== false) {
27
+ if(!$gzipCheck->result->gzipenabled && !$gzipCheck->error && !$hideError) {
28
+ echo '<div class="error"><p><strong>GZIP compression is disabled. Please go to the <a href="'.admin_url('tools.php?page=richards-toolbox-gzip').'">plugin admin page</a> to enable GZIP compression and make your site '.$gzipCheck->result->percentagesaved.'% smaller!</strong> | <a href="'.admin_url('tools.php?page=richards-toolbox-gzip&rt_gzip_error_ignore').'">Remove alert</a></p></div>';
29
+ } elseif($gzipCheck->result->gzipenabled && !$gzipCheck->error && !$hideSuccess) {
30
+ echo '<div class="updated"><p><strong>GZIP compression is enabled. Good job!</strong> | <a href="'.$siteUrl.'/wp-admin/tools.php?page=richards-toolbox-gzip&rt_gzip_success_ignore">Remove alert</a></p></div>';
31
+ }
32
  }
33
  }
34
  }