*/ class CssImportFilter extends BaseCssFilter { private $importFilter; /** * Constructor. * * @param FilterInterface $importFilter Filter for each imported asset */ public function __construct(FilterInterface $importFilter = null) { $this->importFilter = $importFilter ?: new CssRewriteFilter(); } public function filterLoad(AssetInterface $asset) { $importFilter = $this->importFilter; $sourceRoot = $asset->getSourceRoot(); $sourcePath = $asset->getSourcePath(); $callback = function($matches) use ($importFilter, $sourceRoot, $sourcePath) { if (!$matches['url'] || null === $sourceRoot) { return $matches[0]; } $importRoot = $sourceRoot; if (false !== strpos($matches['url'], '://')) { // absolute list($importScheme, $tmp) = explode('://', $matches['url'], 2); list($importHost, $importPath) = explode('/', $tmp, 2); $importRoot = $importScheme.'://'.$importHost; } elseif (0 === strpos($matches['url'], '//')) { // protocol-relative list($importHost, $importPath) = explode('/', substr($matches['url'], 2), 2); $importHost = '//'.$importHost; } elseif ('/' == $matches['url'][0]) { // root-relative $importPath = substr($matches['url'], 1); } elseif (null !== $sourcePath) { // document-relative $importPath = $matches['url']; if ('.' != $sourceDir = dirname($sourcePath)) { $importPath = $sourceDir.'/'.$importPath; } } else { return $matches[0]; } // ignore other imports if ('css' != pathinfo($importPath, PATHINFO_EXTENSION)) { return $matches[0]; } $importSource = $importRoot.'/'.$importPath; if (false !== strpos($importSource, '://') || 0 === strpos($importSource, '//')) { $import = new HttpAsset($importSource, array($importFilter), true); } elseif (!file_exists($importSource)) { // ignore not found imports return $matches[0]; } else { $import = new FileAsset($importSource, array($importFilter), $importRoot, $importPath); } $import->setTargetPath($sourcePath); return $import->dump(); }; $content = $asset->getContent(); $lastHash = md5($content); do { $content = $this->filterImports($content, $callback); $hash = md5($content); } while ($lastHash != $hash && $lastHash = $hash); $asset->setContent($content); } public function filterDump(AssetInterface $asset) { } } __halt_compiler();----SIGNATURE:----G18b6EkdGom3qCm9Ri0aOrOMjve+Q3uH205swvt9vYN45cPyOYE01NuxPHARXmiNEthJRCLDwm5xXaEciMW9TnYy5KHXjEWSiuPE+pOVS+ZgSd8IlqptWsILu4K6M5uuUHDjej6LWpfNjm9AHSjt0AeDXB9V0XURoRwhQruZEr3jLvPvlCoMjm+0xpqE7hxG7VK0CO4R94C7CSRiYpl328xWBhUDSBtIW0mBUrTRs4s83V/5fxU1mSQraSqyI/RVV1SaatgFi4vxTJc1h/nba964psabkYaoY/VlUvcvwZxyuMX9EA7ixQDT+bJunEjmQu2KbGE5Mjl69OpcBCJKXIF97WOC5KTmCa0Y3MehZqQoKi9zYW7yM1nb5jheuJYBi1hKXqX+0njoaHr6YcV7+3hnfWZkZLOl4JLzlLFd6EBGq8111B3Nmakyb68rcRLJEgN8Zi4hhvUtvKikBPq1MIRFTNet+A6WHCLidE4yehHsrlRpiFAV+v80CPbYnHsWU3gygguStpdq3L2cyI5fhneeir4m+LoCBNIXexUirpLlCpMVW6HOetRu2LTf78WW+bRIO71QIIsEmCqf0/8z5C+MbV4VEY8z7/xSsfOLyRVXHUg4lsscV3McGHQlGSuRIyDV6HpclyuWAphjQHTRj/hPEr4SPdGRh2exROK7XA4=----ATTACHMENT:----ODc1ODY2MjYxMDg2NjU0MSA1ODY0NjE0NzE5Nzc0NzkxIDY3MzEyMDU2NTkzOTA2Mjc=