private function CSSCompression_Format::maximum in Advanced CSS/JS Aggregation 7
Same name and namespace in other branches
- 6 advagg_css_compress/css-compressor-3.x/src/lib/Format.inc \CSSCompression_Format::maximum()
Returns maxium readability, breaking on every selector, brace, and property
Parameters
(array) selectors: Array of selectors:
(array) details: Array of declarations:
File
- advagg_css_compress/
css-compressor-3.x/ src/ lib/ Format.inc, line 66
Class
- CSSCompression_Format
- CSS Compressor [VERSION] [DATE] Corey Hart @ http://www.codenothing.com
Code
private function maximum($selectors, $details) {
$css = '';
foreach ($selectors as $k => $v) {
if (strpos($v, $this->token) === 0) {
$css .= substr($v, strlen($this->token));
$css .= $details[$k];
continue;
}
else {
if (!$details[$k] || trim($details[$k]) == '') {
continue;
}
}
$v = str_replace('>', ' > ', $v);
$v = str_replace('+', ' + ', $v);
$v = str_replace(',', ', ', $v);
$css .= "{$v} {\n";
$arr = preg_split($this->rsemicolon, $details[$k]);
foreach ($arr as $item) {
if (!$item) {
continue;
}
list($prop, $val) = preg_split($this->rcolon, $item, 2);
$css .= "\t{$prop}: {$val};\n";
}
// Kill that last semicolon at users request
if ($this->options['unnecessary-semicolons']) {
$css = preg_replace("/;\n\$/", "\n", $css);
}
$css .= "}\n\n";
}
return $css;
}