function _ctools_css_disassemble_selector in Chaos Tool Suite (ctools) 6
Same name and namespace in other branches
- 7 includes/css.inc \_ctools_css_disassemble_selector()
1 call to _ctools_css_disassemble_selector()
- ctools_css_disassemble in includes/
css.inc - Disassemble the css string.
File
- includes/
css.inc, line 344
Code
function _ctools_css_disassemble_selector($selector_str) {
// Get all selectors individually.
$selectors = explode(",", trim($selector_str));
// Iterate through all the selectors, sanity check them and return if they
// pass. Note that this handles 0, 1, or more valid selectors gracefully.
foreach ($selectors as $key => $selector) {
// Replace un-needed characters and do a little cleanup.
$selector = preg_replace("/[\n|\t|\\|\\s]+/", ' ', trim($selector));
// Make sure this is still a real selector after cleanup.
if (!empty($selector)) {
$selectors[$key] = $selector;
}
else {
// Selector is no good, so we scrap it.
unset($selectors[$key]);
}
}
// Check for malformed selectors; if found, we skip this declaration.
if (empty($selectors)) {
return FALSE;
}
return implode(', ', $selectors);
}