Version Description
- fix for some ternary operators warning in PHP 7.4 and up.
- hard-exclude document.write (WordPress core injects inline JS that has
<script src
in it which AsyncJS acted on) - fix for WordPress 5.6 renaming jQuery from jquery.js into jquery.min.js
Download this release
Release Info
Developer | futtta |
Plugin | Async JavaScript |
Version | 2.20.12.09 |
Comparing to | |
See all releases |
Code changes from version 2.20.03.01 to 2.20.12.09
- async-javascript.php +1 -1
- asyncjsBackendClass.php +1 -1
- asyncjsDashboardScreens.php +1 -1
- asyncjsFrontendClass.php +7 -2
- asyncjsStatusScreens.php +1 -1
- lib/gtmetrix/class.Services_WTF_Test.php +1 -1
- readme.txt +8 -2
async-javascript.php
CHANGED
@@ -3,7 +3,7 @@
|
|
3 |
* Plugin Name: Async JavaScript
|
4 |
* Plugin URI: https://autoptimize.com/
|
5 |
* Description: Async JavaScript gives you full control of which scripts to add a 'async' or 'defer' attribute to or to exclude to help increase the performance of your WordPress website
|
6 |
-
* Version: 2.20.
|
7 |
* Author: Frank Goossens (futtta)
|
8 |
* Author URI: https://autoptimize.com/
|
9 |
* Text Domain: async-javascript
|
3 |
* Plugin Name: Async JavaScript
|
4 |
* Plugin URI: https://autoptimize.com/
|
5 |
* Description: Async JavaScript gives you full control of which scripts to add a 'async' or 'defer' attribute to or to exclude to help increase the performance of your WordPress website
|
6 |
+
* Version: 2.20.12.09
|
7 |
* Author: Frank Goossens (futtta)
|
8 |
* Author URI: https://autoptimize.com/
|
9 |
* Text Domain: async-javascript
|
asyncjsBackendClass.php
CHANGED
@@ -17,7 +17,7 @@ class AsyncJavaScriptBackend {
|
|
17 |
define( 'AJ_ADMIN_URL', trailingslashit( admin_url() ) );
|
18 |
define( 'AJ_PLUGIN_URL', trailingslashit( plugin_dir_url( __FILE__ ) ) );
|
19 |
define( 'AJ_PLUGIN_DIR', trailingslashit( plugin_dir_path( __FILE__ ) ) );
|
20 |
-
define( 'AJ_VERSION', '2.20.
|
21 |
define( 'AJ_UA', 'Async JavaScript/' . AJ_VERSION . ' (+https://autoptimize.com/)' );
|
22 |
add_filter( 'plugin_action_links_'.plugin_basename( 'async-javascript/async-javascript.php' ), array( $this, 'setmeta' ), 10, 2 );
|
23 |
add_action( 'plugins_loaded', array( $this, 'aj_admin_init' ) );
|
17 |
define( 'AJ_ADMIN_URL', trailingslashit( admin_url() ) );
|
18 |
define( 'AJ_PLUGIN_URL', trailingslashit( plugin_dir_url( __FILE__ ) ) );
|
19 |
define( 'AJ_PLUGIN_DIR', trailingslashit( plugin_dir_path( __FILE__ ) ) );
|
20 |
+
define( 'AJ_VERSION', '2.20.12.09' );
|
21 |
define( 'AJ_UA', 'Async JavaScript/' . AJ_VERSION . ' (+https://autoptimize.com/)' );
|
22 |
add_filter( 'plugin_action_links_'.plugin_basename( 'async-javascript/async-javascript.php' ), array( $this, 'setmeta' ), 10, 2 );
|
23 |
add_action( 'plugins_loaded', array( $this, 'aj_admin_init' ) );
|
asyncjsDashboardScreens.php
CHANGED
@@ -11,7 +11,7 @@ $aj_enabled = ( get_option( 'aj_enabled', 0 ) == 1 ) ? 'Enabled' : 'Disabled';
|
|
11 |
$aj_method = ( get_option( 'aj_method', 'async' ) == 'async' ) ? 'Async' : 'Defer';
|
12 |
$aj_jquery = get_option( 'aj_jquery', 'async' );
|
13 |
$aj_jquery = ( $aj_jquery == 'same ' ) ? get_option( 'aj_method', 'async' ) : $aj_jquery;
|
14 |
-
$aj_jquery = ( $aj_jquery == 'async' ) ? 'Async' : ( $aj_jquery == 'defer' ) ? 'Defer' : 'Excluded';
|
15 |
$aj_exclusions = get_option( 'aj_exclusions', '' );
|
16 |
$aj_plugin_exclusions = get_option( 'aj_plugin_exclusions', array() );
|
17 |
$aj_theme_exclusions = get_option( 'aj_theme_exclusions', array() );
|
11 |
$aj_method = ( get_option( 'aj_method', 'async' ) == 'async' ) ? 'Async' : 'Defer';
|
12 |
$aj_jquery = get_option( 'aj_jquery', 'async' );
|
13 |
$aj_jquery = ( $aj_jquery == 'same ' ) ? get_option( 'aj_method', 'async' ) : $aj_jquery;
|
14 |
+
$aj_jquery = ( $aj_jquery == 'async' ) ? 'Async' : (( $aj_jquery == 'defer' ) ? 'Defer' : 'Excluded');
|
15 |
$aj_exclusions = get_option( 'aj_exclusions', '' );
|
16 |
$aj_plugin_exclusions = get_option( 'aj_plugin_exclusions', array() );
|
17 |
$aj_theme_exclusions = get_option( 'aj_theme_exclusions', array() );
|
asyncjsFrontendClass.php
CHANGED
@@ -68,6 +68,11 @@ class AsyncJavaScriptFrontend {
|
|
68 |
$aj_plugin_exclusions = get_option( 'aj_plugin_exclusions', array() );
|
69 |
$aj_theme_exclusions = get_option( 'aj_theme_exclusions', array() );
|
70 |
}
|
|
|
|
|
|
|
|
|
|
|
71 |
if ( false !== $aj_enabled && false !== $this->aj_shop() && false !== $this->aj_logged() && false === is_admin() && false === $this->aj_is_amp() && false === $this->aj_noptimize() ) {
|
72 |
if ( is_array( $aj_plugin_exclusions ) && !empty( $aj_plugin_exclusions ) ) {
|
73 |
foreach ( $aj_plugin_exclusions as $aj_plugin_exclusion ) {
|
@@ -93,13 +98,13 @@ class AsyncJavaScriptFrontend {
|
|
93 |
foreach ( $array_exclusions as $exclusion ) {
|
94 |
$exclusion = trim( $exclusion );
|
95 |
if ( !empty( $exclusion ) ) {
|
96 |
-
if ( false !== strpos( strtolower( $
|
97 |
return $tag;
|
98 |
}
|
99 |
}
|
100 |
}
|
101 |
}
|
102 |
-
if ( false !== strpos( strtolower( $src ), 'js/jquery/jquery.js' ) ) {
|
103 |
if ( $aj_jquery == 'async' || $aj_jquery == 'defer' ) {
|
104 |
$tag = str_replace( 'src=', $aj_jquery . "='" . $aj_jquery . "' src=", $tag );
|
105 |
return $tag;
|
68 |
$aj_plugin_exclusions = get_option( 'aj_plugin_exclusions', array() );
|
69 |
$aj_theme_exclusions = get_option( 'aj_theme_exclusions', array() );
|
70 |
}
|
71 |
+
|
72 |
+
// hard exclude "document.write", which e.g. WordPress core uses to add polyfills,
|
73 |
+
// but we _really_ should hide all inline JS from AsyncJS in a future release.
|
74 |
+
$array_exclusions[] = 'document.write';
|
75 |
+
|
76 |
if ( false !== $aj_enabled && false !== $this->aj_shop() && false !== $this->aj_logged() && false === is_admin() && false === $this->aj_is_amp() && false === $this->aj_noptimize() ) {
|
77 |
if ( is_array( $aj_plugin_exclusions ) && !empty( $aj_plugin_exclusions ) ) {
|
78 |
foreach ( $aj_plugin_exclusions as $aj_plugin_exclusion ) {
|
98 |
foreach ( $array_exclusions as $exclusion ) {
|
99 |
$exclusion = trim( $exclusion );
|
100 |
if ( !empty( $exclusion ) ) {
|
101 |
+
if ( false !== strpos( strtolower( $tag ), strtolower( $exclusion ) ) ) {
|
102 |
return $tag;
|
103 |
}
|
104 |
}
|
105 |
}
|
106 |
}
|
107 |
+
if ( false !== strpos( strtolower( $src ), 'js/jquery/jquery.js' ) || false !== strpos( strtolower( $src ), 'js/jquery/jquery.min.js' ) ) {
|
108 |
if ( $aj_jquery == 'async' || $aj_jquery == 'defer' ) {
|
109 |
$tag = str_replace( 'src=', $aj_jquery . "='" . $aj_jquery . "' src=", $tag );
|
110 |
return $tag;
|
asyncjsStatusScreens.php
CHANGED
@@ -21,7 +21,7 @@ $aj_enabled = (get_option('aj_enabled', 0) == 1) ? 'Enabled' : 'Disabled';
|
|
21 |
$aj_method = (get_option('aj_method', 'async') == 'async') ? 'Async' : 'Defer';
|
22 |
$aj_jquery = get_option('aj_jquery', 'async');
|
23 |
$aj_jquery = ($aj_jquery == 'same ') ? get_option('aj_method', 'async') : $aj_jquery;
|
24 |
-
$aj_jquery = ($aj_jquery == 'async') ? 'Async' : ($aj_jquery == 'defer') ? 'Defer' : 'Excluded';
|
25 |
$aj_async = get_option('aj_async', '');
|
26 |
$aj_defer = get_option('aj_defer', '');
|
27 |
$aj_exclusions = get_option('aj_exclusions', '');
|
21 |
$aj_method = (get_option('aj_method', 'async') == 'async') ? 'Async' : 'Defer';
|
22 |
$aj_jquery = get_option('aj_jquery', 'async');
|
23 |
$aj_jquery = ($aj_jquery == 'same ') ? get_option('aj_method', 'async') : $aj_jquery;
|
24 |
+
$aj_jquery = ( $aj_jquery == 'async' ) ? 'Async' : ( ( $aj_jquery == 'defer' ) ? 'Defer' : 'Excluded' );
|
25 |
$aj_async = get_option('aj_async', '');
|
26 |
$aj_defer = get_option('aj_defer', '');
|
27 |
$aj_exclusions = get_option('aj_exclusions', '');
|
lib/gtmetrix/class.Services_WTF_Test.php
CHANGED
@@ -465,4 +465,4 @@ class Services_WTF_Test {
|
|
465 |
return false;
|
466 |
}
|
467 |
|
468 |
-
}
|
465 |
return false;
|
466 |
}
|
467 |
|
468 |
+
}
|
readme.txt
CHANGED
@@ -3,8 +3,8 @@ Contributors: (cloughit), optimizingmatters, futtta, wormeyman
|
|
3 |
Donate link: http://blog.futtta.be/2013/10/21/do-not-donate-to-me/
|
4 |
Tags: async, javascript, pagespeed, performance, render blocking
|
5 |
Requires at least: 4.6
|
6 |
-
Tested up to: 5.
|
7 |
-
Stable tag: 2.20.
|
8 |
License: GPLv2 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
10 |
|
@@ -57,6 +57,12 @@ We recommend using the awesome <a href="https://wordpress.org/plugins/autoptimiz
|
|
57 |
|
58 |
== Changelog ==
|
59 |
|
|
|
|
|
|
|
|
|
|
|
|
|
60 |
= 2.20.03.01 =
|
61 |
|
62 |
* extra security measure; check the nonce when saving settings/ going through wizard.
|
3 |
Donate link: http://blog.futtta.be/2013/10/21/do-not-donate-to-me/
|
4 |
Tags: async, javascript, pagespeed, performance, render blocking
|
5 |
Requires at least: 4.6
|
6 |
+
Tested up to: 5.6
|
7 |
+
Stable tag: 2.20.12.09
|
8 |
License: GPLv2 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
10 |
|
57 |
|
58 |
== Changelog ==
|
59 |
|
60 |
+
= 2.20.12.09 =
|
61 |
+
|
62 |
+
* fix for some ternary operators warning in PHP 7.4 and up.
|
63 |
+
* hard-exclude document.write (WordPress core injects inline JS that has `<script src` in it which AsyncJS acted on)
|
64 |
+
* fix for WordPress 5.6 renaming jQuery from jquery.js into jquery.min.js
|
65 |
+
|
66 |
= 2.20.03.01 =
|
67 |
|
68 |
* extra security measure; check the nonce when saving settings/ going through wizard.
|