You are here

public function CSSCompression_Combine_Aural::combine in Advanced CSS/JS Aggregation 7

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

Combines Aural properties (currently being depreciated in W3C Standards)

Parameters

(string) val: Rule Set:

File

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

Class

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

Code

public function combine($val) {
  $storage = $this
    ->storage($val);
  $pos = 0;

  // Replace first occurance with it's prop, and remove all following occurances
  while (preg_match($this->raural, $val, $match, PREG_OFFSET_CAPTURE, $pos)) {
    $prop = $match[2][0];
    if (isset($storage[$prop])) {
      $colon = strlen($match[1][0]);
      $val = substr_replace($val, $storage[$prop], $match[0][1] + $colon, strlen($match[0][0]) - $colon);
      $pos = $match[0][1] + strlen($storage[$prop]) - $colon - 1;
      $storage[$prop] = '';
    }
    else {
      $pos = $match[0][1] + strlen($match[0][0]) - 1;
    }
  }

  // Return converted val
  return $val;
}