WP Performance Score Booster - Version 1.9.2

Version Description

Download this release

Release Info

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

Code changes from version 1.9.1 to 1.9.2

Files changed (3) hide show
  1. readme.txt +6 -1
  2. uninstall.php +2 -0
  3. wp-performance-score-booster.php +72 -33
readme.txt CHANGED
@@ -4,7 +4,7 @@ Tags: performance, speed, gzip, booster, query string
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.9
7
- Stable tag: 1.9.1
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
@@ -58,6 +58,11 @@ Alternatively, you can open a [support thread](http://wordpress.org/support/plug
58
  1. Admin Settings
59
 
60
  == Changelog ==
 
 
 
 
 
61
  = 1.9.1, May 02, 2017 =
62
  * Added Review Plugin - admin notice
63
  * Improved Recommendations tab
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.9
7
+ Stable tag: 1.9.2
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
58
  1. Admin Settings
59
 
60
  == Changelog ==
61
+ = 1.9.2, May 11, 2017 =
62
+ * Fixed bug with Review Plugin notice.
63
+ * - Review Plugin notice is now dismissible (permanently) when a user click the (X) on the top right.
64
+ * Improved user experience (by implementing jQuery - Ajax calls).
65
+
66
  = 1.9.1, May 02, 2017 =
67
  * Added Review Plugin - admin notice
68
  * Improved Recommendations tab
uninstall.php CHANGED
@@ -5,6 +5,8 @@ delete_option( 'wppsb_plugin_version' );
5
  delete_option( 'wppsb_remove_query_strings' );
6
  delete_option( 'wppsb_enable_gzip' );
7
  delete_option( 'wppsb_expire_caching' );
 
 
8
 
9
  // Delete .htaccess backups (including backup storage page directory)
10
  delete_storage_dir( get_home_path() . 'wp-content/wp-performance-score-booster');
5
  delete_option( 'wppsb_remove_query_strings' );
6
  delete_option( 'wppsb_enable_gzip' );
7
  delete_option( 'wppsb_expire_caching' );
8
+ delete_option( 'wppsb_review_notice' );
9
+ delete_option( 'wppsb_activation_date' );
10
 
11
  // Delete .htaccess backups (including backup storage page directory)
12
  delete_storage_dir( get_home_path() . 'wp-content/wp-performance-score-booster');
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.9.1
7
  Author: Dipak C. Gajjar
8
  Author URI: https://dipakgajjar.com
9
  Text Domain: wp-performance-score-booster
@@ -16,7 +16,7 @@ include_once ( ABSPATH . 'wp-admin/includes/plugin.php' ); // to is_plugin_activ
16
 
17
  // Define plugin version for future releases
18
  if (!defined('WPPSB_PLUGIN_VERSION')) {
19
- define('WPPSB_PLUGIN_VERSION', '1.9.1');
20
  }
21
 
22
  define( 'WPPSB_PATH', WP_PLUGIN_DIR . '/' . basename( dirname( __FILE__ ) ) ); // plugin Path
@@ -59,24 +59,22 @@ function wppsb_master_admin_init () {
59
 
60
  /* BEGIN : Rate this plugin on wordpress */
61
  // check for admin notice dismissal
62
- if ( isset( $_GET['wppsb-already-reviewed'] ) ) {
63
  update_option( 'wppsb_review_notice', "" );
64
  }
65
 
66
- // display admin notice after 7 days if clicked 'May be later'
67
- if ( isset( $_GET['wppsb-review-later'] ) ) {
68
  update_option( 'wppsb_review_notice', "" );
69
- $now = strtotime( "now" );
70
- add_option( 'wppsb_activation_date', $now );
71
  }
72
 
73
  $install_date = get_option( 'wppsb_activation_date' );
74
- $past_date = strtotime( '-10 days' );
75
 
76
  if ( $past_date >= $install_date ) {
77
  update_option( 'wppsb_review_notice', "on" );
78
- $now = strtotime( "now" );
79
- update_option( 'wppsb_activation_date', $now );
80
  }
81
  /* END : Rate this plugin on wordpress */
82
  }
@@ -177,10 +175,7 @@ function wppsb_activate_plugin() {
177
  // set_transient( 'wppsb_submit_review_transient', true, 360 );
178
 
179
  // Rate this plugin on wordpress - check for admin notice dismissal
180
- if ( FALSE !== get_option( 'wppsb_review_notice' ) ) {
181
- update_option( 'wppsb_review_notice', "on" );
182
- }
183
- else {
184
  add_option( 'wppsb_review_notice', "on" );
185
  }
186
 
@@ -213,35 +208,79 @@ add_action( 'admin_notices', 'wppsb_submit_review_notice' );
213
  function wppsb_submit_review_notice() {
214
  global $wppsb_plugin_version;
215
 
216
- /* Display review plugin notice if plugin updated and plugin version is older than 1.9.1.
217
- This will help boosting plugin review for older installs */
218
- if ( isset( $_GET['update-applied'] ) && $_GET['update-applied'] == 'true' && $wppsb_plugin_version <= "1.9.1" ) {
219
- if ( !isset( $_GET['wppsb-already-reviewed'] ) && !isset( $_GET['wppsb-review-later'] ) ) { // if url doesn't contain wppsb-already-reviewed and review-later string
220
- if ( FALSE !== get_option('wppsb_review_notice' ) ) {
221
- update_option( 'wppsb_review_notice', "on" );
222
- }
223
  }
224
  }
225
 
226
  /* Check transient that's been set on plugin activation or check if user has already submitted review */
227
  // if( get_transient( 'wppsb_submit_review_transient' ) || !get_user_meta( $user_id, 'wppsb_submit_review_dismissed' ) ) {
228
- if( FALSE !== get_option( 'wppsb_review_notice') && get_option( 'wppsb_review_notice' ) == "on" ) {
229
 
230
  $notice_contents = "<p> Thank you for using <strong>WP Performance Score Booster</strong>. </p>";
231
  $notice_contents .= "<p> Could you please do me a BIG favour and give this plugin a 5-star rating on WordPress? It will help me spread the word and boost my motivation. — Dipak C. Gajjar </p>";
232
- $notice_contents .= "<p> <a href=\"//wordpress.org/support/plugin/wp-performance-score-booster/reviews/?rate=5#new-post\" target=\"_blank\" style=\"font-weight: bold;\">Yes, you deserve it</a> <br /> <a href=\"#\" id=\"willReviewLater\" style=\"font-weight: bold;\">May be later</a> <br /> <a href=\"#\" id=\"alredyReviewed\" style=\"font-weight: bold; cursor: hand;\">I already did it</a> </p>";
233
  ?>
234
- <div class="notice notice-info is-dismissible"> <?php _e($notice_contents, 'wp-performance-score-booster'); ?> </div>
235
- <script>
236
- jQuery("#alredyReviewed").on('click', function() {
237
- var loc = location.href;
238
- loc += loc.indexOf("?") === -1 ? "?" : "&";
239
- location.href = loc + "wppsb-already-reviewed";
240
- });
241
- jQuery("#willReviewLater").on('click', function() {
242
  var loc = location.href;
243
- loc += loc.indexOf("?") === -1 ? "?" : "&";
244
- location.href = loc + "wppsb-review-later";
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
245
  });
246
  </script>
247
  <?php
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.9.2
7
  Author: Dipak C. Gajjar
8
  Author URI: https://dipakgajjar.com
9
  Text Domain: wp-performance-score-booster
16
 
17
  // Define plugin version for future releases
18
  if (!defined('WPPSB_PLUGIN_VERSION')) {
19
+ define('WPPSB_PLUGIN_VERSION', '1.9.2');
20
  }
21
 
22
  define( 'WPPSB_PATH', WP_PLUGIN_DIR . '/' . basename( dirname( __FILE__ ) ) ); // plugin Path
59
 
60
  /* BEGIN : Rate this plugin on wordpress */
61
  // check for admin notice dismissal
62
+ if ( isset( $_POST['wppsb-already-reviewed'] ) ) {
63
  update_option( 'wppsb_review_notice', "" );
64
  }
65
 
66
+ // display admin notice after 30 days if clicked 'May be later'
67
+ if ( isset( $_POST['wppsb-review-later'] ) ) {
68
  update_option( 'wppsb_review_notice', "" );
69
+ update_option( 'wppsb_activation_date', strtotime( "now" ) );
 
70
  }
71
 
72
  $install_date = get_option( 'wppsb_activation_date' );
73
+ $past_date = strtotime( '-30 days' );
74
 
75
  if ( $past_date >= $install_date ) {
76
  update_option( 'wppsb_review_notice', "on" );
77
+ delete_option( 'wppsb_activation_date' );
 
78
  }
79
  /* END : Rate this plugin on wordpress */
80
  }
175
  // set_transient( 'wppsb_submit_review_transient', true, 360 );
176
 
177
  // Rate this plugin on wordpress - check for admin notice dismissal
178
+ if ( FALSE === get_option( 'wppsb_review_notice' ) ) {
 
 
 
179
  add_option( 'wppsb_review_notice', "on" );
180
  }
181
 
208
  function wppsb_submit_review_notice() {
209
  global $wppsb_plugin_version;
210
 
211
+ /* Display review plugin notice if plugin updated */
212
+ // only applies to older versions of the plugin (older than 1.9.1) where option isn't set
213
+ if ( isset( $_GET['update-applied'] ) && $_GET['update-applied'] == 'true' ) {
214
+ if ( FALSE === get_option('wppsb_review_notice' ) ) {
215
+ update_option( 'wppsb_review_notice', "on" );
 
 
216
  }
217
  }
218
 
219
  /* Check transient that's been set on plugin activation or check if user has already submitted review */
220
  // if( get_transient( 'wppsb_submit_review_transient' ) || !get_user_meta( $user_id, 'wppsb_submit_review_dismissed' ) ) {
221
+ if( get_option( 'wppsb_review_notice') && get_option( 'wppsb_review_notice' ) == "on" ) {
222
 
223
  $notice_contents = "<p> Thank you for using <strong>WP Performance Score Booster</strong>. </p>";
224
  $notice_contents .= "<p> Could you please do me a BIG favour and give this plugin a 5-star rating on WordPress? It will help me spread the word and boost my motivation. — Dipak C. Gajjar </p>";
225
+ $notice_contents .= "<p> <a href=\"#\"id=\"letMeReview\" class=\"button button-primary\">Yes, you deserve it</a> &nbsp; <a href=\"#\" id=\"willReviewLater\" class=\"button button-primary\">May be later</a> &nbsp; <a href=\"#\" id=\"alredyReviewed\" class=\"button button-primary\">I already did it</a> </p>";
226
  ?>
227
+ <div class="notice notice-info is-dismissible" id="wppsb-review-notice"> <?php _e($notice_contents, 'wp-performance-score-booster'); ?> </div>
228
+ <script type="text/javascript">
229
+ // set jQuery in noConflict mode. This helps to mitigate conflicts between jQuery scripts. jQuery conflicts are all too common with themes and plugins.
230
+ var $j = jQuery.noConflict();
231
+ $j(document).ready( function() {
 
 
 
232
  var loc = location.href;
233
+ // loc += loc.indexOf("?") === -1 ? "?" : "&";
234
+
235
+ $j("#letMeReview").on('click', function() {
236
+ /*jQuery('.notice').slideUp("slow", function(){;
237
+ window.open("//wordpress.org/support/plugin/wp-performance-score-booster/reviews/?rate=5#new-post", "_blank");
238
+ });*/
239
+ $j('.notice').slideUp();
240
+ $j.ajax({
241
+ url: loc,
242
+ type: 'POST',
243
+ data: {
244
+ "wppsb-review-later": ''
245
+ },
246
+ success: function(msg) {
247
+ window.open("//wordpress.org/support/plugin/wp-performance-score-booster/reviews/?rate=5#new-post", "_blank");
248
+ }
249
+ });
250
+ });
251
+ $j("#willReviewLater").on('click', function() {
252
+ $j('.notice').slideUp();
253
+ $j.ajax({
254
+ url: loc,
255
+ type: 'POST',
256
+ data: {
257
+ "wppsb-review-later": ''
258
+ }/* ,
259
+ success: function(msg) {
260
+ console.log("WPPSB DEBUG: Review the Plugin Later.");
261
+ } */
262
+ });
263
+ });
264
+ $j("#alredyReviewed").on('click', function() {
265
+ $j('.notice').slideUp();
266
+ $j.ajax({
267
+ url: loc,
268
+ type: 'POST',
269
+ data: {
270
+ "wppsb-already-reviewed": ''
271
+ }
272
+ });
273
+ });
274
+ /* If top-right X button clicked */
275
+ $j('#wppsb-review-notice').on('click', '.notice-dismiss', function(event){
276
+ $j.ajax({
277
+ url: loc,
278
+ type: 'POST',
279
+ data: {
280
+ "wppsb-already-reviewed": ''
281
+ }
282
+ });
283
+ });
284
  });
285
  </script>
286
  <?php