From 140673f5b609f28366a3831d8ed1ca69a4a54307 Mon Sep 17 00:00:00 2001 From: Steve Clay Date: Sun, 4 Sep 2016 10:23:51 -0400 Subject: [PATCH 1/3] Deleted references to WordPress --- README.md | 9 --------- 1 file changed, 9 deletions(-) diff --git a/README.md b/README.md index e896bb5..ed7d360 100644 --- a/README.md +++ b/README.md @@ -17,15 +17,6 @@ News Version [2.3.0](https://github.com/mrclay/minify/releases/tag/2.3.0) was released, mainly to deprecate some classes that will be removed in 3.0. -Wordpress User? ---------------- - -Consider instead using a dedicated WordPress plugin for more deep integration and simpler installation. E.g.: -- [BWP Minify](http://wordpress.org/extend/plugins/bwp-minify/) -- [W3 Total Cache](http://wordpress.org/extend/plugins/w3-total-cache/) - -Unfortunately we can't support the WordPress plugins here. - Installation ------------ From 2d2e06f4382512cd21590d17e4f98e9390473b22 Mon Sep 17 00:00:00 2001 From: Steve Clay Date: Sun, 2 Oct 2016 05:37:07 -0400 Subject: [PATCH 2/3] Add temp location to server-info.php --- min/server-info.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/min/server-info.php b/min/server-info.php index c9ddba6..7e543d7 100644 --- a/min/server-info.php +++ b/min/server-info.php @@ -16,10 +16,13 @@ if (!$enabled) { header('Content-Type: text/plain'); $file = __FILE__; +$tmp = sys_get_temp_dir(); + echo << Date: Wed, 18 Jan 2017 18:48:15 -0500 Subject: [PATCH 3/3] URI rewriter passes through empty URLs Fixes #561 --- min/lib/Minify/CSS/UriRewriter.php | 5 +++++ min_unit_tests/_test_files/css_uriRewriter/exp.css | 2 ++ min_unit_tests/_test_files/css_uriRewriter/exp_prepend.css | 2 ++ min_unit_tests/_test_files/css_uriRewriter/exp_prepend2.css | 2 ++ min_unit_tests/_test_files/css_uriRewriter/in.css | 2 ++ 5 files changed, 13 insertions(+) diff --git a/min/lib/Minify/CSS/UriRewriter.php b/min/lib/Minify/CSS/UriRewriter.php index e963fb8..349b8ec 100644 --- a/min/lib/Minify/CSS/UriRewriter.php +++ b/min/lib/Minify/CSS/UriRewriter.php @@ -290,6 +290,11 @@ class Minify_CSS_UriRewriter { ? $m[1] : substr($m[1], 1, strlen($m[1]) - 2); } + + if ($uri === '') { + return $m[0]; + } + // if not root/scheme relative and not starts with scheme if (!preg_match('~^(/|[a-z]+\:)~', $uri)) { // URI is file-relative: rewrite depending on options diff --git a/min_unit_tests/_test_files/css_uriRewriter/exp.css b/min_unit_tests/_test_files/css_uriRewriter/exp.css index 3296c26..5ce7667 100644 --- a/min_unit_tests/_test_files/css_uriRewriter/exp.css +++ b/min_unit_tests/_test_files/css_uriRewriter/exp.css @@ -8,6 +8,7 @@ @import url("/css/foo.css"); /* abs, should not alter */ @import url(/css2/foo.css); /* abs, should not alter */ @import url(foo:bar); /* scheme, should not alter */ +@import url(); /* empty, should not alter */ foo {clip-path:url(#c1)} /* inline clip path, should not alter */ foo {clip-path:url(/_test_files/css_uriRewriter/foo.svg#c1)} foo {mask: url(#c1)} /* should not alter */ @@ -17,5 +18,6 @@ foo {background:url('http://foo.com/css/foo.css');} /* scheme, should not alter foo {background:url("//foo.com/css/foo.css");} /* protocol relative, should not alter */ foo {background:url(foo:bar);} /* scheme, should not alter */ foo {background:url("/_test_files/css_uriRewriter/foo bar.jpg");} +foo {background:url("");} /* empty, should not alter */ @import url('/_test_files/css_uriRewriter/foo bar.css'); @import "/_test_files/css_uriRewriter/foo bar.css"; diff --git a/min_unit_tests/_test_files/css_uriRewriter/exp_prepend.css b/min_unit_tests/_test_files/css_uriRewriter/exp_prepend.css index bc09c44..a56103d 100644 --- a/min_unit_tests/_test_files/css_uriRewriter/exp_prepend.css +++ b/min_unit_tests/_test_files/css_uriRewriter/exp_prepend.css @@ -8,6 +8,7 @@ @import url("/css/foo.css"); /* abs, should not alter */ @import url(/css2/foo.css); /* abs, should not alter */ @import url(foo:bar); /* scheme, should not alter */ +@import url(); /* empty, should not alter */ foo {clip-path:url(#c1)} /* inline clip path, should not alter */ foo {clip-path:url(http://cnd.com/A/B/foo.svg#c1)} foo {mask: url(#c1)} /* should not alter */ @@ -17,5 +18,6 @@ foo {background:url('http://foo.com/css/foo.css');} /* scheme, should not alter foo {background:url("//foo.com/css/foo.css");} /* protocol relative, should not alter */ foo {background:url(foo:bar);} /* scheme, should not alter */ foo {background:url("http://cnd.com/A/B/foo bar.jpg");} +foo {background:url("");} /* empty, should not alter */ @import url('http://cnd.com/A/B/foo bar.css'); @import "http://cnd.com/A/B/foo bar.css"; diff --git a/min_unit_tests/_test_files/css_uriRewriter/exp_prepend2.css b/min_unit_tests/_test_files/css_uriRewriter/exp_prepend2.css index c8f7c61..f9398a5 100644 --- a/min_unit_tests/_test_files/css_uriRewriter/exp_prepend2.css +++ b/min_unit_tests/_test_files/css_uriRewriter/exp_prepend2.css @@ -8,6 +8,7 @@ @import url("/css/foo.css"); /* abs, should not alter */ @import url(/css2/foo.css); /* abs, should not alter */ @import url(foo:bar); /* scheme, should not alter */ +@import url(); /* empty, should not alter */ foo {clip-path:url(#c1)} /* inline clip path, should not alter */ foo {clip-path:url(//cnd.com/A/B/foo.svg#c1)} foo {mask: url(#c1)} /* should not alter */ @@ -17,5 +18,6 @@ foo {background:url('http://foo.com/css/foo.css');} /* scheme, should not alter foo {background:url("//foo.com/css/foo.css");} /* protocol relative, should not alter */ foo {background:url(foo:bar);} /* scheme, should not alter */ foo {background:url("//cnd.com/A/B/foo bar.jpg");} +foo {background:url("");} /* empty, should not alter */ @import url('//cnd.com/A/B/foo bar.css'); @import "//cnd.com/A/B/foo bar.css"; diff --git a/min_unit_tests/_test_files/css_uriRewriter/in.css b/min_unit_tests/_test_files/css_uriRewriter/in.css index 0200450..e5c4858 100644 --- a/min_unit_tests/_test_files/css_uriRewriter/in.css +++ b/min_unit_tests/_test_files/css_uriRewriter/in.css @@ -8,6 +8,7 @@ @import url("/css/foo.css"); /* abs, should not alter */ @import url(/css2/foo.css); /* abs, should not alter */ @import url(foo:bar); /* scheme, should not alter */ +@import url(); /* empty, should not alter */ foo {clip-path:url(#c1)} /* inline clip path, should not alter */ foo {clip-path:url(foo.svg#c1)} foo {mask: url( #c1 )} /* should not alter */ @@ -17,5 +18,6 @@ foo {background:url('http://foo.com/css/foo.css');} /* scheme, should not alter foo {background:url("//foo.com/css/foo.css");} /* protocol relative, should not alter */ foo {background:url(foo:bar);} /* scheme, should not alter */ foo {background:url("foo bar.jpg");} +foo {background:url("");} /* empty, should not alter */ @import url('foo bar.css'); @import "foo bar.css";