You are here

function csstidy_print::_convert_raw_css in Advanced CSS/JS Aggregation 7

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

Converts $this->css array to a raw array ($this->tokens)

@access private @version 1.0

Parameters

string $default_media default @media to add to selectors without any @media:

1 call to csstidy_print::_convert_raw_css()
csstidy_print::_print in advagg_css_compress/csstidy/class.csstidy_print.inc
Returns the formatted CSS Code and saves it into $this->output_css and $this->output_css_plain

File

advagg_css_compress/csstidy/class.csstidy_print.inc, line 307

Class

csstidy_print
CSS Printing class

Code

function _convert_raw_css($default_media = '') {
  $this->tokens = array();
  foreach ($this->css as $medium => $val) {
    if ($this->parser
      ->get_cfg('sort_selectors')) {
      ksort($val);
    }
    if (intval($medium) < DEFAULT_AT) {
      $this->parser
        ->_add_token(AT_START, $medium, true);
    }
    elseif ($default_media) {
      $this->parser
        ->_add_token(AT_START, $default_media, true);
    }
    foreach ($val as $selector => $vali) {
      if ($this->parser
        ->get_cfg('sort_properties')) {
        ksort($vali);
      }
      $this->parser
        ->_add_token(SEL_START, $selector, true);
      foreach ($vali as $property => $valj) {
        $this->parser
          ->_add_token(PROPERTY, $property, true);
        $this->parser
          ->_add_token(VALUE, $valj, true);
      }
      $this->parser
        ->_add_token(SEL_END, $selector, true);
    }
    if (intval($medium) < DEFAULT_AT) {
      $this->parser
        ->_add_token(AT_END, $medium, true);
    }
    elseif ($default_media) {
      $this->parser
        ->_add_token(AT_END, $default_media, true);
    }
  }
}