You are here

private function CSSCompression_Combine_Aural::storage in Advanced CSS/JS Aggregation 6

Same name and namespace in other branches
  1. 7 advagg_css_compress/css-compressor-3.x/src/lib/Combine/Aural.inc \CSSCompression_Combine_Aural::storage()

Builds a storage object for iteration

Parameters

(string) val: Rule Set:

1 call to CSSCompression_Combine_Aural::storage()
CSSCompression_Combine_Aural::combine in advagg_css_compress/css-compressor-3.x/src/lib/Combine/Aural.inc
Combines Aural properties (currently being depreciated in W3C Standards)

File

advagg_css_compress/css-compressor-3.x/src/lib/Combine/Aural.inc, line 63

Class

CSSCompression_Combine_Aural
CSS Compressor [VERSION] [DATE] Corey Hart @ http://www.codenothing.com

Code

private function storage($val) {
  $storage = array();

  // Find all possible occurences and build the replacement
  $pos = 0;
  while (preg_match($this->raural, $val, $match, PREG_OFFSET_CAPTURE, $pos)) {
    if (!isset($storage[$match[2][0]])) {
      $storage[$match[2][0]] = array(
        $match[3][0] => $match[4][0],
      );
    }

    // Override double written properties
    $storage[$match[2][0]][$match[3][0]] = $match[4][0];
    $pos = $match[0][1] + strlen($match[0][0]) - 1;
  }

  // Go through each tag for possible combination
  foreach ($storage as $tag => $arr) {

    // All three have to be defined
    if (count($arr) == 2 && !$this->Combine
      ->checkUncombinables($arr)) {
      $storage[$tag] = "{$tag}:" . $arr['before'] . ' ' . $arr['after'] . ';';
    }
    else {
      unset($storage[$tag]);
    }
  }
  return $storage;
}