You are here

private function CSSmin::replace_string in Advanced CSS/JS Aggregation 8.3

Same name and namespace in other branches
  1. 8.2 advagg_css_minify/yui/CSSMin.inc \CSSmin::replace_string()
  2. 6 advagg_css_compress/yui/CSSMin.inc \CSSmin::replace_string()

File

advagg_css_minify/yui/CSSMin.inc, line 574

Class

CSSmin

Code

private function replace_string($matches) {
  $match = $matches[0];
  $quote = substr($match, 0, 1);

  // Must use addcslashes in PHP to avoid parsing of backslashes
  $match = addcslashes($this
    ->str_slice($match, 1, -1), '\\');

  // maybe the string contains a comment-like substring?
  // one, maybe more? put'em back then
  if (($pos = $this
    ->index_of($match, self::COMMENT)) >= 0) {
    for ($i = 0, $max = count($this->comments); $i < $max; $i++) {
      $match = preg_replace('/' . self::COMMENT . $i . '___/', $this->comments[$i], $match, 1);
    }
  }

  // minify alpha opacity in filter strings
  $match = preg_replace('/progid\\:DXImageTransform\\.Microsoft\\.Alpha\\(Opacity\\=/i', 'alpha(opacity=', $match);
  $this->preserved_tokens[] = $match;
  return $quote . self::TOKEN . (count($this->preserved_tokens) - 1) . '___' . $quote;
}