You are here

function csstidy::explode_selectors in Advanced CSS/JS Aggregation 6

Explodes selectors @access private @version 1.0

1 call to csstidy::explode_selectors()
csstidy::parse in advagg_css_compress/csstidy/class.csstidy.inc
Parses CSS in $string. The code is saved as array in $this->css

File

advagg_css_compress/csstidy/class.csstidy.inc, line 934

Class

csstidy
CSS Parser class

Code

function explode_selectors() {

  // Explode multiple selectors
  if ($this
    ->get_cfg('merge_selectors') === 1) {
    $new_sels = array();
    $lastpos = 0;
    $this->sel_separate[] = strlen($this->selector);
    foreach ($this->sel_separate as $num => $pos) {
      if ($num == count($this->sel_separate) - 1) {
        $pos += 1;
      }
      $new_sels[] = substr($this->selector, $lastpos, $pos - $lastpos - 1);
      $lastpos = $pos;
    }
    if (count($new_sels) > 1) {
      foreach ($new_sels as $selector) {
        if (isset($this->css[$this->at][$this->selector])) {
          $this
            ->merge_css_blocks($this->at, $selector, $this->css[$this->at][$this->selector]);
        }
      }
      unset($this->css[$this->at][$this->selector]);
    }
  }
  $this->sel_separate = array();
}