2008-08-29 22:56:34 +00:00
|
|
|
<?php
|
|
|
|
|
2014-10-15 23:51:13 +03:00
|
|
|
require dirname(__FILE__) . '/../vendor/bootstrap.php';
|
2008-09-11 20:37:16 +00:00
|
|
|
require dirname(__FILE__) . '/../min/config.php';
|
|
|
|
|
2009-01-27 15:15:43 +00:00
|
|
|
// set cache path and doc root if configured
|
2008-09-11 20:37:16 +00:00
|
|
|
$minifyCachePath = isset($min_cachePath)
|
|
|
|
? $min_cachePath
|
|
|
|
: '';
|
2009-01-27 15:15:43 +00:00
|
|
|
if ($min_documentRoot) {
|
|
|
|
$_SERVER['DOCUMENT_ROOT'] = $min_documentRoot;
|
|
|
|
}
|
2008-08-29 22:56:34 +00:00
|
|
|
|
2009-01-28 20:02:25 +00:00
|
|
|
// default log to FirePHP
|
|
|
|
if ($min_errorLogger && true !== $min_errorLogger) { // custom logger
|
|
|
|
Minify_Logger::setLogger($min_errorLogger);
|
|
|
|
} else {
|
|
|
|
Minify_Logger::setLogger(FirePHP::getInstance(true));
|
|
|
|
}
|
|
|
|
|
2008-08-29 22:56:34 +00:00
|
|
|
error_reporting(E_ALL | E_STRICT);
|
|
|
|
ini_set('display_errors', 1);
|
2008-09-11 20:37:16 +00:00
|
|
|
|
2010-05-16 01:27:33 +00:00
|
|
|
header('Content-Type: text/plain;charset=utf-8');
|
2008-08-29 22:56:34 +00:00
|
|
|
|
|
|
|
$thisDir = dirname(__FILE__);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* pTest - PHP Unit Tester
|
|
|
|
* @param mixed $test Condition to test, evaluated as boolean
|
|
|
|
* @param string $message Descriptive message to output upon test
|
|
|
|
* @url http://www.sitepoint.com/blogs/2007/08/13/ptest-php-unit-tester-in-9-lines-of-code/
|
|
|
|
*/
|
|
|
|
function assertTrue($test, $message)
|
|
|
|
{
|
|
|
|
static $count;
|
|
|
|
if (!isset($count)) $count = array('pass'=>0, 'fail'=>0, 'total'=>0);
|
|
|
|
|
|
|
|
$mode = $test ? 'pass' : 'fail';
|
|
|
|
$outMode = $test ? 'PASS' : '!FAIL';
|
|
|
|
printf("%s: %s (%d of %d tests run so far have %sed)\n",
|
|
|
|
$outMode, $message, ++$count[$mode], ++$count['total'], $mode);
|
|
|
|
|
|
|
|
return (bool)$test;
|
|
|
|
}
|
2009-01-28 20:02:25 +00:00
|
|
|
|
2010-05-16 01:27:33 +00:00
|
|
|
/**
|
|
|
|
* Get number of bytes in a string regardless of mbstring.func_overload
|
|
|
|
*
|
|
|
|
* @param string $str
|
|
|
|
* @return int
|
|
|
|
*/
|
|
|
|
function countBytes($str)
|
|
|
|
{
|
|
|
|
return (function_exists('mb_strlen') && ((int)ini_get('mbstring.func_overload') & 2))
|
|
|
|
? mb_strlen($str, '8bit')
|
|
|
|
: strlen($str);
|
|
|
|
}
|
|
|
|
|
2014-10-12 16:27:43 +03:00
|
|
|
ob_start();
|