mirror of
https://github.com/mrclay/minify.git
synced 2025-08-10 16:14:18 +02:00
do some trivial codestyle fixes
unix newlines, trailing spaces
This commit is contained in:
@@ -38,7 +38,7 @@ class DooDigestAuth{
|
||||
* @param string $fail_url URL to be redirect if the User cancel the login
|
||||
* @return string The username if login success.
|
||||
*/
|
||||
public static function http_auth($realm, $users, $fail_msg=NULL, $fail_url=NULL){
|
||||
public static function http_auth($realm, $users, $fail_msg=NULL, $fail_url=NULL) {
|
||||
$realm = "Restricted area - $realm";
|
||||
|
||||
//user => password
|
||||
@@ -114,8 +114,8 @@ class DooDigestAuth{
|
||||
$data['uri'] = $match[1];
|
||||
$res = preg_match('/response=\"([^\"]+)\"/i', $txt, $match);
|
||||
$data['response'] = $match[1];
|
||||
|
||||
return $data;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
@@ -246,7 +246,6 @@ class HTTP_ConditionalGet {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get a GMT formatted date for use in HTTP headers
|
||||
*
|
||||
@@ -305,6 +304,7 @@ class HTTP_ConditionalGet {
|
||||
if ($isValid) {
|
||||
$this->_headers['_responseCode'] = 'HTTP/1.0 304 Not Modified';
|
||||
}
|
||||
|
||||
return $isValid;
|
||||
}
|
||||
|
||||
@@ -327,9 +327,11 @@ class HTTP_ConditionalGet {
|
||||
// respond with the client's matched ETag, even if it's not what
|
||||
// we would've sent by default
|
||||
$this->_headers['ETag'] = trim($clientEtag);
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -340,6 +342,7 @@ class HTTP_ConditionalGet {
|
||||
*/
|
||||
protected function normalizeEtag($etag) {
|
||||
$etag = trim($etag);
|
||||
|
||||
return $this->_stripEtag
|
||||
? preg_replace('/;\\w\\w"$/', '"', $etag)
|
||||
: $etag;
|
||||
@@ -359,8 +362,10 @@ class HTTP_ConditionalGet {
|
||||
// Apache 2.2's behavior. If there was no ETag match, send the
|
||||
// non-encoded version of the ETag value.
|
||||
$this->_headers['ETag'] = $this->normalizeEtag($this->_etag);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
@@ -61,7 +61,6 @@ class HTTP_Encoder {
|
||||
*/
|
||||
public static $encodeToIe6 = true;
|
||||
|
||||
|
||||
/**
|
||||
* Default compression level for zlib operations
|
||||
*
|
||||
@@ -71,7 +70,6 @@ class HTTP_Encoder {
|
||||
*/
|
||||
public static $compressionLevel = 6;
|
||||
|
||||
|
||||
/**
|
||||
* Get an HTTP Encoder object
|
||||
*
|
||||
@@ -230,6 +228,7 @@ class HTTP_Encoder {
|
||||
,$m)) {
|
||||
return array('compress', $m[1]);
|
||||
}
|
||||
|
||||
return array('', '');
|
||||
}
|
||||
|
||||
@@ -279,6 +278,7 @@ class HTTP_Encoder {
|
||||
: (string)strlen($encoded);
|
||||
$this->_headers['Content-Encoding'] = $this->_encodeMethod[1];
|
||||
$this->_content = $encoded;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -302,6 +302,7 @@ class HTTP_Encoder {
|
||||
$he = new HTTP_Encoder(array('content' => $content));
|
||||
$ret = $he->encode($compressionLevel);
|
||||
$he->sendAll();
|
||||
|
||||
return $ret;
|
||||
}
|
||||
|
||||
@@ -323,6 +324,7 @@ class HTTP_Encoder {
|
||||
}
|
||||
// no regex = faaast
|
||||
$version = (float)substr($ua, 30);
|
||||
|
||||
return self::$encodeToIe6
|
||||
? ($version < 6 || ($version == 6 && false === strpos($ua, 'SV1')))
|
||||
: ($version < 7);
|
||||
|
@@ -216,6 +216,7 @@ class Minify {
|
||||
$this->errorExit($this->options['badRequestHeader'], self::URL_DEBUG);
|
||||
} else {
|
||||
list(,$statusCode) = explode(' ', $this->options['badRequestHeader']);
|
||||
|
||||
return array(
|
||||
'success' => false,
|
||||
'statusCode' => (int)$statusCode,
|
||||
@@ -268,6 +269,7 @@ class Minify {
|
||||
// client's cache is valid
|
||||
if (! $this->options['quiet']) {
|
||||
$cg->sendHeaders();
|
||||
|
||||
return;
|
||||
} else {
|
||||
return array(
|
||||
@@ -422,6 +424,7 @@ class Minify {
|
||||
$out = $this->serve($controller, $options);
|
||||
|
||||
$this->cache = $tmpCache;
|
||||
|
||||
return $out['content'];
|
||||
}
|
||||
|
||||
@@ -585,6 +588,7 @@ class Minify {
|
||||
if ($this->options['postprocessor']) {
|
||||
$content = call_user_func($this->options['postprocessor'], $content, $type);
|
||||
}
|
||||
|
||||
return $content;
|
||||
}
|
||||
|
||||
@@ -610,6 +614,7 @@ class Minify {
|
||||
$this->options['bubbleCssImports'],
|
||||
Minify::VERSION,
|
||||
)));
|
||||
|
||||
return "{$prefix}_{$name}_{$md5}";
|
||||
}
|
||||
|
||||
@@ -626,6 +631,7 @@ class Minify {
|
||||
// bubble CSS imports
|
||||
preg_match_all('/@import.*?;/', $css, $imports);
|
||||
$css = implode('', $imports[0]) . preg_replace('/@import.*?;/', '', $css);
|
||||
|
||||
return $css;
|
||||
}
|
||||
|
||||
@@ -644,6 +650,7 @@ class Minify {
|
||||
// { appears before @import : prepend warning
|
||||
$css = $this->options['importWarning'] . $css;
|
||||
}
|
||||
|
||||
return $css;
|
||||
}
|
||||
|
||||
@@ -672,6 +679,7 @@ class Minify {
|
||||
Minify_Logger::log('ContentType mismatch');
|
||||
|
||||
$this->sources = array();
|
||||
|
||||
return $options;
|
||||
}
|
||||
|
||||
@@ -686,6 +694,7 @@ class Minify {
|
||||
Minify_Logger::log('ContentType mismatch');
|
||||
|
||||
$this->sources = array();
|
||||
|
||||
return $options;
|
||||
}
|
||||
}
|
||||
|
@@ -71,6 +71,7 @@ class Minify_Build {
|
||||
$sep = ($forceAmpersand || strpos($uri, '?') !== false)
|
||||
? self::$ampersand
|
||||
: '?';
|
||||
|
||||
return "{$uri}{$sep}{$this->lastModified}";
|
||||
}
|
||||
|
||||
|
@@ -40,6 +40,7 @@ class Minify_CSS_Compressor {
|
||||
public static function process($css, $options = array())
|
||||
{
|
||||
$obj = new Minify_CSS_Compressor($options);
|
||||
|
||||
return $obj->_process($css);
|
||||
}
|
||||
|
||||
@@ -55,7 +56,6 @@ class Minify_CSS_Compressor {
|
||||
*/
|
||||
protected $_inHack = false;
|
||||
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
@@ -208,22 +208,26 @@ class Minify_CSS_Compressor {
|
||||
@x', $m, $n)) {
|
||||
// end hack mode after this comment, but preserve the hack and comment content
|
||||
$this->_inHack = false;
|
||||
|
||||
return "/*/{$n[1]}/**/";
|
||||
}
|
||||
}
|
||||
if (substr($m, -1) === '\\') { // comment ends like \*/
|
||||
// begin hack mode and preserve hack
|
||||
$this->_inHack = true;
|
||||
|
||||
return '/*\\*/';
|
||||
}
|
||||
if ($m !== '' && $m[0] === '/') { // comment looks like /*/ foo */
|
||||
// begin hack mode and preserve hack
|
||||
$this->_inHack = true;
|
||||
|
||||
return '/*/*/';
|
||||
}
|
||||
if ($this->_inHack) {
|
||||
// a regular comment ends hack mode but should be preserved
|
||||
$this->_inHack = false;
|
||||
|
||||
return '/**/';
|
||||
}
|
||||
// Issue 107: if there's any surrounding whitespace, it may be important, so
|
||||
@@ -252,6 +256,7 @@ class Minify_CSS_Compressor {
|
||||
}
|
||||
$out .= $piece;
|
||||
}
|
||||
|
||||
return $out . $m[2];
|
||||
}
|
||||
}
|
||||
|
@@ -98,6 +98,7 @@ class Minify_CSS_UriRewriter {
|
||||
,array(self::$className, '_processUriCB'), $css);
|
||||
|
||||
self::$_prependPath = null;
|
||||
|
||||
return $css;
|
||||
}
|
||||
|
||||
@@ -187,6 +188,7 @@ class Minify_CSS_UriRewriter {
|
||||
do {
|
||||
$uri = preg_replace('@/[^/]+/\\.\\./@', '/', $uri, 1, $changed);
|
||||
} while ($changed);
|
||||
|
||||
return $uri;
|
||||
}
|
||||
|
||||
@@ -212,6 +214,7 @@ class Minify_CSS_UriRewriter {
|
||||
if ($realPath !== false) {
|
||||
$path = $realPath;
|
||||
}
|
||||
|
||||
return rtrim($path, '/\\');
|
||||
}
|
||||
|
||||
@@ -300,6 +303,7 @@ class Minify_CSS_UriRewriter {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return $isImport
|
||||
? "@import {$quoteChar}{$uri}{$quoteChar}"
|
||||
: "url({$quoteChar}{$uri}{$quoteChar})";
|
||||
|
@@ -57,6 +57,7 @@ class Minify_Cache_APC implements Minify_CacheInterface {
|
||||
if (! $this->_fetch($id)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return (function_exists('mb_strlen') && ((int)ini_get('mbstring.func_overload') & 2))
|
||||
? mb_strlen($this->_data, '8bit')
|
||||
: strlen($this->_data);
|
||||
@@ -124,10 +125,12 @@ class Minify_Cache_APC implements Minify_CacheInterface {
|
||||
$ret = apc_fetch($id);
|
||||
if (false === $ret) {
|
||||
$this->_id = null;
|
||||
|
||||
return false;
|
||||
}
|
||||
list($this->_lm, $this->_data) = explode('|', $ret, 2);
|
||||
$this->_id = $id;
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
@@ -37,8 +37,10 @@ class Minify_Cache_File implements Minify_CacheInterface {
|
||||
if ($data !== $this->fetch($id)) {
|
||||
@unlink($file);
|
||||
$this->_log("Minify_Cache_File: Post-write read failed for '$file'");
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -66,6 +68,7 @@ class Minify_Cache_File implements Minify_CacheInterface {
|
||||
public function isValid($id, $srcMtime)
|
||||
{
|
||||
$file = $this->_path . '/' . $id;
|
||||
|
||||
return (is_file($file) && (filemtime($file) >= $srcMtime));
|
||||
}
|
||||
|
||||
@@ -105,6 +108,7 @@ class Minify_Cache_File implements Minify_CacheInterface {
|
||||
$ret = stream_get_contents($fp);
|
||||
flock($fp, LOCK_UN);
|
||||
fclose($fp);
|
||||
|
||||
return $ret;
|
||||
} else {
|
||||
return file_get_contents($this->_path . '/' . $id);
|
||||
@@ -140,6 +144,7 @@ class Minify_Cache_File implements Minify_CacheInterface {
|
||||
: self::_tmp();
|
||||
$tmp = rtrim($tmp, DIRECTORY_SEPARATOR);
|
||||
}
|
||||
|
||||
return $tmp;
|
||||
}
|
||||
|
||||
|
@@ -60,6 +60,7 @@ class Minify_Cache_Memcache implements Minify_CacheInterface {
|
||||
if (! $this->_fetch($id)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return (function_exists('mb_strlen') && ((int)ini_get('mbstring.func_overload') & 2))
|
||||
? mb_strlen($this->_data, '8bit')
|
||||
: strlen($this->_data);
|
||||
@@ -128,10 +129,12 @@ class Minify_Cache_Memcache implements Minify_CacheInterface {
|
||||
$ret = $this->_mc->get($id);
|
||||
if (false === $ret) {
|
||||
$this->_id = null;
|
||||
|
||||
return false;
|
||||
}
|
||||
list($this->_lm, $this->_data) = explode('|', $ret, 2);
|
||||
$this->_id = $id;
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
@@ -59,6 +59,7 @@ class Minify_Cache_WinCache implements Minify_CacheInterface
|
||||
if (!$this->_fetch($id)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return (function_exists('mb_strlen') && ((int) ini_get('mbstring.func_overload') & 2)) ? mb_strlen($this->_data, '8bit') : strlen($this->_data);
|
||||
}
|
||||
|
||||
@@ -121,10 +122,12 @@ class Minify_Cache_WinCache implements Minify_CacheInterface
|
||||
$ret = wincache_ucache_get($id, $suc);
|
||||
if (!$suc) {
|
||||
$this->_id = NULL;
|
||||
|
||||
return false;
|
||||
}
|
||||
list($this->_lm, $this->_data) = explode('|', $ret, 2);
|
||||
$this->_id = $id;
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
@@ -54,6 +54,7 @@ class Minify_Cache_XCache implements Minify_CacheInterface {
|
||||
if (! $this->_fetch($id)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return (function_exists('mb_strlen') && ((int)ini_get('mbstring.func_overload') & 2))
|
||||
? mb_strlen($this->_data, '8bit')
|
||||
: strlen($this->_data);
|
||||
@@ -117,10 +118,12 @@ class Minify_Cache_XCache implements Minify_CacheInterface {
|
||||
$ret = xcache_get($id);
|
||||
if (false === $ret) {
|
||||
$this->_id = null;
|
||||
|
||||
return false;
|
||||
}
|
||||
list($this->_lm, $this->_data) = explode('|', $ret, 2);
|
||||
$this->_id = $id;
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
@@ -4,7 +4,6 @@
|
||||
* @package Minify
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* ZendPlatform-based cache class for Minify
|
||||
*
|
||||
@@ -19,7 +18,6 @@
|
||||
*/
|
||||
class Minify_Cache_ZendPlatform implements Minify_CacheInterface {
|
||||
|
||||
|
||||
/**
|
||||
* Create a Minify_Cache_ZendPlatform object, to be passed to
|
||||
* Minify::setCache().
|
||||
@@ -33,7 +31,6 @@ class Minify_Cache_ZendPlatform implements Minify_CacheInterface {
|
||||
$this->_exp = $expire;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Write data to cache.
|
||||
*
|
||||
@@ -48,7 +45,6 @@ class Minify_Cache_ZendPlatform implements Minify_CacheInterface {
|
||||
return output_cache_put($id, "{$_SERVER['REQUEST_TIME']}|{$data}");
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get the size of a cache entry
|
||||
*
|
||||
@@ -75,6 +71,7 @@ class Minify_Cache_ZendPlatform implements Minify_CacheInterface {
|
||||
public function isValid($id, $srcMtime)
|
||||
{
|
||||
$ret = ($this->_fetch($id) && ($this->_lm >= $srcMtime));
|
||||
|
||||
return $ret;
|
||||
}
|
||||
|
||||
@@ -90,7 +87,6 @@ class Minify_Cache_ZendPlatform implements Minify_CacheInterface {
|
||||
: '';
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Fetch the cached content
|
||||
*
|
||||
@@ -127,10 +123,12 @@ class Minify_Cache_ZendPlatform implements Minify_CacheInterface {
|
||||
$ret = output_cache_get($id, $this->_exp);
|
||||
if (false === $ret) {
|
||||
$this->_id = null;
|
||||
|
||||
return false;
|
||||
}
|
||||
list($this->_lm, $this->_data) = explode('|', $ret, 2);
|
||||
$this->_id = $id;
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
@@ -4,7 +4,6 @@
|
||||
* @package Minify
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* Interface for Minify cache adapters
|
||||
*
|
||||
|
@@ -73,6 +73,7 @@ class Minify_ClosureCompiler
|
||||
public static function minify($js, $options = array())
|
||||
{
|
||||
$min = new static();
|
||||
|
||||
return $min->process($js, $options);
|
||||
}
|
||||
|
||||
@@ -123,6 +124,7 @@ class Minify_ClosureCompiler
|
||||
$this->getCompilerCommandLine(),
|
||||
$this->getOptionsCommandLine($userOptions)
|
||||
);
|
||||
|
||||
return join(' ', $args) . ' ' . escapeshellarg($tmpFile);
|
||||
}
|
||||
|
||||
@@ -137,6 +139,7 @@ class Minify_ClosureCompiler
|
||||
self::$javaExecutable,
|
||||
'-jar', escapeshellarg(self::$jarFile)
|
||||
);
|
||||
|
||||
return $server;
|
||||
}
|
||||
|
||||
@@ -215,6 +218,7 @@ class Minify_ClosureCompiler
|
||||
throw new Minify_ClosureCompiler_Exception('Could not create temp file in "' . $dir . '".');
|
||||
}
|
||||
file_put_contents($tmpFile, $content);
|
||||
|
||||
return $tmpFile;
|
||||
}
|
||||
|
||||
@@ -232,6 +236,7 @@ class Minify_ClosureCompiler
|
||||
if (!in_array($result_code, $expectedCodes)) {
|
||||
throw new Minify_ClosureCompiler_Exception("Unpexpected return code: $result_code");
|
||||
}
|
||||
|
||||
return $output;
|
||||
}
|
||||
}
|
||||
|
@@ -55,6 +55,7 @@ class Minify_CommentPreserver {
|
||||
$ret .= $comment;
|
||||
$content = $afterComment;
|
||||
}
|
||||
|
||||
return $ret;
|
||||
}
|
||||
|
||||
@@ -84,6 +85,7 @@ class Minify_CommentPreserver {
|
||||
$ret[] = (0 === $endChars)
|
||||
? ''
|
||||
: substr($in, -$endChars);
|
||||
|
||||
return $ret;
|
||||
}
|
||||
}
|
||||
|
@@ -72,9 +72,11 @@ class Minify_Controller_Files extends Minify_Controller_Base {
|
||||
));
|
||||
} catch (Minify_Source_FactoryException $e) {
|
||||
$this->log($e->getMessage());
|
||||
|
||||
return new Minify_ServeConfiguration($options);
|
||||
}
|
||||
}
|
||||
|
||||
return new Minify_ServeConfiguration($options, $sources);
|
||||
}
|
||||
}
|
||||
|
@@ -52,6 +52,7 @@ class Minify_Controller_Groups extends Minify_Controller_Files {
|
||||
if (false === $pathInfo || ! isset($groups[$pathInfo])) {
|
||||
// no PATH_INFO or not a valid group
|
||||
$this->log("Missing PATH_INFO or no group set for \"$pathInfo\"");
|
||||
|
||||
return new Minify_ServeConfiguration($options);
|
||||
}
|
||||
|
||||
|
@@ -59,11 +59,13 @@ class Minify_Controller_MinApp extends Minify_Controller_Base {
|
||||
$keys = explode(',', $get['g']);
|
||||
if ($keys != array_unique($keys)) {
|
||||
$this->log("Duplicate group key found.");
|
||||
|
||||
return new Minify_ServeConfiguration($options);
|
||||
}
|
||||
foreach ($keys as $key) {
|
||||
if (! isset($localOptions['groups'][$key])) {
|
||||
$this->log("A group configuration for \"{$key}\" was not found");
|
||||
|
||||
return new Minify_ServeConfiguration($options);
|
||||
}
|
||||
$files = $localOptions['groups'][$key];
|
||||
@@ -91,6 +93,7 @@ class Minify_Controller_MinApp extends Minify_Controller_Base {
|
||||
} else {
|
||||
$secondMissingResource = basename($file);
|
||||
$this->log("More than one file was missing: '$firstMissingResource', '$secondMissingResource'");
|
||||
|
||||
return new Minify_ServeConfiguration($options);
|
||||
}
|
||||
}
|
||||
@@ -110,12 +113,14 @@ class Minify_Controller_MinApp extends Minify_Controller_Base {
|
||||
|| strpos($get['f'], '\\') !== false
|
||||
) {
|
||||
$this->log("GET param 'f' was invalid");
|
||||
|
||||
return new Minify_ServeConfiguration($options);
|
||||
}
|
||||
$ext = ".{$m[1]}";
|
||||
$files = explode(',', $get['f']);
|
||||
if ($files != array_unique($files)) {
|
||||
$this->log("Duplicate files were specified");
|
||||
|
||||
return new Minify_ServeConfiguration($options);
|
||||
}
|
||||
if (isset($get['b'])) {
|
||||
@@ -127,6 +132,7 @@ class Minify_Controller_MinApp extends Minify_Controller_Base {
|
||||
$base = "/{$get['b']}/";
|
||||
} else {
|
||||
$this->log("GET param 'b' was invalid");
|
||||
|
||||
return new Minify_ServeConfiguration($options);
|
||||
}
|
||||
} else {
|
||||
@@ -160,6 +166,7 @@ class Minify_Controller_MinApp extends Minify_Controller_Base {
|
||||
} else {
|
||||
$secondMissingResource = $uri;
|
||||
$this->log("More than one file was missing: '$firstMissingResource', '$secondMissingResource`'");
|
||||
|
||||
return new Minify_ServeConfiguration($options);
|
||||
}
|
||||
}
|
||||
@@ -172,6 +179,7 @@ class Minify_Controller_MinApp extends Minify_Controller_Base {
|
||||
|
||||
if (!$sources) {
|
||||
$this->log("No sources to serve");
|
||||
|
||||
return new Minify_ServeConfiguration($options);
|
||||
}
|
||||
|
||||
|
@@ -22,6 +22,7 @@ class Minify_DebugDetector {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
@@ -41,6 +41,7 @@ class Minify_Env {
|
||||
if (null === $key) {
|
||||
return $this->server;
|
||||
}
|
||||
|
||||
return isset($this->server[$key])
|
||||
? $this->server[$key]
|
||||
: null;
|
||||
@@ -51,6 +52,7 @@ class Minify_Env {
|
||||
if (null === $key) {
|
||||
return $this->cookie;
|
||||
}
|
||||
|
||||
return isset($this->cookie[$key])
|
||||
? $this->cookie[$key]
|
||||
: null;
|
||||
@@ -61,6 +63,7 @@ class Minify_Env {
|
||||
if (null === $key) {
|
||||
return $this->get;
|
||||
}
|
||||
|
||||
return isset($this->get[$key])
|
||||
? $this->get[$key]
|
||||
: null;
|
||||
@@ -87,6 +90,7 @@ class Minify_Env {
|
||||
,0
|
||||
,strlen($server['SCRIPT_FILENAME']) - strlen($server['SCRIPT_NAME'])
|
||||
);
|
||||
|
||||
return rtrim($docRoot, '\\');
|
||||
}
|
||||
}
|
||||
|
@@ -42,10 +42,10 @@ class Minify_HTML {
|
||||
*/
|
||||
public static function minify($html, $options = array()) {
|
||||
$min = new self($html, $options);
|
||||
|
||||
return $min->process();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Create a minifier object
|
||||
*
|
||||
@@ -81,7 +81,6 @@ class Minify_HTML {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Minify the markeup given in the constructor
|
||||
*
|
||||
@@ -157,6 +156,7 @@ class Minify_HTML {
|
||||
,array_values($this->_placeholders)
|
||||
,$this->_html
|
||||
);
|
||||
|
||||
return $this->_html;
|
||||
}
|
||||
|
||||
@@ -171,6 +171,7 @@ class Minify_HTML {
|
||||
{
|
||||
$placeholder = '%' . $this->_replacementHash . count($this->_placeholders) . '%';
|
||||
$this->_placeholders[$placeholder] = $content;
|
||||
|
||||
return $placeholder;
|
||||
}
|
||||
|
||||
|
@@ -48,6 +48,7 @@ class Minify_HTML_Helper {
|
||||
$h->setGroup($keyOrFiles, $opts['farExpires']);
|
||||
}
|
||||
$uri = $h->getRawUri($opts['farExpires'], $opts['debug']);
|
||||
|
||||
return htmlspecialchars($uri, ENT_QUOTES, $opts['charset']);
|
||||
}
|
||||
|
||||
@@ -75,6 +76,7 @@ class Minify_HTML_Helper {
|
||||
} elseif ($farExpires && $this->_lastModified) {
|
||||
$path .= "&" . $this->_lastModified;
|
||||
}
|
||||
|
||||
return $path;
|
||||
}
|
||||
|
||||
@@ -156,6 +158,7 @@ class Minify_HTML_Helper {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return $max;
|
||||
}
|
||||
|
||||
@@ -163,7 +166,6 @@ class Minify_HTML_Helper {
|
||||
protected $_filePaths = array();
|
||||
protected $_lastModified = null;
|
||||
|
||||
|
||||
/**
|
||||
* In a given array of strings, find the character they all have at
|
||||
* a particular index
|
||||
@@ -186,6 +188,7 @@ class Minify_HTML_Helper {
|
||||
return '';
|
||||
}
|
||||
}
|
||||
|
||||
return $c;
|
||||
}
|
||||
|
||||
@@ -225,6 +228,7 @@ class Minify_HTML_Helper {
|
||||
? $uri
|
||||
: $bUri;
|
||||
}
|
||||
|
||||
return $uri;
|
||||
}
|
||||
}
|
||||
|
@@ -27,6 +27,7 @@ class Minify_ImportProcessor {
|
||||
self::$filesIncluded = array();
|
||||
self::$_isCss = (strtolower(substr($file, -4)) === '.css');
|
||||
$obj = new Minify_ImportProcessor(dirname($file));
|
||||
|
||||
return $obj->_getContent($file);
|
||||
}
|
||||
|
||||
@@ -129,6 +130,7 @@ class Minify_ImportProcessor {
|
||||
? $m[0]
|
||||
: "/* Minify_ImportProcessor could not fetch '{$file}' */";
|
||||
}
|
||||
|
||||
return (!self::$_isCss || preg_match('@(?:^$|\\ball\\b)@', $mediaList))
|
||||
? $content
|
||||
: "@media {$mediaList} {\n{$content}\n}\n";
|
||||
@@ -154,6 +156,7 @@ class Minify_ImportProcessor {
|
||||
$url = self::getPathDiff(realpath($this->_previewsDir), $path);
|
||||
}
|
||||
}
|
||||
|
||||
return "url({$quote}{$url}{$quote})";
|
||||
}
|
||||
|
||||
@@ -175,6 +178,7 @@ class Minify_ImportProcessor {
|
||||
array_shift($arFrom);
|
||||
array_shift($arTo);
|
||||
}
|
||||
|
||||
return str_pad("", count($arFrom) * 3, '..' . $ps) . implode($ps, $arTo);
|
||||
}
|
||||
|
||||
@@ -184,7 +188,7 @@ class Minify_ImportProcessor {
|
||||
* @return string The resolved path, it might not exist.
|
||||
* @see http://stackoverflow.com/questions/4049856/replace-phps-realpath
|
||||
*/
|
||||
function truepath($path)
|
||||
public function truepath($path)
|
||||
{
|
||||
// whether $path is unix or not
|
||||
$unipath = strlen($path) == 0 || $path{0} != '/';
|
||||
@@ -211,6 +215,7 @@ class Minify_ImportProcessor {
|
||||
$path = readlink($path);
|
||||
// put initial separator that could have been lost
|
||||
$path = !$unipath ? '/' . $path : $path;
|
||||
|
||||
return $path;
|
||||
}
|
||||
}
|
||||
|
@@ -81,6 +81,7 @@ class Minify_JS_ClosureCompiler {
|
||||
public static function minify($js, array $options = array())
|
||||
{
|
||||
$obj = new self($options);
|
||||
|
||||
return $obj->min($js);
|
||||
}
|
||||
|
||||
|
@@ -35,6 +35,7 @@ class Minify_LessCssSource extends Minify_Source {
|
||||
$lastModified = max($lastModified, $mtime);
|
||||
|
||||
}
|
||||
|
||||
return $lastModified;
|
||||
}
|
||||
|
||||
@@ -90,6 +91,7 @@ class Minify_LessCssSource extends Minify_Source {
|
||||
*/
|
||||
private function getCacheId($prefix = 'minify') {
|
||||
$md5 = md5($this->filepath);
|
||||
|
||||
return "{$prefix}_less_{$md5}";
|
||||
}
|
||||
|
||||
@@ -102,6 +104,7 @@ class Minify_LessCssSource extends Minify_Source {
|
||||
$less = new lessc();
|
||||
// do not spend CPU time letting less doing minify
|
||||
$less->setPreserveComments(true);
|
||||
|
||||
return $less;
|
||||
}
|
||||
}
|
||||
|
@@ -117,6 +117,7 @@ class Minify_Lines {
|
||||
$line = substr($line, $pos + 2);
|
||||
}
|
||||
}
|
||||
|
||||
return $inComment;
|
||||
}
|
||||
|
||||
|
@@ -18,6 +18,7 @@ class Minify_Loader {
|
||||
$file .= strtr($class, "\\_", DIRECTORY_SEPARATOR . DIRECTORY_SEPARATOR) . '.php';
|
||||
if (is_readable($file)) {
|
||||
require $file;
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -36,6 +37,7 @@ class Minify_Loader {
|
||||
{
|
||||
$inst = new self();
|
||||
spl_autoload_register(array($inst, 'loadClass'));
|
||||
|
||||
return $inst;
|
||||
}
|
||||
}
|
||||
|
@@ -24,6 +24,7 @@ class Minify_Packer {
|
||||
{
|
||||
// @todo: set encoding options based on $options :)
|
||||
$packer = new JavascriptPacker($code, 'Normal', true, false);
|
||||
|
||||
return trim($packer->pack());
|
||||
}
|
||||
}
|
||||
|
@@ -31,7 +31,7 @@ class Minify_ServeConfiguration {
|
||||
* @param Minify_SourceInterface[] $sources
|
||||
* @param string $selectionId
|
||||
*/
|
||||
function __construct(array $options, array $sources = array(), $selectionId = '')
|
||||
public function __construct(array $options, array $sources = array(), $selectionId = '')
|
||||
{
|
||||
$this->options = $options;
|
||||
$this->sources = $sources;
|
||||
|
@@ -24,6 +24,7 @@ class Minify_SourceSet {
|
||||
$source->getId(), $source->getMinifier(), $source->getMinifierOptions()
|
||||
);
|
||||
}
|
||||
|
||||
return md5(serialize($info));
|
||||
}
|
||||
}
|
||||
|
@@ -98,6 +98,7 @@ class Minify_YUICompressor {
|
||||
if ($result_code != 0) {
|
||||
throw new Exception('Minify_YUICompressor : YUI compressor execution failed.');
|
||||
}
|
||||
|
||||
return implode("\n", $output);
|
||||
}
|
||||
|
||||
@@ -134,6 +135,7 @@ class Minify_YUICompressor {
|
||||
: '';
|
||||
}
|
||||
}
|
||||
|
||||
return $cmd . ' ' . escapeshellarg($tmpFile);
|
||||
}
|
||||
|
||||
|
@@ -116,6 +116,7 @@ class Cli {
|
||||
$arg = new Arg($required);
|
||||
}
|
||||
$this->_args[$letter] = $arg;
|
||||
|
||||
return $arg;
|
||||
}
|
||||
|
||||
@@ -207,6 +208,7 @@ class Cli {
|
||||
$pattern = "/^-[" . str_replace($letter, '', $lettersUsed) . "]/i";
|
||||
if (preg_match($pattern, $v)) {
|
||||
$this->addError($letter, "Value was read as another option: %s", $v);
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -249,6 +251,7 @@ class Cli {
|
||||
}
|
||||
$this->moreArgs = $argvCopy;
|
||||
reset($this->moreArgs);
|
||||
|
||||
return empty($this->errors);
|
||||
}
|
||||
|
||||
@@ -270,6 +273,7 @@ class Cli {
|
||||
$r[$k] = $v;
|
||||
}
|
||||
}
|
||||
|
||||
return $r;
|
||||
}
|
||||
|
||||
@@ -288,6 +292,7 @@ class Cli {
|
||||
$r .= " $letter : " . implode(', ', $arr) . "\n";
|
||||
}
|
||||
$r .= "\n";
|
||||
|
||||
return $r;
|
||||
}
|
||||
|
||||
@@ -318,6 +323,7 @@ class Cli {
|
||||
$desc = wordwrap($desc, 70);
|
||||
$r .= $flag . str_replace("\n", "\n ", $desc) . "\n\n";
|
||||
}
|
||||
|
||||
return $r;
|
||||
}
|
||||
|
||||
@@ -333,6 +339,7 @@ class Cli {
|
||||
return STDIN;
|
||||
} else {
|
||||
$this->_stdin = fopen($this->_stdin, 'rb');
|
||||
|
||||
return $this->_stdin;
|
||||
}
|
||||
}
|
||||
@@ -357,6 +364,7 @@ class Cli {
|
||||
return STDOUT;
|
||||
} else {
|
||||
$this->_stdout = fopen($this->_stdout, 'wb');
|
||||
|
||||
return $this->_stdout;
|
||||
}
|
||||
}
|
||||
|
@@ -97,6 +97,7 @@ class Arg {
|
||||
public function useAsOutfile()
|
||||
{
|
||||
$this->spec['useAsOutfile'] = true;
|
||||
|
||||
return $this->assertFile()->assertWritable();
|
||||
}
|
||||
|
||||
@@ -109,6 +110,7 @@ class Arg {
|
||||
public function useAsInfile()
|
||||
{
|
||||
$this->spec['useAsInfile'] = true;
|
||||
|
||||
return $this->assertFile()->assertReadable();
|
||||
}
|
||||
|
||||
@@ -127,6 +129,7 @@ class Arg {
|
||||
public function setDescription($desc)
|
||||
{
|
||||
$this->description = $desc;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
@@ -164,6 +167,7 @@ class Arg {
|
||||
} else {
|
||||
throw new BadMethodCallException('Method does not exist');
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
@@ -178,6 +182,7 @@ class Arg {
|
||||
if (array_key_exists($name, $this->spec)) {
|
||||
return $this->spec[$name];
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user