mirror of
https://github.com/mrclay/minify.git
synced 2025-08-17 19:37:22 +02:00
no need for user to call setDocRoot()
This commit is contained in:
@@ -228,9 +228,6 @@ $(function () {
|
|||||||
$content = ob_get_clean();
|
$content = ob_get_clean();
|
||||||
|
|
||||||
// setup Minify
|
// setup Minify
|
||||||
if (0 === stripos(PHP_OS, 'win')) {
|
|
||||||
Minify::setDocRoot(); // we may be on IIS
|
|
||||||
}
|
|
||||||
Minify::setCache(
|
Minify::setCache(
|
||||||
isset($min_cachePath) ? $min_cachePath : ''
|
isset($min_cachePath) ? $min_cachePath : ''
|
||||||
,$min_cacheFileLocking
|
,$min_cacheFileLocking
|
||||||
|
@@ -25,8 +25,7 @@ Minify::setCache(
|
|||||||
|
|
||||||
if ($min_documentRoot) {
|
if ($min_documentRoot) {
|
||||||
$_SERVER['DOCUMENT_ROOT'] = $min_documentRoot;
|
$_SERVER['DOCUMENT_ROOT'] = $min_documentRoot;
|
||||||
} elseif (0 === stripos(PHP_OS, 'win')) {
|
Minify::$isDocRootSet = true;
|
||||||
Minify::setDocRoot(); // IIS may need help
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$min_serveOptions['minifierOptions']['text/css']['symlinks'] = $min_symlinks;
|
$min_serveOptions['minifierOptions']['text/css']['symlinks'] = $min_symlinks;
|
||||||
|
@@ -60,6 +60,13 @@ class Minify {
|
|||||||
*/
|
*/
|
||||||
public static $importWarning = "/* See http://code.google.com/p/minify/wiki/CommonProblems#@imports_can_appear_in_invalid_locations_in_combined_CSS_files */\n";
|
public static $importWarning = "/* See http://code.google.com/p/minify/wiki/CommonProblems#@imports_can_appear_in_invalid_locations_in_combined_CSS_files */\n";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Has the DOCUMENT_ROOT been set in user code?
|
||||||
|
*
|
||||||
|
* @var bool
|
||||||
|
*/
|
||||||
|
public static $isDocRootSet = false;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Specify a cache object (with identical interface as Minify_Cache_File) or
|
* Specify a cache object (with identical interface as Minify_Cache_File) or
|
||||||
* a path to use with Minify_Cache_File.
|
* a path to use with Minify_Cache_File.
|
||||||
@@ -160,6 +167,10 @@ class Minify {
|
|||||||
*/
|
*/
|
||||||
public static function serve($controller, $options = array())
|
public static function serve($controller, $options = array())
|
||||||
{
|
{
|
||||||
|
if (! self::$isDocRootSet && 0 === stripos(PHP_OS, 'win')) {
|
||||||
|
self::setDocRoot();
|
||||||
|
}
|
||||||
|
|
||||||
if (is_string($controller)) {
|
if (is_string($controller)) {
|
||||||
// make $controller into object
|
// make $controller into object
|
||||||
$class = 'Minify_Controller_' . $controller;
|
$class = 'Minify_Controller_' . $controller;
|
||||||
@@ -400,6 +411,7 @@ class Minify {
|
|||||||
require_once 'Minify/Logger.php';
|
require_once 'Minify/Logger.php';
|
||||||
Minify_Logger::log("setDocRoot() set DOCUMENT_ROOT to \"{$_SERVER['DOCUMENT_ROOT']}\"");
|
Minify_Logger::log("setDocRoot() set DOCUMENT_ROOT to \"{$_SERVER['DOCUMENT_ROOT']}\"");
|
||||||
}
|
}
|
||||||
|
self::$isDocRootSet = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Reference in New Issue
Block a user