WP Performance Score Booster - Version 1.8

Version Description

Download this release

Release Info

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

Code changes from version 1.7.2 to 1.8

Files changed (3) hide show
  1. readme.txt +22 -5
  2. uninstall.php +30 -0
  3. wp-performance-score-booster.php +30 -13
readme.txt CHANGED
@@ -1,10 +1,10 @@
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.8
7
- Stable tag: 1.7.2
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
@@ -19,9 +19,11 @@ This plugin speed-up page load times and improve website scores in services like
19
  * Add Vary: Accept-Encoding header, and
20
  * Set expires caching (leverage browser caching).
21
 
 
 
22
  **Follow the development of this plugin on [GitHub](https://github.com/dipakcg/wp-performance-score-booster)**
23
 
24
- **P.S. It is always the best policy to open a [support thread](http://wordpress.org/support/plugin/wp-performance-score-booster) first before posting any negative review.**
25
 
26
  == Installation ==
27
  1. Upload the ‘wp-performance-score-booster’ folder to the ‘/wp-content/plugins/‘ directory
@@ -38,14 +40,29 @@ It speed-up page load times and improve website scores in services like PageSpee
38
  * GZIP compression should be enabled in your web-server (apache?). If not then you can ask your web hosting provider.
39
  * .htaccess in your WordPress root folder must have write permissions.
40
 
41
- = Is that it? =
 
 
 
 
 
 
 
 
42
 
43
- Pretty much, yeah.
 
 
44
 
45
  == Screenshots ==
46
  1. Admin Settings
47
 
48
  == Changelog ==
 
 
 
 
 
49
  = 1.7.2, March 21, 2017 =
50
  * Improved Promos, News and Updates, and recommendations area.
51
 
1
  === WP Performance Score Booster ===
2
  Contributors: dipakcg
3
+ Tags: performance, speed, compression, caching, booster, query
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.8
7
+ Stable tag: 1.8
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
19
  * Add Vary: Accept-Encoding header, and
20
  * Set expires caching (leverage browser caching).
21
 
22
+ [youtube https://www.youtube.com/watch?v=nEFZLFyZNcE]
23
+
24
  **Follow the development of this plugin on [GitHub](https://github.com/dipakcg/wp-performance-score-booster)**
25
 
26
+ **P.S. It is always the best policy to open a [support thread](http://wordpress.org/support/plugin/wp-performance-score-booster#new-topic-0) first before posting any negative review.**
27
 
28
  == Installation ==
29
  1. Upload the ‘wp-performance-score-booster’ folder to the ‘/wp-content/plugins/‘ directory
40
  * GZIP compression should be enabled in your web-server (apache?). If not then you can ask your web hosting provider.
41
  * .htaccess in your WordPress root folder must have write permissions.
42
 
43
+ = What if I get 500 Internal Server Error? =
44
+
45
+ If you get "500 - Internal Server Error" after you activate the plugin, Follow the steps below:
46
+
47
+ (1) Login to your FTP or open File Manager (ask your hosting provider)
48
+ (2) Go to the WordPress installation folder and then `wp-content/wp-performance-score-booster` folder
49
+ (3) Copy `.htaccess.wppsb` file
50
+ (4) Now move back to WordPress installation folder and Rename the `.htaccess` file (to something like .htaccess.bak)
51
+ (5) Paste `.htaccess.wppsb` file (copied from step 3) and rename it to `.htaccess`
52
 
53
+ That's it! Your site should be up now.
54
+
55
+ Alternatively, you can open a [support thread](http://wordpress.org/support/plugin/wp-performance-score-booster#new-topic-0)
56
 
57
  == Screenshots ==
58
  1. Admin Settings
59
 
60
  == Changelog ==
61
+ = 1.8, July 03, 2017 =
62
+ * Added a feature that auto-backup .htaccess file before appending any rules (for GZIP and browser caching)
63
+ * Improved uninstallation process
64
+ * Added a topic on 500 - Internal Server Error Fix into FAQ
65
+
66
  = 1.7.2, March 21, 2017 =
67
  * Improved Promos, News and Updates, and recommendations area.
68
 
uninstall.php ADDED
@@ -0,0 +1,30 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ if ( ! defined( 'WP_UNINSTALL_PLUGIN' ) ) exit; // Exit if accessed directly.
3
+
4
+ // Include to get get_home_path() function work
5
+ require_once(ABSPATH . 'wp-admin/includes/file.php');
6
+
7
+ delete_option( 'wppsb_plugin_version' );
8
+ delete_option( 'wppsb_remove_query_strings' );
9
+ delete_option( 'wppsb_enable_gzip' );
10
+ delete_option( 'wppsb_expire_caching' );
11
+
12
+ // Delete .htaccess backups (including directory)
13
+ $home_path = get_home_path();
14
+ delete_storage_dir($home_path . 'wp-content/wp-performance-score-booster');
15
+
16
+ function delete_storage_dir($dir) {
17
+ $it = new RecursiveDirectoryIterator($dir, RecursiveDirectoryIterator::SKIP_DOTS);
18
+ $files = new RecursiveIteratorIterator($it,
19
+ RecursiveIteratorIterator::CHILD_FIRST);
20
+ foreach($files as $file) {
21
+ if ($file->isDir()){
22
+ rmdir($file->getRealPath());
23
+ } else {
24
+ unlink($file->getRealPath());
25
+ }
26
+ }
27
+ rmdir($dir);
28
+ }
29
+
30
+ ?>
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: Speed-up page load times and improve website scores in services like PageSpeed, YSlow, Pingdom and GTmetrix.
6
- Version: 1.7.2
7
  Author: Dipak C. Gajjar
8
  Author URI: https://dipakgajjar.com
9
  Text Domain: wp-performance-score-booster
@@ -11,12 +11,15 @@ Text Domain: wp-performance-score-booster
11
 
12
  if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly.
13
 
 
 
 
14
  // Define plugin version for future releases
15
  if (!defined('WPPSB_PLUGIN_VERSION')) {
16
  define('WPPSB_PLUGIN_VERSION', 'wppsb_plugin_version');
17
  }
18
  if (!defined('WPPSB_PLUGIN_VERSION_NUM')) {
19
- define('WPPSB_PLUGIN_VERSION_NUM', '1.7.2');
20
  }
21
  update_option(WPPSB_PLUGIN_VERSION, WPPSB_PLUGIN_VERSION_NUM);
22
 
@@ -26,6 +29,8 @@ define( 'WPPSB_PATH', WP_PLUGIN_DIR . '/' . basename( dirname( __FILE__ ) ) );
26
  define( 'WPPSB_FILE', __FILE__ );
27
  /* Plugin URL */
28
  define( 'WPPSB_URL', plugins_url( '', __FILE__ ) );
 
 
29
 
30
  require_once 'admin-page.php'; // admin options page.
31
  require_once 'data-processing.php'; // process the data such as remove query strings, enable gzip and leverage browser caching.
@@ -91,6 +96,9 @@ add_action('wp_head', 'wppsb_add_header', 1);
91
  // Calling this function will make flush_rules to be called at the end of the PHP execution
92
  function wppsb_activate_plugin() {
93
 
 
 
 
94
  // Save default options value in the database
95
  update_option( 'wppsb_remove_query_strings', 'on' );
96
  add_filter( 'script_loader_src', 'wppsb_remove_query_strings_q', 15, 1 );
@@ -107,14 +115,30 @@ function wppsb_activate_plugin() {
107
 
108
  flush_rewrite_rules();
109
  wppsb_save_mod_rewrite_rules();
110
-
111
- register_uninstall_hook( __FILE__, 'wppsb_uninstall_plugin' );
112
  }
113
  register_activation_hook( __FILE__, 'wppsb_activate_plugin' );
114
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
115
  // Remove filters/functions on plugin deactivation
116
  function wppsb_deactivate_plugin() {
117
- delete_option( 'wppsb_plugin_version' );
118
  // Clear (off) all the options value (from database)
119
  update_option( 'wppsb_remove_query_strings', "" );
120
  update_option( 'wppsb_enable_gzip', "" );
@@ -124,11 +148,4 @@ function wppsb_deactivate_plugin() {
124
  wppsb_save_mod_rewrite_rules();
125
  }
126
  register_deactivation_hook( __FILE__, 'wppsb_deactivate_plugin' );
127
-
128
- // Delete all the options (from database) on plugin uninstall
129
- function wppsb_uninstall_plugin(){
130
- delete_option( 'wppsb_remove_query_strings' );
131
- delete_option( 'wppsb_enable_gzip' );
132
- delete_option( 'wppsb_expire_caching' );
133
- }
134
- ?>
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
+ Version: 1.8
7
  Author: Dipak C. Gajjar
8
  Author URI: https://dipakgajjar.com
9
  Text Domain: wp-performance-score-booster
11
 
12
  if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly.
13
 
14
+ // Include to get get_home_path() function work
15
+ require_once(ABSPATH . 'wp-admin/includes/file.php');
16
+
17
  // Define plugin version for future releases
18
  if (!defined('WPPSB_PLUGIN_VERSION')) {
19
  define('WPPSB_PLUGIN_VERSION', 'wppsb_plugin_version');
20
  }
21
  if (!defined('WPPSB_PLUGIN_VERSION_NUM')) {
22
+ define('WPPSB_PLUGIN_VERSION_NUM', '1.8');
23
  }
24
  update_option(WPPSB_PLUGIN_VERSION, WPPSB_PLUGIN_VERSION_NUM);
25
 
29
  define( 'WPPSB_FILE', __FILE__ );
30
  /* Plugin URL */
31
  define( 'WPPSB_URL', plugins_url( '', __FILE__ ) );
32
+ /* Storage path to store .htaccess backups */
33
+ define( 'WPPSB_STORAGE_PATH', get_home_path() . 'wp-content/wp-performance-score-booster' );
34
 
35
  require_once 'admin-page.php'; // admin options page.
36
  require_once 'data-processing.php'; // process the data such as remove query strings, enable gzip and leverage browser caching.
96
  // Calling this function will make flush_rules to be called at the end of the PHP execution
97
  function wppsb_activate_plugin() {
98
 
99
+ // Backup .htacces before appending any rules
100
+ wppsb_htaccess_bakup();
101
+
102
  // Save default options value in the database
103
  update_option( 'wppsb_remove_query_strings', 'on' );
104
  add_filter( 'script_loader_src', 'wppsb_remove_query_strings_q', 15, 1 );
115
 
116
  flush_rewrite_rules();
117
  wppsb_save_mod_rewrite_rules();
 
 
118
  }
119
  register_activation_hook( __FILE__, 'wppsb_activate_plugin' );
120
 
121
+ function wppsb_htaccess_bakup() {
122
+ if (!file_exists( WPPSB_STORAGE_PATH )) {
123
+ mkdir( WPPSB_STORAGE_PATH, 0777, true );
124
+ }
125
+
126
+ $home_path = get_home_path();
127
+ $htaccess_file = $home_path . '.htaccess'; // original .htaccess file
128
+ $htaccess_bak = WPPSB_STORAGE_PATH . '/.htaccess.wppsb';
129
+
130
+ copy($htaccess_file, $htaccess_bak);
131
+
132
+ /* if (file_exists($htaccess_bak)) {
133
+ copy($htaccess_file, $htaccess_bak . "." . date('mdYhis'));
134
+ } else {
135
+ copy($htaccess_file, $htaccess_bak);
136
+ } */
137
+ }
138
+
139
  // Remove filters/functions on plugin deactivation
140
  function wppsb_deactivate_plugin() {
141
+
142
  // Clear (off) all the options value (from database)
143
  update_option( 'wppsb_remove_query_strings', "" );
144
  update_option( 'wppsb_enable_gzip', "" );
148
  wppsb_save_mod_rewrite_rules();
149
  }
150
  register_deactivation_hook( __FILE__, 'wppsb_deactivate_plugin' );
151
+ ?>