function panels_page_disassemble_css in Panels 6.2
Same name and namespace in other branches
- 5.2 panels_page/panels_page.css_filter.inc \panels_page_disassemble_css()
Disassemble the css string.
Strip the css of irrelevant characters, invalid/malformed selectors and declarations, and otherwise prepare it for processing.
Parameters
string $css: A string containing the css to be disassembled.
Return value
array $disassembled_css An array of disassembled, slightly cleaned-up/formatted css statements.
1 call to panels_page_disassemble_css()
- panels_page_custom_css in panels_page/
panels_page.render.inc - Add custom css entered on the configuration form, if any. Filter it first.
File
- panels_page/
panels_page.css_filter.inc, line 83
Code
function panels_page_disassemble_css($css) {
$disassembled_css = array();
// Remove comments.
$css = preg_replace("/\\/\\*(.*)?\\*\\//Usi", "", $css);
// Split out each statement
$statements = explode("}", $css);
// If we have any statements, parse them.
if (!empty($statements)) {
// Iterate through all of the statements.
foreach ($statements as $statement) {
// Get the selector(s) and declaration.
list($selector_str, $declaration) = explode('{', $statement);
// If the selector exists, then disassemble it, check it, and regenerate
// the selector string.
$selector_str = empty($selector_str) ? FALSE : panels_page_disassemble_css_selector($selector_str);
if (empty($selector_str)) {
// No valid selectors. Bomb out and start the next item.
continue;
}
// Disassemble the declaration, check it and tuck it into an array.
$disassembled_css[$selector_str] = panels_page_disassemble_css_declaration(strtolower($declaration));
}
}
return $disassembled_css;
}