Autoptimize - Version 2.6.2

Version Description

  • auto-exclude images from lazyload when they have loading="eager" attribute.
  • bugfix: don't take querystring into account when deciding as-value for preloaded resources.
  • bugfix; ensure lqip images (used when both image optimization and lazyload are active) always work by normalizing the URL before sending it to shortpixel.
  • minimum WordPress version bumped to 4.4.
Download this release

Release Info

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

Code changes from version 2.6.1 to 2.6.2

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.6.1
7
  * Author: Frank Goossens (futtta)
8
  * Author URI: https://autoptimize.com/
9
  * Text Domain: autoptimize
@@ -20,7 +20,7 @@ if ( ! defined( 'ABSPATH' ) ) {
20
  exit;
21
  }
22
 
23
- define( 'AUTOPTIMIZE_PLUGIN_VERSION', '2.6.1' );
24
 
25
  // plugin_dir_path() returns the trailing slash!
26
  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.6.2
7
  * Author: Frank Goossens (futtta)
8
  * Author URI: https://autoptimize.com/
9
  * Text Domain: autoptimize
20
  exit;
21
  }
22
 
23
+ define( 'AUTOPTIMIZE_PLUGIN_VERSION', '2.6.2' );
24
 
25
  // plugin_dir_path() returns the trailing slash!
26
  define( 'AUTOPTIMIZE_PLUGIN_DIR', plugin_dir_path( __FILE__ ) );
classes/autoptimizeConfig.php CHANGED
@@ -1,6 +1,6 @@
1
  <?php
2
  /**
3
- * Main configurtion logic.
4
  */
5
 
6
  if ( ! defined( 'ABSPATH' ) ) {
@@ -88,7 +88,7 @@ class autoptimizeConfig
88
  <div class="wrap">
89
  <h1><?php _e( 'Autoptimize Settings', 'autoptimize' ); ?></h1>
90
  <?php echo $this->ao_admin_tabs(); ?>
91
- <p style="font-size:120%;"><?php _e( 'Autoptimize is enabled and configured on a WordPress network level. Please contact your network administrator if you need Autoptimize settings changed.', 'autoptimize' ); ?></p>
92
  </div>
93
  <?php
94
  }
1
  <?php
2
  /**
3
+ * Main configuration logic.
4
  */
5
 
6
  if ( ! defined( 'ABSPATH' ) ) {
88
  <div class="wrap">
89
  <h1><?php _e( 'Autoptimize Settings', 'autoptimize' ); ?></h1>
90
  <?php echo $this->ao_admin_tabs(); ?>
91
+ <p style="font-size:120%;"><?php echo apply_filters( 'autoptimize_filter_settingsscreen_multisite_network_message', __( 'Autoptimize is enabled and configured on a WordPress network level. Please contact your network administrator if you need Autoptimize settings changed.', 'autoptimize' ) ); ?></p>
92
  </div>
93
  <?php
94
  }
classes/autoptimizeExtra.php CHANGED
@@ -406,19 +406,20 @@ class autoptimizeExtra
406
  $crossorigin = '';
407
  $preload_as = '';
408
  $mime_type = '';
 
409
 
410
- if ( autoptimizeUtils::str_ends_in( $preload, '.css' ) ) {
411
  $preload_as = 'style';
412
- } elseif ( autoptimizeUtils::str_ends_in( $preload, '.js' ) ) {
413
  $preload_as = 'script';
414
- } elseif ( autoptimizeUtils::str_ends_in( $preload, '.woff' ) || autoptimizeUtils::str_ends_in( $preload, '.woff2' ) || autoptimizeUtils::str_ends_in( $preload, '.ttf' ) || autoptimizeUtils::str_ends_in( $preload, '.eot' ) ) {
415
  $preload_as = 'font';
416
  $crossorigin = ' crossorigin';
417
- $mime_type = ' type="font/' . pathinfo( $preload, PATHINFO_EXTENSION ) . '"';
418
  if ( ' type="font/eot"' === $mime_type ) {
419
  $mime_type = 'application/vnd.ms-fontobject';
420
  }
421
- } elseif ( autoptimizeUtils::str_ends_in( $preload, '.jpeg' ) || autoptimizeUtils::str_ends_in( $preload, '.jpg' ) || autoptimizeUtils::str_ends_in( $preload, '.webp' ) || autoptimizeUtils::str_ends_in( $preload, '.png' ) || autoptimizeUtils::str_ends_in( $preload, '.gif' ) ) {
422
  $preload_as = 'image';
423
  } else {
424
  $preload_as = 'other';
406
  $crossorigin = '';
407
  $preload_as = '';
408
  $mime_type = '';
409
+ $_preload = strtok( $preload, '?' );
410
 
411
+ if ( autoptimizeUtils::str_ends_in( $_preload, '.css' ) ) {
412
  $preload_as = 'style';
413
+ } elseif ( autoptimizeUtils::str_ends_in( $_preload, '.js' ) ) {
414
  $preload_as = 'script';
415
+ } elseif ( autoptimizeUtils::str_ends_in( $_preload, '.woff' ) || autoptimizeUtils::str_ends_in( $_preload, '.woff2' ) || autoptimizeUtils::str_ends_in( $_preload, '.ttf' ) || autoptimizeUtils::str_ends_in( $_preload, '.eot' ) ) {
416
  $preload_as = 'font';
417
  $crossorigin = ' crossorigin';
418
+ $mime_type = ' type="font/' . pathinfo( $_preload, PATHINFO_EXTENSION ) . '"';
419
  if ( ' type="font/eot"' === $mime_type ) {
420
  $mime_type = 'application/vnd.ms-fontobject';
421
  }
422
+ } elseif ( autoptimizeUtils::str_ends_in( $_preload, '.jpeg' ) || autoptimizeUtils::str_ends_in( $_preload, '.jpg' ) || autoptimizeUtils::str_ends_in( $_preload, '.webp' ) || autoptimizeUtils::str_ends_in( $_preload, '.png' ) || autoptimizeUtils::str_ends_in( $_preload, '.gif' ) ) {
423
  $preload_as = 'image';
424
  } else {
425
  $preload_as = 'other';
classes/autoptimizeImages.php CHANGED
@@ -555,6 +555,8 @@ class autoptimizeImages
555
  $_url = $url;
556
  }
557
 
 
 
558
  $placeholder = '';
559
  if ( $this->can_optimize_image( $_url ) && apply_filters( 'autoptimize_filter_imgopt_lazyload_dolqip', true ) ) {
560
  $lqip_w = '';
@@ -815,7 +817,7 @@ class autoptimizeImages
815
  $options = $this->options;
816
 
817
  // set default exclusions.
818
- $exclude_lazyload_array = array( 'skip-lazy', 'data-no-lazy', 'notlazy', 'data-src', 'data-srcset', 'data:image/', 'data-lazyload', 'rev-slidebg' );
819
 
820
  // add from setting.
821
  if ( array_key_exists( 'autoptimize_imgopt_text_field_5', $options ) ) {
@@ -1154,7 +1156,7 @@ class autoptimizeImages
1154
  // translators: "associate your domain" will appear in a "a href".
1155
  $_imgopt_notice = $_imgopt_notice . ' ' . sprintf( __( 'If you already have enough credits then you may need to %1$sassociate your domain%2$s to your Shortpixel account.', 'autoptimize' ), '<a rel="noopener noreferrer" href="' . $_imgopt_assoc . '" target="_blank">', '</a>' );
1156
  } elseif ( -3 == $_stat['Status'] ) {
1157
- // translators: "add more credits" will appear in a "a href".
1158
  $_imgopt_notice = sprintf( __( 'It seems ShortPixel image optimization is not able to fetch images from your site, %1$scheck the documentation here%2$s for more information', 'autoptimize' ), '<a href="' . $_imgopt_unreach . '" target="_blank">', '</a>' );
1159
  } else {
1160
  $_imgopt_upsell = 'https://shortpixel.com/g/af/GWRGFLW109483';
555
  $_url = $url;
556
  }
557
 
558
+ $_url = $this->normalize_img_url( $_url );
559
+
560
  $placeholder = '';
561
  if ( $this->can_optimize_image( $_url ) && apply_filters( 'autoptimize_filter_imgopt_lazyload_dolqip', true ) ) {
562
  $lqip_w = '';
817
  $options = $this->options;
818
 
819
  // set default exclusions.
820
+ $exclude_lazyload_array = array( 'skip-lazy', 'data-no-lazy', 'notlazy', 'data-src', 'data-srcset', 'data:image/', 'data-lazyload', 'rev-slidebg', 'loading="eager"' );
821
 
822
  // add from setting.
823
  if ( array_key_exists( 'autoptimize_imgopt_text_field_5', $options ) ) {
1156
  // translators: "associate your domain" will appear in a "a href".
1157
  $_imgopt_notice = $_imgopt_notice . ' ' . sprintf( __( 'If you already have enough credits then you may need to %1$sassociate your domain%2$s to your Shortpixel account.', 'autoptimize' ), '<a rel="noopener noreferrer" href="' . $_imgopt_assoc . '" target="_blank">', '</a>' );
1158
  } elseif ( -3 == $_stat['Status'] ) {
1159
+ // translators: "check the documentation here" will appear in a "a href".
1160
  $_imgopt_notice = sprintf( __( 'It seems ShortPixel image optimization is not able to fetch images from your site, %1$scheck the documentation here%2$s for more information', 'autoptimize' ), '<a href="' . $_imgopt_unreach . '" target="_blank">', '</a>' );
1161
  } else {
1162
  $_imgopt_upsell = 'https://shortpixel.com/g/af/GWRGFLW109483';
readme.txt CHANGED
@@ -3,9 +3,9 @@ Contributors: futtta, optimizingmatters, zytzagoo, turl
3
  Tags: optimize, minify, performance, pagespeed, images, lazy-load, google fonts
4
  Donate link: http://blog.futtta.be/2013/10/21/do-not-donate-to-me/
5
  Requires at least: 4.4
6
- Tested up to: 5.3
7
  Requires PHP: 5.6
8
- Stable tag: 2.6.1
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
 
@@ -278,6 +278,12 @@ Just [fork Autoptimize on Github](https://github.com/futtta/autoptimize) and cod
278
 
279
  == Changelog ==
280
 
 
 
 
 
 
 
281
  = 2.6.1 =
282
  * bugfixes for multiple lazyload bugs causing images not to load or load incorrectly
283
  * bugfixes for multiple multisite bugs causing settings-screen to be unavailable
3
  Tags: optimize, minify, performance, pagespeed, images, lazy-load, google fonts
4
  Donate link: http://blog.futtta.be/2013/10/21/do-not-donate-to-me/
5
  Requires at least: 4.4
6
+ Tested up to: 5.4
7
  Requires PHP: 5.6
8
+ Stable tag: 2.6.2
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
 
278
 
279
  == Changelog ==
280
 
281
+ = 2.6.2 =
282
+ * auto-exclude images from lazyload when they have `loading="eager"` attribute.
283
+ * bugfix: don't take querystring into account when deciding as-value for preloaded resources.
284
+ * bugfix; ensure lqip images (used when both image optimization and lazyload are active) always work by normalizing the URL before sending it to shortpixel.
285
+ * minimum WordPress version bumped to 4.4.
286
+
287
  = 2.6.1 =
288
  * bugfixes for multiple lazyload bugs causing images not to load or load incorrectly
289
  * bugfixes for multiple multisite bugs causing settings-screen to be unavailable