mirror of
https://github.com/mrclay/minify.git
synced 2025-09-07 20:50:50 +02:00
Compare commits
51 Commits
Author | SHA1 | Date | |
---|---|---|---|
|
dc02cdfba7 | ||
|
23f055d3f5 | ||
|
4970127e91 | ||
|
39c37bdd8c | ||
|
4a9d0595e3 | ||
|
ca8fdc6fdd | ||
|
8c69866874 | ||
|
ae5b9f0bfb | ||
|
e74adc4f6b | ||
|
5dee6538be | ||
|
455084b284 | ||
|
5112bb50f4 | ||
|
1962d3614c | ||
|
2226a6add1 | ||
|
8b91de51c3 | ||
|
1c000f9d05 | ||
|
cbda49556e | ||
|
b314554a0f | ||
|
9dac0ac873 | ||
|
c80add80a2 | ||
|
ad732493b8 | ||
|
ad0fb95556 | ||
|
f1572a580a | ||
|
40f9dafe5f | ||
|
c814ff4bae | ||
|
8382fb85d8 | ||
|
efec97278f | ||
|
e9d4db41ac | ||
|
b89bc57164 | ||
|
69e3eb241f | ||
|
b17c00c05c | ||
|
e3fe3001c3 | ||
|
8600312ed1 | ||
|
070c6c0349 | ||
|
b31855f6b8 | ||
|
031e804d08 | ||
|
263381a23f | ||
|
a36bfd50b0 | ||
|
8dba84a2d2 | ||
|
0f607be23a | ||
|
d2a3e8c1d2 | ||
|
e59454bed5 | ||
|
eb5197f9d4 | ||
|
20f336f598 | ||
|
94829874f9 | ||
|
f0aa0aa7d7 | ||
|
5705fc9d89 | ||
|
3036ee9f55 | ||
|
6e3ae8417a | ||
|
d39fdd9e6b | ||
|
d35e780865 |
42
.php_cs
42
.php_cs
@@ -1,27 +1,23 @@
|
||||
<?php
|
||||
|
||||
$finder = Symfony\CS\Finder\DefaultFinder::create()
|
||||
->in(__DIR__ . '/lib')
|
||||
;
|
||||
$rules = array(
|
||||
'@PSR2' => true,
|
||||
);
|
||||
|
||||
return Symfony\CS\Config\Config::create()
|
||||
->level(Symfony\CS\FixerInterface::PSR2_LEVEL)
|
||||
$config = PhpCsFixer\Config::create();
|
||||
$finder = $config->getFinder();
|
||||
|
||||
$finder
|
||||
->in(array('.', 'builder/', 'lib/', 'tests/', 'min_extras/', 'static/'))
|
||||
->name('*.php')
|
||||
->ignoreDotFiles(true)
|
||||
->ignoreVCS(true);
|
||||
|
||||
return $config
|
||||
->setUsingCache(true)
|
||||
->fixers(array(
|
||||
'linefeed',
|
||||
'trailing_spaces',
|
||||
'unused_use',
|
||||
'short_tag',
|
||||
'return',
|
||||
'visibility',
|
||||
'php_closing_tag',
|
||||
'extra_empty_lines',
|
||||
'function_declaration',
|
||||
'include',
|
||||
'controls_spaces',
|
||||
'elseif',
|
||||
'-eof_ending',
|
||||
'-method_argument_space',
|
||||
))
|
||||
->finder($finder)
|
||||
;
|
||||
->setRiskyAllowed(true)
|
||||
->setRules($rules)
|
||||
->setIndent(' ')
|
||||
->setLineEnding("\n");
|
||||
|
||||
// vim:ft=php
|
||||
|
6
.semver
Normal file
6
.semver
Normal file
@@ -0,0 +1,6 @@
|
||||
---
|
||||
:major: 3
|
||||
:minor: 0
|
||||
:patch: 11
|
||||
:special: ''
|
||||
:metadata: ''
|
16
.travis.yml
16
.travis.yml
@@ -5,8 +5,8 @@ dist: trusty
|
||||
jobs:
|
||||
fast_finish: true
|
||||
allow_failures:
|
||||
- php: "7.4snapshot"
|
||||
- php: "nightly"
|
||||
- name: "Php CS Fixer"
|
||||
include:
|
||||
- php: "5.3"
|
||||
dist: precise
|
||||
@@ -17,7 +17,12 @@ jobs:
|
||||
- php: "7.1"
|
||||
- php: "7.2"
|
||||
- php: "7.3"
|
||||
- php: "7.4snapshot"
|
||||
- php: "7.4"
|
||||
- php: "nightly"
|
||||
- name: "Php CS Fixer"
|
||||
php: "7.3"
|
||||
env:
|
||||
- PHP_CS_FIXER=1
|
||||
|
||||
env:
|
||||
- CLOSURE_VERSION: 20161024
|
||||
@@ -37,7 +42,14 @@ before_script:
|
||||
- tests/dl-closure.sh
|
||||
|
||||
script:
|
||||
- PATH=vendor/bin:$PATH
|
||||
- composer validate
|
||||
- |
|
||||
if [ "$PHP_CS_FIXER" ]; then
|
||||
composer config --unset platform.php
|
||||
composer require --dev friendsofphp/php-cs-fixer:2.16
|
||||
php-cs-fixer fix --verbose --diff --dry-run --ansi
|
||||
fi
|
||||
- vendor/bin/phpunit --verbose
|
||||
|
||||
# vim:ts=2:sw=2:et
|
||||
|
123
CHANGELOG.md
123
CHANGELOG.md
@@ -1,33 +1,128 @@
|
||||
# Changelog
|
||||
|
||||
All notable changes to this project will be documented in this file.
|
||||
|
||||
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
|
||||
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).
|
||||
|
||||
## 3.0.6 - 2019-10-28
|
||||
## [3.0.14] - 2023-05-05
|
||||
|
||||
- Bugfix for option sanitizer, #654, #655
|
||||
- Support monolog v3, [#705]
|
||||
- Allow invalidation from manual invocation, [#700]
|
||||
- Add property declaration, [#699]
|
||||
|
||||
## 3.0.5 - 2019-10-01
|
||||
[3.0.14]: https://github.com/mrclay/minify/compare/3.0.13...3.0.14
|
||||
[#705]: https://github.com/mrclay/minify/pull/705
|
||||
[#700]: https://github.com/mrclay/minify/pull/700
|
||||
[#699]: https://github.com/mrclay/minify/pull/699
|
||||
|
||||
- Fix syntax error in composer.json, #653
|
||||
## [3.0.13] - 2022-10-03
|
||||
|
||||
- Add `Minify_Cache_APCu` to replace `Minify_Cache_APC`, [#697]
|
||||
- Require `marcusschwarz/lesserphp:^0.5.5` to fix php 7.4 compatibility, [#688]
|
||||
|
||||
[3.0.13]: https://github.com/mrclay/minify/compare/3.0.12...3.0.13
|
||||
[#697]: https://github.com/mrclay/minify/pull/697
|
||||
[#688]: https://github.com/mrclay/minify/pull/688
|
||||
|
||||
## [3.0.12] - 2022-05-14
|
||||
|
||||
- Update jquery to 1.12.4 to avoid xss attacks, [#692]
|
||||
- Fix null argument to preg_split, [#696], [#695]
|
||||
|
||||
[3.0.12]: https://github.com/mrclay/minify/compare/3.0.11...3.0.12
|
||||
[#692]: https://github.com/mrclay/minify/pull/692
|
||||
[#696]: https://github.com/mrclay/minify/pull/696
|
||||
[#695]: https://github.com/mrclay/minify/issues/695
|
||||
|
||||
## [3.0.11] - 2021-03-11
|
||||
|
||||
- PHP 8.0 support, [#685], [#682], [#677]
|
||||
|
||||
[3.0.11]: https://github.com/mrclay/minify/compare/3.0.10...3.0.11
|
||||
[#685]: https://github.com/mrclay/minify/pull/685
|
||||
[#682]: https://github.com/mrclay/minify/pull/682
|
||||
[#677]: https://github.com/mrclay/minify/pull/677
|
||||
|
||||
## [3.0.10] - 2020-04-02
|
||||
|
||||
- Exclude SSI Comments from HTML minify, [#670], [#671]
|
||||
|
||||
[3.0.10]: https://github.com/mrclay/minify/compare/3.0.9...3.0.10
|
||||
[#671]: https://github.com/mrclay/minify/issues/671
|
||||
[#670]: https://github.com/mrclay/minify/pull/670
|
||||
|
||||
## [3.0.9] - 2020-03-24
|
||||
|
||||
- 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
|
||||
- Fix PHP 7.3 compatibility issues, [#648]
|
||||
|
||||
## 3.0.3 - 2017-11-03
|
||||
[3.0.4]: https://github.com/mrclay/minify/compare/3.0.3...3.0.4
|
||||
[#648]: https://github.com/mrclay/minify/issues/648
|
||||
|
||||
* Fix closure-compiler's error "redirection limit reached". #618, #619
|
||||
## [3.0.3] - 2017-11-03
|
||||
|
||||
## 3.0.2 - 2017-09-14
|
||||
- Fix closure-compiler's error "redirection limit reached". [#618], [#619]
|
||||
|
||||
* Fixes syntax error in Groups controller, #613
|
||||
* Better-maintained lessphp fork, #610
|
||||
* No longer corrupts some chars in some environments, #608
|
||||
[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.1 - 2017-06-09
|
||||
## [3.0.2] - 2017-09-14
|
||||
|
||||
* Update CSSmin to v4, #599, #590
|
||||
- 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
|
||||
|
||||
|
@@ -153,8 +153,8 @@ by Minify. E.g. <code>@import "<span class=minRoot>/min/?</span>g=css2";</code><
|
||||
list</a>.</p>
|
||||
<p><small>Powered by Minify <?php echo Minify::VERSION; ?></small></p>
|
||||
|
||||
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.6.3/jquery.min.js"></script>
|
||||
<script>window.jQuery || document.write('<script src="jquery-1.6.3.min.js"><\/script>')</script>
|
||||
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script>
|
||||
<script>window.jQuery || document.write('<script src="jquery-1.12.4.min.js"><\/script>')</script>
|
||||
<script>
|
||||
(function () {
|
||||
// workaround required to test when /min isn't child of web root
|
||||
|
5
builder/jquery-1.12.4.min.js
vendored
Normal file
5
builder/jquery-1.12.4.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
4
builder/jquery-1.6.3.min.js
vendored
4
builder/jquery-1.6.3.min.js
vendored
File diff suppressed because one or more lines are too long
@@ -29,7 +29,6 @@ if ($app->env->get('hello')) {
|
||||
));
|
||||
$he->encode();
|
||||
$he->sendAll();
|
||||
|
||||
} else {
|
||||
// echo status "0" or "1"
|
||||
header('Content-Type: text/plain');
|
||||
|
@@ -29,11 +29,11 @@
|
||||
"sort-packages": true
|
||||
},
|
||||
"require": {
|
||||
"php": "^5.3.0 || ^7.0",
|
||||
"php": "^5.3.0 || ^7.0 || ^8.0",
|
||||
"ext-pcre": "*",
|
||||
"intervention/httpauth": "~2.0",
|
||||
"marcusschwarz/lesserphp": "~0.5.1",
|
||||
"monolog/monolog": "~1.1|~2.0",
|
||||
"intervention/httpauth": "^2.0|^3.0",
|
||||
"marcusschwarz/lesserphp": "^0.5.5",
|
||||
"monolog/monolog": "~1.1|~2.0|~3.0",
|
||||
"mrclay/jsmin-php": "~2",
|
||||
"mrclay/props-dic": "^2.2|^3.0",
|
||||
"tubalmartin/cssmin": "~4"
|
||||
|
@@ -7,4 +7,3 @@
|
||||
*
|
||||
* @package Minify
|
||||
*/
|
||||
|
||||
|
@@ -198,4 +198,3 @@ $min_uploaderHoursBehind = 0;
|
||||
*/
|
||||
//$min_factories['minify'] = ... a callable accepting a Minify\App object
|
||||
//$min_factories['controller'] = ... a callable accepting a Minify\App object
|
||||
|
||||
|
@@ -317,7 +317,7 @@ class HTTP_ConditionalGet
|
||||
if (!isset($_SERVER['HTTP_IF_NONE_MATCH'])) {
|
||||
return false;
|
||||
}
|
||||
$clientEtagList = get_magic_quotes_gpc()
|
||||
$clientEtagList = PHP_VERSION_ID < 50400 && get_magic_quotes_gpc()
|
||||
? stripslashes($_SERVER['HTTP_IF_NONE_MATCH'])
|
||||
: $_SERVER['HTTP_IF_NONE_MATCH'];
|
||||
$clientEtags = explode(',', $clientEtagList);
|
||||
|
@@ -204,9 +204,10 @@ class HTTP_Encoder
|
||||
}
|
||||
// gzip checks (slow)
|
||||
if (preg_match(
|
||||
'@(?:^|,)\\s*((?:x-)?gzip)\\s*(?:$|,|;\\s*q=(?:0\\.|1))@'
|
||||
,$ae
|
||||
,$m)) {
|
||||
'@(?:^|,)\\s*((?:x-)?gzip)\\s*(?:$|,|;\\s*q=(?:0\\.|1))@',
|
||||
$ae,
|
||||
$m
|
||||
)) {
|
||||
return array('gzip', $m[1]);
|
||||
}
|
||||
if ($allowDeflate) {
|
||||
@@ -217,14 +218,17 @@ class HTTP_Encoder
|
||||
|| 0 === strpos($ae, 'deflate,') // opera
|
||||
// slow parsing
|
||||
|| preg_match(
|
||||
'@(?:^|,)\\s*deflate\\s*(?:$|,|;\\s*q=(?:0\\.|1))@', $ae)) {
|
||||
'@(?:^|,)\\s*deflate\\s*(?:$|,|;\\s*q=(?:0\\.|1))@',
|
||||
$ae
|
||||
)) {
|
||||
return array('deflate', 'deflate');
|
||||
}
|
||||
}
|
||||
if ($allowCompress && preg_match(
|
||||
'@(?:^|,)\\s*((?:x-)?compress)\\s*(?:$|,|;\\s*q=(?:0\\.|1))@'
|
||||
,$ae
|
||||
,$m)) {
|
||||
'@(?:^|,)\\s*((?:x-)?compress)\\s*(?:$|,|;\\s*q=(?:0\\.|1))@',
|
||||
$ae,
|
||||
$m
|
||||
)) {
|
||||
return array('compress', $m[1]);
|
||||
}
|
||||
|
||||
|
@@ -118,6 +118,7 @@ class Minify
|
||||
'quiet' => false, // serve() will send headers and output
|
||||
'debug' => false,
|
||||
'concatOnly' => false,
|
||||
'invalidate' => false,
|
||||
|
||||
// if you override these, the response codes MUST be directly after
|
||||
// the first space.
|
||||
@@ -284,6 +285,7 @@ class Minify
|
||||
'lastModifiedTime' => $this->options['lastModifiedTime'],
|
||||
'isPublic' => $this->options['isPublic'],
|
||||
'encoding' => $this->options['encodeMethod'],
|
||||
'invalidate' => $this->options['invalidate'],
|
||||
);
|
||||
|
||||
if ($this->options['maxAge'] > 0) {
|
||||
@@ -593,7 +595,8 @@ class Minify
|
||||
! $source // yes, we ran out of sources
|
||||
|| $type === self::TYPE_CSS // yes, to process CSS individually (avoiding PCRE bugs/limits)
|
||||
|| $minifier !== $lastMinifier // yes, minifier changed
|
||||
|| $options !== $lastOptions)) { // yes, options changed
|
||||
|| $options !== $lastOptions // yes, options changed
|
||||
)) {
|
||||
// minify previous sources with last settings
|
||||
$imploded = implode($implodeSeparator, $groupToProcessTogether);
|
||||
$groupToProcessTogether = array();
|
||||
|
@@ -82,8 +82,7 @@ class App extends Container
|
||||
|
||||
$varDefined = get_defined_vars();
|
||||
|
||||
$varNames = array_filter($varNames, function($name) use($varDefined)
|
||||
{
|
||||
$varNames = array_filter($varNames, function ($name) use ($varDefined) {
|
||||
return array_key_exists($name, $varDefined);
|
||||
});
|
||||
|
||||
|
@@ -259,7 +259,7 @@ class Minify_CSS_Compressor
|
||||
{
|
||||
// Issue 210: must not eliminate WS between words in unquoted families
|
||||
$flags = PREG_SPLIT_DELIM_CAPTURE | PREG_SPLIT_NO_EMPTY;
|
||||
$pieces = preg_split('/(\'[^\']+\'|"[^"]+")/', $m[1], null, $flags);
|
||||
$pieces = preg_split('/(\'[^\']+\'|"[^"]+")/', $m[1], -1, $flags);
|
||||
$out = 'font-family:';
|
||||
|
||||
while (null !== ($piece = array_shift($pieces))) {
|
||||
|
@@ -73,16 +73,16 @@ class Minify_CSSmin
|
||||
}
|
||||
if ($options['currentDir']) {
|
||||
return Minify_CSS_UriRewriter::rewrite(
|
||||
$css
|
||||
,$options['currentDir']
|
||||
,$options['docRoot']
|
||||
,$options['symlinks']
|
||||
$css,
|
||||
$options['currentDir'],
|
||||
$options['docRoot'],
|
||||
$options['symlinks']
|
||||
);
|
||||
}
|
||||
|
||||
return Minify_CSS_UriRewriter::prepend(
|
||||
$css
|
||||
,$options['prependRelativePath']
|
||||
$css,
|
||||
$options['prependRelativePath']
|
||||
);
|
||||
}
|
||||
}
|
||||
|
@@ -13,6 +13,8 @@
|
||||
*
|
||||
* @package Minify
|
||||
* @author Chris Edwards
|
||||
*
|
||||
* @deprecated Use Minify_Cache_APCu
|
||||
**/
|
||||
class Minify_Cache_APC implements Minify_CacheInterface
|
||||
{
|
||||
|
136
lib/Minify/Cache/APCu.php
Normal file
136
lib/Minify/Cache/APCu.php
Normal file
@@ -0,0 +1,136 @@
|
||||
<?php
|
||||
/**
|
||||
* Class Minify_Cache_APCu
|
||||
* @package Minify
|
||||
*/
|
||||
|
||||
/**
|
||||
* APCu-based cache class for Minify
|
||||
*
|
||||
* <code>
|
||||
* Minify::setCache(new Minify_Cache_APCu());
|
||||
* </code>
|
||||
*
|
||||
* @package Minify
|
||||
* @author Chris Edwards
|
||||
**/
|
||||
class Minify_Cache_APCu implements Minify_CacheInterface
|
||||
{
|
||||
|
||||
/**
|
||||
* Create a Minify_Cache_APCu object, to be passed to
|
||||
* Minify::setCache().
|
||||
*
|
||||
*
|
||||
* @param int $expire seconds until expiration (default = 0
|
||||
* meaning the item will not get an expiration date)
|
||||
*
|
||||
* @return null
|
||||
*/
|
||||
public function __construct($expire = 0)
|
||||
{
|
||||
$this->_exp = $expire;
|
||||
}
|
||||
|
||||
/**
|
||||
* Write data to cache.
|
||||
*
|
||||
* @param string $id cache id
|
||||
*
|
||||
* @param string $data
|
||||
*
|
||||
* @return bool success
|
||||
*/
|
||||
public function store($id, $data)
|
||||
{
|
||||
return apcu_store($id, "{$_SERVER['REQUEST_TIME']}|{$data}", $this->_exp);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the size of a cache entry
|
||||
*
|
||||
* @param string $id cache id
|
||||
*
|
||||
* @return int size in bytes
|
||||
*/
|
||||
public function getSize($id)
|
||||
{
|
||||
if (! $this->_fetch($id)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (function_exists('mb_strlen') && ((int)ini_get('mbstring.func_overload') & 2)) {
|
||||
return mb_strlen($this->_data, '8bit');
|
||||
} else {
|
||||
return strlen($this->_data);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Does a valid cache entry exist?
|
||||
*
|
||||
* @param string $id cache id
|
||||
*
|
||||
* @param int $srcMtime mtime of the original source file(s)
|
||||
*
|
||||
* @return bool exists
|
||||
*/
|
||||
public function isValid($id, $srcMtime)
|
||||
{
|
||||
return ($this->_fetch($id) && ($this->_lm >= $srcMtime));
|
||||
}
|
||||
|
||||
/**
|
||||
* Send the cached content to output
|
||||
*
|
||||
* @param string $id cache id
|
||||
*/
|
||||
public function display($id)
|
||||
{
|
||||
echo $this->_fetch($id) ? $this->_data : '';
|
||||
}
|
||||
|
||||
/**
|
||||
* Fetch the cached content
|
||||
*
|
||||
* @param string $id cache id
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function fetch($id)
|
||||
{
|
||||
return $this->_fetch($id) ? $this->_data : '';
|
||||
}
|
||||
|
||||
private $_exp = null;
|
||||
|
||||
// cache of most recently fetched id
|
||||
private $_lm = null;
|
||||
private $_data = null;
|
||||
private $_id = null;
|
||||
|
||||
/**
|
||||
* Fetch data and timestamp from apcu, store in instance
|
||||
*
|
||||
* @param string $id
|
||||
*
|
||||
* @return bool success
|
||||
*/
|
||||
private function _fetch($id)
|
||||
{
|
||||
if ($this->_id === $id) {
|
||||
return true;
|
||||
}
|
||||
$ret = apcu_fetch($id);
|
||||
if (false === $ret) {
|
||||
$this->_id = null;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
list($this->_lm, $this->_data) = explode('|', $ret, 2);
|
||||
$this->_id = $id;
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
@@ -68,4 +68,3 @@ class Minify_Controller_Files extends Minify_Controller_Base
|
||||
return new Minify_ServeConfiguration($options, $sources);
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -73,4 +73,3 @@ class Minify_Controller_Groups extends Minify_Controller_Files
|
||||
return parent::createConfiguration($options);
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -66,4 +66,3 @@ class Minify_Controller_Page extends Minify_Controller_Base
|
||||
return new Minify_ServeConfiguration($options, $sources, $selectionId);
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -23,6 +23,11 @@ class Minify_HTML
|
||||
*/
|
||||
protected $_jsCleanComments = true;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
protected $_html;
|
||||
|
||||
/**
|
||||
* "Minify" an HTML page
|
||||
*
|
||||
@@ -99,32 +104,34 @@ class Minify_HTML
|
||||
|
||||
// replace SCRIPTs (and minify) with placeholders
|
||||
$this->_html = preg_replace_callback(
|
||||
'/(\\s*)<script(\\b[^>]*?>)([\\s\\S]*?)<\\/script>(\\s*)/iu'
|
||||
,array($this, '_removeScriptCB')
|
||||
,$this->_html);
|
||||
'/(\\s*)<script(\\b[^>]*?>)([\\s\\S]*?)<\\/script>(\\s*)/iu',
|
||||
array($this, '_removeScriptCB'),
|
||||
$this->_html
|
||||
);
|
||||
|
||||
// replace STYLEs (and minify) with placeholders
|
||||
$this->_html = preg_replace_callback(
|
||||
'/\\s*<style(\\b[^>]*>)([\\s\\S]*?)<\\/style>\\s*/iu'
|
||||
,array($this, '_removeStyleCB')
|
||||
,$this->_html);
|
||||
'/\\s*<style(\\b[^>]*>)([\\s\\S]*?)<\\/style>\\s*/iu',
|
||||
array($this, '_removeStyleCB'),
|
||||
$this->_html
|
||||
);
|
||||
|
||||
// remove HTML comments (not containing IE conditional comments).
|
||||
$this->_html = preg_replace_callback(
|
||||
'/<!--([\\s\\S]*?)-->/u'
|
||||
,array($this, '_commentCB')
|
||||
,$this->_html);
|
||||
'/<!--([\\s\\S]*?)-->/u',
|
||||
array($this, '_commentCB'),
|
||||
$this->_html
|
||||
);
|
||||
|
||||
// replace PREs with placeholders
|
||||
$this->_html = preg_replace_callback('/\\s*<pre(\\b[^>]*?>[\\s\\S]*?<\\/pre>)\\s*/iu'
|
||||
,array($this, '_removePreCB')
|
||||
,$this->_html);
|
||||
$this->_html = preg_replace_callback('/\\s*<pre(\\b[^>]*?>[\\s\\S]*?<\\/pre>)\\s*/iu', array($this, '_removePreCB'), $this->_html);
|
||||
|
||||
// replace TEXTAREAs with placeholders
|
||||
$this->_html = preg_replace_callback(
|
||||
'/\\s*<textarea(\\b[^>]*?>[\\s\\S]*?<\\/textarea>)\\s*/iu'
|
||||
,array($this, '_removeTextareaCB')
|
||||
,$this->_html);
|
||||
'/\\s*<textarea(\\b[^>]*?>[\\s\\S]*?<\\/textarea>)\\s*/iu',
|
||||
array($this, '_removeTextareaCB'),
|
||||
$this->_html
|
||||
);
|
||||
|
||||
// trim each line.
|
||||
// @todo take into account attribute values that span multiple lines.
|
||||
@@ -139,24 +146,25 @@ class Minify_HTML
|
||||
|
||||
// remove ws outside of all elements
|
||||
$this->_html = preg_replace(
|
||||
'/>(\\s(?:\\s*))?([^<]+)(\\s(?:\s*))?</u'
|
||||
,'>$1$2$3<'
|
||||
,$this->_html);
|
||||
'/>(\\s(?:\\s*))?([^<]+)(\\s(?:\s*))?</u',
|
||||
'>$1$2$3<',
|
||||
$this->_html
|
||||
);
|
||||
|
||||
// use newlines before 1st attribute in open tags (to limit line lengths)
|
||||
$this->_html = preg_replace('/(<[a-z\\-]+)\\s+([^>]+>)/iu', "$1\n$2", $this->_html);
|
||||
|
||||
// fill placeholders
|
||||
$this->_html = str_replace(
|
||||
array_keys($this->_placeholders)
|
||||
,array_values($this->_placeholders)
|
||||
,$this->_html
|
||||
array_keys($this->_placeholders),
|
||||
array_values($this->_placeholders),
|
||||
$this->_html
|
||||
);
|
||||
// issue 229: multi-pass to catch scripts that didn't get replaced in textareas
|
||||
$this->_html = str_replace(
|
||||
array_keys($this->_placeholders)
|
||||
,array_values($this->_placeholders)
|
||||
,$this->_html
|
||||
array_keys($this->_placeholders),
|
||||
array_values($this->_placeholders),
|
||||
$this->_html
|
||||
);
|
||||
|
||||
return $this->_html;
|
||||
@@ -164,7 +172,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]
|
||||
: '';
|
||||
}
|
||||
@@ -209,7 +217,8 @@ class Minify_HTML
|
||||
: 'trim';
|
||||
$css = call_user_func($minifier, $css);
|
||||
|
||||
return $this->_reservePlace($this->_needsCdata($css)
|
||||
return $this->_reservePlace(
|
||||
$this->_needsCdata($css)
|
||||
? "{$openStyle}/*<![CDATA[*/{$css}/*]]>*/</style>"
|
||||
: "{$openStyle}{$css}</style>"
|
||||
);
|
||||
@@ -238,7 +247,8 @@ class Minify_HTML
|
||||
: 'trim';
|
||||
$js = call_user_func($minifier, $js);
|
||||
|
||||
return $this->_reservePlace($this->_needsCdata($js)
|
||||
return $this->_reservePlace(
|
||||
$this->_needsCdata($js)
|
||||
? "{$ws1}{$openScript}/*<![CDATA[*/{$js}/*]]>*/</script>{$ws2}"
|
||||
: "{$ws1}{$openScript}{$js}</script>{$ws2}"
|
||||
);
|
||||
|
@@ -182,7 +182,7 @@ class Minify_ImportProcessor
|
||||
private function truepath($path)
|
||||
{
|
||||
// whether $path is unix or not
|
||||
$unipath = ('' === $path) || ($path{0} !== '/');
|
||||
$unipath = ('' === $path) || ($path[0] !== '/');
|
||||
|
||||
// attempts to detect if path is relative in which case, add cwd
|
||||
if (strpos($path, ':') === false && $unipath) {
|
||||
|
@@ -154,4 +154,3 @@ class Minify_YUICompressor
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -390,4 +390,3 @@ class Cli
|
||||
$this->errors[$letter][] = sprintf($msg, $value);
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -59,4 +59,3 @@ if ($testRun) {
|
||||
fwrite($fp, $combined);
|
||||
$cli->closeOutput();
|
||||
}
|
||||
|
||||
|
@@ -13,7 +13,8 @@ $app->cache = new Minify_Cache_Null();
|
||||
|
||||
$env = $app->env;
|
||||
|
||||
function h($txt) {
|
||||
function h($txt)
|
||||
{
|
||||
return htmlspecialchars($txt, ENT_QUOTES, 'UTF-8');
|
||||
}
|
||||
|
||||
@@ -22,13 +23,12 @@ if ($env->post('textIn')) {
|
||||
}
|
||||
|
||||
if ($env->post('method') === 'Minify and serve') {
|
||||
|
||||
$base = trim($env->post('base'));
|
||||
if ($base) {
|
||||
$textIn = preg_replace(
|
||||
'@(<head\\b[^>]*>)@i'
|
||||
,'$1<base href="' . h($base) . '" />'
|
||||
,$textIn
|
||||
'@(<head\\b[^>]*>)@i',
|
||||
'$1<base href="' . h($base) . '" />',
|
||||
$textIn
|
||||
);
|
||||
}
|
||||
|
||||
@@ -58,7 +58,6 @@ $tpl = array();
|
||||
$tpl['classes'] = array('Minify_HTML', 'JSMin\\JSMin', 'Minify_CSS', 'Minify_Lines');
|
||||
|
||||
if (in_array($env->post('method'), $tpl['classes'])) {
|
||||
|
||||
$args = array($textIn);
|
||||
if ($env->post('method') === 'Minify_HTML') {
|
||||
$args[] = array(
|
||||
@@ -88,7 +87,8 @@ sendPage($tpl);
|
||||
* @param string $input
|
||||
* @return string HTML
|
||||
*/
|
||||
function getExceptionMsg(Exception $e, $input) {
|
||||
function getExceptionMsg(Exception $e, $input)
|
||||
{
|
||||
$msg = "<p>" . h($e->getMessage()) . "</p>";
|
||||
if (0 === strpos(get_class($e), 'JSMin_Unterminated')
|
||||
&& preg_match('~byte (\d+)~', $e->getMessage(), $m)) {
|
||||
@@ -113,9 +113,9 @@ function getExceptionMsg(Exception $e, $input) {
|
||||
*
|
||||
* @param array $vars
|
||||
*/
|
||||
function sendPage($vars) {
|
||||
header('Content-Type: text/html; charset=utf-8');
|
||||
?>
|
||||
function sendPage($vars)
|
||||
{
|
||||
header('Content-Type: text/html; charset=utf-8'); ?>
|
||||
<!DOCTYPE html><head><title>minifyTextarea</title></head>
|
||||
|
||||
<p><strong>Warning! Please do not place this application on a public site.</strong> This should be used only for testing.</p>
|
||||
@@ -132,18 +132,16 @@ if (isset($vars['time'])) {
|
||||
<tr><th>Time (s)</th><td>" . round($vars['time'], 5) . "</td></tr>
|
||||
</table>
|
||||
";
|
||||
}
|
||||
?>
|
||||
} ?>
|
||||
<form action="?2" method="post">
|
||||
<p><label>Content<br><textarea name="textIn" cols="80" rows="35" style="width:99%"><?php
|
||||
if (isset($vars['output'])) {
|
||||
echo h($vars['output']);
|
||||
}
|
||||
?></textarea></label></p>
|
||||
} ?></textarea></label></p>
|
||||
<p>Minify with:
|
||||
<?php foreach ($vars['classes'] as $minClass): ?>
|
||||
<input type="submit" name="method" value="<?php echo $minClass; ?>">
|
||||
<?php endForEach; ?>
|
||||
<?php endforeach; ?>
|
||||
</p>
|
||||
<p>...or <input type="submit" name="method" value="Minify and serve"> this HTML to the browser. Also minify:
|
||||
<label>CSS <input type="checkbox" name="minCss" checked></label> :
|
||||
|
@@ -12,23 +12,26 @@ $app->cache = new Minify_Cache_Null();
|
||||
|
||||
$env = $app->env;
|
||||
|
||||
function getPost($key) {
|
||||
function getPost($key)
|
||||
{
|
||||
if (! isset($_POST[$key])) {
|
||||
return null;
|
||||
}
|
||||
return get_magic_quotes_gpc()
|
||||
return (PHP_VERSION_ID < 50400 && get_magic_quotes_gpc())
|
||||
? stripslashes($_POST[$key])
|
||||
: $_POST[$key];
|
||||
}
|
||||
|
||||
function sniffType($headers) {
|
||||
function sniffType($headers)
|
||||
{
|
||||
$charset = 'utf-8';
|
||||
$type = null;
|
||||
$headers = "\n\n" . implode("\n\n", $headers) . "\n\n";
|
||||
if (preg_match(
|
||||
'@\\n\\nContent-Type: *([\\w/\\+-]+)( *; *charset *= *([\\w-]+))? *\\n\\n@i'
|
||||
,$headers
|
||||
,$m)) {
|
||||
'@\\n\\nContent-Type: *([\\w/\\+-]+)( *; *charset *= *([\\w-]+))? *\\n\\n@i',
|
||||
$headers,
|
||||
$m
|
||||
)) {
|
||||
$sentType = $m[1];
|
||||
if (isset($m[3])) {
|
||||
$charset = $m[3];
|
||||
@@ -49,7 +52,6 @@ function sniffType($headers) {
|
||||
}
|
||||
|
||||
if (isset($_POST['url'])) {
|
||||
|
||||
require '../config.php';
|
||||
|
||||
$url = trim($env->post('url'));
|
||||
@@ -92,9 +94,9 @@ if (isset($_POST['url'])) {
|
||||
&& isset($_POST['addBase'])
|
||||
&& ! preg_match('@<base\\b@i', $content)) {
|
||||
$content = preg_replace(
|
||||
'@(<head\\b[^>]*>)@i'
|
||||
,'$1<base href="' . htmlspecialchars($url, ENT_QUOTES, 'UTF-8') . '" />'
|
||||
,$content
|
||||
'@(<head\\b[^>]*>)@i',
|
||||
'$1<base href="' . htmlspecialchars($url, ENT_QUOTES, 'UTF-8') . '" />',
|
||||
$content
|
||||
);
|
||||
}
|
||||
|
||||
|
@@ -8,9 +8,13 @@ $env = $app->env;
|
||||
|
||||
header('Content-Type: text/html;charset=utf-8');
|
||||
|
||||
function h($str) { return htmlspecialchars($str, ENT_QUOTES); }
|
||||
function h($str)
|
||||
{
|
||||
return htmlspecialchars($str, ENT_QUOTES);
|
||||
}
|
||||
|
||||
function getInput($name, $default = '', $size = 50) {
|
||||
function getInput($name, $default = '', $size = 50)
|
||||
{
|
||||
global $env;
|
||||
$val = $env->post($name, $default);
|
||||
return "<input type='text' name='{$name}' value='" . h($val) . "' size='{$size}' />";
|
||||
|
@@ -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>
|
||||
|
@@ -13,7 +13,8 @@ if (!$enabled) {
|
||||
die('Set $enabled to true to see server info.');
|
||||
}
|
||||
|
||||
function assertTrue($test, $message) {
|
||||
function assertTrue($test, $message)
|
||||
{
|
||||
if (!$test) {
|
||||
echo "Warning: $message\n";
|
||||
}
|
||||
|
@@ -10,7 +10,8 @@ namespace Minify\StaticService;
|
||||
* @param string $type "css" or "js"
|
||||
* @return string
|
||||
*/
|
||||
function build_uri($static_uri, $query, $type) {
|
||||
function build_uri($static_uri, $query, $type)
|
||||
{
|
||||
$static_uri = rtrim($static_uri, '/');
|
||||
$query = ltrim($query, '?');
|
||||
|
||||
@@ -30,7 +31,8 @@ function build_uri($static_uri, $query, $type) {
|
||||
* @param bool $auto_create Automatically create the directory if missing?
|
||||
* @return null|string null if missing or can't create
|
||||
*/
|
||||
function get_cache_time($auto_create = true) {
|
||||
function get_cache_time($auto_create = true)
|
||||
{
|
||||
foreach (scandir(__DIR__) as $entry) {
|
||||
if (ctype_digit($entry)) {
|
||||
return $entry;
|
||||
@@ -50,14 +52,16 @@ function get_cache_time($auto_create = true) {
|
||||
return $time;
|
||||
}
|
||||
|
||||
function flush_cache() {
|
||||
function flush_cache()
|
||||
{
|
||||
$time = get_cache_time(false);
|
||||
if ($time) {
|
||||
remove_tree(__DIR__ . "/$time");
|
||||
}
|
||||
}
|
||||
|
||||
function remove_tree($dir) {
|
||||
function remove_tree($dir)
|
||||
{
|
||||
$files = array_diff(scandir($dir), array('.', '..'));
|
||||
|
||||
foreach ($files as $file) {
|
||||
|
@@ -127,7 +127,7 @@ class HTTPConditionalGetTest extends TestCase
|
||||
if (null === $inm) {
|
||||
unset($_SERVER['HTTP_IF_NONE_MATCH']);
|
||||
} else {
|
||||
$_SERVER['HTTP_IF_NONE_MATCH'] = get_magic_quotes_gpc()
|
||||
$_SERVER['HTTP_IF_NONE_MATCH'] = PHP_VERSION_ID < 50400 && get_magic_quotes_gpc()
|
||||
? addslashes($inm) :
|
||||
$inm;
|
||||
}
|
||||
|
@@ -32,8 +32,11 @@ class JsClosureCompilerTest extends TestCase
|
||||
$this->compile($src);
|
||||
} catch (Minify_JS_ClosureCompiler_Exception $e) {
|
||||
}
|
||||
$this->assertInstanceOf('Minify_JS_ClosureCompiler_Exception', $e,
|
||||
'Throws Minify_JS_ClosureCompiler_Exception');
|
||||
$this->assertInstanceOf(
|
||||
'Minify_JS_ClosureCompiler_Exception',
|
||||
$e,
|
||||
'Throws Minify_JS_ClosureCompiler_Exception'
|
||||
);
|
||||
}
|
||||
|
||||
// Test maximum byte size check (default)
|
||||
@@ -46,8 +49,11 @@ class JsClosureCompilerTest extends TestCase
|
||||
$this->compile($src);
|
||||
} catch (Minify_JS_ClosureCompiler_Exception $e) {
|
||||
}
|
||||
$this->assertInstanceOf('Minify_JS_ClosureCompiler_Exception', $e,
|
||||
'Throws Minify_JS_ClosureCompiler_Exception');
|
||||
$this->assertInstanceOf(
|
||||
'Minify_JS_ClosureCompiler_Exception',
|
||||
$e,
|
||||
'Throws Minify_JS_ClosureCompiler_Exception'
|
||||
);
|
||||
|
||||
$expected = 'POST content larger than ' . Minify_JS_ClosureCompiler::DEFAULT_MAX_BYTES . ' bytes';
|
||||
$this->assertEquals($expected, $e->getMessage(), 'Message must tell how big maximum byte size is');
|
||||
@@ -76,8 +82,11 @@ class JsClosureCompilerTest extends TestCase
|
||||
));
|
||||
} catch (Minify_JS_ClosureCompiler_Exception $e) {
|
||||
}
|
||||
$this->assertInstanceOf('Minify_JS_ClosureCompiler_Exception', $e,
|
||||
'Throws Minify_JS_ClosureCompiler_Exception');
|
||||
$this->assertInstanceOf(
|
||||
'Minify_JS_ClosureCompiler_Exception',
|
||||
$e,
|
||||
'Throws Minify_JS_ClosureCompiler_Exception'
|
||||
);
|
||||
|
||||
$expected = 'POST content larger than ' . $allowedBytes . ' bytes';
|
||||
$this->assertEquals($expected, $e->getMessage(), 'Message must tell how big maximum byte size is');
|
||||
@@ -96,8 +105,11 @@ class JsClosureCompilerTest extends TestCase
|
||||
));
|
||||
} catch (Minify_JS_ClosureCompiler_Exception $e) {
|
||||
}
|
||||
$this->assertInstanceOf('Minify_JS_ClosureCompiler_Exception', $e,
|
||||
'Throws Minify_JS_ClosureCompiler_Exception');
|
||||
$this->assertInstanceOf(
|
||||
'Minify_JS_ClosureCompiler_Exception',
|
||||
$e,
|
||||
'Throws Minify_JS_ClosureCompiler_Exception'
|
||||
);
|
||||
}
|
||||
|
||||
public function test7()
|
||||
|
@@ -16,9 +16,10 @@ class MinifyCSSUriRewriterTest extends TestCase
|
||||
$in = file_get_contents(self::$test_files . '/css_uriRewriter/in.css');
|
||||
$expected = file_get_contents(self::$test_files . '/css_uriRewriter/exp.css');
|
||||
$actual = Minify_CSS_UriRewriter::rewrite(
|
||||
$in
|
||||
, self::$test_files . '/css_uriRewriter' // currentDir
|
||||
, self::$document_root // use DOCUMENT_ROOT = '/full/path/to/min_unit_tests'
|
||||
$in,
|
||||
self::$test_files . '/css_uriRewriter' // currentDir
|
||||
,
|
||||
self::$document_root // use DOCUMENT_ROOT = '/full/path/to/min_unit_tests'
|
||||
);
|
||||
|
||||
$this->assertEquals($expected, $actual, 'rewrite, debug: ' . Minify_CSS_UriRewriter::$debugText);
|
||||
@@ -47,9 +48,9 @@ class MinifyCSSUriRewriterTest extends TestCase
|
||||
$in = '../../../../assets/skins/sam/sprite.png';
|
||||
$exp = '/yui/assets/skins/sam/sprite.png';
|
||||
$actual = Minify_CSS_UriRewriter::rewriteRelative(
|
||||
$in
|
||||
, 'sf_root_dir\web\yui\menu\assets\skins\sam'
|
||||
, 'sf_root_dir\web'
|
||||
$in,
|
||||
'sf_root_dir\web\yui\menu\assets\skins\sam',
|
||||
'sf_root_dir\web'
|
||||
);
|
||||
|
||||
$this->assertEquals($exp, $actual, 'Issue 99, debug: ' . Minify_CSS_UriRewriter::$debugText);
|
||||
|
@@ -9,7 +9,6 @@ class MinifyCacheAPCTest extends TestCase
|
||||
public function setUp()
|
||||
{
|
||||
if (!function_exists('apc_store')) {
|
||||
// FIXME: is APCu extension ok too?
|
||||
$this->markTestSkipped("To test this component, install APC extension");
|
||||
}
|
||||
}
|
||||
|
25
tests/MinifyCacheAPCuTest.php
Normal file
25
tests/MinifyCacheAPCuTest.php
Normal file
@@ -0,0 +1,25 @@
|
||||
<?php
|
||||
|
||||
namespace Minify\Test;
|
||||
|
||||
use Minify_Cache_APCu;
|
||||
|
||||
class MinifyCacheAPCuTest extends TestCase
|
||||
{
|
||||
public function setUp()
|
||||
{
|
||||
if (!function_exists('apcu_store')) {
|
||||
$this->markTestSkipped("To test this component, install APCu extension");
|
||||
}
|
||||
ini_set('apc.enable_cli', 1);
|
||||
}
|
||||
|
||||
public function test1()
|
||||
{
|
||||
$data = str_repeat(md5(time()) . 'í', 100); // 3400 bytes in UTF-8
|
||||
$id = 'Minify_test_cache';
|
||||
|
||||
$cache = new Minify_Cache_APCu();
|
||||
$this->assertTestCache($cache, $id, $data);
|
||||
}
|
||||
}
|
@@ -45,4 +45,3 @@ class MinifyCacheMemcacheTest extends TestCase
|
||||
$this->assertTestCache($cache, $id, $data);
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -23,7 +23,10 @@ class MinifyImportProcessorTest extends TestCase
|
||||
realpath($linDir . '/lib/css/example.css'),
|
||||
);
|
||||
|
||||
$this->assertEquals($expectedIncludes, Minify_ImportProcessor::$filesIncluded,
|
||||
'included right files in right order');
|
||||
$this->assertEquals(
|
||||
$expectedIncludes,
|
||||
Minify_ImportProcessor::$filesIncluded,
|
||||
'included right files in right order'
|
||||
);
|
||||
}
|
||||
}
|
||||
|
@@ -62,8 +62,8 @@ class MinifyTest extends TestCase
|
||||
|
||||
$content = preg_replace('/\\r\\n?/', "\n", file_get_contents($minifyTestPath . '/minified.js'));
|
||||
$lastModified = max(
|
||||
filemtime($minifyTestPath . '/email.js')
|
||||
, filemtime($minifyTestPath . '/QueryString.js')
|
||||
filemtime($minifyTestPath . '/email.js'),
|
||||
filemtime($minifyTestPath . '/QueryString.js')
|
||||
);
|
||||
$expected = array(
|
||||
'success' => true,
|
||||
@@ -153,8 +153,10 @@ class MinifyTest extends TestCase
|
||||
));
|
||||
$output = $output['content'];
|
||||
|
||||
$this->assertFalse(strpos($output, $defaultOptions['importWarning']),
|
||||
'Issue 89 : don\'t warn about valid imports');
|
||||
$this->assertFalse(
|
||||
strpos($output, $defaultOptions['importWarning']),
|
||||
'Issue 89 : don\'t warn about valid imports'
|
||||
);
|
||||
|
||||
// Test Issue 132
|
||||
if (function_exists('mb_strlen') && ((int)ini_get('mbstring.func_overload') & 2)) {
|
||||
@@ -164,8 +166,11 @@ class MinifyTest extends TestCase
|
||||
'encodeOutput' => false,
|
||||
));
|
||||
|
||||
$this->assertEquals(77, $output['headers']['Content-Length'],
|
||||
'Issue 132 : mbstring.func_overload shouldn\'t cause incorrect Content-Length');
|
||||
$this->assertEquals(
|
||||
77,
|
||||
$output['headers']['Content-Length'],
|
||||
'Issue 132 : mbstring.func_overload shouldn\'t cause incorrect Content-Length'
|
||||
);
|
||||
}
|
||||
|
||||
// Test minifying CSS and responding with Etag/Last-Modified
|
||||
|
@@ -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"><!--
|
||||
|
@@ -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 < & */
|
||||
|
@@ -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"><!--
|
||||
|
@@ -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 < & */
|
||||
|
Reference in New Issue
Block a user