1
0
mirror of https://github.com/mrclay/minify.git synced 2025-09-07 12:40:51 +02:00

10 Commits
3.0.1 ... 3.0.3

Author SHA1 Message Date
Elan Ruusamäe
404664509c fill 3.0.3 release notes 2017-11-03 23:00:15 +02:00
Elan Ruusamäe
9ed7f9dc24 Fix closure-compiler's error "redirection limit reached". fixes #618, #619 2017-11-03 22:58:09 +02:00
Emanuele "ToX" Toscano
d9b392c474 Fix closure-compiler's "redirection limit reached"
Since a few days, the js minification was complaining about a redirection limit in the closure-compiler call. This was generating an error each time I have tried to use this tool.

After a bit of investigation I have found out that it was missing some parameters that are now mandatory. Plus, it now works in https only.
2017-11-03 10:24:25 +01:00
Steve Clay
004f6bf730 3.0.2 release notes 2017-09-14 18:13:04 -04:00
Steve Clay
72ece76cdf Fixes syntax error in Groups controller
Fixes #613
2017-09-14 18:03:49 -04:00
Elan Ruusamäe
bde7a41021 Merge pull request #610 from glensc/lesserphp
replace leafo/lessphp with marcusschwarz/lesserphp
2017-08-17 09:38:36 +03:00
Elan Ruusamäe
88aca4019d replace leafo/lessphp with marcusschwarz/lesserphp
This is a better maintained fork of lessphp. It seems to be fully
compatible, so this is more or less a drop in replacement.

Dokuwiki switched to this fork:
https://github.com/splitbrain/dokuwiki/pull/1969
2017-08-17 09:33:05 +03:00
Steve Clay
70952d88f9 Merge pull request #608 from benface/patch-1
Fix issue where minify() would corrupt some characters such as   in some environments
2017-08-10 12:22:30 -04:00
Benoît Rouleau
6b274afd0b unicode flag everywhere to fix more issues with   and MAMP 2017-08-09 17:22:32 -04:00
Benoît Rouleau
449f009b39 Fix issue where minify() would corrupt Unicode characters (such as  ) in some environments
Adding the `u` flag there fixes an issue in my environment (MAMP 4.1.1 with PHP 7.1.5) where `minify()` would corrupt the ` ` character (it would get replaced by the replacement character).
2017-07-20 20:34:49 -04:00
5 changed files with 29 additions and 16 deletions

View File

@@ -1,3 +1,13 @@
## Version 3.0.3 (2017-11-03)
* Fix closure-compiler's error "redirection limit reached". #618, #619
## Version 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
## Version 3.0.1 (2017-06-09)
* Update CSSmin to v4, #599, #590

View File

@@ -33,15 +33,15 @@
},
"require-dev": {
"firephp/firephp-core": "~0.4.0",
"leafo/lessphp": "~0.4.0",
"leafo/scssphp": "~0.6.6",
"marcusschwarz/lesserphp": "~0.5.1",
"meenie/javascript-packer": "~1.1",
"phpunit/phpunit": "4.8.*",
"tedivm/jshrink": "~1.1.0"
},
"suggest": {
"firephp/firephp-core": "Use FirePHP for Log messages",
"leafo/lessphp": "LESS support",
"marcusschwarz/lesserphp": "LESS support",
"meenie/javascript-packer": "Keep track of the Packer PHP port using Composer"
},
"scripts": {

View File

@@ -48,7 +48,7 @@ class Minify_Controller_Groups extends Minify_Controller_Files
if (isset($server['ORIG_PATH_INFO'])) {
$pathInfo = substr($server['ORIG_PATH_INFO'], 1);
} elseif (isset($server['PATH_INFO'])) {
$pathInfo = substr($server['PATH_INFO'], 1)
$pathInfo = substr($server['PATH_INFO'], 1);
} else {
$pathInfo = false;
}

View File

@@ -99,52 +99,52 @@ class Minify_HTML
// replace SCRIPTs (and minify) with placeholders
$this->_html = preg_replace_callback(
'/(\\s*)<script(\\b[^>]*?>)([\\s\\S]*?)<\\/script>(\\s*)/i'
'/(\\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*/i'
'/\\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]*?)-->/'
'/<!--([\\s\\S]*?)-->/u'
,array($this, '_commentCB')
,$this->_html);
// replace PREs with placeholders
$this->_html = preg_replace_callback('/\\s*<pre(\\b[^>]*?>[\\s\\S]*?<\\/pre>)\\s*/i'
$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*/i'
'/\\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.
$this->_html = preg_replace('/^\\s+|\\s+$/m', '', $this->_html);
$this->_html = preg_replace('/^\\s+|\\s+$/mu', '', $this->_html);
// remove ws around block/undisplayed elements
$this->_html = preg_replace('/\\s+(<\\/?(?:area|article|aside|base(?:font)?|blockquote|body'
.'|canvas|caption|center|col(?:group)?|dd|dir|div|dl|dt|fieldset|figcaption|figure|footer|form'
.'|frame(?:set)?|h[1-6]|head|header|hgroup|hr|html|legend|li|link|main|map|menu|meta|nav'
.'|ol|opt(?:group|ion)|output|p|param|section|t(?:able|body|head|d|h||r|foot|itle)'
.'|ul|video)\\b[^>]*>)/i', '$1', $this->_html);
.'|ul|video)\\b[^>]*>)/iu', '$1', $this->_html);
// remove ws outside of all elements
$this->_html = preg_replace(
'/>(\\s(?:\\s*))?([^<]+)(\\s(?:\s*))?</'
'/>(\\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+([^>]+>)/i', "$1\n$2", $this->_html);
$this->_html = preg_replace('/(<[a-z\\-]+)\\s+([^>]+>)/iu', "$1\n$2", $this->_html);
// fill placeholders
$this->_html = str_replace(
@@ -198,7 +198,7 @@ class Minify_HTML
$openStyle = "<style{$m[1]}";
$css = $m[2];
// remove HTML comments
$css = preg_replace('/(?:^\\s*<!--|-->\\s*$)/', '', $css);
$css = preg_replace('/(?:^\\s*<!--|-->\\s*$)/u', '', $css);
// remove CDATA section markers
$css = $this->_removeCdata($css);
@@ -226,7 +226,7 @@ class Minify_HTML
// remove HTML comments (and ending "//" if present)
if ($this->_jsCleanComments) {
$js = preg_replace('/(?:^\\s*<!--\\s*|\\s*(?:\\/\\/)?\\s*-->\\s*$)/', '', $js);
$js = preg_replace('/(?:^\\s*<!--\\s*|\\s*(?:\\/\\/)?\\s*-->\\s*$)/u', '', $js);
}
// remove CDATA section markers
@@ -253,6 +253,6 @@ class Minify_HTML
protected function _needsCdata($str)
{
return ($this->_isXhtml && preg_match('/(?:[<&]|\\-\\-|\\]\\]>)/', $str));
return ($this->_isXhtml && preg_match('/(?:[<&]|\\-\\-|\\]\\]>)/u', $str));
}
}

View File

@@ -54,7 +54,7 @@ class Minify_JS_ClosureCompiler
/**
* @var string $url URL of compiler server. defaults to Google's
*/
protected $serviceUrl = 'http://closure-compiler.appspot.com/compile';
protected $serviceUrl = 'https://closure-compiler.appspot.com/compile';
/**
* @var int $maxBytes The maximum JS size that can be sent to the compiler server in bytes
@@ -174,6 +174,9 @@ class Minify_JS_ClosureCompiler
$contents = file_get_contents($this->serviceUrl, false, stream_context_create(array(
'http' => array(
'method' => 'POST',
'compilation_level' => 'SIMPLE',
'output_format' => 'text',
'output_info' => 'compiled_code',
'header' => "Content-type: application/x-www-form-urlencoded\r\nConnection: close\r\n",
'content' => $postBody,
'max_redirects' => 0,