Autoptimize - Version 2.9.5

Version Description

  • Better fix for PHP notice in autoptimizeImages.php.
  • Further improvements to the exit survey.
Download this release

Release Info

Developer futtta
Plugin Icon 128x128 Autoptimize
Version 2.9.5
Comparing to
See all releases

Code changes from version 2.9.4 to 2.9.5

autoptimize.php CHANGED
@@ -3,7 +3,7 @@
3
  * Plugin Name: Autoptimize
4
  * Plugin URI: https://autoptimize.com/
5
  * Description: Makes your site faster by optimizing CSS, JS, Images, Google fonts and more.
6
- * Version: 2.9.4
7
  * Author: Frank Goossens (futtta)
8
  * Author URI: https://autoptimize.com/
9
  * Text Domain: autoptimize
@@ -21,7 +21,7 @@ if ( ! defined( 'ABSPATH' ) ) {
21
  exit;
22
  }
23
 
24
- define( 'AUTOPTIMIZE_PLUGIN_VERSION', '2.9.4' );
25
 
26
  // plugin_dir_path() returns the trailing slash!
27
  define( 'AUTOPTIMIZE_PLUGIN_DIR', plugin_dir_path( __FILE__ ) );
3
  * Plugin Name: Autoptimize
4
  * Plugin URI: https://autoptimize.com/
5
  * Description: Makes your site faster by optimizing CSS, JS, Images, Google fonts and more.
6
+ * Version: 2.9.5
7
  * Author: Frank Goossens (futtta)
8
  * Author URI: https://autoptimize.com/
9
  * Text Domain: autoptimize
21
  exit;
22
  }
23
 
24
+ define( 'AUTOPTIMIZE_PLUGIN_VERSION', '2.9.5' );
25
 
26
  // plugin_dir_path() returns the trailing slash!
27
  define( 'AUTOPTIMIZE_PLUGIN_DIR', plugin_dir_path( __FILE__ ) );
classes/autoptimizeExitSurvey.php CHANGED
@@ -29,50 +29,52 @@ class autoptimizeExitSurvey
29
  }
30
 
31
  function render_survey_model() {
 
 
32
  $data = array(
33
  "home" => home_url(),
34
  "dest" => 'aHR0cHM6Ly9taXNjLm9wdGltaXppbmdtYXR0ZXJzLmNvbS9hb19leGl0X3N1cnZleS9pbmRleC5waHA='
35
  );
36
  ?>
37
 
38
- <div class="ao-plugin-uninstall-feedback-popup ao-feedback" id="ao_uninstall_feedback_popup" data-modal="<?php echo base64_encode(json_encode($data)) ?>">
39
  <div class="popup--header">
40
- <h5>Sorry to see you go, we would appreciate if you let us know why you're deactivating Autoptimize!</h5>
41
  </div><!--/.popup--header-->
42
  <div class="popup--body">
43
  <ul class="popup--form">
44
  <li ao-option-id="5">
45
  <input type="radio" name="ao-deactivate-option" id="ao_feedback5">
46
  <label for="ao_feedback5">
47
- I don't see a performance improvement.
48
  </label>
49
- <p class="last-attempt">Autoptimize does not do page caching, so you might have to install e.g. KeyCDN Cache Enabler or WP Super Cache. Feel free to create a topic on <a href="https://wordpress.org/support/plugin/autoptimize/#new-topic-0" target="_blank">the support forum here</a> to get pointers on how get the most out of Autoptimize!</p>
50
  </li>
51
  <li ao-option-id="6">
52
  <input type="radio" name="ao-deactivate-option" id="ao_feedback6">
53
- <label for="ao_feedback6">
54
- It broke my site.
55
  </label>
56
- <p class="last-attempt">Almost all problems can be fixed with the right configuration, have a look at <a href="https://wordpress.org/plugins/autoptimize/#faq" target="_blank">the FAQ</a> or create a topic on <a href="https://wordpress.org/support/plugin/autoptimize/#new-topic-0" target="_blank">the support forum here</a>!</p>
57
  <li ao-option-id="4">
58
  <input type="radio" name="ao-deactivate-option" id="ao_feedback4">
59
- <label for="ao_feedback4">
60
- I found a better solution.
61
  </label>
62
  <li ao-option-id="3">
63
  <input type="radio" name="ao-deactivate-option" id="ao_feedback3">
64
- <label for="ao_feedback3">
65
- I'm just disabling temporarily.
66
  </label>
67
  <li ao-option-id="999">
68
  <input type="radio" name="ao-deactivate-option" id="ao_feedback999">
69
- <label for="ao_feedback999">
70
- Other (please specify below) </label>
71
  <textarea width="100%" rows="2" name="comments" placeholder="What can we do better?"></textarea></li>
72
  <hr />
73
  <li ao-option-id="998">
74
- <label for="ao_feedback998">
75
- If you want to be contacted about your experience with Autoptimize, leave your email here (we won't spam).
76
  </label>
77
  <input type="email" name="ao-deactivate-option" id="ao_feedback998" placeholder="mymail@domain.xyz">
78
  </li>
@@ -80,13 +82,14 @@ class autoptimizeExitSurvey
80
  </div><!--/.popup--body-->
81
  <div class="popup--footer">
82
  <div class="actions">
83
- <a href="#" class="info-disclosure-link">What info do we collect?</a>
84
- <div class="info-disclosure-content"><p>Below is a detailed view of all data that Optimizing Matters will receive if
85
- you fill in this survey. Your email address is only shared if you explicitly fill it in, your IP addres is never sent.</p>
86
  <ul>
87
- <li><strong>Plugin version </strong> <code id="ao_plugin_version"> <?php echo AUTOPTIMIZE_PLUGIN_VERSION ?> </code></li>
88
- <li><strong>Current website:</strong> <code> <?php echo trailingslashit(get_site_url()) ?> </code></li>
89
- <li><strong>Uninstall reason </strong> <i> Selected reason from the above survey </i></li>
 
90
  </ul>
91
  </div>
92
  <div class="buttons">
29
  }
30
 
31
  function render_survey_model() {
32
+ global $wp_version;
33
+
34
  $data = array(
35
  "home" => home_url(),
36
  "dest" => 'aHR0cHM6Ly9taXNjLm9wdGltaXppbmdtYXR0ZXJzLmNvbS9hb19leGl0X3N1cnZleS9pbmRleC5waHA='
37
  );
38
  ?>
39
 
40
+ <div class="ao-plugin-uninstall-feedback-popup ao-feedback" id="ao_uninstall_feedback_popup" data-modal="<?php echo base64_encode( json_encode( $data ) ) ?>">
41
  <div class="popup--header">
42
+ <h5><?php _e( 'Sorry to see you go, we would appreciate if you let us know why you\'re deactivating Autoptimize!', 'autoptimize' ); ?></h5>
43
  </div><!--/.popup--header-->
44
  <div class="popup--body">
45
  <ul class="popup--form">
46
  <li ao-option-id="5">
47
  <input type="radio" name="ao-deactivate-option" id="ao_feedback5">
48
  <label for="ao_feedback5">
49
+ <?php _e( 'I don\'t see a performance improvement.', 'autoptimize' ); ?>
50
  </label>
51
+ <p class="last-attempt"><?php _e( 'As Autoptimize does not do page caching, you might have to install e.g. KeyCDN Cache Enabler or WP Super Cache as well. Feel free to create a topic on <a href="https://wordpress.org/support/plugin/autoptimize/#new-topic-0" target="_blank">the support forum here</a> to get pointers on how get the most out of Autoptimize!', 'autoptimize' ); ?></p>
52
  </li>
53
  <li ao-option-id="6">
54
  <input type="radio" name="ao-deactivate-option" id="ao_feedback6">
55
+ <label for="ao_feedback6" data-reason="broke site">
56
+ <?php _e( 'It broke my site.', 'autoptimize' ); ?>
57
  </label>
58
+ <p class="last-attempt"><?php _e( 'Almost all problems can be fixed with the right configuration, have a look at <a href="https://wordpress.org/plugins/autoptimize/#faq" target="_blank">the FAQ</a> or create a topic on <a href="https://wordpress.org/support/plugin/autoptimize/#new-topic-0" target="_blank">the support forum here</a>!', 'autoptimize' ); ?></p>
59
  <li ao-option-id="4">
60
  <input type="radio" name="ao-deactivate-option" id="ao_feedback4">
61
+ <label for="ao_feedback4" data-reason="found better">
62
+ <?php _e( 'I found a better solution.', 'autoptimize' ); ?>
63
  </label>
64
  <li ao-option-id="3">
65
  <input type="radio" name="ao-deactivate-option" id="ao_feedback3">
66
+ <label for="ao_feedback3" data-reason="just temporarily">
67
+ <?php _e( 'I\'m just disabling temporarily.', 'autoptimize' ); ?>
68
  </label>
69
  <li ao-option-id="999">
70
  <input type="radio" name="ao-deactivate-option" id="ao_feedback999">
71
+ <label for="ao_feedback999" data-reason="other">
72
+ <?php _e( 'Other (please specify below)', 'autoptimize' ); ?> </label>
73
  <textarea width="100%" rows="2" name="comments" placeholder="What can we do better?"></textarea></li>
74
  <hr />
75
  <li ao-option-id="998">
76
+ <label for="ao_feedback998" data-reason="other detail">
77
+ <?php _e( 'If you want to be contacted about or get help with Autoptimize, leave your email here (we never spam).', 'autoptimize' ); ?>
78
  </label>
79
  <input type="email" name="ao-deactivate-option" id="ao_feedback998" placeholder="mymail@domain.xyz">
80
  </li>
82
  </div><!--/.popup--body-->
83
  <div class="popup--footer">
84
  <div class="actions">
85
+ <a href="#" class="info-disclosure-link"><?php _e( 'What info do we collect?', 'autoptimize' ); ?></a>
86
+ <div class="info-disclosure-content"><p><?php _e( 'Below is a detailed view of all data that Optimizing Matters will receive if
87
+ you fill in this survey. Your email address is only shared if you explicitly fill it in, your IP addres is never sent.', 'autoptimize' ); ?></p>
88
  <ul>
89
+ <li><strong><?php _e( 'Plugin version', 'autoptimize' ); ?> </strong> <code id="ao_plugin_version"> <?php echo AUTOPTIMIZE_PLUGIN_VERSION ?> </code></li>
90
+ <li><strong><?php _e( 'WordPress version', 'autoptimize' ); ?> </strong> <code id="core_version"> <?php echo $wp_version ?> </code></li>
91
+ <li><strong><?php _e( 'Current website:', 'autoptimize' ); ?></strong> <code> <?php echo trailingslashit(get_site_url()) ?> </code></li>
92
+ <li><strong><?php _e( 'Uninstall reason', 'autoptimize' ); ?> </strong> <i> <?php _e( 'Selected reason from the above survey', 'autoptimize' ); ?> </i></li>
93
  </ul>
94
  </div>
95
  <div class="buttons">
classes/autoptimizeImages.php CHANGED
@@ -52,10 +52,10 @@ class autoptimizeImages
52
  // get service availability and add it to the options-array.
53
  $value['availabilities'] = autoptimizeOptionWrapper::get_option( 'autoptimize_service_availablity' );
54
 
55
- if ( empty( $value['availabilities'] || ! is_array( $value['availabilities'] ) ) ) {
56
  $value['availabilities'] = null;
57
 
58
- if ( autoptimizeImages::imgopt_active() ) {
59
  $value['availabilities'] = autoptimizeUtils::check_service_availability( true );
60
  }
61
 
52
  // get service availability and add it to the options-array.
53
  $value['availabilities'] = autoptimizeOptionWrapper::get_option( 'autoptimize_service_availablity' );
54
 
55
+ if ( empty( $value['availabilities'] ) || ! is_array( $value['availabilities'] ) ) {
56
  $value['availabilities'] = null;
57
 
58
+ if ( true === autoptimizeImages::imgopt_active() ) {
59
  $value['availabilities'] = autoptimizeUtils::check_service_availability( true );
60
  }
61
 
classes/static/exit-survey/exit-survey.js CHANGED
@@ -33,16 +33,28 @@
33
  radio.parent().find('textarea').on('keyup', function (e) {
34
  if ($(this).val().length === 0) {
35
  $('#ao_uninstall_feedback_popup #ao-deactivate-yes').attr('disabled', 'disabled');
36
- } else {
37
  $('#ao_uninstall_feedback_popup #ao-deactivate-yes').removeAttr('disabled');
38
  }
39
  });
40
  } else {
41
- $('#ao_uninstall_feedback_popup #ao-deactivate-yes').removeAttr('disabled');
 
 
42
  $(this).siblings('p.last-attempt').show();
43
  }
44
  });
45
 
 
 
 
 
 
 
 
 
 
 
46
  $('#ao_uninstall_feedback_popup #ao-deactivate-no').on('click', function (e) {
47
  e.preventDefault();
48
  e.stopPropagation();
@@ -75,16 +87,17 @@
75
  if( selectedOption.attr("id") === "ao_feedback999" ){
76
  reason = 'Other: ' + selectedOption.parent().find('textarea').val().trim()
77
  }else{
78
- reason = selectedOption.parent().find('label').text().trim()
79
  }
80
 
81
  var data = {
82
  'url': modal_data.home,
83
  'reason': reason,
84
- 'type': 'wordpress',
85
- 'version' : $('#ao_plugin_version').text().trim(),
86
  'email': $('#ao_feedback998').val().trim(),
87
  };
 
88
  $.ajax({
89
  type: 'POST',
90
  url: atob( modal_data.dest ),
33
  radio.parent().find('textarea').on('keyup', function (e) {
34
  if ($(this).val().length === 0) {
35
  $('#ao_uninstall_feedback_popup #ao-deactivate-yes').attr('disabled', 'disabled');
36
+ } else if ( $('#ao_feedback998')[0].checkValidity() == true ) {
37
  $('#ao_uninstall_feedback_popup #ao-deactivate-yes').removeAttr('disabled');
38
  }
39
  });
40
  } else {
41
+ if ( $('#ao_feedback998')[0].checkValidity() == true ) {
42
+ $('#ao_uninstall_feedback_popup #ao-deactivate-yes').removeAttr('disabled');
43
+ }
44
  $(this).siblings('p.last-attempt').show();
45
  }
46
  });
47
 
48
+ $('#ao_feedback998').on('keyup', function (e) {
49
+ email_node = $(this);
50
+ email_val = email_node.val();
51
+ if ( email_val.length > 0 && email_node[0].checkValidity() == false ) {
52
+ $('#ao_uninstall_feedback_popup #ao-deactivate-yes').attr('disabled', 'disabled');
53
+ } else if ( $( '#ao_uninstall_feedback_popup input[name="ao-deactivate-option"]:checked' ).length > 0 ) {
54
+ $('#ao_uninstall_feedback_popup #ao-deactivate-yes').removeAttr('disabled');
55
+ }
56
+ });
57
+
58
  $('#ao_uninstall_feedback_popup #ao-deactivate-no').on('click', function (e) {
59
  e.preventDefault();
60
  e.stopPropagation();
87
  if( selectedOption.attr("id") === "ao_feedback999" ){
88
  reason = 'Other: ' + selectedOption.parent().find('textarea').val().trim()
89
  }else{
90
+ reason = selectedOption.parent().find('label').attr('data-reason').trim()
91
  }
92
 
93
  var data = {
94
  'url': modal_data.home,
95
  'reason': reason,
96
+ 'type': 'WP ' + $('#core_version').text().trim(),
97
+ 'version' : 'AO ' + $('#ao_plugin_version').text().trim(),
98
  'email': $('#ao_feedback998').val().trim(),
99
  };
100
+
101
  $.ajax({
102
  type: 'POST',
103
  url: atob( modal_data.dest ),
readme.txt CHANGED
@@ -3,9 +3,9 @@ Contributors: futtta, optimizingmatters, zytzagoo, turl
3
  Tags: optimize, minify, performance, images, core web vitals, lazy-load, pagespeed, google fonts
4
  Donate link: http://blog.futtta.be/2013/10/21/do-not-donate-to-me/
5
  Requires at least: 4.9
6
- Tested up to: 5.8
7
  Requires PHP: 5.6
8
- Stable tag: 2.9.4
9
 
10
  Autoptimize speeds up your website by optimizing JS, CSS, images (incl. lazy-load), HTML and Google Fonts, asyncing JS, removing emoji cruft and more.
11
 
@@ -325,6 +325,10 @@ Just [fork Autoptimize on Github](https://github.com/futtta/autoptimize) and cod
325
 
326
  == Changelog ==
327
 
 
 
 
 
328
  = 2.9.4 =
329
  * Fix for 2 AMP compatibility issues (toolbar JS & lazyload JS).
330
  * Fix for PHP notice in autoptimizeImages.php.
3
  Tags: optimize, minify, performance, images, core web vitals, lazy-load, pagespeed, google fonts
4
  Donate link: http://blog.futtta.be/2013/10/21/do-not-donate-to-me/
5
  Requires at least: 4.9
6
+ Tested up to: 5.9
7
  Requires PHP: 5.6
8
+ Stable tag: 2.9.5
9
 
10
  Autoptimize speeds up your website by optimizing JS, CSS, images (incl. lazy-load), HTML and Google Fonts, asyncing JS, removing emoji cruft and more.
11
 
325
 
326
  == Changelog ==
327
 
328
+ = 2.9.5 =
329
+ * Better fix for PHP notice in autoptimizeImages.php.
330
+ * Further improvements to the exit survey.
331
+
332
  = 2.9.4 =
333
  * Fix for 2 AMP compatibility issues (toolbar JS & lazyload JS).
334
  * Fix for PHP notice in autoptimizeImages.php.