Permalink
Browse files

misc. fixes for issues in 2.0.1

  • Loading branch information...
futtta committed Mar 14, 2016
1 parent fa46052 commit 5ecb5a1689e89f979d86b5e8788e358470b70ce6
@@ -94,7 +94,7 @@ function autoptimize_do_cachepurged_action() {
do_action("autoptimize_action_cachepurged");
}
}
add_action("plugins_loaded","autoptimize_do_cachepurged_action",11);
add_action("after_theme_setup","autoptimize_do_cachepurged_action",11);
// try to purge caching plugins cache-files?
include_once(AUTOPTIMIZE_PLUGIN_DIR.'classlesses/autoptimizePageCacheFlush.php');
@@ -346,7 +346,7 @@ private function ismergeable($tag) {
//Checks agains the blacklist
private function ismovable($tag) {
if ($this->include_inline !== true || apply_filters('autoptimize_filter_js_unmovable',false)) {
if ($this->include_inline !== true || apply_filters('autoptimize_filter_js_unmovable',true)) {
return false;
}
@@ -391,12 +391,10 @@ public function minify() {
}
// CDN the fonts!
if ((!empty($this->cdn_url))&&apply_filters("autoptimize_filter_css_fonts_cdn",false)) {
if ( (!empty($this->cdn_url)) && (apply_filters('autoptimize_filter_css_fonts_cdn',false)) && (version_compare(PHP_VERSION, '5.3.0') >= 0) ) {
$fontreplace = array();
$fonturl_regex = <<<'LOD'
~(?(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
LOD;
include_once(AUTOPTIMIZE_PLUGIN_DIR.'classlesses/autoptimizeFontRegex.php');
preg_match_all($fonturl_regex,$code,$matches);
if (is_array($matches)) {
foreach($matches[8] as $count => $quotedurl) {
@@ -0,0 +1,9 @@
<?php
// regex to find fonts, externalised to avoid nasty errors for php<5.3
$fonturl_regex = <<<'LOD'
~(?(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
LOD;
error_log('fontregex included');
?>

0 comments on commit 5ecb5a1

Please sign in to comment.