Version Description
- Fix for problem reported by Matthew Berry
- confirmed working with WordPress 4.8
Download this release
Release Info
Developer | futtta |
Plugin | Autoptimize |
Version | 2.1.1 |
Comparing to | |
See all releases |
Code changes from version 2.1.0 to 2.1.1
- autoptimize.php +2 -1
- classes/autoptimizeBase.php +9 -7
- classes/autoptimizeScripts.php +1 -1
- classes/autoptimizeStyles.php +3 -3
- readme.txt +5 -1
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.1.
|
7 |
Author: Frank Goossens (futtta)
|
8 |
Author URI: http://blog.futtta.be/
|
9 |
Domain Path: localization/
|
@@ -218,6 +218,7 @@ function autoptimize_end_buffering($content) {
|
|
218 |
define('AUTOPTIMIZE_CACHE_URL',AUTOPTIMIZE_WP_CONTENT_URL.AUTOPTIMIZE_CACHE_CHILD_DIR);
|
219 |
}
|
220 |
define('AUTOPTIMIZE_WP_ROOT_URL',str_replace(AUTOPTIMIZE_WP_CONTENT_NAME,'',AUTOPTIMIZE_WP_CONTENT_URL));
|
|
|
221 |
|
222 |
// Config element
|
223 |
$conf = autoptimizeConfig::instance();
|
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.1.1
|
7 |
Author: Frank Goossens (futtta)
|
8 |
Author URI: http://blog.futtta.be/
|
9 |
Domain Path: localization/
|
218 |
define('AUTOPTIMIZE_CACHE_URL',AUTOPTIMIZE_WP_CONTENT_URL.AUTOPTIMIZE_CACHE_CHILD_DIR);
|
219 |
}
|
220 |
define('AUTOPTIMIZE_WP_ROOT_URL',str_replace(AUTOPTIMIZE_WP_CONTENT_NAME,'',AUTOPTIMIZE_WP_CONTENT_URL));
|
221 |
+
define('AUTOPTIMIZE_HASH',wp_hash(AUTOPTIMIZE_CACHE_URL.microtime()));
|
222 |
|
223 |
// Config element
|
224 |
$conf = autoptimizeConfig::instance();
|
classes/autoptimizeBase.php
CHANGED
@@ -129,7 +129,7 @@ abstract class autoptimizeBase {
|
|
129 |
'#<!--\s?noptimize\s?-->.*?<!--\s?/\s?noptimize\s?-->#is',
|
130 |
create_function(
|
131 |
'$matches',
|
132 |
-
'return "%%NOPTIMIZE%%".base64_encode($matches[0])."%%NOPTIMIZE%%";'
|
133 |
),
|
134 |
$noptimize_in
|
135 |
);
|
@@ -143,7 +143,7 @@ abstract class autoptimizeBase {
|
|
143 |
protected function restore_noptimize($noptimize_in) {
|
144 |
if ( strpos( $noptimize_in, '%%NOPTIMIZE%%' ) !== false ) {
|
145 |
$noptimize_out = preg_replace_callback(
|
146 |
-
'#%%NOPTIMIZE%%(.*?)%%NOPTIMIZE%%#is',
|
147 |
create_function(
|
148 |
'$matches',
|
149 |
'return base64_decode($matches[1]);'
|
@@ -162,7 +162,7 @@ abstract class autoptimizeBase {
|
|
162 |
'#<!--\[if.*?\[endif\]-->#is',
|
163 |
create_function(
|
164 |
'$matches',
|
165 |
-
'return "%%IEHACK%%".base64_encode($matches[0])."%%IEHACK%%";'
|
166 |
),
|
167 |
$iehacks_in
|
168 |
);
|
@@ -175,7 +175,7 @@ abstract class autoptimizeBase {
|
|
175 |
protected function restore_iehacks($iehacks_in) {
|
176 |
if ( strpos( $iehacks_in, '%%IEHACK%%' ) !== false ) {
|
177 |
$iehacks_out = preg_replace_callback(
|
178 |
-
'#%%IEHACK%%(.*?)%%IEHACK%%#is',
|
179 |
create_function(
|
180 |
'$matches',
|
181 |
'return base64_decode($matches[1]);'
|
@@ -194,7 +194,7 @@ abstract class autoptimizeBase {
|
|
194 |
'#<!--.*?-->#is',
|
195 |
create_function(
|
196 |
'$matches',
|
197 |
-
'return "%%COMMENTS%%".base64_encode($matches[0])."%%COMMENTS%%";'
|
198 |
),
|
199 |
$comments_in
|
200 |
);
|
@@ -207,7 +207,7 @@ abstract class autoptimizeBase {
|
|
207 |
protected function restore_comments($comments_in) {
|
208 |
if ( strpos( $comments_in, '%%COMMENTS%%' ) !== false ) {
|
209 |
$comments_out = preg_replace_callback(
|
210 |
-
'#%%COMMENTS%%(.*?)%%COMMENTS%%#is',
|
211 |
create_function(
|
212 |
'$matches',
|
213 |
'return base64_decode($matches[1]);'
|
@@ -283,7 +283,7 @@ abstract class autoptimizeBase {
|
|
283 |
protected function inject_minified($in) {
|
284 |
if ( strpos( $in, '%%INJECTLATER%%' ) !== false ) {
|
285 |
$out = preg_replace_callback(
|
286 |
-
'#%%INJECTLATER%%(.*?)%%INJECTLATER%%#is',
|
287 |
create_function(
|
288 |
'$matches',
|
289 |
'$filepath=base64_decode(strtok($matches[1],"|"));
|
@@ -311,6 +311,8 @@ abstract class autoptimizeBase {
|
|
311 |
}
|
312 |
} else if ((substr($filepath,-4,4)===".css")) {
|
313 |
$filecontent=autoptimizeStyles::fixurls($filepath,$filecontent);
|
|
|
|
|
314 |
}
|
315 |
|
316 |
// return
|
129 |
'#<!--\s?noptimize\s?-->.*?<!--\s?/\s?noptimize\s?-->#is',
|
130 |
create_function(
|
131 |
'$matches',
|
132 |
+
'return "%%NOPTIMIZE".AUTOPTIMIZE_HASH."%%".base64_encode($matches[0])."%%NOPTIMIZE%%";'
|
133 |
),
|
134 |
$noptimize_in
|
135 |
);
|
143 |
protected function restore_noptimize($noptimize_in) {
|
144 |
if ( strpos( $noptimize_in, '%%NOPTIMIZE%%' ) !== false ) {
|
145 |
$noptimize_out = preg_replace_callback(
|
146 |
+
'#%%NOPTIMIZE'.AUTOPTIMIZE_HASH.'%%(.*?)%%NOPTIMIZE%%#is',
|
147 |
create_function(
|
148 |
'$matches',
|
149 |
'return base64_decode($matches[1]);'
|
162 |
'#<!--\[if.*?\[endif\]-->#is',
|
163 |
create_function(
|
164 |
'$matches',
|
165 |
+
'return "%%IEHACK".AUTOPTIMIZE_HASH."%%".base64_encode($matches[0])."%%IEHACK%%";'
|
166 |
),
|
167 |
$iehacks_in
|
168 |
);
|
175 |
protected function restore_iehacks($iehacks_in) {
|
176 |
if ( strpos( $iehacks_in, '%%IEHACK%%' ) !== false ) {
|
177 |
$iehacks_out = preg_replace_callback(
|
178 |
+
'#%%IEHACK'.AUTOPTIMIZE_HASH.'%%(.*?)%%IEHACK%%#is',
|
179 |
create_function(
|
180 |
'$matches',
|
181 |
'return base64_decode($matches[1]);'
|
194 |
'#<!--.*?-->#is',
|
195 |
create_function(
|
196 |
'$matches',
|
197 |
+
'return "%%COMMENTS".AUTOPTIMIZE_HASH."%%".base64_encode($matches[0])."%%COMMENTS%%";'
|
198 |
),
|
199 |
$comments_in
|
200 |
);
|
207 |
protected function restore_comments($comments_in) {
|
208 |
if ( strpos( $comments_in, '%%COMMENTS%%' ) !== false ) {
|
209 |
$comments_out = preg_replace_callback(
|
210 |
+
'#%%COMMENTS'.AUTOPTIMIZE_HASH.'%%(.*?)%%COMMENTS%%#is',
|
211 |
create_function(
|
212 |
'$matches',
|
213 |
'return base64_decode($matches[1]);'
|
283 |
protected function inject_minified($in) {
|
284 |
if ( strpos( $in, '%%INJECTLATER%%' ) !== false ) {
|
285 |
$out = preg_replace_callback(
|
286 |
+
'#%%INJECTLATER'.AUTOPTIMIZE_HASH.'%%(.*?)%%INJECTLATER%%#is',
|
287 |
create_function(
|
288 |
'$matches',
|
289 |
'$filepath=base64_decode(strtok($matches[1],"|"));
|
311 |
}
|
312 |
} else if ((substr($filepath,-4,4)===".css")) {
|
313 |
$filecontent=autoptimizeStyles::fixurls($filepath,$filecontent);
|
314 |
+
} else {
|
315 |
+
$filecontent="";
|
316 |
}
|
317 |
|
318 |
// return
|
classes/autoptimizeScripts.php
CHANGED
@@ -212,7 +212,7 @@ class autoptimizeScripts extends autoptimizeBase {
|
|
212 |
$scriptsrc=$tmpscriptsrc;
|
213 |
$this->alreadyminified=true;
|
214 |
} else if ((( strpos($script,"min.js") !== false ) || ( strpos($script,"wp-includes/js/jquery/jquery.js") !== false )) && ( $this->inject_min_late === true )) {
|
215 |
-
$scriptsrc="%%INJECTLATER%%".base64_encode($script)."|".md5($scriptsrc)."%%INJECTLATER%%";
|
216 |
}
|
217 |
$this->jscode .= "\n".$scriptsrc;
|
218 |
}/*else{
|
212 |
$scriptsrc=$tmpscriptsrc;
|
213 |
$this->alreadyminified=true;
|
214 |
} else if ((( strpos($script,"min.js") !== false ) || ( strpos($script,"wp-includes/js/jquery/jquery.js") !== false )) && ( $this->inject_min_late === true )) {
|
215 |
+
$scriptsrc="%%INJECTLATER".AUTOPTIMIZE_HASH."%%".base64_encode($script)."|".md5($scriptsrc)."%%INJECTLATER%%";
|
216 |
}
|
217 |
$this->jscode .= "\n".$scriptsrc;
|
218 |
}/*else{
|
classes/autoptimizeStyles.php
CHANGED
@@ -95,7 +95,7 @@ class autoptimizeStyles extends autoptimizeBase {
|
|
95 |
'#<(?:no)?script.*?<\/(?:no)?script>#is',
|
96 |
create_function(
|
97 |
'$matches',
|
98 |
-
'return "%%SCRIPT%%".base64_encode($matches[0])."%%SCRIPT%%";'
|
99 |
),
|
100 |
$this->content
|
101 |
);
|
@@ -190,7 +190,7 @@ class autoptimizeStyles extends autoptimizeBase {
|
|
190 |
$css=$tmpstyle;
|
191 |
$this->alreadyminified=true;
|
192 |
} else if ($this->can_inject_late($cssPath,$css)) {
|
193 |
-
$css="%%INJECTLATER%%".base64_encode($cssPath)."|".md5($css)."%%INJECTLATER%%";
|
194 |
}
|
195 |
} else {
|
196 |
// Couldn't read CSS. Maybe getpath isn't working?
|
@@ -490,7 +490,7 @@ class autoptimizeStyles extends autoptimizeBase {
|
|
490 |
// restore (no)script
|
491 |
if ( strpos( $this->content, '%%SCRIPT%%' ) !== false ) {
|
492 |
$this->content = preg_replace_callback(
|
493 |
-
'#%%SCRIPT%%(.*?)%%SCRIPT%%#is',
|
494 |
create_function(
|
495 |
'$matches',
|
496 |
'return base64_decode($matches[1]);'
|
95 |
'#<(?:no)?script.*?<\/(?:no)?script>#is',
|
96 |
create_function(
|
97 |
'$matches',
|
98 |
+
'return "%%SCRIPT".AUTOPTIMIZE_HASH."%%".base64_encode($matches[0])."%%SCRIPT%%";'
|
99 |
),
|
100 |
$this->content
|
101 |
);
|
190 |
$css=$tmpstyle;
|
191 |
$this->alreadyminified=true;
|
192 |
} else if ($this->can_inject_late($cssPath,$css)) {
|
193 |
+
$css="%%INJECTLATER".AUTOPTIMIZE_HASH."%%".base64_encode($cssPath)."|".md5($css)."%%INJECTLATER%%";
|
194 |
}
|
195 |
} else {
|
196 |
// Couldn't read CSS. Maybe getpath isn't working?
|
490 |
// restore (no)script
|
491 |
if ( strpos( $this->content, '%%SCRIPT%%' ) !== false ) {
|
492 |
$this->content = preg_replace_callback(
|
493 |
+
'#%%SCRIPT'.AUTOPTIMIZE_HASH.'%%(.*?)%%SCRIPT%%#is',
|
494 |
create_function(
|
495 |
'$matches',
|
496 |
'return base64_decode($matches[1]);'
|
readme.txt
CHANGED
@@ -3,7 +3,7 @@ Contributors: futtta, turl, optimizingmatters
|
|
3 |
Tags: minify, css, html, javascript, js, optimize, speed, cache, aggregate, minification, performance, pagespeed
|
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.
|
7 |
Stable tag: 2.1.0
|
8 |
|
9 |
Autoptimize speeds up your website and helps you save bandwidth by aggregating and minimizing JS, CSS and HTML.
|
@@ -229,6 +229,10 @@ Just [fork Autoptimize on Github](https://github.com/futtta/autoptimize) and cod
|
|
229 |
|
230 |
== Changelog ==
|
231 |
|
|
|
|
|
|
|
|
|
232 |
= 2.1.0 =
|
233 |
* new: Autoptimize now appears in admin-toolbar with an easy view on cache size and the possibility to purge the cache (pass `false` to `autoptimize_filter_toolbar_show` filter to disable), a big thanks to [Pablo Custo](https://github.com/pablocusto) for his hard work on this nice feature!
|
234 |
* new: An extra "More Optimization"-tab is shown (can be hidden with ´autoptimize_filter_show_partner_tabs´-filter) with information about related optimization tools- and services.
|
3 |
Tags: minify, css, html, javascript, js, optimize, speed, cache, aggregate, minification, performance, pagespeed
|
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.8
|
7 |
Stable tag: 2.1.0
|
8 |
|
9 |
Autoptimize speeds up your website and helps you save bandwidth by aggregating and minimizing JS, CSS and HTML.
|
229 |
|
230 |
== Changelog ==
|
231 |
|
232 |
+
= 2.1.1 =
|
233 |
+
* Fix for problem reported by Matthew Berry
|
234 |
+
* confirmed working with WordPress 4.8
|
235 |
+
|
236 |
= 2.1.0 =
|
237 |
* new: Autoptimize now appears in admin-toolbar with an easy view on cache size and the possibility to purge the cache (pass `false` to `autoptimize_filter_toolbar_show` filter to disable), a big thanks to [Pablo Custo](https://github.com/pablocusto) for his hard work on this nice feature!
|
238 |
* new: An extra "More Optimization"-tab is shown (can be hidden with ´autoptimize_filter_show_partner_tabs´-filter) with information about related optimization tools- and services.
|