mirror of
https://github.com/mrclay/minify.git
synced 2025-09-07 12:40:51 +02:00
Compare commits
10 Commits
Author | SHA1 | Date | |
---|---|---|---|
|
404664509c | ||
|
9ed7f9dc24 | ||
|
d9b392c474 | ||
|
004f6bf730 | ||
|
72ece76cdf | ||
|
bde7a41021 | ||
|
88aca4019d | ||
|
70952d88f9 | ||
|
6b274afd0b | ||
|
449f009b39 |
@@ -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
|
@@ -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": {
|
||||
|
@@ -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;
|
||||
}
|
||||
|
@@ -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));
|
||||
}
|
||||
}
|
||||
|
@@ -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,
|
||||
|
Reference in New Issue
Block a user