Version Description
- Improvement: Autoptimize now also tries to purge WP Engine cache when AOs cache is cleared
- Improvement: for AMP pages (which are pretty optimized anyway) Autoptimize will not optimize to avoid issues with e.g. "inline & defer" and with AO adding attributes to link-tags that are not allowed in the subset of HTML that AMP is
- Improvement: refactored the page cache purging mechanism (removing duplicate code, now nicely hooking into AO's own
autoptimize_action_cachepurged
action) - Improvement: Re-enable functionality to move non-aggregated JS if also aggregate inline JS is active (can be disabled with
autoptiize_filter_js_unmovable
filter) - Improvement: script tags with
data-noptimize
attribute will be excluded from optimization - Bugfix: Better support for renamed wp-content directories
- Bugfix: Multiple fixes for late-injected CSS/ JS (changes in those files were not always picked up, fonts or background images were not being CDNed, )
- Misc. other fixes & improvements, go read the commit-log on GitHub if youre that curious
- Tested & confirmed working with WordPress 4.5 (beta 3)
Download this release
Release Info
Developer | futtta |
Plugin | Autoptimize |
Version | 2.0.1 |
Comparing to | |
See all releases |
Code changes from version 2.0.2 to 2.0.1
- autoptimize.php +1 -1
- classes/autoptimizeCache.php +1 -1
- classes/autoptimizeConfig.php +0 -4
- classes/autoptimizeScripts.php +1 -1
- classes/autoptimizeStyles.php +4 -2
- classlesses/autoptimizeFontRegex.php +0 -8
- readme.txt +9 -14
autoptimize.php
CHANGED
@@ -3,7 +3,7 @@
|
|
3 |
Plugin Name: Autoptimize
|
4 |
Plugin URI: http://blog.futtta.be/autoptimize
|
5 |
Description: Optimizes your website, concatenating the CSS and JavaScript code, and compressing it.
|
6 |
-
Version: 2.0.
|
7 |
Author: Frank Goossens (futtta)
|
8 |
Author URI: http://blog.futtta.be/
|
9 |
Domain Path: localization/
|
3 |
Plugin Name: Autoptimize
|
4 |
Plugin URI: http://blog.futtta.be/autoptimize
|
5 |
Description: Optimizes your website, concatenating the CSS and JavaScript code, and compressing it.
|
6 |
+
Version: 2.0.1
|
7 |
Author: Frank Goossens (futtta)
|
8 |
Author URI: http://blog.futtta.be/
|
9 |
Domain Path: localization/
|
classes/autoptimizeCache.php
CHANGED
@@ -94,7 +94,7 @@ class autoptimizeCache {
|
|
94 |
do_action("autoptimize_action_cachepurged");
|
95 |
}
|
96 |
}
|
97 |
-
add_action("
|
98 |
|
99 |
// try to purge caching plugins cache-files?
|
100 |
include_once(AUTOPTIMIZE_PLUGIN_DIR.'classlesses/autoptimizePageCacheFlush.php');
|
94 |
do_action("autoptimize_action_cachepurged");
|
95 |
}
|
96 |
}
|
97 |
+
add_action("plugins_loaded","autoptimize_do_cachepurged_action",11);
|
98 |
|
99 |
// try to purge caching plugins cache-files?
|
100 |
include_once(AUTOPTIMIZE_PLUGIN_DIR.'classlesses/autoptimizePageCacheFlush.php');
|
classes/autoptimizeConfig.php
CHANGED
@@ -47,10 +47,6 @@ class autoptimizeConfig {
|
|
47 |
|
48 |
<h1><?php _e('Autoptimize Settings','autoptimize'); ?></h1>
|
49 |
|
50 |
-
<?php if (version_compare(PHP_VERSION, '5.3.0') < 0) { ?>
|
51 |
-
<div class="notice-error notice"><?php _e('<p><strong>You are using a very old version of PHP</strong> (5.2.x or older) which has <a href="http://blog.futtta.be/2016/03/15/why-would-you-still-be-on-php-5-2/" target="_blank">serious security and performance issues</a>. Please ask your hoster to provide you with an upgrade path to 5.6 or 7.0</p>','autoptimize'); ?></div>
|
52 |
-
<?php } ?>
|
53 |
-
|
54 |
<div style="float:left;width:70%;">
|
55 |
|
56 |
<?php echo $this->ao_admin_tabs(); ?>
|
47 |
|
48 |
<h1><?php _e('Autoptimize Settings','autoptimize'); ?></h1>
|
49 |
|
|
|
|
|
|
|
|
|
50 |
<div style="float:left;width:70%;">
|
51 |
|
52 |
<?php echo $this->ao_admin_tabs(); ?>
|
classes/autoptimizeScripts.php
CHANGED
@@ -346,7 +346,7 @@ class autoptimizeScripts extends autoptimizeBase {
|
|
346 |
|
347 |
//Checks agains the blacklist
|
348 |
private function ismovable($tag) {
|
349 |
-
if ($this->include_inline !== true || apply_filters('autoptimize_filter_js_unmovable',
|
350 |
return false;
|
351 |
}
|
352 |
|
346 |
|
347 |
//Checks agains the blacklist
|
348 |
private function ismovable($tag) {
|
349 |
+
if ($this->include_inline !== true || apply_filters('autoptimize_filter_js_unmovable',false)) {
|
350 |
return false;
|
351 |
}
|
352 |
|
classes/autoptimizeStyles.php
CHANGED
@@ -391,9 +391,11 @@ class autoptimizeStyles extends autoptimizeBase {
|
|
391 |
}
|
392 |
|
393 |
// CDN the fonts!
|
394 |
-
if (
|
395 |
$fontreplace = array();
|
396 |
-
|
|
|
|
|
397 |
|
398 |
preg_match_all($fonturl_regex,$code,$matches);
|
399 |
if (is_array($matches)) {
|
391 |
}
|
392 |
|
393 |
// CDN the fonts!
|
394 |
+
if ((!empty($this->cdn_url))&&apply_filters("autoptimize_filter_css_fonts_cdn",false)) {
|
395 |
$fontreplace = array();
|
396 |
+
$fonturl_regex = <<<'LOD'
|
397 |
+
~(?(DEFINE)(?<quoted_content>(["']) (?>[^"'\\]++ | \\{2} | \\. | (?!\g{-1})["'] )*+ \g{-1})(?<comment> /\* .*? \*/ ) (?<url_skip>(?: data: ) [^"'\s)}]*+ ) (?<other_content>(?> [^u}/"']++ | \g<quoted_content> | \g<comment> | \Bu | u(?!rl\s*+\() | /(?!\*) | \g<url_start> \g<url_skip> ["']?+ )++ ) (?<anchor> \G(?<!^) ["']?+ | @font-face \s*+ { ) (?<url_start> url\( \s*+ ["']?+ ) ) \g<comment> (*SKIP)(*FAIL) | \g<anchor> \g<other_content>?+ \g<url_start> \K ((?:(?:https?:)?(?://[[:alnum:]\-\.]+)(?::[0-9]+)?)?\/[^"'\s)}]*+) ~xs
|
398 |
+
LOD;
|
399 |
|
400 |
preg_match_all($fonturl_regex,$code,$matches);
|
401 |
if (is_array($matches)) {
|
classlesses/autoptimizeFontRegex.php
DELETED
@@ -1,8 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
// regex to find fonts, externalised to avoid nasty errors for php<5.3
|
3 |
-
|
4 |
-
$fonturl_regex = <<<'LOD'
|
5 |
-
~(?(DEFINE)(?<quoted_content>(["']) (?>[^"'\\]++ | \\{2} | \\. | (?!\g{-1})["'] )*+ \g{-1})(?<comment> /\* .*? \*/ ) (?<url_skip>(?: data: ) [^"'\s)}]*+ ) (?<other_content>(?> [^u}/"']++ | \g<quoted_content> | \g<comment> | \Bu | u(?!rl\s*+\() | /(?!\*) | \g<url_start> \g<url_skip> ["']?+ )++ ) (?<anchor> \G(?<!^) ["']?+ | @font-face \s*+ { ) (?<url_start> url\( \s*+ ["']?+ ) ) \g<comment> (*SKIP)(*FAIL) | \g<anchor> \g<other_content>?+ \g<url_start> \K ((?:(?:https?:)?(?://[[:alnum:]\-\.]+)(?::[0-9]+)?)?\/[^"'\s)}]*+) ~xs
|
6 |
-
LOD;
|
7 |
-
|
8 |
-
?>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
readme.txt
CHANGED
@@ -1,10 +1,10 @@
|
|
1 |
=== Autoptimize ===
|
2 |
Contributors: futtta, turl, optimizingmatters
|
3 |
-
Tags: css, html, javascript, js, optimize, speed, cache, aggregate,
|
4 |
Donate link: http://blog.futtta.be/2013/10/21/do-not-donate-to-me/
|
5 |
Requires at least: 2.7
|
6 |
-
Tested up to: 4.
|
7 |
-
Stable tag: 2.0.
|
8 |
|
9 |
Autoptimize speeds up your website and helps you save bandwidth by aggregating and minimizing JS, CSS and HTML.
|
10 |
|
@@ -15,7 +15,7 @@ Autoptimize makes optimizing your site really easy. It concatenates all scripts
|
|
15 |
If you consider performance important, you really should use a caching-plugin such as e.g. [WP Super Cache](http://wordpress.org/extend/plugins/wp-super-cache/) or
|
16 |
[HyperCache](http://wordpress.org/extend/plugins/hyper-cache/) to complement Autoptimize.
|
17 |
|
18 |
-
(
|
19 |
|
20 |
== Installation ==
|
21 |
|
@@ -41,7 +41,7 @@ CSS in general should go in the head of the document. Recently a.o. Google start
|
|
41 |
|
42 |
= But how can one find out what the "above the fold CSS" is? =
|
43 |
|
44 |
-
There's no easy solution for that as "above the fold" depends on where the fold is, which in turn depends on screensize. There are some tools available however, which try to identify just what is "above the fold". [This list of tools](https://github.com/addyosmani/above-the-fold-css-tools) is a great starting point. [http://jonassebastianohlsson.com/criticalpathcssgenerator/](http://jonassebastianohlsson.com/criticalpathcssgenerator/) is
|
45 |
|
46 |
= Or should you inline all CSS? =
|
47 |
|
@@ -74,7 +74,7 @@ Before Autoptimize 2.0.0, inline code was always optimized with all CSS pushed i
|
|
74 |
|
75 |
= What can I do with the API? =
|
76 |
|
77 |
-
A whole lot; there are filters you can use to conditionally disable Autoptimize per request, to change the CSS- and JS-excludes, to change the limit for CSS background-images to be inlined in the CSS, to define what JS-files are moved
|
78 |
|
79 |
= How can I use the code in autoptimize_helper.php_example? =
|
80 |
|
@@ -112,7 +112,7 @@ If your blog doesn't function normally after having turned on Autoptimize, here
|
|
112 |
|
113 |
* If all works but you notice your blog is slower, ensure you have a page caching plugin installed (WP Super Cache or similar) and check the info on cache size (the solution for that problem also impacts performance for uncached pages) in this FAQ as well.
|
114 |
* In case your blog looks weird, i.e. when the layout gets messed up, there is problem with CSS optimization. In this case you can turn on the option "Look for styles on just head?" and see if that solves the problem. You can also force CSS not to be aggregated by wrapping it in noptimize-tags in your theme or widget or by adding filename (for external stylesheets) or string (for inline styles) to the exclude-list.
|
115 |
-
* In case some functionality on your site stops working (a carroussel, a menu, the search input, ...) you're likely hitting JavaScript optimization trouble. Disable the option "Aggregate inline JS" and activate "Force JavaScript in head
|
116 |
* If your theme or plugin require jQuery, you can try either forcing all in head and/ or excluding jquery.js (and jQuery-plugins if needed).
|
117 |
* If you can't get either CSS or JS optimization working, you can off course always continue using the other two optimization-techniques.
|
118 |
* If you tried the troubleshooting tips above and you still can't get CSS and JS working at all, you can ask for support on the [WordPress Autoptimize support forum](http://wordpress.org/support/plugin/autoptimize). See below for a description of what information you should provide in your "trouble ticket"
|
@@ -212,19 +212,14 @@ Just [fork Autoptimize on Github](https://github.com/futtta/autoptimize) and cod
|
|
212 |
|
213 |
== Changelog ==
|
214 |
|
215 |
-
= 2.0.2 =
|
216 |
-
* bugfix: disallow moving non-aggregated JS by default (can be re-enabled by passing false to the `autoptimize_filter_js_unmovable`)
|
217 |
-
* bugfix: hook autoptimize_action_cachepurged into init to avoid ugly error-message for ZenCache (Comet Cache) users
|
218 |
-
* bugfix to allow for Autoptimize to work with PHP 5.2, although [you really should upgrade](http://blog.futtta.be/2016/03/15/why-would-you-still-be-on-php-5-2/)
|
219 |
-
|
220 |
= 2.0.1 =
|
221 |
* Improvement: Autoptimize now also tries to purge WP Engine cache when AO’s cache is cleared
|
222 |
* Improvement: for AMP pages (which are pretty optimized anyway) Autoptimize will not optimize to avoid issues with e.g. "inline & defer" and with AO adding attributes to link-tags that are not allowed in the subset of HTML that AMP is
|
223 |
* Improvement: refactored the page cache purging mechanism (removing duplicate code, now nicely hooking into AO's own `autoptimize_action_cachepurged` action)
|
224 |
-
* Improvement: Re-enable functionality to move non-aggregated JS if “also aggregate inline JS” is active (can be disabled with `
|
225 |
* Improvement: script tags with `data-noptimize` attribute will be excluded from optimization
|
226 |
* Bugfix: Better support for renamed wp-content directories
|
227 |
-
* Bugfix: Multiple fixes for late-injected CSS/ JS (changes in those files were not always picked up, fonts or background images were not being CDN’ed,
|
228 |
* Misc. other fixes & improvements, go read [the commit-log on GitHub](https://github.com/futtta/autoptimize/commits/master) if you’re that curious
|
229 |
* Tested & confirmed working with WordPress 4.5 (beta 3)
|
230 |
|
1 |
=== Autoptimize ===
|
2 |
Contributors: futtta, turl, optimizingmatters
|
3 |
+
Tags: css, html, javascript, js, optimize, speed, cache, aggregate, minify, minification, performance, pagespeed
|
4 |
Donate link: http://blog.futtta.be/2013/10/21/do-not-donate-to-me/
|
5 |
Requires at least: 2.7
|
6 |
+
Tested up to: 4.5
|
7 |
+
Stable tag: 2.0.1
|
8 |
|
9 |
Autoptimize speeds up your website and helps you save bandwidth by aggregating and minimizing JS, CSS and HTML.
|
10 |
|
15 |
If you consider performance important, you really should use a caching-plugin such as e.g. [WP Super Cache](http://wordpress.org/extend/plugins/wp-super-cache/) or
|
16 |
[HyperCache](http://wordpress.org/extend/plugins/hyper-cache/) to complement Autoptimize.
|
17 |
|
18 |
+
(Image under creative commons [by LL Twistiti](https://www.flickr.com/photos/twistiti/818552808/))
|
19 |
|
20 |
== Installation ==
|
21 |
|
41 |
|
42 |
= But how can one find out what the "above the fold CSS" is? =
|
43 |
|
44 |
+
There's no easy solution for that as "above the fold" depends on where the fold is, which in turn depends on screensize. There are some tools available however, which try to identify just what is "above the fold". [This list of tools](https://github.com/addyosmani/above-the-fold-css-tools) is a great starting point and esp. [http://jonassebastianohlsson.com/criticalpathcssgenerator/](http://jonassebastianohlsson.com/criticalpathcssgenerator/) is an easy solution if you're not into node.js yourself. Alternatively [this bookmarklet](https://gist.github.com/PaulKinlan/6284142) (Chrome-only) can be helpful as well.
|
45 |
|
46 |
= Or should you inline all CSS? =
|
47 |
|
74 |
|
75 |
= What can I do with the API? =
|
76 |
|
77 |
+
A whole lot; there are filters you can use to conditionally disable Autoptimize per request, to change the CSS- and JS-excludes, to change the limit for CSS background-images to be inlined in the CSS, to define what JS-files are moved behing the aggregated on, to change the defer-attribute on the aggregated JS script-tag, ... There are examples for many filters in autoptimize_helper.php_example and in this FAQ.
|
78 |
|
79 |
= How can I use the code in autoptimize_helper.php_example? =
|
80 |
|
112 |
|
113 |
* If all works but you notice your blog is slower, ensure you have a page caching plugin installed (WP Super Cache or similar) and check the info on cache size (the solution for that problem also impacts performance for uncached pages) in this FAQ as well.
|
114 |
* In case your blog looks weird, i.e. when the layout gets messed up, there is problem with CSS optimization. In this case you can turn on the option "Look for styles on just head?" and see if that solves the problem. You can also force CSS not to be aggregated by wrapping it in noptimize-tags in your theme or widget or by adding filename (for external stylesheets) or string (for inline styles) to the exclude-list.
|
115 |
+
* In case some functionality on your site stops working (a carroussel, a menu, the search input, ...) you're likely hitting JavaScript optimization trouble. Disable the option "Aggregate inline JS" and activate "Force JavaScript in <head>?" and try again. Excluding ´jquery.js´ from optimization (see below) and optionally activating "[Add try/catch wrapping](http://blog.futtta.be/2014/08/18/when-should-you-trycatch-javascript/)") can also help. Alternatively -for the technically savvy- you can exclude specific scripts from being treated (moved and/ or aggregated) by Autoptimize by adding a string that will match the offending Javascript or excluding it from within your template files or widgets by wrapping the code between noptimize-tags. Identifying the offending JavaScript and choosing the correct exclusion-string can be trial and error, but in the majority of cases JavaScript optimization issues can be solved this way. When debugging JavaScript issues, your browsers error console is the most important tool to help you understand what is going on.
|
116 |
* If your theme or plugin require jQuery, you can try either forcing all in head and/ or excluding jquery.js (and jQuery-plugins if needed).
|
117 |
* If you can't get either CSS or JS optimization working, you can off course always continue using the other two optimization-techniques.
|
118 |
* If you tried the troubleshooting tips above and you still can't get CSS and JS working at all, you can ask for support on the [WordPress Autoptimize support forum](http://wordpress.org/support/plugin/autoptimize). See below for a description of what information you should provide in your "trouble ticket"
|
212 |
|
213 |
== Changelog ==
|
214 |
|
|
|
|
|
|
|
|
|
|
|
215 |
= 2.0.1 =
|
216 |
* Improvement: Autoptimize now also tries to purge WP Engine cache when AO’s cache is cleared
|
217 |
* Improvement: for AMP pages (which are pretty optimized anyway) Autoptimize will not optimize to avoid issues with e.g. "inline & defer" and with AO adding attributes to link-tags that are not allowed in the subset of HTML that AMP is
|
218 |
* Improvement: refactored the page cache purging mechanism (removing duplicate code, now nicely hooking into AO's own `autoptimize_action_cachepurged` action)
|
219 |
+
* Improvement: Re-enable functionality to move non-aggregated JS if “also aggregate inline JS” is active (can be disabled with `autoptiize_filter_js_unmovable` filter)
|
220 |
* Improvement: script tags with `data-noptimize` attribute will be excluded from optimization
|
221 |
* Bugfix: Better support for renamed wp-content directories
|
222 |
+
* Bugfix: Multiple fixes for late-injected CSS/ JS (changes in those files were not always picked up, fonts or background images were not being CDN’ed, …)
|
223 |
* Misc. other fixes & improvements, go read [the commit-log on GitHub](https://github.com/futtta/autoptimize/commits/master) if you’re that curious
|
224 |
* Tested & confirmed working with WordPress 4.5 (beta 3)
|
225 |
|