You are here

function csstidy_optimise::shorthands in Advanced CSS/JS Aggregation 7

Same name and namespace in other branches
  1. 6 advagg_css_compress/csstidy/class.csstidy_optimise.inc \csstidy_optimise::shorthands()

Optimises shorthands @access public @version 1.0

File

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

Class

csstidy_optimise
CSS Optimising Class

Code

function shorthands() {
  $shorthands =& $GLOBALS['csstidy']['shorthands'];
  if (!$this->parser
    ->get_cfg('optimise_shorthands') || $this->parser
    ->get_cfg('preserve_css')) {
    return;
  }
  if ($this->property === 'font' && $this->parser
    ->get_cfg('optimise_shorthands') > 1) {
    $this->css[$this->at][$this->selector]['font'] = '';
    $this->parser
      ->merge_css_blocks($this->at, $this->selector, csstidy_optimise::dissolve_short_font($this->value));
  }
  if ($this->property === 'background' && $this->parser
    ->get_cfg('optimise_shorthands') > 2) {
    $this->css[$this->at][$this->selector]['background'] = '';
    $this->parser
      ->merge_css_blocks($this->at, $this->selector, csstidy_optimise::dissolve_short_bg($this->value));
  }
  if (isset($shorthands[$this->property])) {
    $this->parser
      ->merge_css_blocks($this->at, $this->selector, csstidy_optimise::dissolve_4value_shorthands($this->property, $this->value));
    if (is_array($shorthands[$this->property])) {
      $this->css[$this->at][$this->selector][$this->property] = '';
    }
  }
}