WP Performance Score Booster - Version 1.7

Version Description

Download this release

Release Info

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

Code changes from version 1.6 to 1.7

admin-page.php ADDED
@@ -0,0 +1,177 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ function wppsb_admin_options() {
3
+ ?>
4
+ <div class="wrap">
5
+ <table width="100%" border="0">
6
+ <tr>
7
+ <td width="75%">
8
+ <h2><?php echo '<img src="' . WPPSB_URL . '/assets/images/wppsb-icon-24x24.png' . '" > '; ?> <?php _e('WP Performance Score Booster Settings', 'wp-performance-score-booster'); ?></h2>
9
+ <hr />
10
+ <?php
11
+ if ( !current_user_can( 'manage_options' ) ) {
12
+ wp_die( __('You do not have sufficient permissions to access this page.') );
13
+ }
14
+
15
+ // Variables for the field and option names
16
+ $hidden_field_name = 'wppsb_submit_hidden';
17
+ $remove_query_strings = 'wppsb_remove_query_strings';
18
+ $enable_gzip = 'wppsb_enable_gzip';
19
+ $expire_caching = 'wppsb_expire_caching';
20
+
21
+ // Read in existing option value from database
22
+ $remove_query_strings_val = get_option($remove_query_strings);
23
+ $enable_gzip_val = get_option($enable_gzip);
24
+ $expire_caching_val = get_option($expire_caching);
25
+
26
+ // See if the user has posted us some information
27
+ // If they did, this hidden field will be set to 'Y'
28
+ if( isset($_POST[$hidden_field_name]) && $_POST[$hidden_field_name] == 'Y' ) {
29
+ // Read their posted value
30
+ $remove_query_strings_val = (isset($_POST[$remove_query_strings]) ? $_POST[$remove_query_strings] : "");
31
+ $enable_gzip_val = (isset($_POST[$enable_gzip]) ? $_POST[$enable_gzip] : "");
32
+ $expire_caching_val = (isset($_POST[$expire_caching]) ? $_POST[$expire_caching] : "");
33
+
34
+ // Save the posted value in the database
35
+ update_option( $remove_query_strings, $remove_query_strings_val );
36
+ update_option( $enable_gzip, $enable_gzip_val );
37
+ update_option( $expire_caching, $expire_caching_val );
38
+
39
+ flush_rewrite_rules();
40
+ wppsb_save_mod_rewrite_rules();
41
+
42
+ // Put the settings updated message on the screen
43
+ ?>
44
+ <div class="updated"><p><strong><?php _e('<strong>Settings Saved.</strong>', 'wp-performance-score-booster'); ?></strong></p></div>
45
+ <?php
46
+ }
47
+ ?>
48
+ <form method="post" name="options_form">
49
+ <input type="hidden" name="<?php echo $hidden_field_name; ?>" value="Y">
50
+ <table>
51
+ <!-- Remove Query String -->
52
+ <tr> <td class="wppsb_onoff">
53
+ <div class="wppsb_onoffswitch">
54
+ <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; ?>" />
55
+ <label class="wppsb_onoffswitch-label" for="<?php echo $remove_query_strings; ?>">
56
+ <span class="wppsb_onoffswitch-inner"></span>
57
+ <span class="wppsb_onoffswitch-switch"></span>
58
+ </label>
59
+ </div>
60
+ </td> <td>
61
+ <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>
62
+ </td> </tr>
63
+
64
+ <!-- Enable GZIP -->
65
+ <tr>
66
+ <?php if (function_exists('ob_gzhandler') || ini_get('zlib.output_compression')) { // if web server supports GZIP ?>
67
+ <td class="wppsb_onoff">
68
+ <div class="wppsb_onoffswitch">
69
+ <input type="checkbox" name="<?php echo $enable_gzip; ?>" <?php checked( $enable_gzip_val == 'on',true); ?> class="wppsb_onoffswitch-checkbox" id="<?php echo $enable_gzip; ?>" />
70
+ <label class="wppsb_onoffswitch-label" for="<?php echo $enable_gzip; ?>">
71
+ <span class="wppsb_onoffswitch-inner"></span>
72
+ <span class="wppsb_onoffswitch-switch"></span>
73
+ </label>
74
+ </div>
75
+ </td> <td>
76
+ <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>
77
+ </td>
78
+ <?php }
79
+ else { // if web server doesn't support GZIP ?>
80
+ <td class="wppsb_onoff">
81
+ <div class="wppsb_onoffswitch">
82
+ <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; ?>" />
83
+ <label class="wppsb_onoffswitch-label" for="<?php echo $enable_gzip; ?>">
84
+ <span class="wppsb_onoffswitch-inner"></span>
85
+ <span class="wppsb_onoffswitch-switch"></span>
86
+ </label>
87
+ </div>
88
+ </td> <td>
89
+ <span class="wppsb_settings"> <?php _e('Enable GZIP compression <i>(compress text, html, javascript, css, xml and so on)</i>', 'wp-performance-score-booster'); ?> </span> <br />
90
+ <span class="wppsb_settings" style="color:RED; font-style: italic; font-size: 13px !important;"> <?php _e('Your web server does not support GZIP compression. Contact your hosting provider to enable it.', 'wp-performance-score-booster'); ?> </span>
91
+ </td>
92
+ <?php } ?>
93
+ </tr>
94
+
95
+ <!-- Leverage Browser Caching -->
96
+ <tr> <td class="wppsb_onoff">
97
+ <div class="wppsb_onoffswitch">
98
+ <input type="checkbox" name="<?php echo $expire_caching; ?>" <?php checked( $expire_caching_val == 'on',true); ?> class="wppsb_onoffswitch-checkbox" id="<?php echo $expire_caching; ?>" />
99
+ <label class="wppsb_onoffswitch-label" for="<?php echo $expire_caching; ?>">
100
+ <span class="wppsb_onoffswitch-inner"></span>
101
+ <span class="wppsb_onoffswitch-switch"></span>
102
+ </label>
103
+ </div>
104
+ </td> <td>
105
+ <label for="<?php echo $expire_caching; ?>" class="wppsb_settings" style="display: inline;"> <?php _e('Leverage Browser Caching <i>(set expire caching)</i>', 'wp-performance-score-booster'); ?> </label>
106
+ </td> </tr>
107
+ </table>
108
+ <p><input style="font-size: 15px; color: white; font-weight: bold;" type="submit" value="<?php esc_attr_e('Save Changes', 'wp-performance-score-booster'); ?>" class="button button-primary" name="submit" /></p>
109
+ </form>
110
+ </td>
111
+ <td style="text-align: left;">
112
+ <div class="wppsb_admin_dev_sidebar_div">
113
+ <!-- <img src="//www.gravatar.com/avatar/38b380cf488d8f8c4007cf2015dc16ac.jpg" width="100px" height="100px" /> <br /> -->
114
+ <br />
115
+ <span class="wppsb_admin_dev_sidebar"> <?php echo '<img src="' . WPPSB_URL . '/assets/images/wppsb-support-this-16x16.png' . '" > '; ?> <a href="https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=3S8BRPLWLNQ38" target="_blank"> <?php _e('Donate and support this plugin', 'wp-performance-score-booster'); ?> </a> </span>
116
+ <span class="wppsb_admin_dev_sidebar"> <?php echo '<img src="' . WPPSB_URL . '/assets/images/wppsb-rate-this-16x16.png' . '" > '; ?> <a href="http://wordpress.org/support/view/plugin-reviews/wp-performance-score-booster" target="_blank"> <?php _e('Rate this plugin on WordPress.org', 'wp-performance-score-booster'); ?> </a> </span>
117
+ <span class="wppsb_admin_dev_sidebar"> <?php echo '<img src="' . WPPSB_URL . '/assets/images/wppsb-wordpress-16x16.png' . '" > '; ?> <a href="http://wordpress.org/support/plugin/wp-performance-score-booster" target="_blank"> <?php _e('Get support on WordPress.org', 'wp-performance-score-booster'); ?> </a> </span>
118
+ <span class="wppsb_admin_dev_sidebar"> <?php echo '<img src="' . WPPSB_URL . '/assets/images/wppsb-github-16x16.png' . '" > '; ?> <a href="https://github.com/dipakcg/wp-performance-score-booster" target="_blank"> <?php _e('Contribute development on GitHub', 'wp-performance-score-booster'); ?> </a> </span>
119
+ <span class="wppsb_admin_dev_sidebar"> <?php echo '<img src="' . WPPSB_URL . '/assets/images/wppsb-other-plugins-16x16.png' . '" > '; ?> <a href="http://profiles.wordpress.org/dipakcg#content-plugins" target="_blank"> <?php _e('Get my other plugins', 'wp-performance-score-booster'); ?> </a> </span>
120
+ <span class="wppsb_admin_dev_sidebar"> <?php echo '<img src="' . WPPSB_URL . '/assets/images/wppsb-twitter-16x16.png' . '" > '; ?>Follow me on Twitter: <a href="https://twitter.com/dipakcgajjar" target="_blank">@dipakcgajjar</a> </span>
121
+ <br />
122
+ <span class="wppsb_admin_dev_sidebar" style="float: right;"> <?php _e('Version:', 'wp-performance-score-booster'); ?> <strong> <?php echo get_option('wppsb_plugin_version'); ?> </strong> </span>
123
+ </div>
124
+ </td>
125
+ </tr>
126
+ </table>
127
+ </div>
128
+ <hr style="margin: 2em 0 1.5em 0;" />
129
+ <?php
130
+ // Promo - Ad contents
131
+ $promo_content = wp_remote_fopen("https://cdn.rawgit.com/dipakcg/wp-performance-score-booster/master/promos.html");
132
+ echo $promo_content;
133
+ ?>
134
+ <?php // Bottom - News and Tweets part ?>
135
+ <hr style="margin: 1.5em 0 2em 0;" />
136
+ <table cellspacing="0" cellpadding="0" class="wppsb_news_section"> <tr>
137
+ <!-- News and Updates -->
138
+ <td width="49%" valign="top">
139
+ <h2><strong>News & Updates from Dipak C. Gajjar</strong></h2>
140
+ <hr />
141
+ <div class="wppsb_rss-widget">
142
+ <?php
143
+ /* wp_widget_rss_output(array(
144
+ 'url' => 'https://dipakgajjar.com/category/news/feed/?refresh='.rand(10,100).'', // feed URL
145
+ 'title' => 'News & Updates from Dipak C. Gajjar',
146
+ 'items' => 3, // nubmer of posts to display
147
+ 'show_summary' => 1,
148
+ 'show_author' => 0,
149
+ 'show_date' => 0
150
+ )); */
151
+ /* Load the news content from Dropbox url */
152
+ $news_content = wp_remote_fopen("https://cdn.rawgit.com/dipakcg/wp-performance-score-booster/master/news-and-updates.html");
153
+ echo $news_content;
154
+ ?>
155
+ </div> </td>
156
+ <!-- Referrals -->
157
+ <td width="1%"> &nbsp </td>
158
+ <td width="51%" valign="top">
159
+ <div class="wppsb_referrals">
160
+ Scalable and affordable SSD VPS at DigitalOcean starting from $5 per month. <br /> <br />
161
+ <a href="https://www.digitalocean.com" target="_blank" onClick="this.href='https://m.do.co/c/f90a24a27dcc'" ><img src="https://dl.dropboxusercontent.com/u/21966579/do-ssd-virtual-servers-250x250.jpg" alt="Digital Ocean SSD VPS" width="250" height="250" border="0"></a>
162
+ </div>
163
+ <div class="wppsb_referrals">
164
+ Great managed WordPress hosting at SiteGround starting from $3.95 per month. <br /> <br />
165
+ <a href="http://www.siteground.com" target="_blank" onClick="this.href='https://www.siteground.com/wordpress-hosting.htm?afbannercode=783dd6fb6802e26ada6cf20768622fda'" ><img src="https://ua.siteground.com/img/banners/general/best-pack/250x250.gif" alt="WordPress Hosting" width="250" height="250" border="0"></a>
166
+ </div>
167
+ <?php echo '</td> </tr> </table>'; ?>
168
+ <?php
169
+ }
170
+
171
+ // Register admin menu
172
+ add_action( 'admin_menu', 'wppsb_add_admin_menu' );
173
+ function wppsb_add_admin_menu() {
174
+ // add_menu_page( __('WP Performance Score Booster Settings', 'wp-performance-score-booster'), __('WP Performance Score Booster', 'wp-performance-score-booster'), 'manage_options', 'wp-performance-score-booster', 'wppsb_admin_options', plugins_url('assets/images/wppsb-icon-24x24.png', __FILE__) );
175
+ add_options_page( __('WP Performance Score Booster Settings', 'wp-performance-score-booster'), __('WP Performance Score Booster', 'wp-performance-score-booster'), 'manage_options', 'wp-performance-score-booster', 'wppsb_admin_options' );
176
+ }
177
+ ?>
assets/css/style.css CHANGED
@@ -1,5 +1,5 @@
1
  .wppsb_settings {
2
- font-size: 17px !important;
3
  }
4
  .wppsb_admin_dev_sidebar_div {
5
  width:300px;
@@ -23,7 +23,7 @@
23
  padding: 0 5px 0 0;
24
  vertical-align: middle;
25
  }
26
- .news_section {
27
  border-radius: 20px 20px 20px 0;
28
  border: 1px solid #FF9900;
29
  background-color: #FFFFFF;
@@ -31,52 +31,52 @@
31
  width: 98%;
32
  }
33
 
34
- a.rsswidget {
35
  font-size: 16px !important;
36
  text-decoration: none !important;
37
  }
38
- .rss-widget ul li {
39
  margin-bottom: 25px !important;
40
  }
41
 
42
- td.onoff {
43
  width: 75px;
44
- height: 50px;
45
  }
46
  /* ========= */
47
 
48
- .onoffswitch {
49
  position: relative; width: 70px;
50
  -webkit-user-select:none; -moz-user-select:none; -ms-user-select: none;
51
  }
52
- .onoffswitch-checkbox {
53
  display: none !important;
54
  }
55
- .onoffswitch-label {
56
  display: block; overflow: hidden; cursor: pointer;
57
  border: 2px solid #999999; border-radius: 20px;
58
  }
59
- .onoffswitch-inner {
60
  display: block; width: 200%; margin-left: -100%;
61
  transition: margin 0.3s ease-in 0s;
62
  }
63
- .onoffswitch-inner:before, .onoffswitch-inner:after {
64
  display: block; float: left; width: 50%; padding: 0; /* height: 30px; line-height: 30px; */ height: 22px; line-height: 22px;
65
  font-size: 15px; color: white; font-family: Trebuchet, Arial, sans-serif; font-weight: bold;
66
  box-sizing: border-box;
67
  }
68
- .onoffswitch-inner:before {
69
  content: "ON";
70
  padding-left: 10px;
71
  background-color: #5CA21E; color: #FFFFFF;
72
  }
73
- .onoffswitch-inner:after {
74
  content: "OFF";
75
  padding-right: 10px;
76
  background-color: #EEEEEE; color: #999999;
77
  text-align: right;
78
  }
79
- .onoffswitch-switch {
80
  display: block; /* width: 18px; */ width: 11px; margin: 6px;
81
  background: #FFFFFF;
82
  position: absolute; top: 0; bottom: 0;
@@ -84,9 +84,22 @@ td.onoff {
84
  border: 2px solid #999999; border-radius: 20px;
85
  transition: all 0.3s ease-in 0s;
86
  }
87
- .onoffswitch-checkbox:checked + .onoffswitch-label .onoffswitch-inner {
88
  margin-left: 0;
89
  }
90
- .onoffswitch-checkbox:checked + .onoffswitch-label .onoffswitch-switch {
91
  right: 0px;
 
 
 
 
 
 
 
 
 
 
 
 
 
92
  }
1
  .wppsb_settings {
2
+ font-size: 16px !important;
3
  }
4
  .wppsb_admin_dev_sidebar_div {
5
  width:300px;
23
  padding: 0 5px 0 0;
24
  vertical-align: middle;
25
  }
26
+ .wppsb_news_section {
27
  border-radius: 20px 20px 20px 0;
28
  border: 1px solid #FF9900;
29
  background-color: #FFFFFF;
31
  width: 98%;
32
  }
33
 
34
+ a.wppsb_rsswidget {
35
  font-size: 16px !important;
36
  text-decoration: none !important;
37
  }
38
+ .wppsb_rss-widget ul li {
39
  margin-bottom: 25px !important;
40
  }
41
 
42
+ td.wppsb_onoff {
43
  width: 75px;
44
+ height: 40px;
45
  }
46
  /* ========= */
47
 
48
+ .wppsb_onoffswitch {
49
  position: relative; width: 70px;
50
  -webkit-user-select:none; -moz-user-select:none; -ms-user-select: none;
51
  }
52
+ .wppsb_onoffswitch-checkbox {
53
  display: none !important;
54
  }
55
+ .wppsb_onoffswitch-label {
56
  display: block; overflow: hidden; cursor: pointer;
57
  border: 2px solid #999999; border-radius: 20px;
58
  }
59
+ .wppsb_onoffswitch-inner {
60
  display: block; width: 200%; margin-left: -100%;
61
  transition: margin 0.3s ease-in 0s;
62
  }
63
+ .wppsb_onoffswitch-inner:before, .wppsb_onoffswitch-inner:after {
64
  display: block; float: left; width: 50%; padding: 0; /* height: 30px; line-height: 30px; */ height: 22px; line-height: 22px;
65
  font-size: 15px; color: white; font-family: Trebuchet, Arial, sans-serif; font-weight: bold;
66
  box-sizing: border-box;
67
  }
68
+ .wppsb_onoffswitch-inner:before {
69
  content: "ON";
70
  padding-left: 10px;
71
  background-color: #5CA21E; color: #FFFFFF;
72
  }
73
+ .wppsb_onoffswitch-inner:after {
74
  content: "OFF";
75
  padding-right: 10px;
76
  background-color: #EEEEEE; color: #999999;
77
  text-align: right;
78
  }
79
+ .wppsb_onoffswitch-switch {
80
  display: block; /* width: 18px; */ width: 11px; margin: 6px;
81
  background: #FFFFFF;
82
  position: absolute; top: 0; bottom: 0;
84
  border: 2px solid #999999; border-radius: 20px;
85
  transition: all 0.3s ease-in 0s;
86
  }
87
+ .wppsb_onoffswitch-checkbox:checked + .wppsb_onoffswitch-label .wppsb_onoffswitch-inner {
88
  margin-left: 0;
89
  }
90
+ .wppsb_onoffswitch-checkbox:checked + .wppsb_onoffswitch-label .wppsb_onoffswitch-switch {
91
  right: 0px;
92
+ }
93
+ .wppsb_referrals {
94
+ background: #FFF;
95
+ width: 250px;
96
+ min-height: 270px;
97
+ border: 1px solid #CCC;
98
+ float: left;
99
+ padding: 15px;
100
+ position: relative;
101
+ margin: 32px 10px 10px 0;
102
+ color: #0073AA;
103
+ font-size: 14px;
104
+ line-height: 1.5;
105
  }
assets/css/style.min.css CHANGED
@@ -1 +1 @@
1
- .wppsb_settings{font-size:17px !important}.wppsb_admin_dev_sidebar_div{width:300px;height:255px;-webkit-border-radius:10px;-moz-border-radius:10px;border-radius:20px 20px 20px 0;border:1px solid #FF9900;background-color:#FFFFFF;padding:10px 10px 0 30px}.wppsb_admin_dev_sidebar{font-size:14px;margin:0 20px 10px 0;display:block}.wppsb_admin_dev_sidebar a{text-decoration:none}.wppsb_admin_dev_sidebar img{padding:0 5px 0 0;vertical-align:middle}.news_section{border-radius:20px 20px 20px 0;border:1px solid #FF9900;background-color:#FFFFFF;padding:20px 20px 20px 20px;width:98%}a.rsswidget{font-size:16px !important;text-decoration:none !important}.rss-widget ul li{margin-bottom:25px !important}td.onoff{width:75px;height:50px}.onoffswitch{position:relative;width:70px;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none}.onoffswitch-checkbox{display:none !important}.onoffswitch-label{display:block;overflow:hidden;cursor:pointer;border:2px solid #999999;border-radius:20px}.onoffswitch-inner{display:block;width:200%;margin-left:-100%;transition:margin 0.3s ease-in 0s}.onoffswitch-inner:before,.onoffswitch-inner:after{display:block;float:left;width:50%;padding:0;height:22px;line-height:22px;font-size:15px;color:white;font-family:Trebuchet, Arial, sans-serif;font-weight:bold;box-sizing:border-box}.onoffswitch-inner:before{content:"ON";padding-left:10px;background-color:#5CA21E;color:#FFFFFF}.onoffswitch-inner:after{content:"OFF";padding-right:10px;background-color:#EEEEEE;color:#999999;text-align:right}.onoffswitch-switch{display:block;width:11px;margin:6px;background:#FFFFFF;position:absolute;top:0;bottom:0;right:43px;border:2px solid #999999;border-radius:20px;transition:all 0.3s ease-in 0s}.onoffswitch-checkbox:checked + .onoffswitch-label .onoffswitch-inner{margin-left:0}.onoffswitch-checkbox:checked + .onoffswitch-label .onoffswitch-switch{right:0px}
1
+ .wppsb_settings{font-size:16px !important;}.wppsb_admin_dev_sidebar_div{width:300px;height:255px;-webkit-border-radius:10px;-moz-border-radius:10px;border-radius:20px 20px 20px 0;border:1px solid #FF9900;background-color:#FFFFFF;padding:10px 10px 0 30px}.wppsb_admin_dev_sidebar{font-size:14px;margin:0 20px 10px 0;display:block}.wppsb_admin_dev_sidebar a{text-decoration:none}.wppsb_admin_dev_sidebar img{padding:0 5px 0 0;vertical-align:middle}.wppsb_news_section{border-radius:20px 20px 20px 0;border:1px solid #FF9900;background-color:#FFFFFF;padding:20px 20px 20px 20px;width:98%}a.wppsb_rsswidget{font-size:16px !important;text-decoration:none !important}.wppsb_rss-widget ul li{margin-bottom:25px !important}td.wppsb_onoff{width:75px;height:40px}.wppsb_onoffswitch{position:relative;width:70px;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none}.wppsb_onoffswitch-checkbox{display:none !important}.wppsb_onoffswitch-label{display:block;overflow:hidden;cursor:pointer;border:2px solid #999999;border-radius:20px}.wppsb_onoffswitch-inner{display:block;width:200%;margin-left:-100%;transition:margin 0.3s ease-in 0s}.wppsb_onoffswitch-inner:before,.wppsb_onoffswitch-inner:after{display:block;float:left;width:50%;padding:0;height:22px;line-height:22px;font-size:15px;color:white;font-family:Trebuchet, Arial, sans-serif;font-weight:bold;box-sizing:border-box}.wppsb_onoffswitch-inner:before{content:"ON";padding-left:10px;background-color:#5CA21E;color:#FFFFFF}.wppsb_onoffswitch-inner:after{content:"OFF";padding-right:10px;background-color:#EEEEEE;color:#999999;text-align:right}.wppsb_onoffswitch-switch{display:block;width:11px;margin:6px;background:#FFFFFF;position:absolute;top:0;bottom:0;right:43px;border:2px solid #999999;border-radius:20px;transition:all 0.3s ease-in 0s}.wppsb_onoffswitch-checkbox:checked + .wppsb_onoffswitch-label .wppsb_onoffswitch-inner{margin-left:0}.wppsb_onoffswitch-checkbox:checked + .wppsb_onoffswitch-label .wppsb_onoffswitch-switch{right:0px} .wppsb_referrals{background:#FFF;width:250px;min-height:270px;border:1px solid #CCC;float:right;padding:15px;position:relative;margin:32px 10px 10px 0;color:#0073AA;font-size:14px;line-height:1.5}
data-processing.php ADDED
@@ -0,0 +1,133 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /* ========================================
3
+ Remove query strings from static content
4
+ ======================================== */
5
+ function wppsb_remove_query_strings_q( $src ) {
6
+ if(strpos( $src, '?ver=' ))
7
+ $src = remove_query_arg( 'ver', $src );
8
+ return $src;
9
+ }
10
+
11
+ // If 'Remove query strings" checkbox ticked, add filter otherwise remove filter
12
+ if (get_option('wppsb_remove_query_strings') == 'on') {
13
+ add_filter( 'script_loader_src', 'wppsb_remove_query_strings_q', 15, 1 );
14
+ add_filter( 'style_loader_src', 'wppsb_remove_query_strings_q', 15, 1 );
15
+ }
16
+ else {
17
+ remove_filter( 'script_loader_src', 'wppsb_remove_query_strings_q');
18
+ remove_filter( 'style_loader_src', 'wppsb_remove_query_strings_q');
19
+ }
20
+
21
+ /* ========================================
22
+ Enable GZIP Compression
23
+ ======================================== */
24
+ function wppsb_enable_gzip_filter( $rules = '' ) {
25
+ $gzip_htaccess_content = <<<EOD
26
+ \n## BEGIN GZIP Compression ##
27
+ <IfModule mod_deflate.c>
28
+ AddOutputFilterByType DEFLATE text/plain
29
+ AddOutputFilterByType DEFLATE text/html
30
+ AddOutputFilterByType DEFLATE text/xml
31
+ AddOutputFilterByType DEFLATE text/css
32
+ AddOutputFilterByType DEFLATE application/xml
33
+ AddOutputFilterByType DEFLATE application/xhtml+xml
34
+ AddOutputFilterByType DEFLATE application/rss+xml
35
+ AddOutputFilterByType DEFLATE application/javascript
36
+ AddOutputFilterByType DEFLATE application/x-javascript
37
+ AddOutputFilterByType DEFLATE application/x-httpd-php
38
+ AddOutputFilterByType DEFLATE application/x-httpd-fastphp
39
+ AddOutputFilterByType DEFLATE image/svg+xml
40
+ SetOutputFilter DEFLATE
41
+ </IfModule>
42
+ ## END GZIP Compression ##
43
+ EOD;
44
+ return $gzip_htaccess_content . $rules;
45
+ }
46
+
47
+ // Set Vary: Accept-Encoding Header (as a part of compression)
48
+ function wppsb_vary_accept_encoding_filter( $rules = '' ) {
49
+ $vary_accept_encoding_header = <<<EOD
50
+ \n## BEGIN Vary: Accept-Encoding Header ##
51
+ <IfModule mod_headers.c>
52
+ <FilesMatch "\.(js|css|xml|gz)$">
53
+ Header append Vary: Accept-Encoding
54
+ </FilesMatch>
55
+ </IfModule>
56
+ ## END Vary: Accept-Encoding Header ##
57
+ EOD;
58
+ return $vary_accept_encoding_header . $rules;
59
+ }
60
+
61
+ /* ================================================
62
+ Enable expire caching (Leverage browser caching)
63
+ ================================================ */
64
+ function wppsb_expire_caching_filter( $rules = '' ) {
65
+ $expire_cache_htaccess_content = <<<EOD
66
+ \n## BEGIN Leverage Browser Caching (Expires Caching) ##
67
+ <IfModule mod_expires.c>
68
+ ExpiresActive On
69
+ ExpiresByType text/css "access 1 month"
70
+ ExpiresByType text/html "access 1 month"
71
+ ExpiresByType image/jpg "access 1 year"
72
+ ExpiresByType image/jpeg "access 1 year"
73
+ ExpiresByType image/gif "access 1 year"
74
+ ExpiresByType image/png "access 1 year"
75
+ ExpiresByType image/x-icon "access 1 year"
76
+ ExpiresByType application/pdf "access 1 month"
77
+ ExpiresByType application/javascript "access 1 month"
78
+ ExpiresByType text/x-javascript "access 1 month"
79
+ ExpiresByType application/x-shockwave-flash "access 1 month"
80
+ ExpiresDefault "access 1 month"
81
+ </IfModule>
82
+ ## END Leverage Browser Caching (Expires Caching) ##
83
+ EOD;
84
+ return $expire_cache_htaccess_content . $rules;
85
+ }
86
+
87
+ function wppsb_disable_etag_filter( $rules = '' ) {
88
+ $disable_etag_header_content = <<<EOD
89
+ \n## BEGIN Disable ETag header ##
90
+ Header unset Pragma
91
+ Header unset ETag
92
+ FileETag None
93
+ ## END Disable ETag header ##
94
+ EOD;
95
+ return $disable_etag_header_content . $rules;
96
+ }
97
+
98
+ // Special thanks to Marin Atanasov ( https://github.com/tyxla ) for contributing this awesome function.
99
+ // Updates the htaccess file with the current rules if it is writable.
100
+ function wppsb_save_mod_rewrite_rules() {
101
+ if ( is_multisite() )
102
+ return;
103
+ global $wp_rewrite;
104
+ $home_path = get_home_path();
105
+ $htaccess_file = $home_path.'.htaccess';
106
+
107
+ /*
108
+ * If the file doesn't already exist check for write access to the directory
109
+ * and whether we have some rules. Else check for write access to the file.
110
+ */
111
+ if ((!file_exists($htaccess_file) && is_writable($home_path) && $wp_rewrite->using_mod_rewrite_permalinks()) || is_writable($htaccess_file)) {
112
+ if ( got_mod_rewrite() ) {
113
+ $rules = explode( "\n", $wp_rewrite->mod_rewrite_rules() );
114
+ $enable_gzip = 'wppsb_enable_gzip';
115
+ $expire_caching = 'wppsb_expire_caching';
116
+ $enable_gzip_val = get_option($enable_gzip);
117
+ $expire_caching_val = get_option($expire_caching);
118
+ $rules = array();
119
+ if ($enable_gzip_val == 'on') {
120
+ $rules = array_merge($rules, explode("\n", wppsb_enable_gzip_filter()));
121
+ $rules = array_merge($rules, explode("\n", wppsb_vary_accept_encoding_filter()));
122
+ }
123
+ if ($expire_caching_val == 'on') {
124
+ $rules = array_merge($rules, explode("\n", wppsb_expire_caching_filter()));
125
+ $rules = array_merge($rules, explode("\n", wppsb_disable_etag_filter()));
126
+ }
127
+
128
+ return insert_with_markers( $htaccess_file, 'WP Performance Score Booster Settings', $rules );
129
+ }
130
+ }
131
+ return false;
132
+ }
133
+ ?>
readme.txt CHANGED
@@ -3,8 +3,8 @@ 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.6
7
- Stable tag: 1.6
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
@@ -46,48 +46,50 @@ Pretty much, yeah.
46
  1. Admin Settings
47
 
48
  == Changelog ==
 
 
 
 
 
49
 
50
  = 1.6, July 26, 2016 =
51
- * Improved UI
52
- * Fixed minor bugs
53
- * Minified CSS
54
 
55
- = 1.5, Feb 02, 2016 =
56
- * Fixed conflict with Divi and Divi Builder
57
- * Moved Options / Settings under *'Settings'* menu
58
- * Added *'Settings'* option directly under plugins (installed plugins) page
59
- * Amended *'News and Updates'* section
60
 
61
- = 1.4, Feb 28, 2015 =
62
- * Added News and Updates section in admin options
63
 
64
- = 1.3.1, Dec 30, 2014 =
65
- * Fixed issues with htaccess causing internal server error
66
 
67
- = 1.3, Dec 29, 2014 =
68
- * Fixed issues with htaccess custom rules overrides
69
- * WP Performance Score Booster now adds rules to htaccess outside default WordPress block
70
 
71
- = 1.2.2, Dec 27, 2014 =
72
- * Added support for language translations
73
 
74
- = 1.2.1, Nov 17, 2014 =
75
- * Removed (temporarily) feature to enqueue scripts to footer
76
 
77
- = 1.2, Nov 17, 2014 =
78
- * Added feature to enqueue scripts to footer
79
- * Added support for Vary: Accept-Encoding header
80
- * Fixed minor issues for remove query strings from static resources
81
 
82
- = 1.1.1, Sept 02, 2014 =
83
- * Added feature (for urls with &ver) to remove query strings from static resources
84
 
85
- = 1.1, Aug 31, 2014 =
86
- * Added Admin Options / Settings
87
 
88
- = 1.0, Aug 26, 2014 =
89
- * Initial release
90
-
91
- == Upgrade Notice ==
92
- = 1.6 =
93
- This version has improved UI, minified CSS and fixes minor bugs.
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.7
7
+ Stable tag: 1.7
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
46
  1. Admin Settings
47
 
48
  == Changelog ==
49
+ = 1.7, September 15, 2016 =
50
+ * Fixed css conflict with WP Super Minify.
51
+ * Improved deactivation and uninstallation hooks.
52
+ * Organised file structure (custom MVC Skeleton).
53
+ * Added hosting recommendations.
54
 
55
  = 1.6, July 26, 2016 =
56
+ * Improved UI.
57
+ * Fixed minor bugs.
58
+ * Minified CSS.
59
 
60
+ = 1.5, February 02, 2016 =
61
+ * Fixed conflict with Divi and Divi Builder.
62
+ * Moved Options / Settings under *'Settings'* menu.
63
+ * Added *'Settings'* option directly under plugins (installed plugins) page.
64
+ * Amended *'News and Updates'* section.
65
 
66
+ = 1.4, February 28, 2015 =
67
+ * Added News and Updates section in admin options.
68
 
69
+ = 1.3.1, December 30, 2014 =
70
+ * Fixed issues with htaccess causing internal server error.
71
 
72
+ = 1.3, December 29, 2014 =
73
+ * Fixed issues with htaccess custom rules overrides.
74
+ * WP Performance Score Booster now adds rules to htaccess outside default WordPress block.
75
 
76
+ = 1.2.2, December 27, 2014 =
77
+ * Added support for language translations.
78
 
79
+ = 1.2.1, November 17, 2014 =
80
+ * Removed (temporarily) feature to enqueue scripts to footer.
81
 
82
+ = 1.2, November 17, 2014 =
83
+ * Added feature to enqueue scripts to footer.
84
+ * Added support for Vary: Accept-Encoding header.
85
+ * Fixed minor issues for remove query strings from static resources.
86
 
87
+ = 1.1.1, September 02, 2014 =
88
+ * Added feature (for urls with &ver) to remove query strings from static resources.
89
 
90
+ = 1.1, August 31, 2014 =
91
+ * Added Admin Options / Settings.
92
 
93
+ = 1.0, August 26, 2014 =
94
+ * Initial release.
95
+ * Born of WP Performance Score Booster.
 
 
 
wp-performance-score-booster.php CHANGED
@@ -3,23 +3,34 @@
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.6
7
  Author: Dipak C. Gajjar
8
  Author URI: https://dipakgajjar.com
9
  Text Domain: wp-performance-score-booster
10
  */
11
 
 
 
12
  // Define plugin version for future releases
13
  if (!defined('WPPSB_PLUGIN_VERSION')) {
14
  define('WPPSB_PLUGIN_VERSION', 'wppsb_plugin_version');
15
  }
16
  if (!defined('WPPSB_PLUGIN_VERSION_NUM')) {
17
- define('WPPSB_PLUGIN_VERSION_NUM', '1.6');
18
  }
19
  update_option(WPPSB_PLUGIN_VERSION, WPPSB_PLUGIN_VERSION_NUM);
20
 
 
 
 
 
 
 
 
 
 
 
21
  // Load plugin textdomain for language trnaslation
22
- // load_plugin_textdomain( 'wp-performance-score-booster', false, dirname( plugin_basename( __FILE__ ) ) . '/languages/' );
23
  function wppsb_load_plugin_textdomain() {
24
 
25
  $domain = 'wp-performance-score-booster';
@@ -33,260 +44,6 @@ function wppsb_load_plugin_textdomain() {
33
  }
34
  add_action( 'init', 'wppsb_load_plugin_textdomain' );
35
 
36
- // Register with hook 'wp_enqueue_scripts', which can be used for front end CSS and JavaScript
37
- add_action( 'admin_init', 'wppsb_add_stylesheet' );
38
- function wppsb_add_stylesheet() {
39
- // Respects SSL, Style.css is relative to the current file
40
- wp_register_style( 'wppsb-stylesheet', plugins_url('assets/css/style.min.css', __FILE__) );
41
- wp_enqueue_style( 'wppsb-stylesheet' );
42
- }
43
-
44
- // Remove query strings from static content
45
- function wppsb_remove_query_strings_q( $src ) {
46
- if(strpos( $src, '?ver=' ))
47
- $src = remove_query_arg( 'ver', $src );
48
- return $src;
49
- }
50
-
51
- // Enable GZIP Compression
52
- function wppsb_enable_gzip_filter( $rules = '' ) {
53
- $gzip_htaccess_content = <<<EOD
54
- \n## BEGIN Enable GZIP Compression ##
55
- <IfModule mod_deflate.c>
56
- AddOutputFilterByType DEFLATE text/plain
57
- AddOutputFilterByType DEFLATE text/html
58
- AddOutputFilterByType DEFLATE text/xml
59
- AddOutputFilterByType DEFLATE text/css
60
- AddOutputFilterByType DEFLATE application/xml
61
- AddOutputFilterByType DEFLATE application/xhtml+xml
62
- AddOutputFilterByType DEFLATE application/rss+xml
63
- AddOutputFilterByType DEFLATE application/javascript
64
- AddOutputFilterByType DEFLATE application/x-javascript
65
- AddOutputFilterByType DEFLATE application/x-httpd-php
66
- AddOutputFilterByType DEFLATE application/x-httpd-fastphp
67
- AddOutputFilterByType DEFLATE image/svg+xml
68
- SetOutputFilter DEFLATE
69
- </IfModule>
70
- ## END Enable GZIP Compression ##\n
71
- EOD;
72
- return $gzip_htaccess_content . $rules;
73
- }
74
-
75
- // Enable expire caching (Leverage browser caching)
76
- function wppsb_expire_caching_filter( $rules = '' ) {
77
- $expire_cache_htaccess_content = <<<EOD
78
- \n## BEGIN Expires Caching (Leverage Browser Caching) ##
79
- <IfModule mod_expires.c>
80
- ExpiresActive On
81
- ExpiresByType image/jpg "access 2 week"
82
- ExpiresByType image/jpeg "access 2 week"
83
- ExpiresByType image/gif "access 2 week"
84
- ExpiresByType image/png "access 2 week"
85
- ExpiresByType text/css "access 2 week"
86
- ExpiresByType application/pdf "access 2 week"
87
- ExpiresByType text/x-javascript "access 2 week"
88
- ExpiresByType application/x-shockwave-flash "access 2 week"
89
- ExpiresByType image/x-icon "access 2 week"
90
- ExpiresDefault "access 2 week"
91
- </IfModule>
92
- ## END Expires Caching (Leverage Browser Caching) ##\n
93
- EOD;
94
- return $expire_cache_htaccess_content . $rules;
95
- }
96
-
97
- // Set Vary: Accept-Encoding Header
98
- function wppsb_vary_accept_encoding_filter( $rules = '' ) {
99
- $vary_accept_encoding_header = <<<EOD
100
- \n## BEGIN Vary: Accept-Encoding Header ##
101
- <IfModule mod_headers.c>
102
- <FilesMatch "\.(js|css|xml|gz)$">
103
- Header append Vary: Accept-Encoding
104
- </FilesMatch>
105
- </IfModule>
106
- ## END Vary: Accept-Encoding Header ##\n
107
- EOD;
108
- return $vary_accept_encoding_header . $rules;
109
- }
110
-
111
- // If 'Remove query strings" checkbox ticked, add filter otherwise remove filter
112
- if (get_option('wppsb_remove_query_strings') == 'on') {
113
- add_filter( 'script_loader_src', 'wppsb_remove_query_strings_q', 15, 1 );
114
- add_filter( 'style_loader_src', 'wppsb_remove_query_strings_q', 15, 1 );
115
- }
116
- else {
117
- remove_filter( 'script_loader_src', 'wppsb_remove_query_strings_q');
118
- remove_filter( 'style_loader_src', 'wppsb_remove_query_strings_q');
119
- }
120
-
121
- function wppsb_admin_options() {
122
- ?>
123
- <div class="wrap">
124
- <table width="100%" border="0">
125
- <tr>
126
- <td width="75%">
127
- <h2><?php echo '<img src="' . plugins_url( 'assets/images/wppsb-icon-24x24.png' , __FILE__ ) . '" > '; ?> <?php _e('WP Performance Score Booster Settings', 'wp-performance-score-booster'); ?></h2>
128
- <hr />
129
- <?php
130
- if ( !current_user_can( 'manage_options' ) ) {
131
- wp_die( __('You do not have sufficient permissions to access this page.') );
132
- }
133
-
134
- // Variables for the field and option names
135
- $hidden_field_name = 'wppsb_submit_hidden';
136
- $remove_query_strings = 'wppsb_remove_query_strings';
137
- $enable_gzip = 'wppsb_enable_gzip';
138
- $expire_caching = 'wppsb_expire_caching';
139
-
140
- // Read in existing option value from database
141
- $remove_query_strings_val = get_option($remove_query_strings);
142
- $enable_gzip_val = get_option($enable_gzip);
143
- $expire_caching_val = get_option($expire_caching);
144
-
145
- // See if the user has posted us some information
146
- // If they did, this hidden field will be set to 'Y'
147
- if( isset($_POST[$hidden_field_name]) && $_POST[$hidden_field_name] == 'Y' ) {
148
- // Read their posted value
149
- $remove_query_strings_val = (isset($_POST[$remove_query_strings]) ? $_POST[$remove_query_strings] : "");
150
- $enable_gzip_val = (isset($_POST[$enable_gzip]) ? $_POST[$enable_gzip] : "");
151
- $expire_caching_val = (isset($_POST[$expire_caching]) ? $_POST[$expire_caching] : "");
152
-
153
- // Save the posted value in the database
154
- update_option( $remove_query_strings, $remove_query_strings_val );
155
- update_option( $enable_gzip, $enable_gzip_val );
156
- update_option( $expire_caching, $expire_caching_val );
157
-
158
- flush_rewrite_rules();
159
- wppsb_save_mod_rewrite_rules();
160
-
161
- // Put the settings updated message on the screen
162
- ?>
163
- <div class="updated"><p><strong><?php _e('<strong>Settings Saved.</strong>', 'wp-performance-score-booster'); ?></strong></p></div>
164
- <?php
165
- }
166
- ?>
167
- <form method="post" name="options_form">
168
- <input type="hidden" name="<?php echo $hidden_field_name; ?>" value="Y">
169
- <table>
170
- <!-- Remove Query String -->
171
- <tr> <td class="onoff">
172
- <div class="onoffswitch">
173
- <input type="checkbox" name="<?php echo $remove_query_strings; ?>" <?php checked( $remove_query_strings_val == 'on',true); ?> class="onoffswitch-checkbox" id="<?php echo $remove_query_strings; ?>" />
174
- <label class="onoffswitch-label" for="<?php echo $remove_query_strings; ?>">
175
- <span class="onoffswitch-inner"></span>
176
- <span class="onoffswitch-switch"></span>
177
- </label>
178
- </div>
179
- </td> <td>
180
- <span class="wppsb_settings" style="display: inline;"> <?php _e('Remove query strings from static content', 'wp-performance-score-booster'); ?> </span>
181
- </td> </tr>
182
-
183
- <!-- Enable GZIP -->
184
- <tr>
185
- <?php if (function_exists('ob_gzhandler') || ini_get('zlib.output_compression')) { // if web server supports GZIP ?>
186
- <td class="onoff">
187
- <div class="onoffswitch">
188
- <input type="checkbox" name="<?php echo $enable_gzip; ?>" <?php checked( $enable_gzip_val == 'on',true); ?> class="onoffswitch-checkbox" id="<?php echo $enable_gzip; ?>" />
189
- <label class="onoffswitch-label" for="<?php echo $enable_gzip; ?>">
190
- <span class="onoffswitch-inner"></span>
191
- <span class="onoffswitch-switch"></span>
192
- </label>
193
- </div>
194
- </td> <td>
195
- <span class="wppsb_settings"> <?php _e('Enable GZIP compression <i>(compress text, html, javascript, css, xml and so on)</i>', 'wp-performance-score-booster'); ?> </span>
196
- </td>
197
- <?php }
198
- else { // if web server doesn't support GZIP ?>
199
- <td class="onoff">
200
- <div class="onoffswitch">
201
- <input type="checkbox" name="<?php echo $enable_gzip; ?>" disabled="true" <?php checked( $enable_gzip_val == 'on',true); ?> class="onoffswitch-checkbox" id="<?php echo $enable_gzip; ?>" />
202
- <label class="onoffswitch-label" for="<?php echo $enable_gzip; ?>">
203
- <span class="onoffswitch-inner"></span>
204
- <span class="onoffswitch-switch"></span>
205
- </label>
206
- </div>
207
- </td> <td>
208
- <span class="wppsb_settings"> <?php _e('Enable GZIP compression <i>(compress text, html, javascript, css, xml and so on)</i>', 'wp-performance-score-booster'); ?> </span> <br />
209
- <span class="wppsb_settings" style="color:RED; font-style: italic;"> <?php _e('Your web server does not support GZIP compression. Contact your hosting provider to enable it.', 'wp-performance-score-booster'); ?> </span>
210
- </td>
211
- <?php } ?>
212
- </tr>
213
-
214
- <!-- Leverage Browser Caching -->
215
- <tr> <td class="onoff">
216
- <div class="onoffswitch">
217
- <input type="checkbox" name="<?php echo $expire_caching; ?>" <?php checked( $expire_caching_val == 'on',true); ?> class="onoffswitch-checkbox" id="<?php echo $expire_caching; ?>" />
218
- <label class="onoffswitch-label" for="<?php echo $expire_caching; ?>">
219
- <span class="onoffswitch-inner"></span>
220
- <span class="onoffswitch-switch"></span>
221
- </label>
222
- </div>
223
- </td> <td>
224
- <span class="wppsb_settings"> <?php _e('Leverage Browser Caching <i>(set expire caching)</i>', 'wp-performance-score-booster'); ?> </span>
225
- </td> </tr>
226
- </table>
227
- <p><input style="font-size: 15px; color: white; font-weight: bold;" type="submit" value="<?php esc_attr_e('Save Changes', 'wp-performance-score-booster'); ?>" class="button button-primary" name="submit" /></p>
228
- </form>
229
- </td>
230
- <td style="text-align: left;">
231
- <div class="wppsb_admin_dev_sidebar_div">
232
- <!-- <img src="//www.gravatar.com/avatar/38b380cf488d8f8c4007cf2015dc16ac.jpg" width="100px" height="100px" /> <br /> -->
233
- <br />
234
- <span class="wppsb_admin_dev_sidebar"> <?php echo '<img src="' . plugins_url( 'assets/images/wppsb-support-this-16x16.png' , __FILE__ ) . '" > '; ?> <a href="https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=3S8BRPLWLNQ38" target="_blank"> <?php _e('Donate and support this plugin', 'wp-performance-score-booster'); ?> </a> </span>
235
- <span class="wppsb_admin_dev_sidebar"> <?php echo '<img src="' . plugins_url( 'assets/images/wppsb-rate-this-16x16.png' , __FILE__ ) . '" > '; ?> <a href="http://wordpress.org/support/view/plugin-reviews/wp-performance-score-booster" target="_blank"> <?php _e('Rate this plugin on WordPress.org', 'wp-performance-score-booster'); ?> </a> </span>
236
- <span class="wppsb_admin_dev_sidebar"> <?php echo '<img src="' . plugins_url( 'assets/images/wppsb-wordpress-16x16.png' , __FILE__ ) . '" > '; ?> <a href="http://wordpress.org/support/plugin/wp-performance-score-booster" target="_blank"> <?php _e('Get support on WordPress.org', 'wp-performance-score-booster'); ?> </a> </span>
237
- <span class="wppsb_admin_dev_sidebar"> <?php echo '<img src="' . plugins_url( 'assets/images/wppsb-github-16x16.png' , __FILE__ ) . '" > '; ?> <a href="https://github.com/dipakcg/wp-performance-score-booster" target="_blank"> <?php _e('Contribute development on GitHub', 'wp-performance-score-booster'); ?> </a> </span>
238
- <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"> <?php _e('Get my other plugins', 'wp-performance-score-booster'); ?> </a> </span>
239
- <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>
240
- <br />
241
- <span class="wppsb_admin_dev_sidebar" style="float: right;"> <?php _e('Version:', 'wp-performance-score-booster'); ?> <strong> <?php echo get_option('wppsb_plugin_version'); ?> </strong> </span>
242
- </div>
243
- </td>
244
- </tr>
245
- </table>
246
- </div>
247
- <hr style="margin: 2em 0 1.5em 0;" />
248
- <?php
249
- // Promo - Ad contents
250
- $promo_content = wp_remote_fopen("https://dl.dropboxusercontent.com/u/21966579/promos.html");
251
- echo $promo_content;
252
- ?>
253
- <?php // Bottom - News and Tweets part ?>
254
- <hr style="margin: 1.5em 0 2em 0;" />
255
- <table cellspacing="0" cellpadding="0" class="news_section"> <tr>
256
- <!-- News and Updates -->
257
- <td width="50%" valign="top">
258
- <h2><strong>News & Updates from Dipak C. Gajjar</strong></h2>
259
- <hr />
260
- <div class="rss-widget">
261
- <?php
262
- /* wp_widget_rss_output(array(
263
- 'url' => 'https://dipakgajjar.com/category/news/feed/?refresh='.rand(10,100).'', // feed URL
264
- 'title' => 'News & Updates from Dipak C. Gajjar',
265
- 'items' => 3, // nubmer of posts to display
266
- 'show_summary' => 1,
267
- 'show_author' => 0,
268
- 'show_date' => 0
269
- )); */
270
- /* Load the news content from Dropbox url */
271
- $news_content = wp_remote_fopen("https://dl.dropboxusercontent.com/u/21966579/news-and-updates.html");
272
- echo $news_content;
273
- ?>
274
- </div> </td>
275
- <!-- Tweets -->
276
- <td width="5%"> &nbsp </td>
277
- <td valign="top">
278
- <a class="twitter-timeline" data-dnt="true" href="https://twitter.com/dipakcgajjar" data-widget-id="547661367281729536">Tweets by @dipakcgajjar</a>
279
- <script>!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0],p=/^http:/.test(d.location)?'http':'https';if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src=p+"://platform.twitter.com/widgets.js";fjs.parentNode.insertBefore(js,fjs);}}(document,"script","twitter-wjs");</script>
280
- <?php echo '</td> </tr> </table>';
281
- }
282
-
283
- // Register admin menu
284
- add_action( 'admin_menu', 'wppsb_add_admin_menu' );
285
- function wppsb_add_admin_menu() {
286
- // add_menu_page( __('WP Performance Score Booster Settings', 'wp-performance-score-booster'), __('WP Performance Score Booster', 'wp-performance-score-booster'), 'manage_options', 'wp-performance-score-booster', 'wppsb_admin_options', plugins_url('assets/images/wppsb-icon-24x24.png', __FILE__) );
287
- add_options_page( __('WP Performance Score Booster Settings', 'wp-performance-score-booster'), __('WP Performance Score Booster', 'wp-performance-score-booster'), 'manage_options', 'wp-performance-score-booster', 'wppsb_admin_options' );
288
- }
289
-
290
  // Add settings link on plugin page
291
  function dcg_settings_link($links) {
292
  // $settings_link = '<a href="admin.php?page=wp-performance-score-booster">Settings</a>';
@@ -297,6 +54,28 @@ function dcg_settings_link($links) {
297
  $plugin = plugin_basename(__FILE__);
298
  add_filter("plugin_action_links_$plugin", 'dcg_settings_link' );
299
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
300
  // Add header
301
  function wppsb_add_header() {
302
  // Get the plugin version from options (in the database)
@@ -328,53 +107,28 @@ function wppsb_activate_plugin() {
328
 
329
  flush_rewrite_rules();
330
  wppsb_save_mod_rewrite_rules();
 
 
331
  }
332
  register_activation_hook( __FILE__, 'wppsb_activate_plugin' );
333
 
334
  // Remove filters/functions on plugin deactivation
335
  function wppsb_deactivate_plugin() {
336
  delete_option( 'wppsb_plugin_version' );
 
 
 
 
337
 
338
  flush_rewrite_rules();
339
  wppsb_save_mod_rewrite_rules();
340
  }
341
  register_deactivation_hook( __FILE__, 'wppsb_deactivate_plugin' );
342
 
343
- // Special thanks to Marin Atanasov ( https://github.com/tyxla ) for contributing this awesome function.
344
- // Updates the htaccess file with the current rules if it is writable.
345
- function wppsb_save_mod_rewrite_rules() {
346
- if ( is_multisite() )
347
- return;
348
- global $wp_rewrite;
349
- $home_path = get_home_path();
350
- $htaccess_file = $home_path.'.htaccess';
351
- /*
352
- * If the file doesn't already exist check for write access to the directory
353
- * and whether we have some rules. Else check for write access to the file.
354
- */
355
- if ((!file_exists($htaccess_file) && is_writable($home_path) && $wp_rewrite->using_mod_rewrite_permalinks()) || is_writable($htaccess_file)) {
356
- if ( got_mod_rewrite() ) {
357
- $rules = explode( "\n", $wp_rewrite->mod_rewrite_rules() );
358
- // $remove_query_strings = 'wppsb_remove_query_strings';
359
- $enable_gzip = 'wppsb_enable_gzip';
360
- $expire_caching = 'wppsb_expire_caching';
361
- // $remove_query_strings_val = get_option($remove_query_strings);
362
- $enable_gzip_val = get_option($enable_gzip);
363
- $expire_caching_val = get_option($expire_caching);
364
- $rules = array();
365
- if ($enable_gzip_val == 'on') {
366
- $rules = array_merge($rules, explode("\n", wppsb_enable_gzip_filter()));
367
- $rules = array_merge($rules, explode("\n", wppsb_vary_accept_encoding_filter()));
368
- }
369
- // If 'Expire caching" checkbox ticked, add filter otherwise remove filter
370
- if ($expire_caching_val == 'on') {
371
- $rules = array_merge($rules, explode("\n", wppsb_expire_caching_filter()));
372
- }
373
- return insert_with_markers( $htaccess_file, 'WP Performance Score Booster Settings', $rules );
374
- }
375
- }
376
- return false;
377
  }
378
-
379
- /* End of plugin */
380
  ?>
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
7
  Author: Dipak C. Gajjar
8
  Author URI: https://dipakgajjar.com
9
  Text Domain: wp-performance-score-booster
10
  */
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');
20
  }
21
  update_option(WPPSB_PLUGIN_VERSION, WPPSB_PLUGIN_VERSION_NUM);
22
 
23
+ /* Plugin Path */
24
+ define( 'WPPSB_PATH', WP_PLUGIN_DIR . '/' . basename( dirname( __FILE__ ) ) );
25
+ /* Plugin 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.
32
+
33
  // Load plugin textdomain for language trnaslation
 
34
  function wppsb_load_plugin_textdomain() {
35
 
36
  $domain = 'wp-performance-score-booster';
44
  }
45
  add_action( 'init', 'wppsb_load_plugin_textdomain' );
46
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
47
  // Add settings link on plugin page
48
  function dcg_settings_link($links) {
49
  // $settings_link = '<a href="admin.php?page=wp-performance-score-booster">Settings</a>';
54
  $plugin = plugin_basename(__FILE__);
55
  add_filter("plugin_action_links_$plugin", 'dcg_settings_link' );
56
 
57
+ // Adding WordPress plugin meta links
58
+ function wppsb_plugin_meta_links( $links, $file ) {
59
+ $plugin = plugin_basename(__FILE__);
60
+ // Create link
61
+ if ( $file == $plugin ) {
62
+ return array_merge(
63
+ $links,
64
+ array( '<a href="https://dipakgajjar.com/products/wordpress-speed-optimisation-service?utm_source=plugins%20page&utm_medium=text%20link&utm_campaign=wordplress%20plugins" style="color:#FF0000;" target="_blank">Order WordPress Speed Optimisation Service</a>' )
65
+ );
66
+ }
67
+ return $links;
68
+ }
69
+ add_filter( 'plugin_row_meta', 'wppsb_plugin_meta_links', 10, 2 );
70
+
71
+ // Register with hook 'wp_enqueue_scripts', which can be used for front end CSS and JavaScript
72
+ add_action( 'admin_init', 'wppsb_add_stylesheet' );
73
+ function wppsb_add_stylesheet() {
74
+ // Respects SSL, style.css is relative to the current file
75
+ wp_register_style( 'wppsb-stylesheet', WPPSB_URL . '/assets/css/style.min.css' );
76
+ wp_enqueue_style( 'wppsb-stylesheet' );
77
+ }
78
+
79
  // Add header
80
  function wppsb_add_header() {
81
  // Get the plugin version from options (in the database)
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', "" );
121
+ update_option( 'wppsb_expire_caching', "" );
122
 
123
  flush_rewrite_rules();
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
  ?>