private static function buildPath($content, $base) { if (preg_match_all('/@import\\s+(?:url\\s*(\\(|))\\s*([\'\\"]?)([^\'\\"\\()]+)(?(1)\\)|)(?(2)\\2|)\\;/i', $content, $matches)) { foreach ($matches[1] as $m => $match) { $path = jbetoloFileHelper::normalizeCall($base . '/' . $matches[3][$m], true, false); $content = str_replace($matches[0][$m], '@import url("' . $path . '");', $content); } } /** * @@todo: simplify and document regexps */ if (preg_match_all('/url\\([\'"]?(?![a-z]+:|\\/+)([^\'"\\?\\#)]+)([^\'")]+)?[\'"]?\\)/i', $content, $matches)) { foreach ($matches[1] as $m => $match) { if (self::$cdn_merged) { $path = jbetoloFileHelper::normalizeTOCDN($base . '/' . $match); if (!$path) { $path = jbetoloFileHelper::normalizeTOCDN(self::$root . '/' . $match); } } else { $abs = plgSystemJBetolo::param('css_map_resources_absolute', false); $path = jbetoloFileHelper::normalizeCall($base . '/' . $match, $abs, false); if (!$path) { $path = jbetoloFileHelper::normalizeCall(self::$root . '/' . $match, $abs, false); } } $path = self::processResources($path); if ($path) { $path .= $matches[2][$m]; $content = str_replace($matches[0][$m], 'url(' . $path . ')', $content); } } } return $content; }