diff --git a/min/builder/index.php b/min/builder/index.php index 35e10a9..b033933 100644 --- a/min/builder/index.php +++ b/min/builder/index.php @@ -22,11 +22,9 @@ if (0 === strpos($_SERVER["SERVER_SOFTWARE"], 'Apache/') } } +require dirname(__FILE__) . '/../lib/Minify/Loader.php'; require dirname(__FILE__) . '/../config.php'; -require "$min_libPath/Minify/Loader.php"; -Minify_Loader::register(); - if (! $min_enableBuilder) { header('Content-Type: text/plain'); die('This application is not enabled. See http://code.google.com/p/minify/wiki/BuilderApp'); diff --git a/min/builder/ocCheck.php b/min/builder/ocCheck.php index 5c40e74..2aa5abf 100644 --- a/min/builder/ocCheck.php +++ b/min/builder/ocCheck.php @@ -5,6 +5,8 @@ * @package Minify */ +require dirname(__FILE__) . '/../lib/Minify/Loader.php'; + $_oc = ini_get('zlib.output_compression'); // allow access only if builder is enabled @@ -20,7 +22,6 @@ if (isset($_GET['hello'])) { // try to prevent double encoding (may not have an effect) ini_set('zlib.output_compression', '0'); - require $min_libPath . '/HTTP/Encoder.php'; HTTP_Encoder::$encodeToIe6 = true; // just in case $he = new HTTP_Encoder(array( 'content' => 'World!' diff --git a/min/config.php b/min/config.php index ee757e1..b198b0f 100644 --- a/min/config.php +++ b/min/config.php @@ -57,7 +57,6 @@ $min_allowDebugFlag = false; * To use APC/Memcache/ZendPlatform for cache storage, require the class and * set $min_cachePath to an instance. Example below: */ -//require dirname(__FILE__) . '/lib/Minify/Cache/APC.php'; //$min_cachePath = new Minify_Cache_APC(); @@ -72,6 +71,7 @@ $min_allowDebugFlag = false; * second line. The third line might work on some Apache servers. */ $min_documentRoot = ''; +//$min_documentRoot = dirname(dirname(dirname(__FILE__))); //$min_documentRoot = substr(__FILE__, 0, -15); //$min_documentRoot = $_SERVER['SUBDOMAIN_DOCUMENT_ROOT']; diff --git a/min/index.php b/min/index.php index f23d508..7f78a7c 100644 --- a/min/index.php +++ b/min/index.php @@ -9,6 +9,8 @@ define('MINIFY_MIN_DIR', dirname(__FILE__)); +require MINIFY_MIN_DIR . '/lib/Minify/Loader.php'; + // set config path defaults $min_configPaths = array( 'base' => MINIFY_MIN_DIR . '/config.php', @@ -28,9 +30,6 @@ if (isset($_GET['test'])) { include $min_configPaths['test']; } -require "$min_libPath/Minify/Loader.php"; -Minify_Loader::register(); - // use an environment object to encapsulate all input $server = $_SERVER; if ($min_documentRoot) { diff --git a/min/lib/Minify/Loader.php b/min/lib/Minify/Loader.php index 0a225c0..591528f 100644 --- a/min/lib/Minify/Loader.php +++ b/min/lib/Minify/Loader.php @@ -17,12 +17,26 @@ class Minify_Loader { $file .= strtr($class, "\\_", DIRECTORY_SEPARATOR . DIRECTORY_SEPARATOR) . '.php'; if (is_readable($file)) { require $file; + return; } + + $map = array( + 'JavascriptPacker' => 'class.JavaScriptPacker.php', + ); + + if (!isset($map[$class])) { + return; + } + + @include $map[$class]; } - static public function register() + public static function register() { $inst = new self(); spl_autoload_register(array($inst, 'loadClass')); + return $inst; } } + +return Minify_Loader::register(); diff --git a/min/lib/Minify/Packer.php b/min/lib/Minify/Packer.php index 949c3ee..1826990 100644 --- a/min/lib/Minify/Packer.php +++ b/min/lib/Minify/Packer.php @@ -14,14 +14,6 @@ * @package Minify */ -if (false === (@include 'class.JavaScriptPacker.php')) { - trigger_error( - 'The script "class.JavaScriptPacker.php" is required. Please see: http:' - .'//code.google.com/p/minify/source/browse/trunk/min/lib/Minify/Packer.php' - ,E_USER_ERROR - ); -} - /** * Minify Javascript using Dean Edward's Packer * diff --git a/min/utils.php b/min/utils.php index 7cf930a..286568f 100644 --- a/min/utils.php +++ b/min/utils.php @@ -10,9 +10,8 @@ * @package Minify */ -if (! class_exists('Minify_Loader', false)) { +if (!class_exists('Minify_Loader', false)) { require dirname(__FILE__) . '/lib/Minify/Loader.php'; - Minify_Loader::register(); } /* diff --git a/min_extras/cli/minify.php b/min_extras/cli/minify.php index e0c4b15..6482fdb 100755 --- a/min_extras/cli/minify.php +++ b/min_extras/cli/minify.php @@ -4,7 +4,6 @@ $pathToLib = dirname(dirname(__DIR__)) . '/min/lib'; require "$pathToLib/Minify/Loader.php"; -Minify_Loader::register(); $cli = new MrClay\Cli; diff --git a/min_extras/cli/rewrite-uris.php b/min_extras/cli/rewrite-uris.php index e0cbfa5..5f51340 100755 --- a/min_extras/cli/rewrite-uris.php +++ b/min_extras/cli/rewrite-uris.php @@ -4,7 +4,6 @@ $pathToLib = dirname(dirname(__DIR__)) . '/min/lib'; require "$min_libPath/Minify/Loader.php"; -Minify_Loader::register(); $cli = new MrClay\Cli; diff --git a/min_extras/config.php b/min_extras/config.php index b44bceb..3874313 100644 --- a/min_extras/config.php +++ b/min_extras/config.php @@ -4,9 +4,6 @@ require dirname(__FILE__) . '/../min/config.php'; -require "$min_libPath/Minify/Loader.php"; -Minify_Loader::register(); - $minifyCachePath = isset($min_cachePath) ? $min_cachePath : ''; diff --git a/min_extras/tools/minifyTextarea.php b/min_extras/tools/minifyTextarea.php index 8199fd6..274a61e 100644 --- a/min_extras/tools/minifyTextarea.php +++ b/min_extras/tools/minifyTextarea.php @@ -1,5 +1,7 @@
- \ No newline at end of file + diff --git a/min_unit_tests/HTTP_ConditionalGet/index.php b/min_unit_tests/HTTP_ConditionalGet/index.php index 0e4192e..d2dad82 100644 --- a/min_unit_tests/HTTP_ConditionalGet/index.php +++ b/min_unit_tests/HTTP_ConditionalGet/index.php @@ -1,7 +1,6 @@ $title ,'explain' => $explain ))); - + diff --git a/min_unit_tests/HTTP_Encoder/index.php b/min_unit_tests/HTTP_Encoder/index.php index c9a391d..663750c 100644 --- a/min_unit_tests/HTTP_Encoder/index.php +++ b/min_unit_tests/HTTP_Encoder/index.php @@ -1,8 +1,7 @@ encode(); $he->sendAll(); - -?> \ No newline at end of file diff --git a/min_unit_tests/_inc.php b/min_unit_tests/_inc.php index 197ed95..2e63304 100644 --- a/min_unit_tests/_inc.php +++ b/min_unit_tests/_inc.php @@ -1,10 +1,8 @@