Optimises $css after parsing @access public @version 1.0

Fichier

advagg_css_compress/csstidy/class.csstidy_optimise.inc, line 65

Classe

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]);
                }
            }
        }
    }
}