1
0
mirror of https://github.com/mrclay/minify.git synced 2025-08-17 11:30:55 +02:00

CSSmin: whitespace cleanup

This commit is contained in:
Steve Clay
2012-03-16 14:45:45 -04:00
parent 9ccc1e98a7
commit a2bed51e2b

View File

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