function csstidy_optimise::postparse in Advanced CSS/JS Aggregation 7
Same name and namespace in other branches
- 6 advagg_css_compress/csstidy/class.csstidy_optimise.inc \csstidy_optimise::postparse()
Optimises $css after parsing @access public @version 1.0
File
- advagg_css_compress/
csstidy/ class.csstidy_optimise.inc, line 65
Class
- csstidy_optimise
- CSS Optimising Class
Code
function postparse() {
if ($this->parser
->get_cfg('preserve_css')) {
return;
}
if ($this->parser
->get_cfg('merge_selectors') === 2) {
foreach ($this->css as $medium => $value) {
$this
->merge_selectors($this->css[$medium]);
}
}
if ($this->parser
->get_cfg('discard_invalid_selectors')) {
foreach ($this->css as $medium => $value) {
$this
->discard_invalid_selectors($this->css[$medium]);
}
}
if ($this->parser
->get_cfg('optimise_shorthands') > 0) {
foreach ($this->css as $medium => $value) {
foreach ($value as $selector => $value1) {
$this->css[$medium][$selector] = csstidy_optimise::merge_4value_shorthands($this->css[$medium][$selector]);
if ($this->parser
->get_cfg('optimise_shorthands') < 2) {
continue;
}
$this->css[$medium][$selector] = csstidy_optimise::merge_font($this->css[$medium][$selector]);
if ($this->parser
->get_cfg('optimise_shorthands') < 3) {
continue;
}
$this->css[$medium][$selector] = csstidy_optimise::merge_bg($this->css[$medium][$selector]);
if (empty($this->css[$medium][$selector])) {
unset($this->css[$medium][$selector]);
}
}
}
}
}