Version Description
- improvement: updated to latest version of Filamentgroup's loadCSS
- improvement: by default exclude
wp-content/cache
andwp-content/uploads
from CSS optimization (Divi, Avada & possibly others store page-specific CSS there) - bugfix: stop double try/catch-blocks
- misc. bugfixes (see GitHub commit log)
- heads-up: this is (supposed to be) the last minor release of the 2.3 branch, 2.4 is a major change with some big under-the-hood and functional changes
Download this release
Release Info
Developer | futtta |
Plugin | Autoptimize |
Version | 2.3.3 |
Comparing to | |
See all releases |
Code changes from version 2.3.2 to 2.3.3
- autoptimize.php +8 -6
- classes/autoptimizeBase.php +2 -0
- classes/autoptimizeConfig.php +7 -3
- classes/autoptimizeHTML.php +1 -1
- classes/autoptimizeStyles.php +2 -5
- classlesses/autoptimizeExtra.php +31 -6
- classlesses/autoptimizePartners.php +1 -1
- classlesses/autoptimizeSpeedupper.php +13 -11
- readme.txt +8 -1
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.
|
7 |
Author: Frank Goossens (futtta)
|
8 |
Author URI: https://autoptimize.com/
|
9 |
Domain Path: localization/
|
@@ -39,11 +39,13 @@ if (!defined('AUTOPTIMIZE_CACHE_CHILD_DIR')) { define('AUTOPTIMIZE_CACHE_CHILD_D
|
|
39 |
if (!defined('AUTOPTIMIZE_CACHEFILE_PREFIX')) { define('AUTOPTIMIZE_CACHEFILE_PREFIX', 'autoptimize_'); }
|
40 |
|
41 |
// Plugin dir constants (plugin url's defined later to accomodate domain mapped sites)
|
42 |
-
if (
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
|
|
|
|
|
47 |
}
|
48 |
define('AUTOPTIMIZE_CACHE_DELAY',true);
|
49 |
define('WP_ROOT_DIR',substr(WP_CONTENT_DIR, 0, strlen(WP_CONTENT_DIR)-strlen(AUTOPTIMIZE_WP_CONTENT_NAME)));
|
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/
|
39 |
if (!defined('AUTOPTIMIZE_CACHEFILE_PREFIX')) { define('AUTOPTIMIZE_CACHEFILE_PREFIX', 'autoptimize_'); }
|
40 |
|
41 |
// Plugin dir constants (plugin url's defined later to accomodate domain mapped sites)
|
42 |
+
if (!defined('AUTOPTIMIZE_CACHE_DIR')) {
|
43 |
+
if (is_multisite() && apply_filters( 'autoptimize_separate_blog_caches' , true )) {
|
44 |
+
$blog_id = get_current_blog_id();
|
45 |
+
define('AUTOPTIMIZE_CACHE_DIR', WP_CONTENT_DIR.AUTOPTIMIZE_CACHE_CHILD_DIR.$blog_id.'/' );
|
46 |
+
} else {
|
47 |
+
define('AUTOPTIMIZE_CACHE_DIR', WP_CONTENT_DIR.AUTOPTIMIZE_CACHE_CHILD_DIR );
|
48 |
+
}
|
49 |
}
|
50 |
define('AUTOPTIMIZE_CACHE_DELAY',true);
|
51 |
define('WP_ROOT_DIR',substr(WP_CONTENT_DIR, 0, strlen(WP_CONTENT_DIR)-strlen(AUTOPTIMIZE_WP_CONTENT_NAME)));
|
classes/autoptimizeBase.php
CHANGED
@@ -378,6 +378,8 @@ abstract class autoptimizeBase {
|
|
378 |
}
|
379 |
}
|
380 |
} else if ($codeType === "css") {
|
|
|
|
|
381 |
if (class_exists('Minify_CSS_Compressor')) {
|
382 |
$tmp_code = trim(Minify_CSS_Compressor::process($_toMinify));
|
383 |
} else if(class_exists('CSSmin')) {
|
378 |
}
|
379 |
}
|
380 |
} else if ($codeType === "css") {
|
381 |
+
// make sure paths to background images/ imported css/ fonts .. are OK
|
382 |
+
$_toMinify = autoptimizeStyles::fixurls($pathIn,$_toMinify);
|
383 |
if (class_exists('Minify_CSS_Compressor')) {
|
384 |
$tmp_code = trim(Minify_CSS_Compressor::process($_toMinify));
|
385 |
} else if(class_exists('CSSmin')) {
|
classes/autoptimizeConfig.php
CHANGED
@@ -159,7 +159,11 @@ input[type=url]:invalid {color: red; border-color:red;} .form-table th{font-weig
|
|
159 |
<div class="wrap">
|
160 |
|
161 |
<?php if (version_compare(PHP_VERSION, '5.3.0') < 0) { ?>
|
162 |
-
<div class="notice-error notice"><?php echo '<p>' . sprintf( __('<strong>You are using a very old version of PHP</strong>
|
|
|
|
|
|
|
|
|
163 |
<?php } ?>
|
164 |
|
165 |
<div id="autoptimize_main">
|
@@ -285,7 +289,7 @@ input[type=url]:invalid {color: red; border-color:red;} .form-table th{font-weig
|
|
285 |
</tr>
|
286 |
<tr valign="top" class="<?php echo $hiddenClass;?>ao_adv css_sub">
|
287 |
<th scope="row"><?php _e('Exclude CSS from Autoptimize:','autoptimize'); ?></th>
|
288 |
-
<td><label><input type="text" style="width:100%;" name="autoptimize_css_exclude" value="<?php echo get_option('autoptimize_css_exclude','admin-bar.min.css, dashicons.min.css'); ?>"/><br />
|
289 |
<?php _e('A comma-separated list of CSS you want to exclude from being optimized.','autoptimize'); ?></label></td>
|
290 |
</tr>
|
291 |
</table>
|
@@ -622,7 +626,7 @@ input[type=url]:invalid {color: red; border-color:red;} .form-table th{font-weig
|
|
622 |
'autoptimize_js_include_inline' => 0,
|
623 |
'autoptimize_js_forcehead' => 0,
|
624 |
'autoptimize_css' => 0,
|
625 |
-
'autoptimize_css_exclude' => "admin-bar.min.css, dashicons.min.css",
|
626 |
'autoptimize_css_justhead' => 0,
|
627 |
'autoptimize_css_include_inline' => 1,
|
628 |
'autoptimize_css_defer' => 0,
|
159 |
<div class="wrap">
|
160 |
|
161 |
<?php if (version_compare(PHP_VERSION, '5.3.0') < 0) { ?>
|
162 |
+
<div class="notice-error notice"><?php echo '<p>' . sprintf( __('<strong>You are using a very old version of PHP</strong> which will not be supported as from the upcoming Autoptimize 2.4 any more, cfr. <a href=%s>this blogpost for more info</a>. please ask your hoster to provide you with an upgrade path to 7.x.','autoptimize'), '"https://blog.futtta.be/2018/02/13/introducing-zytzagoos-major-changes-for-autoptimize-2-4/" target="_blank"' ) . '</p>'; ?></div>
|
163 |
+
<?php } ?>
|
164 |
+
|
165 |
+
<?php if (defined('AUTOPTIMIZE_LEGACY_MINIFIERS')) { ?>
|
166 |
+
<div class="notice-error notice"><?php echo '<p>' . sprintf( __('You are forcing Autoptimize to use the "legacy minifiers" by setting the AUTOPTIMIZE_LEGACY_MINIFIERS constant in /wp-config.php. The "legacy minifiers" will not be supported as from the upcoming Autoptimize 2.4 any more, cfr. <a href=%s>this blogpost for more info</a>.','autoptimize'), '"https://blog.futtta.be/2018/02/13/introducing-zytzagoos-major-changes-for-autoptimize-2-4/" target="_blank"') . '</p>'; ?></div>
|
167 |
<?php } ?>
|
168 |
|
169 |
<div id="autoptimize_main">
|
289 |
</tr>
|
290 |
<tr valign="top" class="<?php echo $hiddenClass;?>ao_adv css_sub">
|
291 |
<th scope="row"><?php _e('Exclude CSS from Autoptimize:','autoptimize'); ?></th>
|
292 |
+
<td><label><input type="text" style="width:100%;" name="autoptimize_css_exclude" value="<?php echo get_option('autoptimize_css_exclude','wp-content/cache/, wp-content/uploads/, admin-bar.min.css, dashicons.min.css'); ?>"/><br />
|
293 |
<?php _e('A comma-separated list of CSS you want to exclude from being optimized.','autoptimize'); ?></label></td>
|
294 |
</tr>
|
295 |
</table>
|
626 |
'autoptimize_js_include_inline' => 0,
|
627 |
'autoptimize_js_forcehead' => 0,
|
628 |
'autoptimize_css' => 0,
|
629 |
+
'autoptimize_css_exclude' => "admin-bar.min.css, dashicons.min.css, wp-content/cache/, wp-content/uploads/",
|
630 |
'autoptimize_css_justhead' => 0,
|
631 |
'autoptimize_css_include_inline' => 1,
|
632 |
'autoptimize_css_defer' => 0,
|
classes/autoptimizeHTML.php
CHANGED
@@ -3,7 +3,7 @@ if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
|
|
3 |
|
4 |
class autoptimizeHTML extends autoptimizeBase {
|
5 |
private $keepcomments = false;
|
6 |
-
private $exclude = array('<!-- ngg_resource_manager_marker -->');
|
7 |
|
8 |
public function read($options) {
|
9 |
// Remove the HTML comments?
|
3 |
|
4 |
class autoptimizeHTML extends autoptimizeBase {
|
5 |
private $keepcomments = false;
|
6 |
+
private $exclude = array('<!-- ngg_resource_manager_marker -->', '<!--noindex-->', '<!--/noindex-->');
|
7 |
|
8 |
public function read($options) {
|
9 |
// Remove the HTML comments?
|
classes/autoptimizeStyles.php
CHANGED
@@ -541,7 +541,7 @@ class autoptimizeStyles extends autoptimizeBase {
|
|
541 |
if($this->defer == true) {
|
542 |
|
543 |
// Filter to modify the onload attribute - passes value and the stylesheet url
|
544 |
-
$preloadOnLoad = apply_filters('autoptimize_filter_css_preload_onload', "this.rel='stylesheet'", $url);
|
545 |
|
546 |
$preloadCssBlock .= '<link rel="preload" as="style" media="'.$media.'" href="'.$url.'" onload="'.$preloadOnLoad.'" />';
|
547 |
$noScriptCssBlock .= '<link type="text/css" media="'.$media.'" href="'.$url.'" rel="stylesheet" />';
|
@@ -556,10 +556,7 @@ class autoptimizeStyles extends autoptimizeBase {
|
|
556 |
}
|
557 |
|
558 |
if($this->defer == true) {
|
559 |
-
$preloadPolyfill = '<script data-cfasync=\'false\'
|
560 |
-
!function(a){"use strict";var b=function(b,c,d){function e(a){return h.body?a():void setTimeout(function(){e(a)})}function f(){i.addEventListener&&i.removeEventListener("load",f),i.media=d||"all"}var g,h=a.document,i=h.createElement("link");if(c)g=c;else{var j=(h.body||h.getElementsByTagName("head")[0]).childNodes;g=j[j.length-1]}var k=h.styleSheets;i.rel="stylesheet",i.href=b,i.media="only x",e(function(){g.parentNode.insertBefore(i,c?g:g.nextSibling)});var l=function(a){for(var b=i.href,c=k.length;c--;)if(k[c].href===b)return a();setTimeout(function(){l(a)})};return i.addEventListener&&i.addEventListener("load",f),i.onloadcssdefined=l,l(f),i};"undefined"!=typeof exports?exports.loadCSS=b:a.loadCSS=b}("undefined"!=typeof global?global:this);
|
561 |
-
/*! loadCSS rel=preload polyfill. [c]2017 Filament Group, Inc. MIT License */
|
562 |
-
!function(a){if(a.loadCSS){var b=loadCSS.relpreload={};if(b.support=function(){try{return a.document.createElement("link").relList.supports("preload")}catch(b){return!1}},b.poly=function(){for(var b=a.document.getElementsByTagName("link"),c=0;c<b.length;c++){var d=b[c];"preload"===d.rel&&"style"===d.getAttribute("as")&&(a.loadCSS(d.href,d,d.getAttribute("media")),d.rel=null)}},!b.support()){b.poly();var c=a.setInterval(b.poly,300);a.addEventListener&&a.addEventListener("load",function(){b.poly(),a.clearInterval(c)}),a.attachEvent&&a.attachEvent("onload",function(){a.clearInterval(c)})}}}(this);</script>';
|
563 |
$noScriptCssBlock .= "</noscript>";
|
564 |
$this->inject_in_html($preloadCssBlock.$noScriptCssBlock,$replaceTag);
|
565 |
|
541 |
if($this->defer == true) {
|
542 |
|
543 |
// Filter to modify the onload attribute - passes value and the stylesheet url
|
544 |
+
$preloadOnLoad = apply_filters('autoptimize_filter_css_preload_onload', "this.onload=null;this.rel='stylesheet'", $url);
|
545 |
|
546 |
$preloadCssBlock .= '<link rel="preload" as="style" media="'.$media.'" href="'.$url.'" onload="'.$preloadOnLoad.'" />';
|
547 |
$noScriptCssBlock .= '<link type="text/css" media="'.$media.'" href="'.$url.'" rel="stylesheet" />';
|
556 |
}
|
557 |
|
558 |
if($this->defer == true) {
|
559 |
+
$preloadPolyfill = '<script data-cfasync=\'false\'>!function(t){"use strict";t.loadCSS||(t.loadCSS=function(){});var e=loadCSS.relpreload={};if(e.support=function(){var e;try{e=t.document.createElement("link").relList.supports("preload")}catch(t){e=!1}return function(){return e}}(),e.bindMediaToggle=function(t){function e(){t.media=a}var a=t.media||"all";t.addEventListener?t.addEventListener("load",e):t.attachEvent&&t.attachEvent("onload",e),setTimeout(function(){t.rel="stylesheet",t.media="only x"}),setTimeout(e,3e3)},e.poly=function(){if(!e.support())for(var a=t.document.getElementsByTagName("link"),n=0;n<a.length;n++){var o=a[n];"preload"!==o.rel||"style"!==o.getAttribute("as")||o.getAttribute("data-loadcss")||(o.setAttribute("data-loadcss",!0),e.bindMediaToggle(o))}},!e.support()){e.poly();var a=t.setInterval(e.poly,500);t.addEventListener?t.addEventListener("load",function(){e.poly(),t.clearInterval(a)}):t.attachEvent&&t.attachEvent("onload",function(){e.poly(),t.clearInterval(a)})}"undefined"!=typeof exports?exports.loadCSS=loadCSS:t.loadCSS=loadCSS}("undefined"!=typeof global?global:this);</script>';
|
|
|
|
|
|
|
560 |
$noScriptCssBlock .= "</noscript>";
|
561 |
$this->inject_in_html($preloadCssBlock.$noScriptCssBlock,$replaceTag);
|
562 |
|
classlesses/autoptimizeExtra.php
CHANGED
@@ -35,7 +35,7 @@ function autoptimize_extra_init() {
|
|
35 |
}
|
36 |
|
37 |
/* async JS */
|
38 |
-
if (!empty($autoptimize_extra_options['autoptimize_extra_text_field_3'])) {
|
39 |
add_filter('autoptimize_filter_js_exclude','autoptimize_extra_async_js',10,1);
|
40 |
}
|
41 |
|
@@ -109,8 +109,9 @@ function autoptimize_extra_async_js($in) {
|
|
109 |
// get asyncs
|
110 |
$_fromSetting = $autoptimize_extra_options['autoptimize_extra_text_field_3'];
|
111 |
$AO_asynced_JS = array_fill_keys(array_filter(array_map('trim',explode(",",$_fromSetting))),"");
|
|
|
112 |
foreach ($AO_asynced_JS as $JSkey => $JSvalue) {
|
113 |
-
$AO_asynced_JS[$JSkey] =
|
114 |
}
|
115 |
|
116 |
// merge exclusions & asyncs in one array and return to AO API
|
@@ -338,13 +339,37 @@ function autoptimize_extra_options_page() {
|
|
338 |
<tr>
|
339 |
<th scope="row"><?php _e('Async Javascript-files <em>(advanced users)</em>','autoptimize'); ?></th>
|
340 |
<td>
|
341 |
-
|
342 |
-
|
343 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
344 |
</td>
|
345 |
</tr>
|
346 |
</table>
|
347 |
-
<p class="submit"><input type="submit" name="submit" id="submit" class="button button-primary" value="Save Changes"
|
348 |
</form>
|
349 |
<?php
|
350 |
}
|
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 |
|
109 |
// get asyncs
|
110 |
$_fromSetting = $autoptimize_extra_options['autoptimize_extra_text_field_3'];
|
111 |
$AO_asynced_JS = array_fill_keys(array_filter(array_map('trim',explode(",",$_fromSetting))),"");
|
112 |
+
$AO_async_flag = apply_filters('autoptimize_filter_extra_async',"async");
|
113 |
foreach ($AO_asynced_JS as $JSkey => $JSvalue) {
|
114 |
+
$AO_asynced_JS[$JSkey] = $AO_async_flag;
|
115 |
}
|
116 |
|
117 |
// merge exclusions & asyncs in one array and return to AO API
|
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 />
|
349 |
+
<?php
|
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>
|
371 |
</table>
|
372 |
+
<p class="submit"><input type="submit" name="submit" id="submit" class="button button-primary" value="<?php _e('Save Changes','autoptimize') ?>" /></p>
|
373 |
</form>
|
374 |
<?php
|
375 |
}
|
classlesses/autoptimizePartners.php
CHANGED
@@ -110,7 +110,7 @@ function getAOPartnerFeed() {
|
|
110 |
}
|
111 |
?>
|
112 |
<div class="itemDescription"><?php echo wp_kses_post($item -> get_description() ); ?></div>
|
113 |
-
<div class="itemButtonRow"><div class="itemButton button-secondary"><a href="<?php echo $itemURL; ?>" target="_blank"
|
114 |
</li>
|
115 |
<?php endforeach; ?>
|
116 |
<?php } ?>
|
110 |
}
|
111 |
?>
|
112 |
<div class="itemDescription"><?php echo wp_kses_post($item -> get_description() ); ?></div>
|
113 |
+
<div class="itemButtonRow"><div class="itemButton button-secondary"><a href="<?php echo $itemURL; ?>" target="_blank"><?php _e('More info','autoptimize'); ?></a></div></div>
|
114 |
</li>
|
115 |
<?php endforeach; ?>
|
116 |
<?php } ?>
|
classlesses/autoptimizeSpeedupper.php
CHANGED
@@ -29,11 +29,12 @@ function ao_js_snippetcacher($jsin,$jsfilename) {
|
|
29 |
$scriptsrc=preg_replace("#^\s*\/\/.*$#Um","",$jsin);
|
30 |
$scriptsrc=preg_replace("#^\s*\/\*[^!].*\*\/\s?#Us","",$scriptsrc);
|
31 |
$scriptsrc=preg_replace("#(^[\r\n]*|[\r\n]+)[\s\t]*[\r\n]+#", "\n", $scriptsrc);
|
|
|
32 |
|
33 |
-
|
34 |
-
|
35 |
-
}
|
36 |
}
|
|
|
37 |
if ( !empty($jsfilename) && str_replace( apply_filters('autoptimize_filter_js_speedup_cache',false), '', $jsfilename ) === $jsfilename ) {
|
38 |
// don't cache inline CSS or if filter says no
|
39 |
$ccheck->cache($scriptsrc,'text/javascript');
|
@@ -41,10 +42,6 @@ function ao_js_snippetcacher($jsin,$jsfilename) {
|
|
41 |
}
|
42 |
unset($ccheck);
|
43 |
|
44 |
-
if (get_option("autoptimize_js_trycatch")==="on") {
|
45 |
-
$scriptsrc="try{".$scriptsrc."}catch(e){}";
|
46 |
-
}
|
47 |
-
|
48 |
return $scriptsrc;
|
49 |
}
|
50 |
|
@@ -97,7 +94,12 @@ function ao_js_speedup_cleanup($jsin) {
|
|
97 |
return trim($jsin);
|
98 |
}
|
99 |
|
100 |
-
|
101 |
-
|
102 |
-
add_filter('
|
103 |
-
add_filter('
|
|
|
|
|
|
|
|
|
|
29 |
$scriptsrc=preg_replace("#^\s*\/\/.*$#Um","",$jsin);
|
30 |
$scriptsrc=preg_replace("#^\s*\/\*[^!].*\*\/\s?#Us","",$scriptsrc);
|
31 |
$scriptsrc=preg_replace("#(^[\r\n]*|[\r\n]+)[\s\t]*[\r\n]+#", "\n", $scriptsrc);
|
32 |
+
}
|
33 |
|
34 |
+
if ( (substr($scriptsrc,-1,1)!==";") && (substr($scriptsrc,-1,1)!=="}") ) {
|
35 |
+
$scriptsrc.=";";
|
|
|
36 |
}
|
37 |
+
|
38 |
if ( !empty($jsfilename) && str_replace( apply_filters('autoptimize_filter_js_speedup_cache',false), '', $jsfilename ) === $jsfilename ) {
|
39 |
// don't cache inline CSS or if filter says no
|
40 |
$ccheck->cache($scriptsrc,'text/javascript');
|
42 |
}
|
43 |
unset($ccheck);
|
44 |
|
|
|
|
|
|
|
|
|
45 |
return $scriptsrc;
|
46 |
}
|
47 |
|
94 |
return trim($jsin);
|
95 |
}
|
96 |
|
97 |
+
// conditionally attach filters
|
98 |
+
if ( apply_filters('autoptimize_css_do_minify',true) ) {
|
99 |
+
add_filter('autoptimize_css_individual_style','ao_css_snippetcacher',10,2);
|
100 |
+
add_filter('autoptimize_css_after_minify','ao_css_speedup_cleanup',10,1);
|
101 |
+
}
|
102 |
+
if ( apply_filters('autoptimize_js_do_minify',true) ) {
|
103 |
+
add_filter('autoptimize_js_individual_script','ao_js_snippetcacher',10,2);
|
104 |
+
add_filter('autoptimize_js_after_minify','ao_js_speedup_cleanup',10,1);
|
105 |
+
}
|
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.
|
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,13 @@ Just [fork Autoptimize on Github](https://github.com/futtta/autoptimize) and cod
|
|
249 |
|
250 |
== Changelog ==
|
251 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
252 |
= 2.3.2 =
|
253 |
* workaround for [stale options-data in external object cache such as Redis, Memcached (core bug)](https://core.trac.wordpress.org/ticket/31245) resulting in Autoptimize continuously executing the upgrade-procedure including clearing the cache and trying to preload it with HTTP-requests with "cachebuster" in the query string, thanks to [Haroon Q. Raja](https://hqraja.com/) and [Tomas Trkulja](https://twitter.com/zytzagoo) for their great assistance!
|
254 |
* fixes for "undefined index" notices on Extra settings page
|
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 |
|
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)
|
255 |
+
* bugfix: stop double try/catch-blocks
|
256 |
+
* misc. bugfixes (see [GitHub commit log](https://github.com/futtta/autoptimize/commits/master))
|
257 |
+
* heads-up: this is (supposed to be) the last minor release of the 2.3 branch, [2.4 is a major change with some big under-the-hood and functional changes](https://blog.futtta.be/2018/02/18/introducing-zytzagoos-major-changes-for-autoptimize-2-4/)
|
258 |
+
|
259 |
= 2.3.2 =
|
260 |
* workaround for [stale options-data in external object cache such as Redis, Memcached (core bug)](https://core.trac.wordpress.org/ticket/31245) resulting in Autoptimize continuously executing the upgrade-procedure including clearing the cache and trying to preload it with HTTP-requests with "cachebuster" in the query string, thanks to [Haroon Q. Raja](https://hqraja.com/) and [Tomas Trkulja](https://twitter.com/zytzagoo) for their great assistance!
|
261 |
* fixes for "undefined index" notices on Extra settings page
|