WP Performance Score Booster - Version 1.2

Version Description

Download this release

Release Info

Developer dipakcg
Plugin Icon 128x128 WP Performance Score Booster
Version 1.2
Comparing to
See all releases

Code changes from version 1.1.1 to 1.2

assets/banner-772x250.png ADDED
Binary file
readme.txt CHANGED
@@ -1,17 +1,24 @@
1
  === WP Performance Score Booster ===
2
  Contributors: dipakcg
3
- Tags: performance, speed, time, query, strings, gzip, compression, caching, boost, pingdom, gtmetrix, yslow, pagespeed
4
  Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=3S8BRPLWLNQ38
5
  Requires at least: 3.5
6
  Tested up to: 4.0
7
- Stable tag: 1.1.1
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
11
- Helps you to improve your website scores in services like PageSpeed, YSlow, Pingdom and GTmetrix.
12
 
13
  == Description ==
14
- This plugin helps you to improve your website scores in services like PageSpeed, YSlow, Pingdom and GTmetrix. It will remove any query strings from static resources like CSS & JS files, enable GZIP compression (compress text, html, javascript, css, xml and so on) and set expires caching (leverage browser caching) to improve your site performance scores.
 
 
 
 
 
 
 
15
 
16
  == Installation ==
17
  1. Upload the ‘wp-performance-score-booster’ folder to the ‘/wp-content/plugins/‘ directory
@@ -21,7 +28,7 @@ This plugin helps you to improve your website scores in services like PageSpeed,
21
  == Frequently Asked Questions ==
22
  = What does this plugin do? =
23
 
24
- It helps you to improve your website scores in services like PageSpeed, YSlow, Pingdom and GTmetrix. It will remove any query strings from static resources like CSS & JS files, enables GZIP Compression (compress text, html, javascript, css, xml and so on) and expires caching (leverage browser caching).
25
 
26
  = Any specific requirements for this plugin to work? =
27
 
@@ -36,8 +43,13 @@ Pretty much, yeah.
36
  1. Admin Settings
37
 
38
  == Changelog ==
 
 
 
 
 
39
  = 1.1.1, Sept 02, 2014 =
40
- * Added function (for urls with &ver) to remove query strings from static resources
41
 
42
  = 1.1, Aug 31, 2014 =
43
  * Added Admin Options / Settings
1
  === WP Performance Score Booster ===
2
  Contributors: dipakcg
3
+ Tags: performance, speed, time, query, strings, gzip, compression, caching, boost, pingdom, gtmetrix, yslow, pagespeed, enqueue, scripts
4
  Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=3S8BRPLWLNQ38
5
  Requires at least: 3.5
6
  Tested up to: 4.0
7
+ Stable tag: 1.2
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
11
+ Speed-up page load times and improve website scores in services like PageSpeed, YSlow, Pingdom and GTmetrix.
12
 
13
  == Description ==
14
+ This plugin speed-up page load times and improve website scores in services like PageSpeed, YSlow, Pingdom and GTmetrix.
15
+
16
+ = This plugin will... =
17
+ * Remove any query strings from static resources like CSS & JS files
18
+ * Enable GZIP compression (compress text, html, javascript, css, xml and so on)
19
+ * Enqueue scripts to footer
20
+ * Add Vary: Accept-Encoding header, and
21
+ * Set expires caching (leverage browser caching).
22
 
23
  == Installation ==
24
  1. Upload the ‘wp-performance-score-booster’ folder to the ‘/wp-content/plugins/‘ directory
28
  == Frequently Asked Questions ==
29
  = What does this plugin do? =
30
 
31
+ It speed-up page load times and improve website scores in services like PageSpeed, YSlow, Pingdom and GTmetrix. It will remove any query strings from static resources like CSS & JS files, enable GZIP compression (compress text, html, javascript, css, xml and so on), enqueue scripts to footer, add Vary: Accept-Encoding header and set expires caching (leverage browser caching).
32
 
33
  = Any specific requirements for this plugin to work? =
34
 
43
  1. Admin Settings
44
 
45
  == Changelog ==
46
+ = 1.2, Nov 17, 2014 =
47
+ * Added feature to enqueue scripts to footer
48
+ * Added support for Vary: Accept-Encoding header
49
+ * Fixed minor issues for remove query strings from static resources
50
+
51
  = 1.1.1, Sept 02, 2014 =
52
+ * Added feature (for urls with &ver) to remove query strings from static resources
53
 
54
  = 1.1, Aug 31, 2014 =
55
  * Added Admin Options / Settings
wp-performance-score-booster.php CHANGED
@@ -2,13 +2,21 @@
2
  /*
3
  Plugin Name: WP Performance Score Booster
4
  Plugin URI: https://github.com/dipakcg/wp-performance-score-booster
5
- Description: Helps you to improve your website scores in services like PageSpeed, YSlow, Pingdom and GTmetrix.
6
  Author: Dipak C. Gajjar
7
- Version: 1.1.1
8
  Author URI: http://www.dipakgajjar.com/
9
  */
10
 
11
- // Important: Don't forget to change version number at line line 7, 131 and 200.
 
 
 
 
 
 
 
 
12
  // Register with hook 'wp_enqueue_scripts', which can be used for front end CSS and JavaScript
13
  add_action( 'admin_init', 'wppsb_add_stylesheet' );
14
  function wppsb_add_stylesheet() {
@@ -17,13 +25,132 @@ function wppsb_add_stylesheet() {
17
  wp_enqueue_style( 'wppsb-stylesheet' );
18
  }
19
 
20
- // Register admin menu
21
- add_action( 'admin_menu', 'wppsb_add_admin_menu' );
22
- function wppsb_add_admin_menu() {
23
- // add_options_page( $page_title, $menu_title, $capability, $menu_slug, $function);
24
- add_menu_page( 'WP Performance Score Booster Options', 'WP Performance Score Booster', 'manage_options', 'wp-performance-score-booster', 'wppsb_admin_options', plugins_url('assets/images/wppsb-icon-24x24.png', __FILE__) );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
25
  }
26
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
27
  function wppsb_admin_options() {
28
  ?>
29
  <div class="wrap">
@@ -61,39 +188,9 @@ function wppsb_admin_options() {
61
  update_option( $enable_gzip, $enable_gzip_val );
62
  update_option( $expire_caching, $expire_caching_val );
63
 
64
- // If 'Remove query strings" checkbox ticked, add filter otherwise remove filter
65
- if ($remove_query_strings_val == 'on') {
66
- add_filter( 'script_loader_src', 'wppsb_remove_query_strings_q', 15, 1 );
67
- add_filter( 'style_loader_src', 'wppsb_remove_query_strings_q', 15, 1 );
68
- add_filter( 'script_loader_src', 'wppsb_remove_query_strings_emp', 15, 1 );
69
- add_filter( 'style_loader_src', 'wppsb_remove_query_strings_emp', 15, 1 );
70
- }
71
- else {
72
- remove_filter( 'script_loader_src', 'wppsb_remove_query_strings_q', 15, 1 );
73
- remove_filter( 'style_loader_src', 'wppsb_remove_query_strings_q', 15, 1 );
74
- remove_filter( 'script_loader_src', 'wppsb_remove_query_strings_emp', 15, 1 );
75
- remove_filter( 'style_loader_src', 'wppsb_remove_query_strings_emp', 15, 1 );
76
- }
77
-
78
- // If 'Enable GZIP" checkbox ticked, add filter otherwise remove filter
79
- if ($enable_gzip_val == 'on') {
80
- add_filter('mod_rewrite_rules', 'wppsb_enable_gzip_filter');
81
- }
82
- else {
83
- remove_filter('mod_rewrite_rules', 'wppsb_enable_gzip_filter');
84
- }
85
-
86
- // If 'Expire caching" checkbox ticked, add filter otherwise remove filter
87
- if ($expire_caching_val == 'on') {
88
- add_filter('mod_rewrite_rules', 'wppsb_expire_caching_filter');
89
- }
90
- else {
91
- remove_filter('mod_rewrite_rules', 'wppsb_expire_caching_filter');
92
- }
93
-
94
  flush_rewrite_rules();
95
 
96
- // Put an settings updated message on the screen
97
  ?>
98
  <div class="updated"><p><strong>Settings Saved.</strong></p></div>
99
  <?php
@@ -128,7 +225,7 @@ function wppsb_admin_options() {
128
  <!-- <span class="wppsb_admin_dev_sidebar"> <?php echo '<img src="' . plugins_url( 'assets/images/wppsb-other-plugins-16x16.png' , __FILE__ ) . '" > '; ?> <a href="http://profiles.wordpress.org/dipakcg#content-plugins" target="_blank"> Get my other plugins </a> </span> -->
129
  <span class="wppsb_admin_dev_sidebar"> <?php echo '<img src="' . plugins_url( 'assets/images/wppsb-twitter-16x16.png' , __FILE__ ) . '" > '; ?>Follow me on Twitter: <a href="https://twitter.com/dipakcgajjar" target="_blank">@dipakcgajjar</a> </span>
130
  <br />
131
- <span class="wppsb_admin_dev_sidebar" style="float: right;"> Version: <strong> 1.1.1 </strong> </span>
132
  </div>
133
  </td>
134
  </tr>
@@ -137,69 +234,21 @@ function wppsb_admin_options() {
137
  <?php
138
  }
139
 
140
- // Remove query strings from static content
141
- function wppsb_remove_query_strings_q( $src ) {
142
- $rqs = explode( '?ver', $src );
143
- return $rqs[0];
144
- }
145
- function wppsb_remove_query_strings_emp( $src ) {
146
- $rqs = explode( '&ver', $src );
147
- return $rqs[0];
148
- }
149
-
150
- // Enable GZIP Compression
151
- function wppsb_enable_gzip_filter( $rules ) {
152
- $gzip_htaccess_content = <<<EOD
153
- \n## Added by WP Performance Score Booster ##
154
- ## BEGIN : Enable GZIP Compression (compress text, html, javascript, css, xml and so on) ##
155
- <IfModule mod_deflate.c>
156
- AddOutputFilterByType DEFLATE text/plain
157
- AddOutputFilterByType DEFLATE text/html
158
- AddOutputFilterByType DEFLATE text/xml
159
- AddOutputFilterByType DEFLATE text/css
160
- AddOutputFilterByType DEFLATE application/xml
161
- AddOutputFilterByType DEFLATE application/xhtml+xml
162
- AddOutputFilterByType DEFLATE application/rss+xml
163
- AddOutputFilterByType DEFLATE application/javascript
164
- AddOutputFilterByType DEFLATE application/x-javascript
165
- AddOutputFilterByType DEFLATE application/x-httpd-php
166
- AddOutputFilterByType DEFLATE application/x-httpd-fastphp
167
- AddOutputFilterByType DEFLATE image/svg+xml
168
- SetOutputFilter DEFLATE
169
- </IfModule>
170
- ## END : Enable GZIP Compression ##\n\n
171
- EOD;
172
- return $gzip_htaccess_content . $rules;
173
- }
174
-
175
- // Enable expire caching
176
- function wppsb_expire_caching_filter( $rules ) {
177
- $expire_cache_htaccess_content = <<<EOD
178
- \n## Added by WP Performance Score Booster ##
179
- ## BEGIN : Expires Caching (Leverage Browser Caching) ##
180
- <IfModule mod_expires.c>
181
- ExpiresActive On
182
- ExpiresByType image/jpg "access 2 week"
183
- ExpiresByType image/jpeg "access 2 week"
184
- ExpiresByType image/gif "access 2 week"
185
- ExpiresByType image/png "access 2 week"
186
- ExpiresByType text/css "access 2 week"
187
- ExpiresByType application/pdf "access 2 week"
188
- ExpiresByType text/x-javascript "access 2 week"
189
- ExpiresByType application/x-shockwave-flash "access 2 week"
190
- ExpiresByType image/x-icon "access 2 week"
191
- ExpiresDefault "access 2 week"
192
- </IfModule>
193
- ## END : Expires Caching (Leverage Browser Caching) ##\n\n
194
- EOD;
195
- return $expire_cache_htaccess_content . $rules;
196
  }
197
 
 
198
  function wppsb_add_header() {
 
 
199
  $head_comment = <<<EOD
200
- <!-- Performance scores of this site is tuned by WP Performance Score Booster plugin v1.1.1 - http://wordpress.org/plugins/wp-performance-score-booster -->\n
201
  EOD;
202
- echo $head_comment;
203
  }
204
  add_action('wp_head', 'wppsb_add_header', 1);
205
 
@@ -216,6 +265,7 @@ function wppsb_activate_plugin() {
216
  if (function_exists('ob_gzhandler') || ini_get('zlib.output_compression')) {
217
  update_option( 'wppsb_enable_gzip', 'on' );
218
  add_filter('mod_rewrite_rules', 'wppsb_enable_gzip_filter');
 
219
  }
220
  else {
221
  update_option( 'wppsb_enable_gzip', '' );
@@ -226,18 +276,18 @@ function wppsb_activate_plugin() {
226
 
227
  flush_rewrite_rules();
228
  }
229
-
230
- // On plugin activation, call the function that will make flush_rules to be called at the end of the PHP execution
231
  register_activation_hook( __FILE__, 'wppsb_activate_plugin' );
232
 
 
233
  function wppsb_deactivate_plugin() {
234
  // Remove filters on plugin deactivate
235
- remove_filter( 'script_loader_src', 'wppsb_remove_query_strings_q', 15, 1 );
236
- remove_filter( 'style_loader_src', 'wppsb_remove_query_strings_q', 15, 1 );
237
- remove_filter( 'script_loader_src', 'wppsb_remove_query_strings_emp', 15, 1 );
238
- remove_filter( 'style_loader_src', 'wppsb_remove_query_strings_emp', 15, 1 );
239
- remove_filter('mod_rewrite_rules', 'wppsb_enable_gzip_filter');
240
- remove_filter('mod_rewrite_rules', 'wppsb_expire_caching_filter');
 
241
 
242
  // Delete default options value in the database
243
  /* delete_option( 'wppsb_remove_query_strings' );
2
  /*
3
  Plugin Name: WP Performance Score Booster
4
  Plugin URI: https://github.com/dipakcg/wp-performance-score-booster
5
+ Description: Speed-up page load times and improve website scores in services like PageSpeed, YSlow, Pingdom and GTmetrix.
6
  Author: Dipak C. Gajjar
7
+ Version: 1.2
8
  Author URI: http://www.dipakgajjar.com/
9
  */
10
 
11
+ // Define plugin version for future releases (line: 17)
12
+ if (!defined('WPPSB_PLUGIN_VERSION')) {
13
+ define('WPPSB_PLUGIN_VERSION', 'wppsb_plugin_version');
14
+ }
15
+ if (!defined('WPPSB_PLUGIN_VERSION_NUM')) {
16
+ define('WPPSB_PLUGIN_VERSION_NUM', '1.2');
17
+ }
18
+ add_option(WPPSB_PLUGIN_VERSION, WPPSB_PLUGIN_VERSION_NUM);
19
+
20
  // Register with hook 'wp_enqueue_scripts', which can be used for front end CSS and JavaScript
21
  add_action( 'admin_init', 'wppsb_add_stylesheet' );
22
  function wppsb_add_stylesheet() {
25
  wp_enqueue_style( 'wppsb-stylesheet' );
26
  }
27
 
28
+ // Remove query strings from static content
29
+ function wppsb_remove_query_strings_q( $src ) {
30
+ $rqs = explode( '?ver', $src );
31
+ return $rqs[0];
32
+ }
33
+ function wppsb_remove_query_strings_emp( $src ) {
34
+ $rqs = explode( '&ver', $src );
35
+ return $rqs[0];
36
+ }
37
+
38
+ // If 'Remove query strings" checkbox ticked, add filter otherwise remove filter
39
+ if (get_option('wppsb_remove_query_strings') == 'on') {
40
+ add_filter( 'script_loader_src', 'wppsb_remove_query_strings_q', 15, 1 );
41
+ add_filter( 'style_loader_src', 'wppsb_remove_query_strings_q', 15, 1 );
42
+ add_filter( 'script_loader_src', 'wppsb_remove_query_strings_emp', 15, 1 );
43
+ add_filter( 'style_loader_src', 'wppsb_remove_query_strings_emp', 15, 1 );
44
+ }
45
+ else {
46
+ remove_filter( 'script_loader_src', 'wppsb_remove_query_strings_q');
47
+ remove_filter( 'style_loader_src', 'wppsb_remove_query_strings_q');
48
+ remove_filter( 'script_loader_src', 'wppsb_remove_query_strings_emp');
49
+ remove_filter( 'style_loader_src', 'wppsb_remove_query_strings_emp');
50
+ }
51
+
52
+ // If 'Enable GZIP" checkbox ticked, add filter otherwise remove filter
53
+ if (get_option('wppsb_enable_gzip') == 'on') {
54
+ add_filter('mod_rewrite_rules', 'wppsb_enable_gzip_filter');
55
+ add_filter('mod_rewrite_rules', 'wppsb_vary_accept_encoding_filter');
56
+ }
57
+ else {
58
+ remove_filter('mod_rewrite_rules', 'wppsb_enable_gzip_filter');
59
+ remove_filter('mod_rewrite_rules', 'wppsb_vary_accept_encoding_filter');
60
+ }
61
+
62
+ // If 'Expire caching" checkbox ticked, add filter otherwise remove filter
63
+ if (get_option('wppsb_expire_caching') == 'on') {
64
+ add_filter('mod_rewrite_rules', 'wppsb_expire_caching_filter');
65
+ }
66
+ else {
67
+ remove_filter('mod_rewrite_rules', 'wppsb_expire_caching_filter');
68
+ }
69
+
70
+ // Enable GZIP Compression
71
+ function wppsb_enable_gzip_filter( $rules ) {
72
+ $gzip_htaccess_content = <<<EOD
73
+ \n## Added by WP Performance Score Booster ##
74
+ ## BEGIN : Enable GZIP Compression (compress text, html, javascript, css, xml and so on) ##
75
+ <IfModule mod_deflate.c>
76
+ AddOutputFilterByType DEFLATE text/plain
77
+ AddOutputFilterByType DEFLATE text/html
78
+ AddOutputFilterByType DEFLATE text/xml
79
+ AddOutputFilterByType DEFLATE text/css
80
+ AddOutputFilterByType DEFLATE application/xml
81
+ AddOutputFilterByType DEFLATE application/xhtml+xml
82
+ AddOutputFilterByType DEFLATE application/rss+xml
83
+ AddOutputFilterByType DEFLATE application/javascript
84
+ AddOutputFilterByType DEFLATE application/x-javascript
85
+ AddOutputFilterByType DEFLATE application/x-httpd-php
86
+ AddOutputFilterByType DEFLATE application/x-httpd-fastphp
87
+ AddOutputFilterByType DEFLATE image/svg+xml
88
+ SetOutputFilter DEFLATE
89
+ </IfModule>
90
+ ## END : Enable GZIP Compression ##\n\n
91
+ EOD;
92
+ return $gzip_htaccess_content . $rules;
93
  }
94
 
95
+ // Enable expire caching
96
+ function wppsb_expire_caching_filter( $rules ) {
97
+ $expire_cache_htaccess_content = <<<EOD
98
+ \n## Added by WP Performance Score Booster ##
99
+ ## BEGIN : Expires Caching (Leverage Browser Caching) ##
100
+ <IfModule mod_expires.c>
101
+ ExpiresActive On
102
+ ExpiresByType image/jpg "access 2 week"
103
+ ExpiresByType image/jpeg "access 2 week"
104
+ ExpiresByType image/gif "access 2 week"
105
+ ExpiresByType image/png "access 2 week"
106
+ ExpiresByType text/css "access 2 week"
107
+ ExpiresByType application/pdf "access 2 week"
108
+ ExpiresByType text/x-javascript "access 2 week"
109
+ ExpiresByType application/x-shockwave-flash "access 2 week"
110
+ ExpiresByType image/x-icon "access 2 week"
111
+ ExpiresDefault "access 2 week"
112
+ </IfModule>
113
+ ## END : Expires Caching (Leverage Browser Caching) ##\n\n
114
+ EOD;
115
+ return $expire_cache_htaccess_content . $rules;
116
+ }
117
+
118
+ // Set Vary: Accept-Encoding Header
119
+ function wppsb_vary_accept_encoding_filter( $rules ) {
120
+ $vary_accept_encoding_header = <<<EOD
121
+ \n## Added by WP Performance Score Booster ##
122
+ ## BEGIN : Vary: Accept-Encoding Header ##
123
+ <IfModule mod_headers.c>
124
+ <FilesMatch "\.(js|css|xml|gz)$">
125
+ Header append Vary: Accept-Encoding
126
+ </FilesMatch>
127
+ </IfModule>
128
+ ## END : Vary: Accept-Encoding Header ##\n\n
129
+ EOD;
130
+ return $vary_accept_encoding_header . $rules;
131
+ }
132
+
133
+ // Defer parsing of java-script (to load at last)
134
+ /* function defer_parsing_of_js ( $src ) {
135
+ if ( FALSE === strpos( $src, '.js' ) )
136
+ return $src;
137
+ if ( strpos( $src, 'jquery.js' ) )
138
+ return $src;
139
+ return "$src' defer='defer";
140
+ }
141
+ add_filter( 'clean_url', 'defer_parsing_of_js', 11, 1 ); */
142
+
143
+ // Enqueue scripts in the footer to speed-up page load
144
+ /* function footer_enqueue_scripts() {
145
+ remove_action('wp_head', 'wp_print_scripts');
146
+ // remove_action('wp_head', 'wp_print_head_scripts', 9);
147
+ remove_action('wp_head', 'wp_enqueue_scripts', 1);
148
+ add_action('wp_footer', 'wp_print_scripts', 5);
149
+ // add_action('wp_footer', 'wp_print_head_scripts', 5);
150
+ add_action('wp_footer', 'wp_enqueue_scripts', 5);
151
+ }
152
+ add_action('after_setup_theme', 'footer_enqueue_scripts'); */
153
+
154
  function wppsb_admin_options() {
155
  ?>
156
  <div class="wrap">
188
  update_option( $enable_gzip, $enable_gzip_val );
189
  update_option( $expire_caching, $expire_caching_val );
190
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
191
  flush_rewrite_rules();
192
 
193
+ // Put the settings updated message on the screen
194
  ?>
195
  <div class="updated"><p><strong>Settings Saved.</strong></p></div>
196
  <?php
225
  <!-- <span class="wppsb_admin_dev_sidebar"> <?php echo '<img src="' . plugins_url( 'assets/images/wppsb-other-plugins-16x16.png' , __FILE__ ) . '" > '; ?> <a href="http://profiles.wordpress.org/dipakcg#content-plugins" target="_blank"> Get my other plugins </a> </span> -->
226
  <span class="wppsb_admin_dev_sidebar"> <?php echo '<img src="' . plugins_url( 'assets/images/wppsb-twitter-16x16.png' , __FILE__ ) . '" > '; ?>Follow me on Twitter: <a href="https://twitter.com/dipakcgajjar" target="_blank">@dipakcgajjar</a> </span>
227
  <br />
228
+ <span class="wppsb_admin_dev_sidebar" style="float: right;"> Version: <strong> <?php echo get_option('wppsb_plugin_version'); ?> </strong> </span>
229
  </div>
230
  </td>
231
  </tr>
234
  <?php
235
  }
236
 
237
+ // Register admin menu
238
+ add_action( 'admin_menu', 'wppsb_add_admin_menu' );
239
+ function wppsb_add_admin_menu() {
240
+ // add_options_page( $page_title, $menu_title, $capability, $menu_slug, $function);
241
+ add_menu_page( 'WP Performance Score Booster Settings', 'WP Performance Score Booster', 'manage_options', 'wp-performance-score-booster', 'wppsb_admin_options', plugins_url('assets/images/wppsb-icon-24x24.png', __FILE__) );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
242
  }
243
 
244
+ // Add header
245
  function wppsb_add_header() {
246
+ // Get the plugin version from options (in the database)
247
+ $wppsb_plugin_version = get_option('wppsb_plugin_version');
248
  $head_comment = <<<EOD
249
+ <!-- Performance scores of this site is tuned by WP Performance Score Booster plugin v$wppsb_plugin_version - http://wordpress.org/plugins/wp-performance-score-booster -->\n
250
  EOD;
251
+ print ($head_comment);
252
  }
253
  add_action('wp_head', 'wppsb_add_header', 1);
254
 
265
  if (function_exists('ob_gzhandler') || ini_get('zlib.output_compression')) {
266
  update_option( 'wppsb_enable_gzip', 'on' );
267
  add_filter('mod_rewrite_rules', 'wppsb_enable_gzip_filter');
268
+ add_filter('mod_rewrite_rules', 'wppsb_vary_accept_encoding_filter');
269
  }
270
  else {
271
  update_option( 'wppsb_enable_gzip', '' );
276
 
277
  flush_rewrite_rules();
278
  }
 
 
279
  register_activation_hook( __FILE__, 'wppsb_activate_plugin' );
280
 
281
+ // Remove filters/functions on plugin deactivation
282
  function wppsb_deactivate_plugin() {
283
  // Remove filters on plugin deactivate
284
+ remove_filter( 'script_loader_src', 'wppsb_remove_query_strings_q' );
285
+ remove_filter( 'style_loader_src', 'wppsb_remove_query_strings_q');
286
+ remove_filter( 'script_loader_src', 'wppsb_remove_query_strings_emp');
287
+ remove_filter( 'style_loader_src', 'wppsb_remove_query_strings_emp');
288
+ remove_filter( 'mod_rewrite_rules', 'wppsb_enable_gzip_filter');
289
+ remove_filter('mod_rewrite_rules', 'wppsb_vary_accept_encoding_filter');
290
+ remove_filter( 'mod_rewrite_rules', 'wppsb_expire_caching_filter');
291
 
292
  // Delete default options value in the database
293
  /* delete_option( 'wppsb_remove_query_strings' );