You are here

private function CSSCompression_Trim::escape in Advanced CSS/JS Aggregation 6

Same name and namespace in other branches
  1. 7 advagg_css_compress/css-compressor-3.x/src/lib/Trim.inc \CSSCompression_Trim::escape()

Escape out possible splitter characters within urls

Parameters

(string) css: Full stylesheet:

1 call to CSSCompression_Trim::escape()
CSSCompression_Trim::trim in advagg_css_compress/css-compressor-3.x/src/lib/Trim.inc
Central trim handler

File

advagg_css_compress/css-compressor-3.x/src/lib/Trim.inc, line 171

Class

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

Code

private function escape($css) {
  foreach ($this->rescape as $regex) {
    $start = 0;
    while (preg_match($regex, $css, $match, PREG_OFFSET_CAPTURE, $start)) {
      $value = $match[1][0] . str_replace($this->escaped['search'], $this->escaped['replace'], $match[2][0]) . $match[3][0];
      $css = substr_replace($css, $value, $match[0][1], strlen($match[0][0]));
      $start = $match[0][1] + strlen($value) + 1;
    }
  }
  return $css;
}