1
0
mirror of https://github.com/mrclay/minify.git synced 2025-09-13 23:42:13 +02:00

24 Commits

Author SHA1 Message Date
Elan Ruusamäe
8dba84a2d2 Prepare for 3.0.10 release 2020-04-02 22:47:26 +03:00
Andrew Welch
0f607be23a Exclude SSI Comments (#670)
* Exclude SSI comments

Exclude Nginx & Apache Server Side Include (SSI) comments from being stripped via minification, the same way IE directives are not stripped.

Both Nginx & Apache SSI directives begin with:

<!—#

So we can just look for the # and don’t strip the comment in that case.

Nginx SSI: http://nginx.org/en/docs/http/ngx_http_ssi_module.html

Apache SSI: https://httpd.apache.org/docs/2.4/howto/ssi.html

* Add tests for Nginx/Apache SSI directives

Co-authored-by: Andrew Welch <andrew@keluli.local>
2020-04-02 22:45:11 +03:00
Elan Ruusamäe
d2a3e8c1d2 Setup .semver (gem install semver or gem install semver2) 2020-03-24 21:30:43 +02:00
Elan Ruusamäe
e59454bed5 Add 3.0.9 release notes 2020-03-24 21:28:47 +02:00
Elan Ruusamäe
eb5197f9d4 Update phpunit.xml deprecated options, exclude vendor from code-coverage 2020-03-24 21:26:16 +02:00
Elan Ruusamäe
20f336f598 Travis: use 7.4 instead of 7.4snapshot 2020-03-24 21:26:16 +02:00
Elan Ruusamäe
94829874f9 Allow intervention/httpauth 3.x 2020-03-24 21:26:16 +02:00
Elan Ruusamäe
f0aa0aa7d7 Add changelog for 3.0.8 2020-03-19 18:42:53 +02:00
robbykrlos
5705fc9d89 Function get_magic_quotes_gpc() is now deprecated in PHP 7.4 #661
- removed deprecated function that since PHP 5.4.0 returns FALSE always, and since PHP 7.4 is deprecated.
2020-03-06 19:20:17 +02:00
Elan Ruusamäe
3036ee9f55 Add more reflinks to changelog 2020-01-30 13:19:52 +02:00
Elan Ruusamäe
6e3ae8417a Allow marcusschwarz/lesserphp updates again 2020-01-30 13:09:30 +02:00
Elan Ruusamäe
d39fdd9e6b Update changelog for 3.0.7 2020-01-30 13:08:06 +02:00
Elan Ruusamäe
d35e780865 Force lesserphp to v0.5.2 because v0.5.3 changed namespace 2019-12-31 11:59:27 +02:00
Elan Ruusamäe
7378a0efe8 Composer: sort packages, set platform version 2019-12-10 08:31:58 +02:00
Jason Varga
c0dd8f50a1 Upgrade mrclay/props-dic (#658)
* Upgrade mrclay/props-dic
* Also support existing version
2019-12-08 22:38:04 +02:00
Elan Ruusamäe
63a812af8d Update changelog for 3.0.6 2019-10-28 13:39:13 +02:00
Elan Ruusamäe
8836df06d2 Bugfix for option sanitizer (#655) 2019-10-28 13:38:13 +02:00
Matthias Zronek
2f33b69786 Bugfix for option sanitizer 2019-10-28 11:03:44 +01:00
Elan Ruusamäe
8e4b0ceb86 Update changelog to format similar to keepachangelog.com 2019-10-01 13:09:59 +03:00
Elan Ruusamäe
266ddd7d54 Update changelog for 3.0.5 2019-10-01 13:04:39 +03:00
Elan Ruusamäe
07ed67aa77 Fix syntax error in composer.json (#653) 2019-10-01 13:03:36 +03:00
Elan Ruusamäe
2bbcce054d travis: add php 7.3, 7.4, 8.0; remove hhvm 2019-10-01 12:52:50 +03:00
Elan Ruusamäe
9040437901 Fix unit test for bd7d1077 2019-10-01 11:40:04 +03:00
Elan Ruusamäe
f954e1bd58 Fix syntax error in composer.json 2019-10-01 10:35:33 +03:00
13 changed files with 168 additions and 53 deletions

6
.semver Normal file
View File

@@ -0,0 +1,6 @@
---
:major: 3
:minor: 0
:patch: 9
:special: ''
:metadata: ''

View File

@@ -5,7 +5,8 @@ dist: trusty
jobs:
fast_finish: true
allow_failures:
- php: "hhvm"
- php: "7.4"
- php: "nightly"
include:
- php: "5.3"
dist: precise
@@ -15,8 +16,8 @@ jobs:
- php: "7.0"
- php: "7.1"
- php: "7.2"
- php: "nightly"
- php: "hhvm"
- php: "7.3"
- php: "7.4"
env:
- CLOSURE_VERSION: 20161024

View File

@@ -1,22 +1,92 @@
## Version 3.0.4 (2019-09-24)
# Changelog
* See git log for details
All notable changes to this project will be documented in this file.
## Version 3.0.3 (2017-11-03)
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
* Fix closure-compiler's error "redirection limit reached". #618, #619
## [3.0.10] - 2020-04-02
## Version 3.0.2 (2017-09-14)
- Exclude SSI Comments from HTML minify, [#670]
* Fixes syntax error in Groups controller, #613
* Better-maintained lessphp fork, #610
* No longer corrupts some chars in some environments, #608
[3.0.10]: https://github.com/mrclay/minify/compare/3.0.8...3.0.10
[#671]: https://github.com/mrclay/minify/issues/671
[#670]: https://github.com/mrclay/minify/pull/670
## Version 3.0.1 (2017-06-09)
## [3.0.9] - 2020-03-24
* Update CSSmin to v4, #599, #590
- Allow `intervention/httpauth` 3.x, [#667], [#666], [#664]
[3.0.9]: https://github.com/mrclay/minify/compare/3.0.8...3.0.9
[#664]: https://github.com/mrclay/minify/issues/664
[#666]: https://github.com/mrclay/minify/pull/666
[#667]: https://github.com/mrclay/minify/pull/667
## [3.0.8] - 2020-03-19
- Removed deprecated get_magic_quotes_gpc() function that since PHP 5.4.0 returns FALSE always, and since PHP 7.4 is deprecated, [#661]
[3.0.8]: https://github.com/mrclay/minify/compare/3.0.7...3.0.8
[#661]: https://github.com/mrclay/minify/pull/661
## [3.0.7] - 2019-12-10
- Allow mrclay/props-dic ^3.0, [#658]
[3.0.7]: https://github.com/mrclay/minify/compare/3.0.6...3.0.7
[#658]: https://github.com/mrclay/minify/pull/658
## [3.0.6] - 2019-10-28
- Bugfix for option sanitizer, [#654], [#655]
[3.0.6]: https://github.com/mrclay/minify/compare/3.0.5...3.0.6
[#654]: https://github.com/mrclay/minify/issues/654
[#655]: https://github.com/mrclay/minify/pull/655
## [3.0.5] - 2019-10-01
- Fix syntax error in composer.json, [#653]
[3.0.5]: https://github.com/mrclay/minify/compare/3.0.4...3.0.5
[#653]: https://github.com/mrclay/minify/pull/653
## 3.0.4 - 2019-09-24
- Fix PHP 7.3 compatibility issues, [#648]
[3.0.4]: https://github.com/mrclay/minify/compare/3.0.3...3.0.4
[#648]: https://github.com/mrclay/minify/issues/648
## [3.0.3] - 2017-11-03
- Fix closure-compiler's error "redirection limit reached". [#618], [#619]
[3.0.3]: https://github.com/mrclay/minify/compare/3.0.2...3.0.3
[#618]: https://github.com/mrclay/minify/pull/618
[#619]: https://github.com/mrclay/minify/issues/619
## [3.0.2] - 2017-09-14
- Fixes syntax error in Groups controller, [#613]
- Better-maintained lessphp fork, [#610]
- No longer corrupts some chars in some environments, [#608]
[3.0.2]: https://github.com/mrclay/minify/compare/3.0.1...3.0.2
[#608]: https://github.com/mrclay/minify/pull/608
[#610]: https://github.com/mrclay/minify/pull/610
[#613]: https://github.com/mrclay/minify/issues/613
## [3.0.1] - 2017-06-09
- Update CSSmin to v4, [#599], [#590]
[3.0.1]: https://github.com/mrclay/minify/compare/3.0.0...3.0.1
[#590]: https://github.com/mrclay/minify/issues/590
[#599]: https://github.com/mrclay/minify/pull/599
## 3.0.0 - 2017-04-03
## Version 3.0.0 (2017-04-03)
* Improved CSS minification via Túbal Martín's CSSMin
* Easier error identification (just see error_log)
* Adds feature to serve static files directly
@@ -34,7 +104,8 @@
* BREAKING: Removes `$min_libPath` option
* BREAKING: The Minify, source, and controller components have changed APIs
## Version 2.3.0 (2016-03-11)
## 2.3.0 - 2016-03-11
* Adds `$min_concatOnly` option to just concatenate files
* Deprecates use of Minify_Loader
* Deprecates use of Minify_Logger
@@ -42,13 +113,15 @@
* Deprecates use of FirePHP
* Deprecates use of DooDigestAuth
## Version 2.2.1 (2014-10-30)
## 2.2.1 - 2014-10-30
* Builder styled with Bootstrap (thanks to help from acidvertigo)
* Update CSSmin to v.2.4.8
* Added WinCache
* URLs with spaces properly rewritten
## Version 2.2.0 (2014-03-12)
## 2.2.0 - 2014-03-12
* Fix handling of RegEx in certain situations in JSMin
* Thanks to Vovan-VE for reporting this
* Update composer.json with support info
@@ -70,11 +143,13 @@
* Allow far-future expiration and file versioning with the "v" querystirng parameter in addition to existing method
* Lots of general code tidy ups
## Version 2.1.7 (2013-07-23)
## 2.1.7 - 2013-07-23
* Fixes arbitrary file inclusion vulnerability on some systems
* Thanks to Matt Mecham for reporting this
## Version 2.1.6 (2013-07-19)
## 2.1.6 - 2013-07-19
* JSMin fixes
* Prevents some Closure Compiler API failures
* Uses autoloading for all class loading
@@ -86,7 +161,8 @@
* CLI script more portable
* Adds composer.json
## Version 2.1.5 (2012-03-10)
## 2.1.5 - 2012-03-10
* Removed XSS vulnerability
* Disabled builder by default
* command line tools to minify and rewrite URIs in CSS
@@ -95,7 +171,8 @@
* Closure Compiler uses cURL when allow\_url\_fopen is off
* Missing file notices when using groups
## Version 2.1.4b (2010-07-10)
## 2.1.4b - 2010-07-10
* Option to minify JS with Closure Compiler API w/ JSMin failover
* Cookie/bookmarklet-based debug mode. No HTML editing!
* Allows 1 file to be missing w/o complete failure
@@ -111,7 +188,8 @@
* Removed annoying maxFiles limit
* mbstring.func\_overload usage is safer
## Version 2.1.3 (2009-06-30)
## 2.1.3 - 2009-06-30
* CSS fixes
* A few URI rewriting bugs fixed
* comment/whitespace removal no longer breaks some values
@@ -126,7 +204,8 @@
* API: Can set contentType Minify\_Source objects (fixes an annoying [caveat](http://groups.google.com/group/minify/msg/8446d32ee99a4961))
* [Resolved Issue list](http://code.google.com/p/minify/issues/list?can=1&q=label%3ARelease-2.1.2%20status%3AVerified)
## Version 2.1.2 (2009-03-04)
## 2.1.2 - 2009-03-04
* Javascript fixes
* Debug mode no longer confused by `*/*` in strings/RegExps (jQuery)
* quote characters inside RegExp literals no longer cause exception
@@ -138,14 +217,16 @@
* Builder app doesn't fail on systems without gzdeflate()
* APC caching class included
## Version 2.1.1 (2008-10-19)
## 2.1.1 - 2008-10-19
* Bug fix release
* Detection and workarounds for zlib.output\_compression and non-PHP encoding modules
* Zlib not required (mod\_rewrite, et.al., can still be used for encoding)
* HTML : More IE conditional comments preserved
* Minify\_groupUri() utility fixed
## Version 2.1.0 (2008-09-18)
## 2.1.0 - 2008-09-18
* "min" default application for quick deployment
* Minify URI Builder app & bookmarklet for quickly creating minify URIs
* Relative URIs in CSS file are fixed automatically by default
@@ -161,8 +242,8 @@
* Minify\_Cache\_File has flock()s (by default)
* Workaround for Windows mtime reporting bug
## 2.0.0 - 2008-05-22
## Version 2.0.0 (2008-05-22)
* Complete code overhaul. Minify is now a PEAR-style class and toolkit for building customized minifying file servers.
* Content-Encoding: deflate/gzip/compress, based on request headers
* Expanded CSS and HTML minifiers with test cases
@@ -171,10 +252,12 @@
* Compression & encoding modules lazy-loaded as needed (304 responses use minimal code)
* Separate utility classes for HTTP encoding and cache control
## Version 1.0.1 (2007-05-05)
## 1.0.1 - 2007-05-05
* Fixed various problems resolving pathnames when hosted on an NFS mount.
* Fixed 'undefined constant' notice.
* Replaced old JSMin library with a much faster custom implementation.
## Version 1.0.0 (2007-05-02)
## 1.0.0 - 2007-05-02
* First release.

View File

@@ -1,7 +1,7 @@
{
"name": "mrclay/minify",
"type": "library",
"description": "Minify is a PHP5 app that helps you follow several rules for client-side performance. It combines multiple CSS or Javascript files, removes unnecessary whitespace and comments, and serves them with gzip encoding and optimal client-side cache headers",
"description": "Minify is a PHP app that helps you follow several rules for client-side performance. It combines multiple CSS or Javascript files, removes unnecessary whitespace and comments, and serves them with gzip encoding and optimal client-side cache headers",
"homepage": "https://github.com/mrclay/minify",
"license": "BSD-3-Clause",
"authors": [
@@ -22,15 +22,21 @@
"autoload-dev": {
"psr-4": {"Minify\\Test\\": "tests/"}
},
"config": {
"platform": {
"php": "5.3.29"
},
"sort-packages": true
},
"require": {
"php": "^5.3.0 || ^7.0",
"ext-pcre": "*",
"intervention/httpauth": "~2.0",
"intervention/httpauth": "^2.0|^3.0",
"marcusschwarz/lesserphp": "^0.5.1",
"monolog/monolog": "~1.1|~2.0",
"mrclay/jsmin-php": "~2",
"mrclay/props-dic": "^2.2",
"php": "^5.3.0 || ^7.0",
"tubalmartin/cssmin": "~4",
"marcusschwarz/lesserphp": "~0.5.1",
"mrclay/props-dic": "^2.2|^3.0",
"tubalmartin/cssmin": "~4"
},
"require-dev": {
"firephp/firephp-core": "~0.4.0",

View File

@@ -317,9 +317,7 @@ class HTTP_ConditionalGet
if (!isset($_SERVER['HTTP_IF_NONE_MATCH'])) {
return false;
}
$clientEtagList = get_magic_quotes_gpc()
? stripslashes($_SERVER['HTTP_IF_NONE_MATCH'])
: $_SERVER['HTTP_IF_NONE_MATCH'];
$clientEtagList = $_SERVER['HTTP_IF_NONE_MATCH'];
$clientEtags = explode(',', $clientEtagList);
$compareTo = $this->normalizeEtag($this->_etag);

View File

@@ -80,10 +80,12 @@ class App extends Container
};
$varNames = array_map($prefixer, $propNames);
$varDefinedChecker = function ($name) {
return array_key_exists($name, get_defined_vars());
};
$varNames = array_filter($varNames, $varDefinedChecker);
$varDefined = get_defined_vars();
$varNames = array_filter($varNames, function($name) use($varDefined)
{
return array_key_exists($name, $varDefined);
});
$vars = compact($varNames);

View File

@@ -164,7 +164,7 @@ class Minify_HTML
protected function _commentCB($m)
{
return (0 === strpos($m[1], '[') || false !== strpos($m[1], '<!['))
return (0 === strpos($m[1], '[') || false !== strpos($m[1], '<![') || 0 === strpos($m[1], '#'))
? $m[0]
: '';
}

View File

@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- http://phpunit.de/manual/current/en/appendixes.configuration.html -->
<!-- https://phpunit.readthedocs.io/en/latest/configuration.html -->
<phpunit
backupGlobals="false"
backupStaticAttributes="false"
@@ -10,7 +10,6 @@
convertWarningsToExceptions="true"
processIsolation="false"
stopOnFailure="false"
syntaxCheck="false"
bootstrap="vendor/autoload.php">
<testsuites>
@@ -32,6 +31,7 @@
<directory>.</directory>
<exclude>
<directory>tests</directory>
<directory>vendor</directory>
</exclude>
</whitelist>
</filter>

View File

@@ -45,7 +45,6 @@ class MinifyTest extends TestCase
'content' => '',
'headers' => array(
'Expires' => gmdate('D, d M Y H:i:s \G\M\T', $_SERVER['REQUEST_TIME'] + 1800),
'Vary' => 'Accept-Encoding',
'Last-Modified' => gmdate('D, d M Y H:i:s \G\M\T', $lastModified),
'ETag' => "\"pub{$lastModified}\"",
'Cache-Control' => 'max-age=1800',

View File

@@ -9,6 +9,11 @@
<meta name="description" content="A demonstration of what can be accomplished visually through CSS-based design." />
<meta name="robots" content="all" />
<title>css Zen Garden: The Beauty in CSS Design</title>
<!--# if expr="$HTTP_COOKIE=/minify\=1/" -->
<meta name="generator" content="minify-cookie" />
<!--# else -->
<meta name="generator" content="minify-no-cookie" />
<!--# endif -->
<!-- to correct the unsightly Flash of Unstyled Content. http://www.bluerobot.com/web/css/fouc.asp -->
<script type="text/javascript"><!--
@@ -63,11 +68,11 @@ css hack {
display:none;
}
</style>
<link
<link
rel="Shortcut Icon"
type="image/x-icon"
href="http://www.csszengarden.com/favicon.ico" />
<link
<link
rel="alternate"
type="application/rss+xml"
title="RSS"
@@ -78,7 +83,7 @@ css hack {
<div id="container">
<div id="pageHeader">
<h1><span>css Zen Garden</span></h1>
<h2><span>The Beauty of <acronym title="Cascading Style Sheets">CSS</acronym>
<h2><span>The Beauty of <acronym title="Cascading Style Sheets">CSS</acronym>
Design</span></h2>
</div>
<pre>

View File

@@ -4,7 +4,12 @@ http-equiv="content-type" content="text/html; charset=iso-8859-1" /><meta
name="author" content="Dave Shea" /><meta
name="keywords" content="design, css, cascading, style, sheets, xhtml, graphic design, w3c, web standards, visual, display" /><meta
name="description" content="A demonstration of what can be accomplished visually through CSS-based design." /><meta
name="robots" content="all" /><title>css Zen Garden: The Beauty in CSS Design</title> <script type="text/javascript">var is={ie:navigator.appName=='Microsoft Internet Explorer',java:navigator.javaEnabled(),ns:navigator.appName=='Netscape',ua:navigator.userAgent.toLowerCase(),version:parseFloat(navigator.appVersion.substr(21))||parseFloat(navigator.appVersion),win:navigator.platform=='Win32'}
name="robots" content="all" /><title>css Zen Garden: The Beauty in CSS Design</title>
<!--# if expr="$HTTP_COOKIE=/minify\=1/" --><meta
name="generator" content="minify-cookie" />
<!--# else --><meta
name="generator" content="minify-no-cookie" />
<!--# endif --> <script type="text/javascript">var is={ie:navigator.appName=='Microsoft Internet Explorer',java:navigator.javaEnabled(),ns:navigator.appName=='Netscape',ua:navigator.userAgent.toLowerCase(),version:parseFloat(navigator.appVersion.substr(21))||parseFloat(navigator.appVersion),win:navigator.platform=='Win32'}
is.mac=is.ua.indexOf('mac')>=0;if(is.ua.indexOf('opera')>=0){is.ie=is.ns=false;is.opera=true;}
if(is.ua.indexOf('gecko')>=0){is.ie=is.ns=false;is.gecko=true;}</script> <script type="text/javascript">/*<![CDATA[*/var i=0;while(++i<10)
{}/*]]>*/</script> <script type="text/javascript">i=1;</script> <script type="text/javascript">/*<![CDATA[*/(i<1);/*]]>*/</script> <!--[if IE 6]><style type="text/css">/*<![CDATA[*//*! copyright: you'll need CDATA for this < & */

View File

@@ -9,6 +9,11 @@
<meta name="description" content="A demonstration of what can be accomplished visually through CSS-based design.">
<meta name="robots" content="all">
<title>css Zen Garden: The Beauty in CSS Design</title>
<!--# if expr="$HTTP_COOKIE=/minify\=1/" -->
<meta name="generator" content="minify-cookie" />
<!--# else -->
<meta name="generator" content="minify-no-cookie" />
<!--# endif -->
<!-- to correct the unsightly Flash of Unstyled Content. http://www.bluerobot.com/web/css/fouc.asp -->
<script type="text/javascript"><!--
@@ -61,11 +66,11 @@ css hack {
display:none;
}
</style>
<link
<link
rel="Shortcut Icon"
type="image/x-icon"
href="http://www.csszengarden.com/favicon.ico">
<link
<link
rel="alternate"
type="application/rss+xml"
title="RSS"
@@ -76,7 +81,7 @@ css hack {
<div id="container">
<div id="pageHeader">
<h1><span>css Zen Garden</span></h1>
<h2><span>The Beauty of <acronym title="Cascading Style Sheets">CSS</acronym>
<h2><span>The Beauty of <acronym title="Cascading Style Sheets">CSS</acronym>
Design</span></h2>
</div>
<pre>

View File

@@ -4,7 +4,12 @@ http-equiv="content-type" content="text/html; charset=iso-8859-1"><meta
name="author" content="Dave Shea"><meta
name="keywords" content="design, css, cascading, style, sheets, xhtml, graphic design, w3c, web standards, visual, display"><meta
name="description" content="A demonstration of what can be accomplished visually through CSS-based design."><meta
name="robots" content="all"><title>css Zen Garden: The Beauty in CSS Design</title> <script type="text/javascript">var is={ie:navigator.appName=='Microsoft Internet Explorer',java:navigator.javaEnabled(),ns:navigator.appName=='Netscape',ua:navigator.userAgent.toLowerCase(),version:parseFloat(navigator.appVersion.substr(21))||parseFloat(navigator.appVersion),win:navigator.platform=='Win32'}
name="robots" content="all"><title>css Zen Garden: The Beauty in CSS Design</title>
<!--# if expr="$HTTP_COOKIE=/minify\=1/" --><meta
name="generator" content="minify-cookie" />
<!--# else --><meta
name="generator" content="minify-no-cookie" />
<!--# endif --> <script type="text/javascript">var is={ie:navigator.appName=='Microsoft Internet Explorer',java:navigator.javaEnabled(),ns:navigator.appName=='Netscape',ua:navigator.userAgent.toLowerCase(),version:parseFloat(navigator.appVersion.substr(21))||parseFloat(navigator.appVersion),win:navigator.platform=='Win32'}
is.mac=is.ua.indexOf('mac')>=0;if(is.ua.indexOf('opera')>=0){is.ie=is.ns=false;is.opera=true;}
if(is.ua.indexOf('gecko')>=0){is.ie=is.ns=false;is.gecko=true;}</script> <script type="text/javascript">var i=0;while(++i<10)
{}</script> <script type="text/javascript">i=1;</script> <script type="text/javascript">(i<1);</script> <!--[if IE 6]><style type="text/css">/*! copyright: you'll need CDATA for this < & */