WP Performance Score Booster - Version 2.2

Version Description

= 2.0 = This version adds support for page preloading, improves compression and caching rules for faster speed, and has newly designed settings page. Recommended upgrade.

Download this release

Release Info

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

Code changes from version 2.1 to 2.2

admin-page.php CHANGED
@@ -9,7 +9,7 @@ add_action( 'admin_menu', 'wppsb_admin_settings_setup' );
9
  // Settings main page
10
  function wppsb_admin_settings_page() {
11
  global $wppsb_active_tab;
12
- $wppsb_active_tab = isset( $_GET['tab'] ) ? $_GET['tab'] : 'settings'; ?>
13
 
14
  <h2><?php echo '<img src="' . WPPSB_URL . '/assets/images/wppsb-icon-24x24.png' . '" > '; ?> <?php _e( 'WP Performance Score Booster', 'wp-performance-score-booster' ); ?></h2>
15
 
@@ -60,17 +60,9 @@ function wppsb_optimize_more_content_fn() {
60
  if ( '' || 'optimize-more' != $wppsb_active_tab ) {
61
  return;
62
  }
63
- ?>
64
-
65
- <h3><?php _e( 'These products will improve your site\'s performance even more!', 'wp-performance-score-booster' ); ?></h3>
66
-
67
- <?php
68
- $referrals_content = wp_remote_fopen("https://dipakgajjar.com/public/recommendations_2.html");
69
- echo $referrals_content;
70
- ?>
71
- <div class="clear"></div>
72
- <div id='footer-thankyou'><?php _e( '* I only recommend the products that I use personally or for my clients.', 'wp-performance-score-booster' ); ?></div>
73
- <?php
74
  }
75
 
76
  // Admin option
@@ -119,10 +111,10 @@ function wppsb_admin_options() {
119
  }
120
 
121
  // Read their posted value
122
- $remove_query_strings_val = ( isset( $_POST[$remove_query_strings] ) ? $_POST[$remove_query_strings] : '' );
123
- $enable_gzip_val = ( isset( $_POST[$enable_gzip] ) ? $_POST[$enable_gzip] : '' );
124
- $expire_caching_val = ( isset( $_POST[$expire_caching] ) ? $_POST[$expire_caching] : '' );
125
- $instant_page_preload_val = ( isset( $_POST[$instant_page_preload] ) ? $_POST[$instant_page_preload] : '' );
126
 
127
  // Save the posted value in the database
128
  update_option( $remove_query_strings, $remove_query_strings_val );
@@ -147,14 +139,14 @@ function wppsb_admin_options() {
147
  <!-- Remove Query String -->
148
  <tr> <td class="wppsb_onoff">
149
  <div class="wppsb_onoffswitch">
150
- <input type="checkbox" name="<?php echo $remove_query_strings; ?>" <?php checked( $remove_query_strings_val == 'on', true ); ?> class="wppsb_onoffswitch-checkbox" id="<?php echo $remove_query_strings; ?>" />
151
- <label class="wppsb_onoffswitch-label" for="<?php echo $remove_query_strings; ?>">
152
  <span class="wppsb_onoffswitch-inner"></span>
153
  <span class="wppsb_onoffswitch-switch"></span>
154
  </label>
155
  </div>
156
  </td> <td>
157
- <label for="<?php echo $remove_query_strings; ?>" class="wppsb_settings" style="display: inline;"> <?php _e( 'Remove query strings from static content', 'wp-performance-score-booster' ); ?> </label>
158
  </td> </tr>
159
 
160
  <!-- Enable GZIP -->
@@ -162,21 +154,21 @@ function wppsb_admin_options() {
162
  <?php if ( function_exists( 'ob_gzhandler' ) || ini_get( 'zlib.output_compression' ) ) { // if web server supports GZIP ?>
163
  <td class="wppsb_onoff">
164
  <div class="wppsb_onoffswitch">
165
- <input type="checkbox" name="<?php echo $enable_gzip; ?>" <?php checked( $enable_gzip_val == 'on', true ); ?> class="wppsb_onoffswitch-checkbox" id="<?php echo $enable_gzip; ?>" />
166
- <label class="wppsb_onoffswitch-label" for="<?php echo $enable_gzip; ?>">
167
  <span class="wppsb_onoffswitch-inner"></span>
168
  <span class="wppsb_onoffswitch-switch"></span>
169
  </label>
170
  </div>
171
  </td> <td>
172
- <label for="<?php echo $enable_gzip; ?>" class="wppsb_settings" style="display: inline;"> <?php _e('Enable GZIP compression <i>(compress text, html, javascript, css, xml and so on)</i>', 'wp-performance-score-booster'); ?> </label>
173
  </td>
174
  <?php }
175
  else { // if web server doesn't support GZIP ?>
176
  <td class="wppsb_onoff">
177
  <div class="wppsb_onoffswitch">
178
- <input type="checkbox" name="<?php echo $enable_gzip; ?>" disabled="true" <?php checked( $enable_gzip_val == 'off', true ); ?> class="wppsb_onoffswitch-checkbox" id="<?php echo $enable_gzip; ?>" />
179
- <label class="wppsb_onoffswitch-label" for="<?php echo $enable_gzip; ?>">
180
  <span class="wppsb_onoffswitch-inner"></span>
181
  <span class="wppsb_onoffswitch-switch"></span>
182
  </label>
@@ -191,27 +183,27 @@ function wppsb_admin_options() {
191
  <!-- Leverage Browser Caching -->
192
  <tr> <td class="wppsb_onoff">
193
  <div class="wppsb_onoffswitch">
194
- <input type="checkbox" name="<?php echo $expire_caching; ?>" <?php checked( $expire_caching_val == 'on', true); ?> class="wppsb_onoffswitch-checkbox" id="<?php echo $expire_caching; ?>" />
195
- <label class="wppsb_onoffswitch-label" for="<?php echo $expire_caching; ?>">
196
  <span class="wppsb_onoffswitch-inner"></span>
197
  <span class="wppsb_onoffswitch-switch"></span>
198
  </label>
199
  </div>
200
  </td> <td>
201
- <label for="<?php echo $expire_caching; ?>" class="wppsb_settings" style="display: inline;"> <?php _e( 'Leverage Browser Caching <i>(expires headers, for better cache control)</i>', 'wp-performance-score-booster' ); ?> </label>
202
  </td> </tr>
203
 
204
  <!-- Instant Page Preload -->
205
  <tr> <td class="wppsb_onoff" id="td_section">
206
  <div class="wppsb_onoffswitch">
207
- <input type="checkbox" name="<?php echo $instant_page_preload; ?>" <?php checked( $instant_page_preload_val == 'on', true ); ?> class="wppsb_onoffswitch-checkbox" id="<?php echo $instant_page_preload; ?>" />
208
- <label class="wppsb_onoffswitch-label" for="<?php echo $instant_page_preload; ?>">
209
  <span class="wppsb_onoffswitch-inner"></span>
210
  <span class="wppsb_onoffswitch-switch"></span>
211
  </label>
212
  </div>
213
  </td> <td id="td_section">
214
- <label for="<?php echo $instant_page_preload; ?>" class="wppsb_settings" style="display: inline;"> <?php _e( 'Page Preload <em>(preload a page right before a user clicks on a link)</em>', 'wp-performance-score-booster' ); ?> </label>
215
  </td> </tr>
216
 
217
  <!-- Extra Options - must be added in the future version -->
@@ -259,7 +251,7 @@ function wppsb_admin_options() {
259
  <!-- <span class="wppsb_admin_dev_sidebar"> <?php echo '<img src="' . WPPSB_URL . '/assets/images/wppsb-other-plugins-16x16.png' . '" > '; ?> <a href="//profiles.wordpress.org/dipakcg#content-plugins" target="_blank"> <?php _e('Get my other plugins', 'wp-performance-score-booster'); ?> </a> </span> -->
260
  <span id="td_section" class="wppsb_admin_dev_sidebar"> <?php echo '<img src="' . WPPSB_URL . '/assets/images/wppsb-icon-24x24.png' . '" width="16" height="16" > '; ?> <a href="//dipakgajjar.com/product/wordpress-speed-optimization-service/" target="_blank"> <?php _e('Order Speed Optimization Service', 'wp-performance-score-booster'); ?> </a> </span>
261
  <span class="wppsb_admin_dev_sidebar"> <?php echo '<img src="' . WPPSB_URL . '/assets/images/wppsb-twitter-16x16.png' . '" width="16" height="16" > '; ?> <a href="//twitter.com/dipakcgajjar" target="_blank"> <?php _e('Let\'s connect on Twitter: @dipakcgajjar', 'wp-performance-score-booster'); ?> </a> </span>
262
- <span id="td_section" class="wppsb_admin_dev_sidebar" style="float: right;"> <?php _e('Version:', 'wp-performance-score-booster'); ?> <strong> <?php echo $wppsb_plugin_version; ?> </strong> </span>
263
  </div>
264
  </td>
265
  </tr>
9
  // Settings main page
10
  function wppsb_admin_settings_page() {
11
  global $wppsb_active_tab;
12
+ $wppsb_active_tab = isset( $_GET['tab'] ) ? sanitize_text_field( $_GET['tab'] ) : 'settings'; ?>
13
 
14
  <h2><?php echo '<img src="' . WPPSB_URL . '/assets/images/wppsb-icon-24x24.png' . '" > '; ?> <?php _e( 'WP Performance Score Booster', 'wp-performance-score-booster' ); ?></h2>
15
 
60
  if ( '' || 'optimize-more' != $wppsb_active_tab ) {
61
  return;
62
  }
63
+
64
+ // Calls optimize-more.php
65
+ wppsb_optimize_more();
 
 
 
 
 
 
 
 
66
  }
67
 
68
  // Admin option
111
  }
112
 
113
  // Read their posted value
114
+ $remove_query_strings_val = ( isset( $_POST[$remove_query_strings] ) ? sanitize_text_field( $_POST[$remove_query_strings] ) : '' );
115
+ $enable_gzip_val = ( isset( $_POST[$enable_gzip] ) ? sanitize_text_field( $_POST[$enable_gzip] ) : '' );
116
+ $expire_caching_val = ( isset( $_POST[$expire_caching] ) ? sanitize_text_field( $_POST[$expire_caching] ) : '' );
117
+ $instant_page_preload_val = ( isset( $_POST[$instant_page_preload] ) ? sanitize_text_field( $_POST[$instant_page_preload] ) : '' );
118
 
119
  // Save the posted value in the database
120
  update_option( $remove_query_strings, $remove_query_strings_val );
139
  <!-- Remove Query String -->
140
  <tr> <td class="wppsb_onoff">
141
  <div class="wppsb_onoffswitch">
142
+ <input type="checkbox" name="<?php echo esc_attr( $remove_query_strings ); ?>" <?php checked( $remove_query_strings_val == 'on', true ); ?> class="wppsb_onoffswitch-checkbox" id="<?php echo esc_attr( $remove_query_strings ); ?>" />
143
+ <label class="wppsb_onoffswitch-label" for="<?php echo esc_attr( $remove_query_strings ); ?>">
144
  <span class="wppsb_onoffswitch-inner"></span>
145
  <span class="wppsb_onoffswitch-switch"></span>
146
  </label>
147
  </div>
148
  </td> <td>
149
+ <label for="<?php echo esc_attr( $remove_query_strings ); ?>" class="wppsb_settings" style="display: inline;"> <?php _e( 'Remove query strings from static content', 'wp-performance-score-booster' ); ?> </label>
150
  </td> </tr>
151
 
152
  <!-- Enable GZIP -->
154
  <?php if ( function_exists( 'ob_gzhandler' ) || ini_get( 'zlib.output_compression' ) ) { // if web server supports GZIP ?>
155
  <td class="wppsb_onoff">
156
  <div class="wppsb_onoffswitch">
157
+ <input type="checkbox" name="<?php echo esc_attr( $enable_gzip ); ?>" <?php checked( $enable_gzip_val == 'on', true ); ?> class="wppsb_onoffswitch-checkbox" id="<?php echo esc_attr( $enable_gzip ); ?>" />
158
+ <label class="wppsb_onoffswitch-label" for="<?php echo esc_attr( $enable_gzip ); ?>">
159
  <span class="wppsb_onoffswitch-inner"></span>
160
  <span class="wppsb_onoffswitch-switch"></span>
161
  </label>
162
  </div>
163
  </td> <td>
164
+ <label for="<?php echo esc_attr( $enable_gzip ); ?>" class="wppsb_settings" style="display: inline;"> <?php _e('Enable GZIP compression <i>(compress text, html, javascript, css, xml and so on)</i>', 'wp-performance-score-booster'); ?> </label>
165
  </td>
166
  <?php }
167
  else { // if web server doesn't support GZIP ?>
168
  <td class="wppsb_onoff">
169
  <div class="wppsb_onoffswitch">
170
+ <input type="checkbox" name="<?php echo esc_attr( $enable_gzip ); ?>" disabled="true" <?php checked( $enable_gzip_val == 'off', true ); ?> class="wppsb_onoffswitch-checkbox" id="<?php echo esc_attr( $enable_gzip ); ?>" />
171
+ <label class="wppsb_onoffswitch-label" for="<?php echo esc_attr( $enable_gzip ); ?>">
172
  <span class="wppsb_onoffswitch-inner"></span>
173
  <span class="wppsb_onoffswitch-switch"></span>
174
  </label>
183
  <!-- Leverage Browser Caching -->
184
  <tr> <td class="wppsb_onoff">
185
  <div class="wppsb_onoffswitch">
186
+ <input type="checkbox" name="<?php echo esc_attr( $expire_caching ); ?>" <?php checked( $expire_caching_val == 'on', true); ?> class="wppsb_onoffswitch-checkbox" id="<?php echo esc_attr( $expire_caching ); ?>" />
187
+ <label class="wppsb_onoffswitch-label" for="<?php echo esc_attr( $expire_caching ); ?>">
188
  <span class="wppsb_onoffswitch-inner"></span>
189
  <span class="wppsb_onoffswitch-switch"></span>
190
  </label>
191
  </div>
192
  </td> <td>
193
+ <label for="<?php echo esc_attr( $expire_caching ); ?>" class="wppsb_settings" style="display: inline;"> <?php _e( 'Leverage Browser Caching <i>(expires headers, for better cache control)</i>', 'wp-performance-score-booster' ); ?> </label>
194
  </td> </tr>
195
 
196
  <!-- Instant Page Preload -->
197
  <tr> <td class="wppsb_onoff" id="td_section">
198
  <div class="wppsb_onoffswitch">
199
+ <input type="checkbox" name="<?php echo esc_attr( $instant_page_preload ); ?>" <?php checked( $instant_page_preload_val == 'on', true ); ?> class="wppsb_onoffswitch-checkbox" id="<?php echo esc_attr( $instant_page_preload ); ?>" />
200
+ <label class="wppsb_onoffswitch-label" for="<?php echo esc_attr( $instant_page_preload ); ?>">
201
  <span class="wppsb_onoffswitch-inner"></span>
202
  <span class="wppsb_onoffswitch-switch"></span>
203
  </label>
204
  </div>
205
  </td> <td id="td_section">
206
+ <label for="<?php echo esc_attr( $instant_page_preload ); ?>" class="wppsb_settings" style="display: inline;"> <?php _e( 'Page Preload <em>(preload a page right before a user clicks on a link)</em>', 'wp-performance-score-booster' ); ?> </label>
207
  </td> </tr>
208
 
209
  <!-- Extra Options - must be added in the future version -->
251
  <!-- <span class="wppsb_admin_dev_sidebar"> <?php echo '<img src="' . WPPSB_URL . '/assets/images/wppsb-other-plugins-16x16.png' . '" > '; ?> <a href="//profiles.wordpress.org/dipakcg#content-plugins" target="_blank"> <?php _e('Get my other plugins', 'wp-performance-score-booster'); ?> </a> </span> -->
252
  <span id="td_section" class="wppsb_admin_dev_sidebar"> <?php echo '<img src="' . WPPSB_URL . '/assets/images/wppsb-icon-24x24.png' . '" width="16" height="16" > '; ?> <a href="//dipakgajjar.com/product/wordpress-speed-optimization-service/" target="_blank"> <?php _e('Order Speed Optimization Service', 'wp-performance-score-booster'); ?> </a> </span>
253
  <span class="wppsb_admin_dev_sidebar"> <?php echo '<img src="' . WPPSB_URL . '/assets/images/wppsb-twitter-16x16.png' . '" width="16" height="16" > '; ?> <a href="//twitter.com/dipakcgajjar" target="_blank"> <?php _e('Let\'s connect on Twitter: @dipakcgajjar', 'wp-performance-score-booster'); ?> </a> </span>
254
+ <span id="td_section" class="wppsb_admin_dev_sidebar" style="float: right;"> <?php _e('Version:', 'wp-performance-score-booster'); ?> <strong> <?php echo esc_attr( $wppsb_plugin_version ); ?> </strong> </span>
255
  </div>
256
  </td>
257
  </tr>
optimize-more.php ADDED
@@ -0,0 +1,42 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ function wppsb_optimize_more() {
3
+ ?>
4
+ <style>
5
+ .wppsb_referrals { background: #FFF; width: 250px; min-height: 340px; border: 1px solid #CCC; float: left; padding: 13px; position: relative; margin: 13px; color: #0073AA; font-size: 14px; line-height: 1.5; border-radius: 10px; }
6
+ .read_more { font-weight: bold; color: #FF9900; }
7
+ .wppsb_ref_title { margin: 0.5em 0 0.5em 0; }
8
+ #wppsb_button { float: right; }
9
+ </style>
10
+
11
+ <div id="wppsb-optimize-more-content"> </div>
12
+
13
+ <script>
14
+ fetch('https://public.dipakgajjar.com/products.json')
15
+ .then(response => {
16
+ return response.json()
17
+ })
18
+ .then(sections => {
19
+ let html = "";
20
+ sections.forEach(section => {
21
+ html += `<h3>${section.title}</h3>`;
22
+ section.products.forEach(product => {
23
+ html += `<div class="wppsb_referrals">
24
+ <a href="${product.url}" target="_blank" ><img src="${product.picture}" alt="${product.title}" width="250" height="250" border="0"></a>
25
+ <h3 class="wppsb_ref_title">${product.title}</h3>
26
+ <p>${product.description}</p>
27
+ <a href="${product.url}" target="_blank"> <button class="button button-primary" id="wppsb_button">${product.buttonText}</button> </a>
28
+ </div>`
29
+ });
30
+ html += `<div class="clear"></div>`;
31
+ html += `<div id='footer-thankyou'>${section.disclaimer}</div>`;
32
+ })
33
+ document.getElementById("wppsb-optimize-more-content").innerHTML = html;
34
+ })
35
+ .catch(err => {
36
+ console.log(err)
37
+ document.getElementById("wppsb-optimize-more-content").innerText = "\n\nOops! Something went wrong.\n\n";
38
+ })
39
+ </script>
40
+
41
+ <?php
42
+ }
readme.txt CHANGED
@@ -3,9 +3,9 @@ Contributors: dipakcg
3
  Tags: performance, optimize, speed, query string, preload, gzip, gtmetrix, etag, compression, headers, cache, 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: 5.8
7
  Requires PHP: 5.6
8
- Stable tag: 2.1
9
  License: GPLv2 or later
10
 
11
  Make website faster, speed up page load time and improve performance scores in services like GTmetrix, Pingdom, YSlow and PageSpeed.
@@ -69,6 +69,9 @@ If this plugin has helped you in any way, you can:
69
  1. Admin Settings
70
 
71
  == Changelog ==
 
 
 
72
  = 2.1, October 12, 2021 =
73
  * Improve: CSRF Check
74
 
3
  Tags: performance, optimize, speed, query string, preload, gzip, gtmetrix, etag, compression, headers, cache, 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: 6.0
7
  Requires PHP: 5.6
8
+ Stable tag: 2.2
9
  License: GPLv2 or later
10
 
11
  Make website faster, speed up page load time and improve performance scores in services like GTmetrix, Pingdom, YSlow and PageSpeed.
69
  1. Admin Settings
70
 
71
  == Changelog ==
72
+ = 2.2, October 13, 2021 =
73
+ * Improve: Data Sanitization / Escaping
74
+
75
  = 2.1, October 12, 2021 =
76
  * Improve: CSRF Check
77
 
wp-performance-score-booster.php CHANGED
@@ -3,7 +3,7 @@
3
  Plugin Name: WP Performance Score Booster
4
  Plugin URI: https://github.com/dipakcg/wp-performance-score-booster
5
  Description: Makes website faster, speeds up page load time, and instantly improves website performance scores in services like GTmetrix, Pingdom, YSlow, and PageSpeed.
6
- Version: 2.1
7
  Author: Dipak C. Gajjar
8
  Author URI: https://dipakgajjar.com
9
  License: GPL-2.0+
@@ -19,7 +19,7 @@ include_once ( ABSPATH . 'wp-admin/includes/plugin.php' ); // to is_plugin_activ
19
 
20
  // Define plugin version for future releases
21
  if ( ! defined( 'WPPSB_PLUGIN_VERSION' ) ) {
22
- define( 'WPPSB_PLUGIN_VERSION', '2.1' );
23
  }
24
 
25
  if ( ! defined( 'WPPSB_BASE' ) ) {
@@ -41,6 +41,7 @@ if ( ! defined( 'WPPSB_STORAGE_PATH' ) ) {
41
 
42
  require_once WPPSB_PATH . 'admin-page.php'; // admin options page.
43
  require_once WPPSB_PATH . 'data-processing.php'; // process the data such as remove query strings, enable gzip and leverage browser caching.
 
44
 
45
  // Check if option values (from the database) exists in the database otherwise set on/active by default
46
  global $wppsb_plugin_version, $wppsb_remove_query_strings, $wppsb_enable_gzip, $wppsb_expire_caching, $wppsb_instant_page_preload;
3
  Plugin Name: WP Performance Score Booster
4
  Plugin URI: https://github.com/dipakcg/wp-performance-score-booster
5
  Description: Makes website faster, speeds up page load time, and instantly improves website performance scores in services like GTmetrix, Pingdom, YSlow, and PageSpeed.
6
+ Version: 2.2
7
  Author: Dipak C. Gajjar
8
  Author URI: https://dipakgajjar.com
9
  License: GPL-2.0+
19
 
20
  // Define plugin version for future releases
21
  if ( ! defined( 'WPPSB_PLUGIN_VERSION' ) ) {
22
+ define( 'WPPSB_PLUGIN_VERSION', '2.2' );
23
  }
24
 
25
  if ( ! defined( 'WPPSB_BASE' ) ) {
41
 
42
  require_once WPPSB_PATH . 'admin-page.php'; // admin options page.
43
  require_once WPPSB_PATH . 'data-processing.php'; // process the data such as remove query strings, enable gzip and leverage browser caching.
44
+ require_once WPPSB_PATH . 'optimize-more.php'; // Optimize more content.
45
 
46
  // Check if option values (from the database) exists in the database otherwise set on/active by default
47
  global $wppsb_plugin_version, $wppsb_remove_query_strings, $wppsb_enable_gzip, $wppsb_expire_caching, $wppsb_instant_page_preload;