diff --git a/.gitignore b/.gitignore index f4558c7..427148e 100644 --- a/.gitignore +++ b/.gitignore @@ -1,7 +1,6 @@ - -# / -/test -/docs -.idea/ +/test +/docs +/.idea/ .DS_Store -vendor +/vendor/ +!/vendor/bootstrap.php diff --git a/composer.json b/composer.json index 3bfb17d..7df82f2 100644 --- a/composer.json +++ b/composer.json @@ -24,11 +24,13 @@ "ext-pcre": "*" }, "require-dev": { + "firephp/firephp-core": "~0.4.0", "leafo/lessphp": "~0.4.0", "meenie/javascript-packer": "~1.1", "tubalmartin/cssmin": "~2.4.8" }, "suggest": { + "firephp/firephp-core": "FirePHP debug output", "leafo/lessphp": "LESS support", "meenie/javascript-packer": "Keep track of the Packer PHP port using Composer", "tubalmartin/cssmin": "Support minify with CSSMin (YUI PHP port)" diff --git a/min/builder/index.php b/min/builder/index.php index 35e10a9..de19dd4 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__) . '/../../vendor/bootstrap.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..4af8525 100644 --- a/min/builder/ocCheck.php +++ b/min/builder/ocCheck.php @@ -5,6 +5,8 @@ * @package Minify */ +require dirname(__FILE__) . '/../../vendor/bootstrap.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..4d9f355 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']; @@ -180,12 +180,5 @@ $min_symlinks = array(); $min_uploaderHoursBehind = 0; -/** - * Path to Minify's lib folder. If you happen to move it, change - * this accordingly. - */ -$min_libPath = dirname(__FILE__) . '/lib'; - - // try to disable output_compression (may not have an effect) ini_set('zlib.output_compression', '0'); diff --git a/min/index.php b/min/index.php index f23d508..e8c36e7 100644 --- a/min/index.php +++ b/min/index.php @@ -7,6 +7,8 @@ * @package Minify */ +require dirname(__FILE__). '/../vendor/bootstrap.php'; + define('MINIFY_MIN_DIR', dirname(__FILE__)); // set config path defaults @@ -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..80c89b1 100644 --- a/min/utils.php +++ b/min/utils.php @@ -10,10 +10,7 @@ * @package Minify */ -if (! class_exists('Minify_Loader', false)) { - require dirname(__FILE__) . '/lib/Minify/Loader.php'; - Minify_Loader::register(); -} +require dirname(__FILE__) . '/../vendor/bootstrap.php'; /* * Get an HTML-escaped Minify URI for a group or set of files. By default, URIs diff --git a/min_extras/cli/minify.php b/min_extras/cli/minify.php index e0c4b15..e3df308 100755 --- a/min_extras/cli/minify.php +++ b/min_extras/cli/minify.php @@ -1,10 +1,7 @@ #!/usr/bin/env php
- \ No newline at end of file + diff --git a/min_unit_tests/HTTP_ConditionalGet/2.php b/min_unit_tests/HTTP_ConditionalGet/2.php index 9b66f24..06eedf5 100644 --- a/min_unit_tests/HTTP_ConditionalGet/2.php +++ b/min_unit_tests/HTTP_ConditionalGet/2.php @@ -1,7 +1,6 @@ setContentLength(strlen($content)); $cg->sendHeaders(); send_slowly($content); - + diff --git a/min_unit_tests/HTTP_ConditionalGet/4.php b/min_unit_tests/HTTP_ConditionalGet/4.php index 4b77d20..537649a 100644 --- a/min_unit_tests/HTTP_ConditionalGet/4.php +++ b/min_unit_tests/HTTP_ConditionalGet/4.php @@ -1,13 +1,11 @@ $title ,'explain' => $explain ))); - + diff --git a/min_unit_tests/HTTP_Encoder/index.php b/min_unit_tests/HTTP_Encoder/index.php index c9a391d..31d2507 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..24af676 100644 --- a/min_unit_tests/_inc.php +++ b/min_unit_tests/_inc.php @@ -1,10 +1,8 @@