You are here

function panels_page_disassemble_css_declaration 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_declaration()
1 call to panels_page_disassemble_css_declaration()
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 137

Code

function panels_page_disassemble_css_declaration($declaration) {
  $formatted_statement = array();
  $propval_pairs = explode(";", $declaration);

  // Make sure we actually have some properties to work with.
  if (!empty($propval_pairs)) {

    // Iterate through the remains and parse them.
    foreach ($propval_pairs as $key => $propval_pair) {

      // Check that we have a ':', otherwise it's an invalid pair.
      if (strpos($propval_pair, ':') === FALSE) {
        continue;
      }

      // Clean up the current property-value pair.
      $propval_pair = preg_replace("/[\n|\t|\\|\\s]+/", ' ', strtolower(trim($propval_pair)));

      // Explode the remaining fragements some more, but clean them up first.
      list($property, $value) = explode(':', $propval_pair);

      // If the property survived, toss it onto the stack.
      if (!empty($property)) {
        $formatted_statement[trim($property)] = trim($value);
      }
    }
  }
  return $formatted_statement;
}