Autoptimize - Version 2.3.4

Version Description

  • bugfix: is_plugin_active causing errors in some cases as reported by @iluminancia and @lozula
  • bugfix: added language domain to 4 __/_e functions, un grand merci Guillaume Blet!
Download this release

Release Info

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

Code changes from version 2.3.3 to 2.3.4

autoptimize.php CHANGED
@@ -3,7 +3,7 @@
3
  Plugin Name: Autoptimize
4
  Plugin URI: https://autoptimize.com/
5
  Description: Optimizes your website, concatenating the CSS and JavaScript code, and compressing it.
6
- Version: 2.3.3
7
  Author: Frank Goossens (futtta)
8
  Author URI: https://autoptimize.com/
9
  Domain Path: localization/
3
  Plugin Name: Autoptimize
4
  Plugin URI: https://autoptimize.com/
5
  Description: Optimizes your website, concatenating the CSS and JavaScript code, and compressing it.
6
+ Version: 2.3.4
7
  Author: Frank Goossens (futtta)
8
  Author URI: https://autoptimize.com/
9
  Domain Path: localization/
classlesses/autoptimizeExtra.php CHANGED
@@ -34,8 +34,19 @@ function autoptimize_extra_init() {
34
  add_filter( 'style_loader_src', 'autoptimize_extra_remove_qs', 15, 1 );
35
  }
36
 
37
- /* async JS */
38
- if ( !empty($autoptimize_extra_options['autoptimize_extra_text_field_3']) && !is_plugin_active('async-javascript/async-javascript.php') ) {
 
 
 
 
 
 
 
 
 
 
 
39
  add_filter('autoptimize_filter_js_exclude','autoptimize_extra_async_js',10,1);
40
  }
41
 
@@ -339,10 +350,10 @@ function autoptimize_extra_options_page() {
339
  <tr>
340
  <th scope="row"><?php _e('Async Javascript-files <em>(advanced users)</em>','autoptimize'); ?></th>
341
  <td>
342
- <?php if ( is_plugin_active('async-javascript/async-javascript.php') ) {
343
  _e('You have "Async JavaScript" installed,','autoptimize');
344
  $asj_config_url="options-general.php?page=async-javascript";
345
- echo sprintf(' <a href="'.$asj_config_url.'">%s</a>', __('configuration of async javascript is best done there.'));
346
  } else { ?>
347
  <input type='text' style='width:80%' name='autoptimize_extra_settings[autoptimize_extra_text_field_3]' value='<?php echo $autoptimize_extra_options['autoptimize_extra_text_field_3']; ?>'>
348
  <br />
@@ -350,21 +361,21 @@ function autoptimize_extra_options_page() {
350
  _e('Comma-separated list of local or 3rd party JS-files that should loaded with the <code>async</code> flag. JS-files from your own site will be automatically excluded if added here. ','autoptimize');
351
  echo sprintf( __('Configuration of async javascript is easier and more flexible using the %s plugin.','autoptimize'), '"<a href="https://wordpress.org/plugins/async-javascript" target="_blank">Async Javascript</a>"');
352
  $asj_install_url= network_admin_url()."plugin-install.php?s=async+javascript&tab=search&type=term";
353
- echo sprintf(' <a href="'.$asj_install_url.'">%s</a>', __('Click here to install and activate it.'));
354
  } ?>
355
  </td>
356
  </tr>
357
  <tr>
358
  <th scope="row"><?php _e('Optimize YouTube videos','autoptimize'); ?></th>
359
  <td>
360
- <?php if ( is_plugin_active('wp-youtube-lyte/wp-youtube-lyte.php') ) {
361
  _e('Great, you have WP YouTube Lyte installed.','autoptimize');
362
  $lyte_config_url="options-general.php?page=lyte_settings_page";
363
- echo sprintf(' <a href="'.$lyte_config_url.'">%s</a>', __('Click here to configure it.'));
364
  } else {
365
  echo sprintf( __('%s allows you to “lazy load” your videos, by inserting responsive “Lite YouTube Embeds". ','autoptimize'),'<a href="https://wordpress.org/plugins/wp-youtube-lyte" target="_blank">WP YouTube Lyte</a>');
366
  $lyte_install_url= network_admin_url()."plugin-install.php?s=lyte&tab=search&type=term";
367
- echo sprintf(' <a href="'.$lyte_install_url.'">%s</a>', __('Click here to install and activate it.'));
368
  } ?>
369
  </td>
370
  </tr>
34
  add_filter( 'style_loader_src', 'autoptimize_extra_remove_qs', 15, 1 );
35
  }
36
 
37
+ /*
38
+ * async JS
39
+ *
40
+ * is_plugin_active is not available in frontend by default
41
+ * cfr. https://codex.wordpress.org/Function_Reference/is_plugin_active
42
+ * so we need to source in wp-admin/includes/plugin.php
43
+ */
44
+ include_once( ABSPATH . 'wp-admin/includes/plugin.php' );
45
+ $_asyncJSactive = false;
46
+ if ( function_exists('is_plugin_active') && is_plugin_active('async-javascript/async-javascript.php') ) {
47
+ $_asyncJSactive = true;
48
+ }
49
+ if ( !empty($autoptimize_extra_options['autoptimize_extra_text_field_3']) && $_asyncJSactive === false ) {
50
  add_filter('autoptimize_filter_js_exclude','autoptimize_extra_async_js',10,1);
51
  }
52
 
350
  <tr>
351
  <th scope="row"><?php _e('Async Javascript-files <em>(advanced users)</em>','autoptimize'); ?></th>
352
  <td>
353
+ <?php if ( function_exists('is_plugin_active') && is_plugin_active('async-javascript/async-javascript.php') ) {
354
  _e('You have "Async JavaScript" installed,','autoptimize');
355
  $asj_config_url="options-general.php?page=async-javascript";
356
+ echo sprintf(' <a href="'.$asj_config_url.'">%s</a>', __('configuration of async javascript is best done there.','autoptimize'));
357
  } else { ?>
358
  <input type='text' style='width:80%' name='autoptimize_extra_settings[autoptimize_extra_text_field_3]' value='<?php echo $autoptimize_extra_options['autoptimize_extra_text_field_3']; ?>'>
359
  <br />
361
  _e('Comma-separated list of local or 3rd party JS-files that should loaded with the <code>async</code> flag. JS-files from your own site will be automatically excluded if added here. ','autoptimize');
362
  echo sprintf( __('Configuration of async javascript is easier and more flexible using the %s plugin.','autoptimize'), '"<a href="https://wordpress.org/plugins/async-javascript" target="_blank">Async Javascript</a>"');
363
  $asj_install_url= network_admin_url()."plugin-install.php?s=async+javascript&tab=search&type=term";
364
+ echo sprintf(' <a href="'.$asj_install_url.'">%s</a>', __('Click here to install and activate it.','autoptimize'));
365
  } ?>
366
  </td>
367
  </tr>
368
  <tr>
369
  <th scope="row"><?php _e('Optimize YouTube videos','autoptimize'); ?></th>
370
  <td>
371
+ <?php if ( function_exists('is_plugin_active') && is_plugin_active('wp-youtube-lyte/wp-youtube-lyte.php') ) {
372
  _e('Great, you have WP YouTube Lyte installed.','autoptimize');
373
  $lyte_config_url="options-general.php?page=lyte_settings_page";
374
+ echo sprintf(' <a href="'.$lyte_config_url.'">%s</a>', __('Click here to configure it.','autoptimize'));
375
  } else {
376
  echo sprintf( __('%s allows you to “lazy load” your videos, by inserting responsive “Lite YouTube Embeds". ','autoptimize'),'<a href="https://wordpress.org/plugins/wp-youtube-lyte" target="_blank">WP YouTube Lyte</a>');
377
  $lyte_install_url= network_admin_url()."plugin-install.php?s=lyte&tab=search&type=term";
378
+ echo sprintf(' <a href="'.$lyte_install_url.'">%s</a>', __('Click here to install and activate it.','autoptimize'));
379
  } ?>
380
  </td>
381
  </tr>
readme.txt CHANGED
@@ -4,7 +4,7 @@ Tags: optimize, minify, performance, pagespeed, async
4
  Donate link: http://blog.futtta.be/2013/10/21/do-not-donate-to-me/
5
  Requires at least: 4.0
6
  Tested up to: 4.9
7
- Stable tag: 2.3.3
8
 
9
  Autoptimize speeds up your website by optimizing JS, CSS and HTML, async-ing JavaScript, removing emoji cruft, optimizing Google Fonts and more.
10
 
@@ -249,6 +249,10 @@ Just [fork Autoptimize on Github](https://github.com/futtta/autoptimize) and cod
249
 
250
  == Changelog ==
251
 
 
 
 
 
252
  = 2.3.3 =
253
  * improvement: updated to latest version of Filamentgroup's loadCSS
254
  * improvement: by default exclude `wp-content/cache` and `wp-content/uploads` from CSS optimization (Divi, Avada & possibly others store page-specific CSS there)
4
  Donate link: http://blog.futtta.be/2013/10/21/do-not-donate-to-me/
5
  Requires at least: 4.0
6
  Tested up to: 4.9
7
+ Stable tag: 2.3.4
8
 
9
  Autoptimize speeds up your website by optimizing JS, CSS and HTML, async-ing JavaScript, removing emoji cruft, optimizing Google Fonts and more.
10
 
249
 
250
  == Changelog ==
251
 
252
+ = 2.3.4 =
253
+ * bugfix: is_plugin_active causing errors in some cases as [reported by @iluminancia and @lozula](https://wordpress.org/support/topic/fatal-error-after-update-to-2-3-3/)
254
+ * bugfix: added language domain to 4 __/_e functions, un grand merci à Guillaume Blet!
255
+
256
  = 2.3.3 =
257
  * improvement: updated to latest version of Filamentgroup's loadCSS
258
  * improvement: by default exclude `wp-content/cache` and `wp-content/uploads` from CSS optimization (Divi, Avada & possibly others store page-specific CSS there)