You are here

function panels_page_disassemble_css_selector in Panels 6.2

Same name and namespace in other branches
  1. 5.2 panels_page/panels_page.css_filter.inc \panels_page_disassemble_css_selector()
1 call to panels_page_disassemble_css_selector()
panels_page_disassemble_css in panels_page/panels_page.css_filter.inc
Disassemble the css string.

File

panels_page/panels_page.css_filter.inc, line 112

Code

function panels_page_disassemble_css_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]+/", ' ', strtolower(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);
}