You are here

public function CSSCompression_Combine_List::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/List.inc \CSSCompression_Combine_List::combine()

Combines multiple list style props into single definition

Parameters

(string) val: Rule Set:

File

advagg_css_compress/css-compressor-3.x/src/lib/Combine/List.inc, line 46

Class

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

Code

public function combine($val) {

  // If replacement string found, run it on all declarations
  if (($replace = $this
    ->replace($val)) !== false) {
    $pos = 0;
    while (preg_match($this->rlist, $val, $match, PREG_OFFSET_CAPTURE, $pos)) {
      $colon = strlen($match[1][0]);
      $val = substr_replace($val, $replace, $match[0][1] + $colon, strlen($match[0][0]) - $colon);
      $pos = $match[0][1] + strlen($replace) - $colon - 1;
      $replace = '';
    }
  }

  // Return converted val
  return $val;
}