1
0
mirror of https://github.com/mrclay/minify.git synced 2025-08-31 17:42:02 +02:00

minor fixes from home

This commit is contained in:
Steve Clay
2011-10-14 16:10:05 -04:00
parent f67da8e359
commit e71e75e5b0
3 changed files with 55 additions and 58 deletions

View File

@@ -53,7 +53,7 @@ if (! isset($min_cachePath) && ! function_exists('sys_get_temp_dir')) {
ob_start(); ob_start();
?> ?>
<!DOCTYPE HTML> <!DOCTYPE html>
<title>Minify URI Builder</title> <title>Minify URI Builder</title>
<meta name="ROBOTS" content="NOINDEX, NOFOLLOW"> <meta name="ROBOTS" content="NOINDEX, NOFOLLOW">
<style> <style>
@@ -176,52 +176,51 @@ by Minify. E.g. <code>@import "<span class=minRoot>/min/?</span>g=css2";</code><
list</a>.</p> list</a>.</p>
<p><small>Powered by Minify <?php echo Minify::VERSION; ?></small></p> <p><small>Powered by Minify <?php echo Minify::VERSION; ?></small></p>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.2.6/jquery.min.js"></script> <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> <script>
$(function () { (function () {
// give Minify a few seconds to serve _index.js before showing scary red warning // workaround required to test when /min isn't child of web root
setTimeout(function () { var src = "../?f=" + location.pathname.replace(/\/[^\/]*$/, '/_index.js').substr(1);
if (! window.MUB) { // load script immediately
// Minify didn't load document.write('<\script src="' + src + '"><\/script>');
$('#jsDidntLoad').css({display:'block'}); $(function () {
} $('#builderScriptSrc')[0].href = src;
}, 3000); // give Minify a few seconds to serve _index.js before showing scary red warning
setTimeout(function () {
if (! window.MUB) {
// Minify didn't load
$('#jsDidntLoad').css({display:'block'});
}
}, 3000);
// detection of double output encoding // detection of double output encoding
var msg = '<\p class=topWarning><\strong>Warning:<\/strong> '; var msg = '<\p class=topWarning><\strong>Warning:<\/strong> ';
var url = 'ocCheck.php?' + (new Date()).getTime(); var url = 'ocCheck.php?' + (new Date()).getTime();
$.get(url, function (ocStatus) { $.get(url, function (ocStatus) {
$.get(url + '&hello=1', function (ocHello) { $.get(url + '&hello=1', function (ocHello) {
if (ocHello != 'World!') { if (ocHello != 'World!') {
msg += 'It appears output is being automatically compressed, interfering ' msg += 'It appears output is being automatically compressed, interfering '
+ ' with Minify\'s own compression. '; + ' with Minify\'s own compression. ';
if (ocStatus == '1') if (ocStatus == '1')
msg += 'The option "zlib.output_compression" is enabled in your PHP configuration. ' msg += 'The option "zlib.output_compression" is enabled in your PHP configuration. '
+ 'Minify set this to "0", but it had no effect. This option must be disabled ' + 'Minify set this to "0", but it had no effect. This option must be disabled '
+ 'in php.ini or .htaccess.'; + 'in php.ini or .htaccess.';
else else
msg += 'The option "zlib.output_compression" is disabled in your PHP configuration ' msg += 'The option "zlib.output_compression" is disabled in your PHP configuration '
+ 'so this behavior is likely due to a server option.'; + 'so this behavior is likely due to a server option.';
$(document.body).prepend(msg + '<\/p>'); $(document.body).prepend(msg + '<\/p>');
} else } else
if (ocStatus == '1') if (ocStatus == '1')
$(document.body).prepend('<\p class=topNote><\strong>Note:</\strong> The option ' $(document.body).prepend('<\p class=topNote><\strong>Note:</\strong> The option '
+ '"zlib.output_compression" is enabled in your PHP configuration, but has been ' + '"zlib.output_compression" is enabled in your PHP configuration, but has been '
+ 'successfully disabled via ini_set(). If you experience mangled output you ' + 'successfully disabled via ini_set(). If you experience mangled output you '
+ 'may want to consider disabling this option in your PHP configuration.<\/p>' + 'may want to consider disabling this option in your PHP configuration.<\/p>'
); );
});
}); });
}); });
}); })();
</script>
<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> </script>
</body> </body>
<?php <?php

4
min/builder/jquery-1.6.3.min.js vendored Normal file

File diff suppressed because one or more lines are too long

View File

@@ -388,30 +388,24 @@ class Minify {
} }
/** /**
* On IIS, create $_SERVER['DOCUMENT_ROOT'] * Set $_SERVER['DOCUMENT_ROOT']. On IIS, the value is created from SCRIPT_FILENAME and SCRIPT_NAME.
* *
* @param bool $unsetPathInfo (default false) if true, $_SERVER['PATH_INFO'] * @param string $docRoot value to use for DOCUMENT_ROOT
* will be unset (it is inconsistent with Apache's setting)
*
* @return null
*/ */
public static function setDocRoot($unsetPathInfo = false) public static function setDocRoot($docRoot = '')
{ {
if (isset($_SERVER['SERVER_SOFTWARE']) self::$isDocRootSet = true;
&& 0 === strpos($_SERVER['SERVER_SOFTWARE'], 'Microsoft-IIS/') if ($docRoot) {
$_SERVER['DOCUMENT_ROOT'] = $docRoot;
} elseif (isset($_SERVER['SERVER_SOFTWARE'])
&& 0 === strpos($_SERVER['SERVER_SOFTWARE'], 'Microsoft-IIS/')
) { ) {
$_SERVER['DOCUMENT_ROOT'] = rtrim(substr( $_SERVER['DOCUMENT_ROOT'] = rtrim(substr(
$_SERVER['SCRIPT_FILENAME'] $_SERVER['SCRIPT_FILENAME']
,0 ,0
,strlen($_SERVER['SCRIPT_FILENAME']) - strlen($_SERVER['SCRIPT_NAME']) ,strlen($_SERVER['SCRIPT_FILENAME']) - strlen($_SERVER['SCRIPT_NAME'])
), '\\'); ), '\\');
if ($unsetPathInfo) {
unset($_SERVER['PATH_INFO']);
}
require_once 'Minify/Logger.php';
Minify_Logger::log("setDocRoot() set DOCUMENT_ROOT to \"{$_SERVER['DOCUMENT_ROOT']}\"");
} }
self::$isDocRootSet = true;
} }
/** /**
@@ -511,7 +505,7 @@ class Minify {
: $defaultOptions; : $defaultOptions;
} }
// do we need to process our group right now? // do we need to process our group right now?
if ($i > 0 // no, the first group doesn't exist yet if ($i > 0 // yes, we have at least the first group populated
&& ( && (
! $source // yes, we ran out of sources ! $source // yes, we ran out of sources
|| $type === self::TYPE_CSS // yes, to process CSS individually (avoiding PCRE bugs/limits) || $type === self::TYPE_CSS // yes, to process CSS individually (avoiding PCRE bugs/limits)