32 $css = preg_replace(
'!/\*[^*]*\*+([^/][^*]*\*+)*/!',
'', $css);
34 $css = preg_replace(
'/@[-|keyframes].*?\{.*?\}[ \r\n]*?/s',
'', $css);
36 foreach(explode(
"}", $css) as $declarationBlock)
38 $declarationBlock = trim($declarationBlock);
39 if(!$declarationBlock)
44 $declarationBlockExploded = explode(
"{", $declarationBlock);
45 $selectorList = $declarationBlockExploded[0];
46 $declaration = $declarationBlockExploded[1];
47 $declaration = trim(trim($declaration),
";");
49 foreach(explode(
',', $selectorList) as $selector)
51 $selector = trim($selector);
53 'SELECTOR' => $selector,
54 'STYLE' => static::getDeclarationArray($declaration),
95 $declarationBlock = trim($declarationBlock);
99 $declarationBlock = str_replace(
';base64',
'__base64', $declarationBlock);
100 foreach(explode(
";", $declarationBlock) as $declaration)
102 $declaration = str_replace(
'__base64',
';base64', $declaration);
103 $declaration = trim($declaration);
110 if (!preg_match(
'#^([-a-z0-9\*]+):(.*)$#i', $declaration, $matches))
115 if(!isset($matches[0], $matches[1], $matches[2]))
120 $matches[1] = trim($matches[1]);
124 $styleList[$matches[1]] = trim($matches[2]);
128 if (!isset($styleList[$matches[1]]))
130 $styleList[$matches[1]] = [];
132 $styleList[$matches[1]][] = trim($matches[2]);