mirror of
https://github.com/mrclay/minify.git
synced 2025-08-16 11:03:59 +02:00
Work on: Issue 125, Issue 126, Issue 132, Issue 134, Issue 138, Issue 139, Issue 147, Issue 149, Issue 151, Issue 162, Issue 166
This commit is contained in:
@@ -197,6 +197,7 @@ var MUB = {
|
||||
* Runs on DOMready
|
||||
*/
|
||||
,init : function () {
|
||||
$('#jsDidntLoad').hide();
|
||||
$('#app').show();
|
||||
$('#sources').html('');
|
||||
$('#add button').click(MUB.addButtonClick);
|
||||
@@ -239,4 +240,4 @@ var MUB = {
|
||||
MUB.checkRewrite();
|
||||
}
|
||||
};
|
||||
window.onload = MUB.init;
|
||||
$(MUB.init);
|
@@ -17,11 +17,10 @@ if (! $min_enableBuilder) {
|
||||
|
||||
ob_start();
|
||||
?>
|
||||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
|
||||
<head>
|
||||
<meta name="ROBOTS" content="NOINDEX, NOFOLLOW">
|
||||
<title>Minify URI Builder</title>
|
||||
<style type="text/css">
|
||||
<!DOCTYPE HTML>
|
||||
<meta name="ROBOTS" content="NOINDEX, NOFOLLOW">
|
||||
<title>Minify URI Builder</title>
|
||||
<style type="text/css">
|
||||
body {margin:1em 60px;}
|
||||
h1, h2, h3 {margin-left:-25px; position:relative;}
|
||||
h1 {margin-top:0;}
|
||||
@@ -37,8 +36,13 @@ h1 {margin-top:0;}
|
||||
b {color:#c00}
|
||||
.topNote {background: #ff9; display:inline-block; padding:.5em .6em; margin:0 0 1em;}
|
||||
.topWarning {background:#c00; color:#fff; padding:.5em .6em; margin:0 0 1em;}
|
||||
</style>
|
||||
</head>
|
||||
.topWarning a {color:#fff;}
|
||||
</style>
|
||||
<body>
|
||||
<p class=topWarning id=jsDidntLoad><strong>Uh Oh.</strong> Minify was unable to
|
||||
serve the Javascript for this app. <a href="http://code.google.com/p/minify/wiki/Debugging">Enable
|
||||
FirePHP debugging</a> and request the <a id=builderScriptSrc href=#>Minify URL</a> directly.
|
||||
</p>
|
||||
|
||||
<?php if (! isset($min_cachePath)): ?>
|
||||
<p class=topNote><strong>Note:</strong> Please set <code>$min_cachePath</code>
|
||||
@@ -149,11 +153,15 @@ $(function () {
|
||||
});
|
||||
</script>
|
||||
<script type="text/javascript">
|
||||
// workaround required to test when /min isn't child of web root
|
||||
var src = location.pathname.replace(/\/[^\/]*$/, '/_index.js').substr(1);
|
||||
document.write('<\script type="text/javascript" src="../?f=' + src + '"><\/script>');
|
||||
// workaround required to test when /min isn't child of web root
|
||||
var src = location.pathname.replace(/\/[^\/]*$/, '/_index.js').substr(1);
|
||||
src = "../?f=" + src;
|
||||
document.write('<\script type="text/javascript" src="' + src + '"><\/script>');
|
||||
$(function () {
|
||||
$('#builderScriptSrc')[0].href = src;
|
||||
});
|
||||
</script>
|
||||
|
||||
</body>
|
||||
<?php
|
||||
|
||||
$serveOpts = array(
|
||||
|
@@ -1,6 +1,8 @@
|
||||
<?php
|
||||
/**
|
||||
* Configuration for default Minify application
|
||||
* Configuration for "min", the default application built with the Minify
|
||||
* library
|
||||
*
|
||||
* @package Minify
|
||||
*/
|
||||
|
||||
@@ -78,9 +80,9 @@ $min_serveOptions['bubbleCssImports'] = false;
|
||||
|
||||
|
||||
/**
|
||||
* Maximum age of browser cache in seconds. After this period, the browser
|
||||
* will send another conditional GET. Use a longer period for lower traffic
|
||||
* but you may want to shorten this before making changes if it's crucial
|
||||
* Cache-Control: max-age value sent to browser (in seconds). After this period,
|
||||
* the browser will send another conditional GET. Use a longer period for lower
|
||||
* traffic but you may want to shorten this before making changes if it's crucial
|
||||
* those changes are seen immediately.
|
||||
*
|
||||
* Note: Despite this setting, if you include a number at the end of the
|
||||
@@ -105,10 +107,15 @@ $min_serveOptions['maxAge'] = 1800;
|
||||
*/
|
||||
$min_serveOptions['minApp']['groupsOnly'] = false;
|
||||
|
||||
|
||||
/**
|
||||
* Maximum # of files that can be specified in the "f" GET parameter
|
||||
* By default, Minify will not minify files with names containing .min or -min
|
||||
* before the extension. E.g. myFile.min.js will not be processed by JSMin
|
||||
*
|
||||
* To minify all files, set this option to null. You could also specify your
|
||||
* own pattern that is matched against the filename.
|
||||
*/
|
||||
$min_serveOptions['minApp']['maxFiles'] = 10;
|
||||
//$min_serveOptions['minApp']['noMinPattern'] = '@[-\\.]min\\.(?:js|css)$@i';
|
||||
|
||||
|
||||
/**
|
||||
|
@@ -7,28 +7,12 @@
|
||||
/**
|
||||
* You may wish to use the Minify URI Builder app to suggest
|
||||
* changes. http://yourdomain/min/builder/
|
||||
*
|
||||
* See http://code.google.com/p/minify/wiki/CustomSource for other ideas
|
||||
**/
|
||||
|
||||
return array(
|
||||
// 'js' => array('//js/file1.js', '//js/file2.js'),
|
||||
// 'css' => array('//css/file1.css', '//css/file2.css'),
|
||||
|
||||
// custom source example
|
||||
/*'js2' => array(
|
||||
dirname(__FILE__) . '/../min_unit_tests/_test_files/js/before.js',
|
||||
// do NOT process this file
|
||||
new Minify_Source(array(
|
||||
'filepath' => dirname(__FILE__) . '/../min_unit_tests/_test_files/js/before.js',
|
||||
'minifier' => create_function('$a', 'return $a;')
|
||||
))
|
||||
),//*/
|
||||
|
||||
/*'js3' => array(
|
||||
dirname(__FILE__) . '/../min_unit_tests/_test_files/js/before.js',
|
||||
// do NOT process this file
|
||||
new Minify_Source(array(
|
||||
'filepath' => dirname(__FILE__) . '/../min_unit_tests/_test_files/js/before.js',
|
||||
'minifier' => array('Minify_Packer', 'minify')
|
||||
))
|
||||
),//*/
|
||||
);
|
@@ -30,6 +30,10 @@ if ($min_documentRoot) {
|
||||
}
|
||||
|
||||
$min_serveOptions['minifierOptions']['text/css']['symlinks'] = $min_symlinks;
|
||||
// auto-add targets to allowDirs
|
||||
foreach ($min_symlinks as $uri => $target) {
|
||||
$min_serveOptions['minApp']['allowDirs'][] = $target;
|
||||
}
|
||||
|
||||
if ($min_allowDebugFlag && isset($_GET['debug'])) {
|
||||
$min_serveOptions['debug'] = true;
|
||||
|
@@ -337,7 +337,7 @@ class HTTP_ConditionalGet {
|
||||
// IE has tacked on extra data to this header, strip it
|
||||
$ifModifiedSince = substr($ifModifiedSince, 0, $semicolon);
|
||||
}
|
||||
if ($ifModifiedSince == self::gmtDate($this->_lmTime)) {
|
||||
if (strtotime($ifModifiedSince) >= $this->_lmTime) {
|
||||
// Apache 2.2's behavior. If there was no ETag match, send the
|
||||
// non-encoded version of the ETag value.
|
||||
$this->_headers['ETag'] = $this->normalizeEtag($this->_etag);
|
||||
|
@@ -59,7 +59,7 @@ class HTTP_Encoder {
|
||||
*
|
||||
* @var bool
|
||||
*/
|
||||
public static $encodeToIe6 = false;
|
||||
public static $encodeToIe6 = true;
|
||||
|
||||
|
||||
/**
|
||||
@@ -195,7 +195,7 @@ class HTTP_Encoder {
|
||||
// @link http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html
|
||||
|
||||
if (! isset($_SERVER['HTTP_ACCEPT_ENCODING'])
|
||||
|| self::_isBuggyIe())
|
||||
|| self::isBuggyIe())
|
||||
{
|
||||
return array('', '');
|
||||
}
|
||||
@@ -253,7 +253,9 @@ class HTTP_Encoder {
|
||||
*/
|
||||
public function encode($compressionLevel = null)
|
||||
{
|
||||
if (! self::isBuggyIe()) {
|
||||
$this->_headers['Vary'] = 'Accept-Encoding';
|
||||
}
|
||||
if (null === $compressionLevel) {
|
||||
$compressionLevel = self::$compressionLevel;
|
||||
}
|
||||
@@ -302,14 +304,12 @@ class HTTP_Encoder {
|
||||
return $ret;
|
||||
}
|
||||
|
||||
protected $_content = '';
|
||||
protected $_headers = array();
|
||||
protected $_encodeMethod = array('', '');
|
||||
|
||||
/**
|
||||
* Is the browser an IE version earlier than 6 SP2?
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
protected static function _isBuggyIe()
|
||||
public static function isBuggyIe()
|
||||
{
|
||||
$ua = $_SERVER['HTTP_USER_AGENT'];
|
||||
// quick escape for non-IEs
|
||||
@@ -323,4 +323,8 @@ class HTTP_Encoder {
|
||||
? ($version < 6 || ($version == 6 && false === strpos($ua, 'SV1')))
|
||||
: ($version < 7);
|
||||
}
|
||||
|
||||
protected $_content = '';
|
||||
protected $_headers = array();
|
||||
protected $_encodeMethod = array('', '');
|
||||
}
|
||||
|
@@ -171,7 +171,7 @@ class JSMin {
|
||||
}
|
||||
if (ord($this->a) <= self::ORD_LF) {
|
||||
throw new JSMin_UnterminatedStringException(
|
||||
'Unterminated String: ' . var_export($str, true));
|
||||
"Unterminated String: {$str}");
|
||||
}
|
||||
$str .= $this->a;
|
||||
if ($this->a === '\\') {
|
||||
@@ -198,7 +198,7 @@ class JSMin {
|
||||
$pattern .= $this->a;
|
||||
} elseif (ord($this->a) <= self::ORD_LF) {
|
||||
throw new JSMin_UnterminatedRegExpException(
|
||||
'Unterminated RegExp: '. var_export($pattern, true));
|
||||
"Unterminated RegExp: {$pattern}");
|
||||
}
|
||||
$this->output .= $this->a;
|
||||
}
|
||||
@@ -310,7 +310,7 @@ class JSMin {
|
||||
return ' ';
|
||||
}
|
||||
} elseif ($get === null) {
|
||||
throw new JSMin_UnterminatedCommentException('Unterminated Comment: ' . var_export('/*' . $comment, true));
|
||||
throw new JSMin_UnterminatedCommentException("Unterminated Comment: /*{$comment}");
|
||||
}
|
||||
$comment .= $get;
|
||||
}
|
||||
|
@@ -35,6 +35,7 @@ class Minify {
|
||||
// there is some debate over the ideal JS Content-Type, but this is the
|
||||
// Apache default and what Yahoo! uses..
|
||||
const TYPE_JS = 'application/x-javascript';
|
||||
const URL_DEBUG = 'http://code.google.com/p/minify/wiki/Debugging';
|
||||
|
||||
/**
|
||||
* How many hours behind are the file modification times of uploaded files?
|
||||
@@ -179,9 +180,7 @@ class Minify {
|
||||
if (! $controller->sources) {
|
||||
// invalid request!
|
||||
if (! self::$_options['quiet']) {
|
||||
header(self::$_options['badRequestHeader']);
|
||||
echo self::$_options['badRequestHeader'];
|
||||
return;
|
||||
self::_errorExit(self::$_options['badRequestHeader'], self::URL_DEBUG);
|
||||
} else {
|
||||
list(,$statusCode) = explode(' ', self::$_options['badRequestHeader']);
|
||||
return array(
|
||||
@@ -202,6 +201,7 @@ class Minify {
|
||||
|
||||
// determine encoding
|
||||
if (self::$_options['encodeOutput']) {
|
||||
$sendVary = true;
|
||||
if (self::$_options['encodeMethod'] !== null) {
|
||||
// controller specifically requested this
|
||||
$contentEncoding = self::$_options['encodeMethod'];
|
||||
@@ -212,6 +212,7 @@ class Minify {
|
||||
// 'x-gzip' while our internal encodeMethod is 'gzip'. Calling
|
||||
// getAcceptedEncoding(false, false) leaves out compress and deflate as options.
|
||||
list(self::$_options['encodeMethod'], $contentEncoding) = HTTP_Encoder::getAcceptedEncoding(false, false);
|
||||
$sendVary = ! HTTP_Encoder::isBuggyIe();
|
||||
}
|
||||
} else {
|
||||
self::$_options['encodeMethod'] = ''; // identity (no encoding)
|
||||
@@ -261,7 +262,7 @@ class Minify {
|
||||
}
|
||||
|
||||
// check server cache
|
||||
if (null !== self::$_cache) {
|
||||
if (null !== self::$_cache && ! self::$_options['debug']) {
|
||||
// using cache
|
||||
// the goal is to use only the cache methods to sniff the length and
|
||||
// output the content, as they do not require ever loading the file into
|
||||
@@ -276,7 +277,15 @@ class Minify {
|
||||
$cacheContentLength = self::$_cache->getSize($fullCacheId);
|
||||
} else {
|
||||
// generate & cache content
|
||||
try {
|
||||
$content = self::_combineMinify();
|
||||
} catch (Exception $e) {
|
||||
self::$_controller->log($e->getMessage());
|
||||
if (! self::$_options['quiet']) {
|
||||
self::_errorExit(self::$_options['errorHeader'], self::URL_DEBUG);
|
||||
}
|
||||
throw $e;
|
||||
}
|
||||
self::$_cache->store($cacheId, $content);
|
||||
if (function_exists('gzencode')) {
|
||||
self::$_cache->store($cacheId . '.gz', gzencode($content, self::$_options['encodeLevel']));
|
||||
@@ -285,7 +294,15 @@ class Minify {
|
||||
} else {
|
||||
// no cache
|
||||
$cacheIsReady = false;
|
||||
try {
|
||||
$content = self::_combineMinify();
|
||||
} catch (Exception $e) {
|
||||
self::$_controller->log($e->getMessage());
|
||||
if (! self::$_options['quiet']) {
|
||||
self::_errorExit(self::$_options['errorHeader'], self::URL_DEBUG);
|
||||
}
|
||||
throw $e;
|
||||
}
|
||||
}
|
||||
if (! $cacheIsReady && self::$_options['encodeMethod']) {
|
||||
// still need to encode
|
||||
@@ -293,16 +310,22 @@ class Minify {
|
||||
}
|
||||
|
||||
// add headers
|
||||
$hasMbOverload = (function_exists('mb_strlen')
|
||||
&& (ini_get('mbstring.func_overload') !== '')
|
||||
&& ((int)ini_get('mbstring.func_overload') & 2));
|
||||
$headers['Content-Length'] = $cacheIsReady
|
||||
? $cacheContentLength
|
||||
: strlen($content);
|
||||
: ($hasMbOverload
|
||||
? mb_strlen($content, '8bit')
|
||||
: strlen($content)
|
||||
);
|
||||
$headers['Content-Type'] = self::$_options['contentTypeCharset']
|
||||
? self::$_options['contentType'] . '; charset=' . self::$_options['contentTypeCharset']
|
||||
: self::$_options['contentType'];
|
||||
if (self::$_options['encodeMethod'] !== '') {
|
||||
$headers['Content-Encoding'] = $contentEncoding;
|
||||
}
|
||||
if (self::$_options['encodeOutput']) {
|
||||
if (self::$_options['encodeOutput'] && $sendVary) {
|
||||
$headers['Vary'] = 'Accept-Encoding';
|
||||
}
|
||||
|
||||
@@ -369,9 +392,9 @@ class Minify {
|
||||
&& 0 === strpos($_SERVER['SERVER_SOFTWARE'], 'Microsoft-IIS/')
|
||||
) {
|
||||
$_SERVER['DOCUMENT_ROOT'] = rtrim(substr(
|
||||
$_SERVER['PATH_TRANSLATED']
|
||||
$_SERVER['SCRIPT_FILENAME']
|
||||
,0
|
||||
,strlen($_SERVER['PATH_TRANSLATED']) - strlen($_SERVER['SCRIPT_NAME'])
|
||||
,strlen($_SERVER['SCRIPT_FILENAME']) - strlen($_SERVER['SCRIPT_NAME'])
|
||||
), '\\');
|
||||
if ($unsetPathInfo) {
|
||||
unset($_SERVER['PATH_INFO']);
|
||||
@@ -396,6 +419,18 @@ class Minify {
|
||||
*/
|
||||
protected static $_options = null;
|
||||
|
||||
protected static function _errorExit($header, $url)
|
||||
{
|
||||
$url = htmlspecialchars($url, ENT_QUOTES);
|
||||
list(,$h1) = explode(' ', $header, 2);
|
||||
$h1 = htmlspecialchars($h1);
|
||||
header($header);
|
||||
header('Content-Type: text/html; charset=utf-8');
|
||||
echo "<h1>$h1</h1>";
|
||||
echo "<p>Please see <a href='$url'>$url</a>.</p>";
|
||||
exit();
|
||||
}
|
||||
|
||||
/**
|
||||
* Set up sources to use Minify_Lines
|
||||
*
|
||||
@@ -440,19 +475,9 @@ class Minify {
|
||||
? self::$_options['minifiers'][$type]
|
||||
: false;
|
||||
|
||||
if (Minify_Source::haveNoMinifyPrefs(self::$_controller->sources)) {
|
||||
// all source have same options/minifier, better performance
|
||||
// to combine, then minify once
|
||||
foreach (self::$_controller->sources as $source) {
|
||||
$pieces[] = $source->getContent();
|
||||
}
|
||||
$content = implode($implodeSeparator, $pieces);
|
||||
if ($defaultMinifier) {
|
||||
self::$_controller->loadMinifier($defaultMinifier);
|
||||
$content = call_user_func($defaultMinifier, $content, $defaultOptions);
|
||||
}
|
||||
} else {
|
||||
// minify each source with its own options and minifier, then combine
|
||||
// minify each source with its own options and minifier, then combine.
|
||||
// Here we used to combine all first but this was probably
|
||||
// bad for PCRE performance, esp. in CSS.
|
||||
foreach (self::$_controller->sources as $source) {
|
||||
// allow the source to override our minifier and options
|
||||
$minifier = (null !== $source->minifier)
|
||||
@@ -470,7 +495,6 @@ class Minify {
|
||||
}
|
||||
}
|
||||
$content = implode($implodeSeparator, $pieces);
|
||||
}
|
||||
|
||||
if ($type === self::TYPE_CSS && false !== strpos($content, '@import')) {
|
||||
$content = self::_handleCssImports($content);
|
||||
|
@@ -108,7 +108,7 @@ class Minify_CSS_Compressor {
|
||||
\\s*
|
||||
:
|
||||
\\s*
|
||||
(\\b|[#\'"]) # 3 = first character of a value
|
||||
(\\b|[#\'"-]) # 3 = first character of a value
|
||||
/x', '$1$2:$3', $css);
|
||||
|
||||
// remove ws in selectors
|
||||
|
@@ -55,6 +55,7 @@ abstract class Minify_Controller_Base {
|
||||
// if you override this, the response code MUST be directly after
|
||||
// the first space.
|
||||
,'badRequestHeader' => 'HTTP/1.0 400 Bad Request'
|
||||
,'errorHeader' => 'HTTP/1.0 500 Internal Server Error'
|
||||
|
||||
// callback function to see/modify content of all sources
|
||||
,'postprocessor' => null
|
||||
@@ -195,7 +196,7 @@ abstract class Minify_Controller_Base {
|
||||
* @param string $msg
|
||||
* @return null
|
||||
*/
|
||||
protected function log($msg) {
|
||||
public function log($msg) {
|
||||
require_once 'Minify/Logger.php';
|
||||
Minify_Logger::log($msg);
|
||||
}
|
||||
|
@@ -28,7 +28,7 @@ class Minify_Controller_MinApp extends Minify_Controller_Base {
|
||||
'allowDirs' => '//'
|
||||
,'groupsOnly' => false
|
||||
,'groups' => array()
|
||||
,'maxFiles' => 10
|
||||
,'noMinPattern' => '@[-\\.]min\\.(?:js|css)$@i' // matched against basename
|
||||
)
|
||||
,(isset($options['minApp']) ? $options['minApp'] : array())
|
||||
);
|
||||
@@ -58,9 +58,7 @@ class Minify_Controller_MinApp extends Minify_Controller_Base {
|
||||
}
|
||||
$file = realpath($file);
|
||||
if (is_file($file)) {
|
||||
$sources[] = new Minify_Source(array(
|
||||
'filepath' => $file
|
||||
));
|
||||
$sources[] = $this->_getFileSource($file, $cOptions);
|
||||
} else {
|
||||
$this->log("The path \"{$file}\" could not be found (or was not a file)");
|
||||
return $options;
|
||||
@@ -84,8 +82,8 @@ class Minify_Controller_MinApp extends Minify_Controller_Base {
|
||||
return $options;
|
||||
}
|
||||
$files = explode(',', $_GET['f']);
|
||||
if (count($files) > $cOptions['maxFiles'] || $files != array_unique($files)) {
|
||||
$this->log("Too many or duplicate files specified");
|
||||
if ($files != array_unique($files)) {
|
||||
$this->log("Duplicate files specified");
|
||||
return $options;
|
||||
}
|
||||
if (isset($_GET['b'])) {
|
||||
@@ -116,9 +114,7 @@ class Minify_Controller_MinApp extends Minify_Controller_Base {
|
||||
$this->log("Path \"{$path}\" failed Minify_Controller_Base::_fileIsSafe()");
|
||||
return $options;
|
||||
} else {
|
||||
$sources[] = new Minify_Source(array(
|
||||
'filepath' => $file
|
||||
));
|
||||
$sources[] = $this->_getFileSource($file, $cOptions);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -129,4 +125,14 @@ class Minify_Controller_MinApp extends Minify_Controller_Base {
|
||||
}
|
||||
return $options;
|
||||
}
|
||||
|
||||
protected function _getFileSource($file, $cOptions)
|
||||
{
|
||||
$spec['filepath'] = $file;
|
||||
if ($cOptions['noMinPattern']
|
||||
&& preg_match($cOptions['noMinPattern'], basename($file))) {
|
||||
$spec['minifier'] = '';
|
||||
}
|
||||
return new Minify_Source($spec);
|
||||
}
|
||||
}
|
||||
|
@@ -40,10 +40,16 @@ class Minify_Lines {
|
||||
? $options['id']
|
||||
: '';
|
||||
$content = str_replace("\r\n", "\n", $content);
|
||||
|
||||
// Hackily rewrite strings with XPath expressions that are
|
||||
// likely to throw off our dumb parser (for Prototype 1.6.1).
|
||||
$content = str_replace('"/*"', '"/"+"*"', $content);
|
||||
$content = preg_replace('@([\'"])(\\.?//?)\\*@', '$1$2$1+$1*', $content);
|
||||
|
||||
$lines = explode("\n", $content);
|
||||
$numLines = count($lines);
|
||||
// determine left padding
|
||||
$padTo = strlen($numLines);
|
||||
$padTo = strlen((string) $numLines); // e.g. 103 lines = 3 digits
|
||||
$inComment = false;
|
||||
$i = 0;
|
||||
$newLines = array();
|
||||
|
@@ -128,11 +128,14 @@ class Minify_YUICompressor {
|
||||
|
||||
private static function _prepare()
|
||||
{
|
||||
if (! is_file(self::$jarFile)
|
||||
|| ! is_dir(self::$tempDir)
|
||||
|| ! is_writable(self::$tempDir)
|
||||
) {
|
||||
throw new Exception('Minify_YUICompressor : $jarFile and $tempDir must be set.');
|
||||
if (! is_file(self::$jarFile)) {
|
||||
throw new Exception('Minify_YUICompressor : $jarFile('.self::$jarFile.') is not a valid file.');
|
||||
}
|
||||
if (! is_dir(self::$tempDir)) {
|
||||
throw new Exception('Minify_YUICompressor : $tempDir('.self::$tempDir.') is not a valid direcotry.');
|
||||
}
|
||||
if (! is_writable(self::$tempDir)) {
|
||||
throw new Exception('Minify_YUICompressor : $tempDir('.self::$tempDir.') is not writable.');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -25,7 +25,7 @@ p{padding:0px;margin:0px;padding-bottom:5px}#post_nav{text-align:left;padding-bo
|
||||
a{text-decoration:none;font-family:Verdana;font-size:12px;color:#108eed}#post_nav a:hover, .post_nav_2 p a:hover{text-decoration:underline;color:#FF8000}#rightcol
|
||||
#about{padding-bottom:10px}#rightcol #r_news
|
||||
input{color:#333;font-size:12px}#header{height:200px;width:100%;background-image:url('images/header_bg.jpg');background-repeat:x-repeat}#header
|
||||
img{float:right;margin-right: -3px;z-index:100}.tags{text-transform:lowercase;color:#333;font-family:arial;font-size:12px;border-top:2px dotted #EEE;width:300px;padding-top:20px;padding-bottom:0px;margin-top:0px;padding-left:20px;padding-right:20px}.tags
|
||||
img{float:right;margin-right:-3px;z-index:100}.tags{text-transform:lowercase;color:#333;font-family:arial;font-size:12px;border-top:2px dotted #EEE;width:300px;padding-top:20px;padding-bottom:0px;margin-top:0px;padding-left:20px;padding-right:20px}.tags
|
||||
a{color:#108eed}.tags
|
||||
p{text-align:left;margin:0px;padding:0px}blockquote
|
||||
strong{font-family:verdana;display:block;margin-top:10px;color:#F00;font-style:italic;text-align:right}blockquote{margin:0px;background-color:#eee;border:2px
|
||||
|
3
min_unit_tests/_test_files/js/issue141.min.js
vendored
Normal file
3
min_unit_tests/_test_files/js/issue141.min.js
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
// The MinApp controller should cause this file to not be minified
|
||||
// since the basename of the filepath matches the default noMinPattern
|
||||
|
@@ -1 +1,2 @@
|
||||
// JSMin should not alter this file
|
||||
if(!a.id)a.id="dp"+ ++this.uuid;
|
@@ -1 +1,2 @@
|
||||
// JSMin should not alter this file
|
||||
if(!a.id)a.id="dp"+ ++this.uuid;
|
6
min_unit_tests/_test_files/minify/issue143.js
Normal file
6
min_unit_tests/_test_files/minify/issue143.js
Normal file
@@ -0,0 +1,6 @@
|
||||
/*
|
||||
* This file is to intentionally throw a JSMin exception
|
||||
*/
|
||||
function HelloWorld() {
|
||||
return /regexp;
|
||||
}
|
@@ -1,2 +1,10 @@
|
||||
var triggerBug = {_default: "*/*"};
|
||||
var essentialFunctionality = true;
|
||||
// sections from Prototype 1.6.1
|
||||
var xpath = ".//*[local-name()='ul' or local-name()='UL']" +
|
||||
"//*[local-name()='li' or local-name()='LI']";
|
||||
this.matcher = ['.//*'];
|
||||
xpath = {
|
||||
descendant: "//*",
|
||||
child: "/*",
|
||||
f: 0
|
||||
};
|
||||
document._getElementsByXPath('.//*' + cond, element);
|
@@ -29,9 +29,16 @@
|
||||
;
|
||||
/* lines_bugs.js */
|
||||
|
||||
/* 1 */ var triggerBug = {_default: "*/*"};
|
||||
/* 2 */ var essentialFunctionality = true;
|
||||
/* 3 */
|
||||
/* 1 */ // sections from Prototype 1.6.1
|
||||
/* 2 */ var xpath = ".//"+"*[local-name()='ul' or local-name()='UL']" +
|
||||
/* 3 */ "//"+"*[local-name()='li' or local-name()='LI']";
|
||||
/* 4 */ this.matcher = ['.//'+'*'];
|
||||
/* 5 */ xpath = {
|
||||
/* 6 */ descendant: "//"+"*",
|
||||
/* 7 */ child: "/"+"*",
|
||||
/* 8 */ f: 0
|
||||
/* 9 */ };
|
||||
/* 10 */ document._getElementsByXPath('.//'+'*' + cond, element);
|
||||
|
||||
;
|
||||
/* QueryString.js */
|
||||
|
@@ -1,5 +1,6 @@
|
||||
(function(){var
|
||||
reMailto=/^mailto:my_name_is_(\S+)_and_the_domain_is_(\S+)$/,reRemoveTitleIf=/^my name is/,oo=window.onload,fixHrefs=function(){var i=0,l,m;while(l=document.links[i++]){if(m=l.href.match(reMailto)){l.href='mailto:'+m[1]+'@'+m[2];if(reRemoveTitleIf.test(l.title)){l.title='';}}}};window.onload=function(){oo&&oo();fixHrefs();};})();;var MrClay=window.MrClay||{};MrClay.QueryString=function(){var parse=function(str){var assignments=str.split('&'),obj={},propValue;for(var i=0,l=assignments.length;i<l;++i){propValue=assignments[i].split('=');if(propValue.length>2||-1!=propValue[0].indexOf('+')||propValue[0]==''){continue;}
|
||||
reMailto=/^mailto:my_name_is_(\S+)_and_the_domain_is_(\S+)$/,reRemoveTitleIf=/^my name is/,oo=window.onload,fixHrefs=function(){var i=0,l,m;while(l=document.links[i++]){if(m=l.href.match(reMailto)){l.href='mailto:'+m[1]+'@'+m[2];if(reRemoveTitleIf.test(l.title)){l.title='';}}}};window.onload=function(){oo&&oo();fixHrefs();};})();
|
||||
;var MrClay=window.MrClay||{};MrClay.QueryString=function(){var parse=function(str){var assignments=str.split('&'),obj={},propValue;for(var i=0,l=assignments.length;i<l;++i){propValue=assignments[i].split('=');if(propValue.length>2||-1!=propValue[0].indexOf('+')||propValue[0]==''){continue;}
|
||||
if(propValue.length==1){propValue[1]=propValue[0];}
|
||||
obj[unescape(propValue[0])]=unescape(propValue[1].replace(/\+/g,' '));}
|
||||
return obj;};function construct_(spec){spec=spec||window;if(typeof spec=='object'){this.window=spec;spec=spec.location.search.substr(1);}else{this.window=window;}
|
||||
|
@@ -129,13 +129,18 @@ function test_HTTP_Encoder()
|
||||
}
|
||||
}
|
||||
|
||||
HTTP_Encoder::$encodeToIe6 = true;
|
||||
$_SERVER['HTTP_ACCEPT_ENCODING'] = 'identity';
|
||||
$he = new HTTP_Encoder(array(
|
||||
'content' => 'Hello'
|
||||
));
|
||||
$he = new HTTP_Encoder(array('content' => 'Hello'));
|
||||
$he->encode();
|
||||
$headers = $he->getHeaders();
|
||||
assertTrue(isset($headers['Vary']), 'HTTP_Encoder : Vary always sent');
|
||||
assertTrue(isset($headers['Vary']), 'HTTP_Encoder : Vary always sent to good browsers');
|
||||
|
||||
$_SERVER['HTTP_USER_AGENT'] = 'Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1)';
|
||||
$he = new HTTP_Encoder(array('content' => 'Hello'));
|
||||
$he->encode();
|
||||
$headers = $he->getHeaders();
|
||||
assertTrue(! isset($headers['Vary']), 'HTTP_Encoder : Vary not sent to bad IE (Issue 126)');
|
||||
}
|
||||
|
||||
test_HTTP_Encoder();
|
||||
|
@@ -40,15 +40,15 @@ function test_JSMin()
|
||||
test_JSMin_exception('"Hello'
|
||||
,'Unterminated String'
|
||||
,'JSMin_UnterminatedStringException'
|
||||
,"Unterminated String: '\"Hello'");
|
||||
,"Unterminated String: \"Hello");
|
||||
test_JSMin_exception("return /regexp\n}"
|
||||
,'Unterminated RegExp'
|
||||
,'JSMin_UnterminatedRegExpException'
|
||||
,"Unterminated RegExp: '/regexp\n'");
|
||||
,"Unterminated RegExp: /regexp\n");
|
||||
test_JSMin_exception("/* Comment "
|
||||
,'Unterminated Comment'
|
||||
,'JSMin_UnterminatedCommentException'
|
||||
,"Unterminated Comment: '/* Comment '");
|
||||
,"Unterminated Comment: /* Comment ");
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -53,7 +53,7 @@ function test_Minify()
|
||||
,'Minify : cache, and minifier classes aren\'t loaded for 304s'
|
||||
);
|
||||
|
||||
// Test minifying JS and serving with Expires header
|
||||
// Test JS and Expires
|
||||
|
||||
$content = preg_replace('/\\r\\n?/', "\n", file_get_contents($minifyTestPath . '/minified.js'));
|
||||
$lastModified = max(
|
||||
@@ -96,7 +96,7 @@ function test_Minify()
|
||||
// test for Issue 73
|
||||
Minify::setCache(null);
|
||||
|
||||
$expected = ";function h(){}";
|
||||
$expected = "\n;function h(){}";
|
||||
$output = Minify::serve('Files', array(
|
||||
'files' => array(
|
||||
$minifyTestPath . '/issue73_1.js'
|
||||
|
@@ -79,7 +79,8 @@ function test_environment()
|
||||
break;
|
||||
}
|
||||
}
|
||||
if ($passed && stream_get_contents($fp) !== 'World!') {
|
||||
$streamContents = stream_get_contents($fp);
|
||||
if ($passed && $streamContents !== 'World!') {
|
||||
$passed = false;
|
||||
}
|
||||
assertTrue(
|
||||
|
Reference in New Issue
Block a user