mirror of
https://github.com/mrclay/minify.git
synced 2025-08-18 20:01:21 +02:00
CSSmin: whitespace cleanup
This commit is contained in:
@@ -23,11 +23,9 @@
|
|||||||
|
|
||||||
class CSSmin
|
class CSSmin
|
||||||
{
|
{
|
||||||
|
|
||||||
private $comments = array();
|
private $comments = array();
|
||||||
private $preserved_tokens = array();
|
private $preserved_tokens = array();
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param bool $raisePhpSettingsLimits if true, raisePhpSettingLimits() will
|
* @param bool $raisePhpSettingsLimits if true, raisePhpSettingLimits() will
|
||||||
* be called.
|
* be called.
|
||||||
@@ -145,7 +143,6 @@ class CSSmin
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Configure PHP to use at least the suggested minimum settings
|
* Configure PHP to use at least the suggested minimum settings
|
||||||
*
|
*
|
||||||
@@ -300,16 +297,14 @@ class CSSmin
|
|||||||
return $css;
|
return $css;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Utility method to replace all data urls with tokens before we start
|
* Utility method to replace all data urls with tokens before we start
|
||||||
* compressing, to avoid performance issues running some of the subsequent
|
* compressing, to avoid performance issues running some of the subsequent
|
||||||
* regexes against large strings chunks.
|
* regexes against large strings chunks.
|
||||||
*/
|
*
|
||||||
* @param string $css
|
* @param string $css
|
||||||
* @return string
|
* @return string
|
||||||
|
*/
|
||||||
private function extract_data_urls($css)
|
private function extract_data_urls($css)
|
||||||
{
|
{
|
||||||
// Leave data urls alone to increase parse performance.
|
// Leave data urls alone to increase parse performance.
|
||||||
@@ -373,9 +368,6 @@ class CSSmin
|
|||||||
return implode('', $sb);
|
return implode('', $sb);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Utility method to compress hex color values of the form #AABBCC to #ABC.
|
* Utility method to compress hex color values of the form #AABBCC to #ABC.
|
||||||
*
|
*
|
||||||
@@ -428,14 +420,10 @@ class CSSmin
|
|||||||
return implode('', $sb);
|
return implode('', $sb);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/* CALLBACKS
|
/* CALLBACKS
|
||||||
* ---------------------------------------------------------------------------------------------
|
* ---------------------------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
private function callback_one($matches)
|
private function callback_one($matches)
|
||||||
{
|
{
|
||||||
$match = $matches[0];
|
$match = $matches[0];
|
||||||
@@ -458,25 +446,16 @@ class CSSmin
|
|||||||
return $quote . '___YUICSSMIN_PRESERVED_TOKEN_' . (count($this->preserved_tokens) - 1) . '___' . $quote;
|
return $quote . '___YUICSSMIN_PRESERVED_TOKEN_' . (count($this->preserved_tokens) - 1) . '___' . $quote;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
private function callback_two($matches)
|
private function callback_two($matches)
|
||||||
{
|
{
|
||||||
return preg_replace('/\:/', '___YUICSSMIN_PSEUDOCLASSCOLON___', $matches[0]);
|
return preg_replace('/\:/', '___YUICSSMIN_PSEUDOCLASSCOLON___', $matches[0]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
private function callback_three($matches)
|
private function callback_three($matches)
|
||||||
{
|
{
|
||||||
return strtolower($matches[1]) . ':0 0' . $matches[2];
|
return strtolower($matches[1]) . ':0 0' . $matches[2];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
private function callback_four($matches)
|
private function callback_four($matches)
|
||||||
{
|
{
|
||||||
$rgbcolors = explode(',', $matches[1]);
|
$rgbcolors = explode(',', $matches[1]);
|
||||||
@@ -489,23 +468,15 @@ class CSSmin
|
|||||||
return '#' . implode('', $rgbcolors);
|
return '#' . implode('', $rgbcolors);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
private function callback_five($matches)
|
private function callback_five($matches)
|
||||||
{
|
{
|
||||||
return strtolower($matches[1]) . ':0' . $matches[2];
|
return strtolower($matches[1]) . ':0' . $matches[2];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/* HELPERS
|
/* HELPERS
|
||||||
* ---------------------------------------------------------------------------------------------
|
* ---------------------------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* PHP port of Javascript's "indexOf" function
|
* PHP port of Javascript's "indexOf" function
|
||||||
* Author: Tubal Martin http://blog.margenn.com
|
* Author: Tubal Martin http://blog.margenn.com
|
||||||
@@ -522,7 +493,6 @@ class CSSmin
|
|||||||
return ($index !== FALSE) ? $index : -1;
|
return ($index !== FALSE) ? $index : -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* PHP port of Javascript's "substring" function
|
* PHP port of Javascript's "substring" function
|
||||||
* Author: Tubal Martin http://blog.margenn.com
|
* Author: Tubal Martin http://blog.margenn.com
|
||||||
|
Reference in New Issue
Block a user