mirror of
https://github.com/mrclay/minify.git
synced 2025-07-31 19:30:29 +02:00
phpcs: enable psr2
This commit is contained in:
3
.php_cs
3
.php_cs
@@ -5,7 +5,7 @@ $finder = Symfony\CS\Finder\DefaultFinder::create()
|
|||||||
;
|
;
|
||||||
|
|
||||||
return Symfony\CS\Config\Config::create()
|
return Symfony\CS\Config\Config::create()
|
||||||
->level(Symfony\CS\FixerInterface::NONE_LEVEL)
|
->level(Symfony\CS\FixerInterface::PSR2_LEVEL)
|
||||||
->setUsingCache(true)
|
->setUsingCache(true)
|
||||||
->fixers(array(
|
->fixers(array(
|
||||||
'linefeed',
|
'linefeed',
|
||||||
@@ -21,6 +21,7 @@ return Symfony\CS\Config\Config::create()
|
|||||||
'controls_spaces',
|
'controls_spaces',
|
||||||
'elseif',
|
'elseif',
|
||||||
'-eof_ending',
|
'-eof_ending',
|
||||||
|
'-method_argument_space',
|
||||||
))
|
))
|
||||||
->finder($finder)
|
->finder($finder)
|
||||||
;
|
;
|
||||||
|
@@ -60,7 +60,8 @@
|
|||||||
* @subpackage HTTP
|
* @subpackage HTTP
|
||||||
* @author Stephen Clay <steve@mrclay.org>
|
* @author Stephen Clay <steve@mrclay.org>
|
||||||
*/
|
*/
|
||||||
class HTTP_ConditionalGet {
|
class HTTP_ConditionalGet
|
||||||
|
{
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Does the client have a valid copy of the requested resource?
|
* Does the client have a valid copy of the requested resource?
|
||||||
@@ -340,7 +341,8 @@ class HTTP_ConditionalGet {
|
|||||||
*
|
*
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
protected function normalizeEtag($etag) {
|
protected function normalizeEtag($etag)
|
||||||
|
{
|
||||||
$etag = trim($etag);
|
$etag = trim($etag);
|
||||||
|
|
||||||
return $this->_stripEtag
|
return $this->_stripEtag
|
||||||
|
@@ -43,7 +43,8 @@
|
|||||||
* @subpackage HTTP
|
* @subpackage HTTP
|
||||||
* @author Stephen Clay <steve@mrclay.org>
|
* @author Stephen Clay <steve@mrclay.org>
|
||||||
*/
|
*/
|
||||||
class HTTP_Encoder {
|
class HTTP_Encoder
|
||||||
|
{
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Should the encoder allow HTTP encoding to IE6?
|
* Should the encoder allow HTTP encoding to IE6?
|
||||||
@@ -97,8 +98,7 @@ class HTTP_Encoder {
|
|||||||
$this->_headers['Content-Type'] = $spec['type'];
|
$this->_headers['Content-Type'] = $spec['type'];
|
||||||
}
|
}
|
||||||
if (isset($spec['method'])
|
if (isset($spec['method'])
|
||||||
&& in_array($spec['method'], array('gzip', 'deflate', 'compress', '')))
|
&& in_array($spec['method'], array('gzip', 'deflate', 'compress', ''))) {
|
||||||
{
|
|
||||||
$this->_encodeMethod = array($spec['method'], $spec['method']);
|
$this->_encodeMethod = array($spec['method'], $spec['method']);
|
||||||
} else {
|
} else {
|
||||||
$this->_encodeMethod = self::getAcceptedEncoding();
|
$this->_encodeMethod = self::getAcceptedEncoding();
|
||||||
@@ -192,8 +192,7 @@ class HTTP_Encoder {
|
|||||||
// @link http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html
|
// @link http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html
|
||||||
|
|
||||||
if (! isset($_SERVER['HTTP_ACCEPT_ENCODING'])
|
if (! isset($_SERVER['HTTP_ACCEPT_ENCODING'])
|
||||||
|| self::isBuggyIe())
|
|| self::isBuggyIe()) {
|
||||||
{
|
|
||||||
return array('', '');
|
return array('', '');
|
||||||
}
|
}
|
||||||
$ae = $_SERVER['HTTP_ACCEPT_ENCODING'];
|
$ae = $_SERVER['HTTP_ACCEPT_ENCODING'];
|
||||||
@@ -259,8 +258,7 @@ class HTTP_Encoder {
|
|||||||
}
|
}
|
||||||
if ('' === $this->_encodeMethod[0]
|
if ('' === $this->_encodeMethod[0]
|
||||||
|| ($compressionLevel == 0)
|
|| ($compressionLevel == 0)
|
||||||
|| !extension_loaded('zlib'))
|
|| !extension_loaded('zlib')) {
|
||||||
{
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if ($this->_encodeMethod[0] === 'deflate') {
|
if ($this->_encodeMethod[0] === 'deflate') {
|
||||||
|
@@ -24,7 +24,8 @@ use Psr\Log\LoggerInterface;
|
|||||||
* @license http://opensource.org/licenses/bsd-license.php New BSD License
|
* @license http://opensource.org/licenses/bsd-license.php New BSD License
|
||||||
* @link https://github.com/mrclay/minify
|
* @link https://github.com/mrclay/minify
|
||||||
*/
|
*/
|
||||||
class Minify {
|
class Minify
|
||||||
|
{
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* API version
|
* API version
|
||||||
@@ -87,7 +88,8 @@ class Minify {
|
|||||||
* @param Minify_CacheInterface $cache
|
* @param Minify_CacheInterface $cache
|
||||||
* @param LoggerInterface $logger
|
* @param LoggerInterface $logger
|
||||||
*/
|
*/
|
||||||
public function __construct(Minify_CacheInterface $cache, LoggerInterface $logger = null) {
|
public function __construct(Minify_CacheInterface $cache, LoggerInterface $logger = null)
|
||||||
|
{
|
||||||
$this->cache = $cache;
|
$this->cache = $cache;
|
||||||
$this->logger = $logger;
|
$this->logger = $logger;
|
||||||
}
|
}
|
||||||
@@ -492,7 +494,8 @@ class Minify {
|
|||||||
* @param string $content
|
* @param string $content
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
public static function nullMinifier($content) {
|
public static function nullMinifier($content)
|
||||||
|
{
|
||||||
if (isset($content[0]) && $content[0] === "\xef") {
|
if (isset($content[0]) && $content[0] === "\xef") {
|
||||||
$content = substr($content, 3);
|
$content = substr($content, 3);
|
||||||
}
|
}
|
||||||
@@ -506,7 +509,7 @@ class Minify {
|
|||||||
*/
|
*/
|
||||||
protected function setupUriRewrites()
|
protected function setupUriRewrites()
|
||||||
{
|
{
|
||||||
foreach($this->sources as $key => $source) {
|
foreach ($this->sources as $key => $source) {
|
||||||
$file = $this->env->normalizePath($source->getFilePath());
|
$file = $this->env->normalizePath($source->getFilePath());
|
||||||
$minifyOptions = $source->getMinifierOptions();
|
$minifyOptions = $source->getMinifierOptions();
|
||||||
|
|
||||||
@@ -594,8 +597,7 @@ class Minify {
|
|||||||
|| $type === self::TYPE_CSS // yes, to process CSS individually (avoiding PCRE bugs/limits)
|
|| $type === self::TYPE_CSS // yes, to process CSS individually (avoiding PCRE bugs/limits)
|
||||||
|| $minifier !== $lastMinifier // yes, minifier changed
|
|| $minifier !== $lastMinifier // yes, minifier changed
|
||||||
|| $options !== $lastOptions) // yes, options changed
|
|| $options !== $lastOptions) // yes, options changed
|
||||||
)
|
) {
|
||||||
{
|
|
||||||
// minify previous sources with last settings
|
// minify previous sources with last settings
|
||||||
$imploded = implode($implodeSeparator, $groupToProcessTogether);
|
$imploded = implode($implodeSeparator, $groupToProcessTogether);
|
||||||
$groupToProcessTogether = array();
|
$groupToProcessTogether = array();
|
||||||
@@ -718,7 +720,6 @@ class Minify {
|
|||||||
if (!empty($options['contentType'])) {
|
if (!empty($options['contentType'])) {
|
||||||
// just verify sources have null content type or match the options
|
// just verify sources have null content type or match the options
|
||||||
if ($sourceType !== null && $sourceType !== $options['contentType']) {
|
if ($sourceType !== null && $sourceType !== $options['contentType']) {
|
||||||
|
|
||||||
$this->logger && $this->logger->warning('ContentType mismatch');
|
$this->logger && $this->logger->warning('ContentType mismatch');
|
||||||
|
|
||||||
$this->sources = array();
|
$this->sources = array();
|
||||||
@@ -732,7 +733,6 @@ class Minify {
|
|||||||
if ($type === null) {
|
if ($type === null) {
|
||||||
$type = $sourceType;
|
$type = $sourceType;
|
||||||
} elseif ($sourceType !== $type) {
|
} elseif ($sourceType !== $type) {
|
||||||
|
|
||||||
$this->logger && $this->logger->warning('ContentType mismatch');
|
$this->logger && $this->logger->warning('ContentType mismatch');
|
||||||
|
|
||||||
$this->sources = array();
|
$this->sources = array();
|
||||||
|
@@ -21,7 +21,8 @@ use Props\Container;
|
|||||||
* @property \Minify_Source_Factory $sourceFactory
|
* @property \Minify_Source_Factory $sourceFactory
|
||||||
* @property array $sourceFactoryOptions
|
* @property array $sourceFactoryOptions
|
||||||
*/
|
*/
|
||||||
class App extends Container {
|
class App extends Container
|
||||||
|
{
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor
|
* Constructor
|
||||||
@@ -249,7 +250,8 @@ class App extends Container {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
public function runServer() {
|
public function runServer()
|
||||||
|
{
|
||||||
if (!$this->env->get('f') && $this->env->get('g') === null) {
|
if (!$this->env->get('f') && $this->env->get('g') === null) {
|
||||||
// no spec given
|
// no spec given
|
||||||
$msg = '<p>No "f" or "g" parameters were detected.</p>';
|
$msg = '<p>No "f" or "g" parameters were detected.</p>';
|
||||||
@@ -265,7 +267,8 @@ class App extends Container {
|
|||||||
* @param mixed $var
|
* @param mixed $var
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
private function typeOf($var) {
|
private function typeOf($var)
|
||||||
|
{
|
||||||
$type = gettype($var);
|
$type = gettype($var);
|
||||||
|
|
||||||
return $type === 'object' ? get_class($var) : $type;
|
return $type === 'object' ? get_class($var) : $type;
|
||||||
|
@@ -34,7 +34,8 @@
|
|||||||
* @package Minify
|
* @package Minify
|
||||||
* @author Stephen Clay <steve@mrclay.org>
|
* @author Stephen Clay <steve@mrclay.org>
|
||||||
*/
|
*/
|
||||||
class Minify_Build {
|
class Minify_Build
|
||||||
|
{
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Last modification time of all files in the build
|
* Last modification time of all files in the build
|
||||||
@@ -67,7 +68,8 @@ class Minify_Build {
|
|||||||
* append the timestamp to the URI.
|
* append the timestamp to the URI.
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
public function uri($uri, $forceAmpersand = false) {
|
public function uri($uri, $forceAmpersand = false)
|
||||||
|
{
|
||||||
$sep = ($forceAmpersand || strpos($uri, '?') !== false)
|
$sep = ($forceAmpersand || strpos($uri, '?') !== false)
|
||||||
? self::$ampersand
|
? self::$ampersand
|
||||||
: '?';
|
: '?';
|
||||||
@@ -75,7 +77,7 @@ class Minify_Build {
|
|||||||
return "{$uri}{$sep}{$this->lastModified}";
|
return "{$uri}{$sep}{$this->lastModified}";
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a build object
|
* Create a build object
|
||||||
*
|
*
|
||||||
* @param array $sources array of Minify_Source objects and/or file paths
|
* @param array $sources array of Minify_Source objects and/or file paths
|
||||||
|
@@ -16,7 +16,8 @@
|
|||||||
*
|
*
|
||||||
* @deprecated Use Minify_CSSmin
|
* @deprecated Use Minify_CSSmin
|
||||||
*/
|
*/
|
||||||
class Minify_CSS {
|
class Minify_CSS
|
||||||
|
{
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Minify a CSS string
|
* Minify a CSS string
|
||||||
|
@@ -26,7 +26,8 @@
|
|||||||
*
|
*
|
||||||
* @deprecated Use CSSmin (tubalmartin/cssmin)
|
* @deprecated Use CSSmin (tubalmartin/cssmin)
|
||||||
*/
|
*/
|
||||||
class Minify_CSS_Compressor {
|
class Minify_CSS_Compressor
|
||||||
|
{
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Minify a CSS string
|
* Minify a CSS string
|
||||||
@@ -61,7 +62,8 @@ class Minify_CSS_Compressor {
|
|||||||
*
|
*
|
||||||
* @param array $options (currently ignored)
|
* @param array $options (currently ignored)
|
||||||
*/
|
*/
|
||||||
private function __construct($options) {
|
private function __construct($options)
|
||||||
|
{
|
||||||
$this->_options = $options;
|
$this->_options = $options;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -10,7 +10,8 @@
|
|||||||
* @package Minify
|
* @package Minify
|
||||||
* @author Stephen Clay <steve@mrclay.org>
|
* @author Stephen Clay <steve@mrclay.org>
|
||||||
*/
|
*/
|
||||||
class Minify_CSS_UriRewriter {
|
class Minify_CSS_UriRewriter
|
||||||
|
{
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* rewrite() and rewriteRelative() append debugging information here
|
* rewrite() and rewriteRelative() append debugging information here
|
||||||
@@ -326,7 +327,8 @@ class Minify_CSS_UriRewriter {
|
|||||||
* @param string $css
|
* @param string $css
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
private static function _owlifySvgPaths($css) {
|
private static function _owlifySvgPaths($css)
|
||||||
|
{
|
||||||
return preg_replace('~\b((?:clip-path|mask|-webkit-mask)\s*\:\s*)url(\(\s*#\w+\s*\))~', '$1owl$2', $css);
|
return preg_replace('~\b((?:clip-path|mask|-webkit-mask)\s*\:\s*)url(\(\s*#\w+\s*\))~', '$1owl$2', $css);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -338,7 +340,8 @@ class Minify_CSS_UriRewriter {
|
|||||||
* @param string $css
|
* @param string $css
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
private static function _unOwlify($css) {
|
private static function _unOwlify($css)
|
||||||
|
{
|
||||||
return preg_replace('~\b((?:clip-path|mask|-webkit-mask)\s*\:\s*)owl~', '$1url', $css);
|
return preg_replace('~\b((?:clip-path|mask|-webkit-mask)\s*\:\s*)owl~', '$1url', $css);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -12,7 +12,8 @@
|
|||||||
* @package Minify
|
* @package Minify
|
||||||
* @author Stephen Clay <steve@mrclay.org>
|
* @author Stephen Clay <steve@mrclay.org>
|
||||||
*/
|
*/
|
||||||
class Minify_CSSmin {
|
class Minify_CSSmin
|
||||||
|
{
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Minify a CSS string
|
* Minify a CSS string
|
||||||
|
@@ -14,7 +14,8 @@
|
|||||||
* @package Minify
|
* @package Minify
|
||||||
* @author Chris Edwards
|
* @author Chris Edwards
|
||||||
**/
|
**/
|
||||||
class Minify_Cache_APC implements Minify_CacheInterface {
|
class Minify_Cache_APC implements Minify_CacheInterface
|
||||||
|
{
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a Minify_Cache_APC object, to be passed to
|
* Create a Minify_Cache_APC object, to be passed to
|
||||||
|
@@ -6,7 +6,8 @@
|
|||||||
|
|
||||||
use Psr\Log\LoggerInterface;
|
use Psr\Log\LoggerInterface;
|
||||||
|
|
||||||
class Minify_Cache_File implements Minify_CacheInterface {
|
class Minify_Cache_File implements Minify_CacheInterface
|
||||||
|
{
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var string
|
* @var string
|
||||||
@@ -117,7 +118,7 @@ class Minify_Cache_File implements Minify_CacheInterface {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Fetch the cached content
|
* Fetch the cached content
|
||||||
*
|
*
|
||||||
* @param string $id cache id (e.g. a filename)
|
* @param string $id cache id (e.g. a filename)
|
||||||
|
@@ -17,7 +17,8 @@
|
|||||||
* }
|
* }
|
||||||
* </code>
|
* </code>
|
||||||
**/
|
**/
|
||||||
class Minify_Cache_Memcache implements Minify_CacheInterface {
|
class Minify_Cache_Memcache implements Minify_CacheInterface
|
||||||
|
{
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a Minify_Cache_Memcache object, to be passed to
|
* Create a Minify_Cache_Memcache object, to be passed to
|
||||||
@@ -92,7 +93,7 @@ class Minify_Cache_Memcache implements Minify_CacheInterface {
|
|||||||
: '';
|
: '';
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Fetch the cached content
|
* Fetch the cached content
|
||||||
*
|
*
|
||||||
* @param string $id cache id
|
* @param string $id cache id
|
||||||
@@ -114,7 +115,7 @@ class Minify_Cache_Memcache implements Minify_CacheInterface {
|
|||||||
private $_data = null;
|
private $_data = null;
|
||||||
private $_id = null;
|
private $_id = null;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Fetch data and timestamp from memcache, store in instance
|
* Fetch data and timestamp from memcache, store in instance
|
||||||
*
|
*
|
||||||
* @param string $id
|
* @param string $id
|
||||||
|
@@ -8,7 +8,8 @@
|
|||||||
*
|
*
|
||||||
* @package Minify
|
* @package Minify
|
||||||
*/
|
*/
|
||||||
class Minify_Cache_Null implements Minify_CacheInterface {
|
class Minify_Cache_Null implements Minify_CacheInterface
|
||||||
|
{
|
||||||
/**
|
/**
|
||||||
* Write data to cache.
|
* Write data to cache.
|
||||||
*
|
*
|
||||||
|
@@ -99,12 +99,12 @@ class Minify_Cache_WinCache implements Minify_CacheInterface
|
|||||||
return $this->_fetch($id) ? $this->_data : '';
|
return $this->_fetch($id) ? $this->_data : '';
|
||||||
}
|
}
|
||||||
|
|
||||||
private $_exp = NULL;
|
private $_exp = null;
|
||||||
|
|
||||||
// cache of most recently fetched id
|
// cache of most recently fetched id
|
||||||
private $_lm = NULL;
|
private $_lm = null;
|
||||||
private $_data = NULL;
|
private $_data = null;
|
||||||
private $_id = NULL;
|
private $_id = null;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Fetch data and timestamp from WinCache, store in instance
|
* Fetch data and timestamp from WinCache, store in instance
|
||||||
@@ -121,7 +121,7 @@ class Minify_Cache_WinCache implements Minify_CacheInterface
|
|||||||
$suc = false;
|
$suc = false;
|
||||||
$ret = wincache_ucache_get($id, $suc);
|
$ret = wincache_ucache_get($id, $suc);
|
||||||
if (!$suc) {
|
if (!$suc) {
|
||||||
$this->_id = NULL;
|
$this->_id = null;
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@@ -17,7 +17,8 @@
|
|||||||
* @package Minify
|
* @package Minify
|
||||||
* @author Elan Ruusamäe <glen@delfi.ee>
|
* @author Elan Ruusamäe <glen@delfi.ee>
|
||||||
**/
|
**/
|
||||||
class Minify_Cache_XCache implements Minify_CacheInterface {
|
class Minify_Cache_XCache implements Minify_CacheInterface
|
||||||
|
{
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a Minify_Cache_XCache object, to be passed to
|
* Create a Minify_Cache_XCache object, to be passed to
|
||||||
|
@@ -16,7 +16,8 @@
|
|||||||
* @package Minify
|
* @package Minify
|
||||||
* @author Patrick van Dissel
|
* @author Patrick van Dissel
|
||||||
*/
|
*/
|
||||||
class Minify_Cache_ZendPlatform implements Minify_CacheInterface {
|
class Minify_Cache_ZendPlatform implements Minify_CacheInterface
|
||||||
|
{
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a Minify_Cache_ZendPlatform object, to be passed to
|
* Create a Minify_Cache_ZendPlatform object, to be passed to
|
||||||
|
@@ -9,7 +9,8 @@
|
|||||||
*
|
*
|
||||||
* @package Minify
|
* @package Minify
|
||||||
*/
|
*/
|
||||||
interface Minify_CacheInterface {
|
interface Minify_CacheInterface
|
||||||
|
{
|
||||||
/**
|
/**
|
||||||
* Write data to cache.
|
* Write data to cache.
|
||||||
*
|
*
|
||||||
|
@@ -10,7 +10,8 @@
|
|||||||
* @package Minify
|
* @package Minify
|
||||||
* @author Stephen Clay <steve@mrclay.org>
|
* @author Stephen Clay <steve@mrclay.org>
|
||||||
*/
|
*/
|
||||||
class Minify_CommentPreserver {
|
class Minify_CommentPreserver
|
||||||
|
{
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* String to be prepended to each preserved comment
|
* String to be prepended to each preserved comment
|
||||||
|
@@ -15,7 +15,8 @@ use Monolog\Logger;
|
|||||||
* @package Minify
|
* @package Minify
|
||||||
* @author Stephen Clay <steve@mrclay.org>
|
* @author Stephen Clay <steve@mrclay.org>
|
||||||
*/
|
*/
|
||||||
abstract class Minify_Controller_Base implements Minify_ControllerInterface {
|
abstract class Minify_Controller_Base implements Minify_ControllerInterface
|
||||||
|
{
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var Minify_Env
|
* @var Minify_Env
|
||||||
|
@@ -28,7 +28,8 @@ use Monolog\Logger;
|
|||||||
* @package Minify
|
* @package Minify
|
||||||
* @author Stephen Clay <steve@mrclay.org>
|
* @author Stephen Clay <steve@mrclay.org>
|
||||||
*/
|
*/
|
||||||
class Minify_Controller_Files extends Minify_Controller_Base {
|
class Minify_Controller_Files extends Minify_Controller_Base
|
||||||
|
{
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set up file sources
|
* Set up file sources
|
||||||
@@ -40,7 +41,8 @@ class Minify_Controller_Files extends Minify_Controller_Base {
|
|||||||
*
|
*
|
||||||
* 'files': (required) array of complete file paths, or a single path
|
* 'files': (required) array of complete file paths, or a single path
|
||||||
*/
|
*/
|
||||||
public function createConfiguration(array $options) {
|
public function createConfiguration(array $options)
|
||||||
|
{
|
||||||
// strip controller options
|
// strip controller options
|
||||||
|
|
||||||
$files = $options['files'];
|
$files = $options['files'];
|
||||||
|
@@ -23,7 +23,8 @@
|
|||||||
* @package Minify
|
* @package Minify
|
||||||
* @author Stephen Clay <steve@mrclay.org>
|
* @author Stephen Clay <steve@mrclay.org>
|
||||||
*/
|
*/
|
||||||
class Minify_Controller_Groups extends Minify_Controller_Files {
|
class Minify_Controller_Groups extends Minify_Controller_Files
|
||||||
|
{
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set up groups of files as sources
|
* Set up groups of files as sources
|
||||||
@@ -35,7 +36,8 @@ class Minify_Controller_Groups extends Minify_Controller_Files {
|
|||||||
*
|
*
|
||||||
* @return array Minify options
|
* @return array Minify options
|
||||||
*/
|
*/
|
||||||
public function createConfiguration(array $options) {
|
public function createConfiguration(array $options)
|
||||||
|
{
|
||||||
// strip controller options
|
// strip controller options
|
||||||
$groups = $options['groups'];
|
$groups = $options['groups'];
|
||||||
unset($options['groups']);
|
unset($options['groups']);
|
||||||
|
@@ -10,7 +10,8 @@
|
|||||||
* @package Minify
|
* @package Minify
|
||||||
* @author Stephen Clay <steve@mrclay.org>
|
* @author Stephen Clay <steve@mrclay.org>
|
||||||
*/
|
*/
|
||||||
class Minify_Controller_MinApp extends Minify_Controller_Base {
|
class Minify_Controller_MinApp extends Minify_Controller_Base
|
||||||
|
{
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set up groups of files as sources
|
* Set up groups of files as sources
|
||||||
@@ -19,7 +20,8 @@ class Minify_Controller_MinApp extends Minify_Controller_Base {
|
|||||||
*
|
*
|
||||||
* @return array Minify options
|
* @return array Minify options
|
||||||
*/
|
*/
|
||||||
public function createConfiguration(array $options) {
|
public function createConfiguration(array $options)
|
||||||
|
{
|
||||||
// PHP insecure by default: realpath() and other FS functions can't handle null bytes.
|
// PHP insecure by default: realpath() and other FS functions can't handle null bytes.
|
||||||
$get = $this->env->get();
|
$get = $this->env->get();
|
||||||
foreach (array('g', 'b', 'f') as $key) {
|
foreach (array('g', 'b', 'f') as $key) {
|
||||||
|
@@ -11,7 +11,8 @@
|
|||||||
* @package Minify
|
* @package Minify
|
||||||
* @author Stephen Clay <steve@mrclay.org>
|
* @author Stephen Clay <steve@mrclay.org>
|
||||||
*/
|
*/
|
||||||
class Minify_Controller_Page extends Minify_Controller_Base {
|
class Minify_Controller_Page extends Minify_Controller_Base
|
||||||
|
{
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set up source of HTML content
|
* Set up source of HTML content
|
||||||
@@ -31,7 +32,8 @@ class Minify_Controller_Page extends Minify_Controller_Base {
|
|||||||
* 'minifyAll': should all CSS and Javascript blocks be individually
|
* 'minifyAll': should all CSS and Javascript blocks be individually
|
||||||
* minified? (default false)
|
* minified? (default false)
|
||||||
*/
|
*/
|
||||||
public function createConfiguration(array $options) {
|
public function createConfiguration(array $options)
|
||||||
|
{
|
||||||
if (isset($options['file'])) {
|
if (isset($options['file'])) {
|
||||||
$sourceSpec = array(
|
$sourceSpec = array(
|
||||||
'filepath' => $options['file']
|
'filepath' => $options['file']
|
||||||
|
@@ -1,7 +1,8 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
|
|
||||||
interface Minify_ControllerInterface {
|
interface Minify_ControllerInterface
|
||||||
|
{
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create controller sources and options for Minify::serve()
|
* Create controller sources and options for Minify::serve()
|
||||||
|
@@ -6,7 +6,8 @@
|
|||||||
* @package Minify
|
* @package Minify
|
||||||
* @author Stephen Clay <steve@mrclay.org>
|
* @author Stephen Clay <steve@mrclay.org>
|
||||||
*/
|
*/
|
||||||
class Minify_DebugDetector {
|
class Minify_DebugDetector
|
||||||
|
{
|
||||||
public static function shouldDebugRequest(Minify_Env $env)
|
public static function shouldDebugRequest(Minify_Env $env)
|
||||||
{
|
{
|
||||||
if ($env->get('debug') !== null) {
|
if ($env->get('debug') !== null) {
|
||||||
|
@@ -1,6 +1,7 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
class Minify_Env {
|
class Minify_Env
|
||||||
|
{
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return string
|
* @return string
|
||||||
|
@@ -16,7 +16,8 @@
|
|||||||
* @package Minify
|
* @package Minify
|
||||||
* @author Stephen Clay <steve@mrclay.org>
|
* @author Stephen Clay <steve@mrclay.org>
|
||||||
*/
|
*/
|
||||||
class Minify_HTML {
|
class Minify_HTML
|
||||||
|
{
|
||||||
/**
|
/**
|
||||||
* @var boolean
|
* @var boolean
|
||||||
*/
|
*/
|
||||||
@@ -40,7 +41,8 @@ class Minify_HTML {
|
|||||||
*
|
*
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
public static function minify($html, $options = array()) {
|
public static function minify($html, $options = array())
|
||||||
|
{
|
||||||
$min = new self($html, $options);
|
$min = new self($html, $options);
|
||||||
|
|
||||||
return $min->process();
|
return $min->process();
|
||||||
|
@@ -10,7 +10,8 @@
|
|||||||
* @package Minify
|
* @package Minify
|
||||||
* @author Stephen Clay <steve@mrclay.org>
|
* @author Stephen Clay <steve@mrclay.org>
|
||||||
*/
|
*/
|
||||||
class Minify_HTML_Helper {
|
class Minify_HTML_Helper
|
||||||
|
{
|
||||||
public $rewriteWorks = true;
|
public $rewriteWorks = true;
|
||||||
public $minAppUri = '/min';
|
public $minAppUri = '/min';
|
||||||
public $groupsConfigFile = '';
|
public $groupsConfigFile = '';
|
||||||
@@ -190,7 +191,8 @@ class Minify_HTML_Helper {
|
|||||||
* @param int $pos index to check
|
* @param int $pos index to check
|
||||||
* @return mixed a common char or '' if any do not match
|
* @return mixed a common char or '' if any do not match
|
||||||
*/
|
*/
|
||||||
protected static function _getCommonCharAtPos($arr, $pos) {
|
protected static function _getCommonCharAtPos($arr, $pos)
|
||||||
|
{
|
||||||
if (!isset($arr[0][$pos])) {
|
if (!isset($arr[0][$pos])) {
|
||||||
return '';
|
return '';
|
||||||
}
|
}
|
||||||
@@ -215,7 +217,8 @@ class Minify_HTML_Helper {
|
|||||||
* @param string $minRoot root-relative URI of the "min" application
|
* @param string $minRoot root-relative URI of the "min" application
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
protected static function _getShortestUri($paths, $minRoot = '/min/') {
|
protected static function _getShortestUri($paths, $minRoot = '/min/')
|
||||||
|
{
|
||||||
$pos = 0;
|
$pos = 0;
|
||||||
$base = '';
|
$base = '';
|
||||||
while (true) {
|
while (true) {
|
||||||
|
@@ -18,8 +18,8 @@
|
|||||||
* @author Stephen Clay <steve@mrclay.org>
|
* @author Stephen Clay <steve@mrclay.org>
|
||||||
* @author Simon Schick <simonsimcity@gmail.com>
|
* @author Simon Schick <simonsimcity@gmail.com>
|
||||||
*/
|
*/
|
||||||
class Minify_ImportProcessor {
|
class Minify_ImportProcessor
|
||||||
|
{
|
||||||
public static $filesIncluded = array();
|
public static $filesIncluded = array();
|
||||||
|
|
||||||
public static function process($file)
|
public static function process($file)
|
||||||
@@ -173,8 +173,7 @@ class Minify_ImportProcessor {
|
|||||||
|
|
||||||
$arFrom = explode($ps, rtrim($realFrom, $ps));
|
$arFrom = explode($ps, rtrim($realFrom, $ps));
|
||||||
$arTo = explode($ps, rtrim($realTo, $ps));
|
$arTo = explode($ps, rtrim($realTo, $ps));
|
||||||
while (count($arFrom) && count($arTo) && ($arFrom[0] == $arTo[0]))
|
while (count($arFrom) && count($arTo) && ($arFrom[0] == $arTo[0])) {
|
||||||
{
|
|
||||||
array_shift($arFrom);
|
array_shift($arFrom);
|
||||||
array_shift($arTo);
|
array_shift($arTo);
|
||||||
}
|
}
|
||||||
@@ -191,18 +190,21 @@ class Minify_ImportProcessor {
|
|||||||
private function truepath($path)
|
private function truepath($path)
|
||||||
{
|
{
|
||||||
// whether $path is unix or not
|
// whether $path is unix or not
|
||||||
$unipath = strlen($path) == 0 || $path{0} != '/';
|
$unipath = strlen($path) == 0 || $path{0}
|
||||||
|
!= '/';
|
||||||
// attempts to detect if path is relative in which case, add cwd
|
// attempts to detect if path is relative in which case, add cwd
|
||||||
if (strpos($path, ':') === false && $unipath)
|
if (strpos($path, ':') === false && $unipath) {
|
||||||
$path = $this->_currentDir . DIRECTORY_SEPARATOR . $path;
|
$path = $this->_currentDir . DIRECTORY_SEPARATOR . $path;
|
||||||
|
}
|
||||||
|
|
||||||
// resolve path parts (single dot, double dot and double delimiters)
|
// resolve path parts (single dot, double dot and double delimiters)
|
||||||
$path = str_replace(array('/', '\\'), DIRECTORY_SEPARATOR, $path);
|
$path = str_replace(array('/', '\\'), DIRECTORY_SEPARATOR, $path);
|
||||||
$parts = array_filter(explode(DIRECTORY_SEPARATOR, $path), 'strlen');
|
$parts = array_filter(explode(DIRECTORY_SEPARATOR, $path), 'strlen');
|
||||||
$absolutes = array();
|
$absolutes = array();
|
||||||
foreach ($parts as $part) {
|
foreach ($parts as $part) {
|
||||||
if ('.' == $part)
|
if ('.' == $part) {
|
||||||
continue;
|
continue;
|
||||||
|
}
|
||||||
if ('..' == $part) {
|
if ('..' == $part) {
|
||||||
array_pop($absolutes);
|
array_pop($absolutes);
|
||||||
} else {
|
} else {
|
||||||
@@ -211,8 +213,9 @@ class Minify_ImportProcessor {
|
|||||||
}
|
}
|
||||||
$path = implode(DIRECTORY_SEPARATOR, $absolutes);
|
$path = implode(DIRECTORY_SEPARATOR, $absolutes);
|
||||||
// resolve any symlinks
|
// resolve any symlinks
|
||||||
if (file_exists($path) && linkinfo($path) > 0)
|
if (file_exists($path) && linkinfo($path) > 0) {
|
||||||
$path = readlink($path);
|
$path = readlink($path);
|
||||||
|
}
|
||||||
// put initial separator that could have been lost
|
// put initial separator that could have been lost
|
||||||
$path = !$unipath ? '/' . $path : $path;
|
$path = !$unipath ? '/' . $path : $path;
|
||||||
|
|
||||||
|
@@ -13,7 +13,8 @@
|
|||||||
*
|
*
|
||||||
* @todo can use a stream wrapper to unit test this?
|
* @todo can use a stream wrapper to unit test this?
|
||||||
*/
|
*/
|
||||||
class Minify_JS_ClosureCompiler {
|
class Minify_JS_ClosureCompiler
|
||||||
|
{
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var string The option key for the maximum POST byte size
|
* @var string The option key for the maximum POST byte size
|
||||||
@@ -228,4 +229,6 @@ class Minify_JS_ClosureCompiler {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
class Minify_JS_ClosureCompiler_Exception extends Exception {}
|
class Minify_JS_ClosureCompiler_Exception extends Exception
|
||||||
|
{
|
||||||
|
}
|
||||||
|
@@ -1,6 +1,7 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
class Minify_LessCssSource extends Minify_Source {
|
class Minify_LessCssSource extends Minify_Source
|
||||||
|
{
|
||||||
/**
|
/**
|
||||||
* @var Minify_CacheInterface
|
* @var Minify_CacheInterface
|
||||||
*/
|
*/
|
||||||
@@ -16,7 +17,8 @@ class Minify_LessCssSource extends Minify_Source {
|
|||||||
/**
|
/**
|
||||||
* @inheritdoc
|
* @inheritdoc
|
||||||
*/
|
*/
|
||||||
public function __construct(array $spec, Minify_CacheInterface $cache) {
|
public function __construct(array $spec, Minify_CacheInterface $cache)
|
||||||
|
{
|
||||||
parent::__construct($spec);
|
parent::__construct($spec);
|
||||||
|
|
||||||
$this->cache = $cache;
|
$this->cache = $cache;
|
||||||
@@ -27,7 +29,8 @@ class Minify_LessCssSource extends Minify_Source {
|
|||||||
*
|
*
|
||||||
* @return int
|
* @return int
|
||||||
*/
|
*/
|
||||||
public function getLastModified() {
|
public function getLastModified()
|
||||||
|
{
|
||||||
$cache = $this->getCache();
|
$cache = $this->getCache();
|
||||||
|
|
||||||
return $cache['lastModified'];
|
return $cache['lastModified'];
|
||||||
@@ -38,7 +41,8 @@ class Minify_LessCssSource extends Minify_Source {
|
|||||||
*
|
*
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
public function getContent() {
|
public function getContent()
|
||||||
|
{
|
||||||
$cache = $this->getCache();
|
$cache = $this->getCache();
|
||||||
|
|
||||||
return $cache['compiled'];
|
return $cache['compiled'];
|
||||||
@@ -49,7 +53,8 @@ class Minify_LessCssSource extends Minify_Source {
|
|||||||
*
|
*
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
private function getCache() {
|
private function getCache()
|
||||||
|
{
|
||||||
// cache for single run
|
// cache for single run
|
||||||
// so that getLastModified and getContent in single request do not add additional cache roundtrips (i.e memcache)
|
// so that getLastModified and getContent in single request do not add additional cache roundtrips (i.e memcache)
|
||||||
if (isset($this->parsed)) {
|
if (isset($this->parsed)) {
|
||||||
@@ -100,7 +105,8 @@ class Minify_LessCssSource extends Minify_Source {
|
|||||||
*
|
*
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
private function getCacheId($prefix = 'minify') {
|
private function getCacheId($prefix = 'minify')
|
||||||
|
{
|
||||||
$md5 = md5($this->filepath);
|
$md5 = md5($this->filepath);
|
||||||
|
|
||||||
return "{$prefix}_less2_{$md5}";
|
return "{$prefix}_less2_{$md5}";
|
||||||
@@ -111,7 +117,8 @@ class Minify_LessCssSource extends Minify_Source {
|
|||||||
*
|
*
|
||||||
* @return lessc
|
* @return lessc
|
||||||
*/
|
*/
|
||||||
private function getCompiler() {
|
private function getCompiler()
|
||||||
|
{
|
||||||
$less = new lessc();
|
$less = new lessc();
|
||||||
// do not spend CPU time letting less doing minify
|
// do not spend CPU time letting less doing minify
|
||||||
$less->setPreserveComments(true);
|
$less->setPreserveComments(true);
|
||||||
|
@@ -11,7 +11,8 @@
|
|||||||
* @author Stephen Clay <steve@mrclay.org>
|
* @author Stephen Clay <steve@mrclay.org>
|
||||||
* @author Adam Pedersen (Issue 55 fix)
|
* @author Adam Pedersen (Issue 55 fix)
|
||||||
*/
|
*/
|
||||||
class Minify_Lines {
|
class Minify_Lines
|
||||||
|
{
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Add line numbers in C-style comments
|
* Add line numbers in C-style comments
|
||||||
@@ -156,7 +157,8 @@ class Minify_Lines {
|
|||||||
* @param string $token Token being checked
|
* @param string $token Token being checked
|
||||||
* @return bool
|
* @return bool
|
||||||
*/
|
*/
|
||||||
private static function _find($str, $token) {
|
private static function _find($str, $token)
|
||||||
|
{
|
||||||
switch ($token) {
|
switch ($token) {
|
||||||
case '//':
|
case '//':
|
||||||
$fakes = array(
|
$fakes = array(
|
||||||
|
@@ -19,7 +19,8 @@
|
|||||||
*
|
*
|
||||||
* @package Minify
|
* @package Minify
|
||||||
*/
|
*/
|
||||||
class Minify_Packer {
|
class Minify_Packer
|
||||||
|
{
|
||||||
public static function minify($code, $options = array())
|
public static function minify($code, $options = array())
|
||||||
{
|
{
|
||||||
// @todo: set encoding options based on $options :)
|
// @todo: set encoding options based on $options :)
|
||||||
|
@@ -8,7 +8,8 @@ use Leafo\ScssPhp\Version;
|
|||||||
*
|
*
|
||||||
* @link https://github.com/leafo/scssphp/
|
* @link https://github.com/leafo/scssphp/
|
||||||
*/
|
*/
|
||||||
class Minify_ScssCssSource extends Minify_Source {
|
class Minify_ScssCssSource extends Minify_Source
|
||||||
|
{
|
||||||
/**
|
/**
|
||||||
* @var Minify_CacheInterface
|
* @var Minify_CacheInterface
|
||||||
*/
|
*/
|
||||||
@@ -146,12 +147,12 @@ class Minify_ScssCssSource extends Minify_Source {
|
|||||||
$start = microtime(true);
|
$start = microtime(true);
|
||||||
$scss = new Compiler();
|
$scss = new Compiler();
|
||||||
|
|
||||||
// set import path directory the input filename resides
|
// set import path directory the input filename resides
|
||||||
// otherwise @import statements will not find the files
|
// otherwise @import statements will not find the files
|
||||||
// and will treat the @import line as css import
|
// and will treat the @import line as css import
|
||||||
$scss->setImportPaths(dirname($filename));
|
$scss->setImportPaths(dirname($filename));
|
||||||
|
|
||||||
$css = $scss->compile(file_get_contents($filename), $filename);
|
$css = $scss->compile(file_get_contents($filename), $filename);
|
||||||
$elapsed = round((microtime(true) - $start), 4);
|
$elapsed = round((microtime(true) - $start), 4);
|
||||||
|
|
||||||
$v = Version::VERSION;
|
$v = Version::VERSION;
|
||||||
|
@@ -9,7 +9,8 @@
|
|||||||
*
|
*
|
||||||
* @package Minify
|
* @package Minify
|
||||||
*/
|
*/
|
||||||
class Minify_ServeConfiguration {
|
class Minify_ServeConfiguration
|
||||||
|
{
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var Minify_SourceInterface[]
|
* @var Minify_SourceInterface[]
|
||||||
|
@@ -13,7 +13,8 @@
|
|||||||
* @package Minify
|
* @package Minify
|
||||||
* @author Stephen Clay <steve@mrclay.org>
|
* @author Stephen Clay <steve@mrclay.org>
|
||||||
*/
|
*/
|
||||||
class Minify_Source implements Minify_SourceInterface {
|
class Minify_Source implements Minify_SourceInterface
|
||||||
|
{
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var int time of last modification
|
* @var int time of last modification
|
||||||
@@ -70,13 +71,13 @@ class Minify_Source implements Minify_SourceInterface {
|
|||||||
if (isset($spec['filepath'])) {
|
if (isset($spec['filepath'])) {
|
||||||
$ext = pathinfo($spec['filepath'], PATHINFO_EXTENSION);
|
$ext = pathinfo($spec['filepath'], PATHINFO_EXTENSION);
|
||||||
switch ($ext) {
|
switch ($ext) {
|
||||||
case 'js' : $this->contentType = Minify::TYPE_JS;
|
case 'js': $this->contentType = Minify::TYPE_JS;
|
||||||
break;
|
break;
|
||||||
case 'less' : // fallthrough
|
case 'less': // fallthrough
|
||||||
case 'css' : $this->contentType = Minify::TYPE_CSS;
|
case 'css': $this->contentType = Minify::TYPE_CSS;
|
||||||
break;
|
break;
|
||||||
case 'htm' : // fallthrough
|
case 'htm': // fallthrough
|
||||||
case 'html' : $this->contentType = Minify::TYPE_HTML;
|
case 'html': $this->contentType = Minify::TYPE_HTML;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
$this->filepath = $spec['filepath'];
|
$this->filepath = $spec['filepath'];
|
||||||
@@ -203,7 +204,8 @@ class Minify_Source implements Minify_SourceInterface {
|
|||||||
/**
|
/**
|
||||||
* {@inheritdoc}
|
* {@inheritdoc}
|
||||||
*/
|
*/
|
||||||
public function setupUriRewrites() {
|
public function setupUriRewrites()
|
||||||
|
{
|
||||||
if ($this->filepath
|
if ($this->filepath
|
||||||
&& !isset($this->minifyOptions['currentDir'])
|
&& !isset($this->minifyOptions['currentDir'])
|
||||||
&& !isset($this->minifyOptions['prependRelativePath'])
|
&& !isset($this->minifyOptions['prependRelativePath'])
|
||||||
|
@@ -1,6 +1,7 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
class Minify_Source_Factory {
|
class Minify_Source_Factory
|
||||||
|
{
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var array
|
* @var array
|
||||||
|
@@ -1,3 +1,5 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
class Minify_Source_FactoryException extends Exception {}
|
class Minify_Source_FactoryException extends Exception
|
||||||
|
{
|
||||||
|
}
|
||||||
|
@@ -12,7 +12,8 @@
|
|||||||
*
|
*
|
||||||
* @package Minify
|
* @package Minify
|
||||||
*/
|
*/
|
||||||
interface Minify_SourceInterface {
|
interface Minify_SourceInterface
|
||||||
|
{
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the minifier
|
* Get the minifier
|
||||||
|
@@ -7,7 +7,8 @@
|
|||||||
/**
|
/**
|
||||||
* @package Minify
|
* @package Minify
|
||||||
*/
|
*/
|
||||||
class Minify_SourceSet {
|
class Minify_SourceSet
|
||||||
|
{
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get unique string for a set of sources
|
* Get unique string for a set of sources
|
||||||
|
@@ -29,7 +29,8 @@
|
|||||||
* @package Minify
|
* @package Minify
|
||||||
* @author Stephen Clay <steve@mrclay.org>
|
* @author Stephen Clay <steve@mrclay.org>
|
||||||
*/
|
*/
|
||||||
class Minify_YUICompressor {
|
class Minify_YUICompressor
|
||||||
|
{
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Filepath of the YUI Compressor jar file. This must be set before
|
* Filepath of the YUI Compressor jar file. This must be set before
|
||||||
@@ -112,15 +113,15 @@ class Minify_YUICompressor {
|
|||||||
,'nomunge' => false
|
,'nomunge' => false
|
||||||
,'preserve-semi' => false
|
,'preserve-semi' => false
|
||||||
,'disable-optimizations' => false
|
,'disable-optimizations' => false
|
||||||
,'stack-size' => ''
|
,'stack-size' => ''
|
||||||
)
|
)
|
||||||
,$userOptions
|
,$userOptions
|
||||||
);
|
);
|
||||||
$cmd = self::$javaExecutable
|
$cmd = self::$javaExecutable
|
||||||
. (!empty($o['stack-size'])
|
. (!empty($o['stack-size'])
|
||||||
? ' -Xss' . $o['stack-size']
|
? ' -Xss' . $o['stack-size']
|
||||||
: '')
|
: '')
|
||||||
. ' -jar ' . escapeshellarg(self::$jarFile)
|
. ' -jar ' . escapeshellarg(self::$jarFile)
|
||||||
. " --type {$type}"
|
. " --type {$type}"
|
||||||
. (preg_match('/^[\\da-zA-Z0-9\\-]+$/', $o['charset'])
|
. (preg_match('/^[\\da-zA-Z0-9\\-]+$/', $o['charset'])
|
||||||
? " --charset {$o['charset']}"
|
? " --charset {$o['charset']}"
|
||||||
|
@@ -18,7 +18,8 @@ use InvalidArgumentException;
|
|||||||
* @author Steve Clay <steve@mrclay.org>
|
* @author Steve Clay <steve@mrclay.org>
|
||||||
* @license http://www.opensource.org/licenses/mit-license.php MIT License
|
* @license http://www.opensource.org/licenses/mit-license.php MIT License
|
||||||
*/
|
*/
|
||||||
class Cli {
|
class Cli
|
||||||
|
{
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var array validation errors
|
* @var array validation errors
|
||||||
|
@@ -43,7 +43,8 @@ use BadMethodCallException;
|
|||||||
* @author Steve Clay <steve@mrclay.org>
|
* @author Steve Clay <steve@mrclay.org>
|
||||||
* @license http://www.opensource.org/licenses/mit-license.php MIT License
|
* @license http://www.opensource.org/licenses/mit-license.php MIT License
|
||||||
*/
|
*/
|
||||||
class Arg {
|
class Arg
|
||||||
|
{
|
||||||
/**
|
/**
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
|
Reference in New Issue
Block a user