You are here

function _themekey_properties_explode_conditions in ThemeKey 6

Same name and namespace in other branches
  1. 6.4 themekey.install \_themekey_properties_explode_conditions()
  2. 6.2 themekey.install \_themekey_properties_explode_conditions()
  3. 6.3 themekey.install \_themekey_properties_explode_conditions()
  4. 7.3 themekey.install \_themekey_properties_explode_conditions()
  5. 7 themekey.install \_themekey_properties_explode_conditions()
  6. 7.2 themekey.install \_themekey_properties_explode_conditions()

Function _themekey_properties_explode_conditions().

1 call to _themekey_properties_explode_conditions()
_themekey_properties_set in ./themekey_build.inc
Function _themekey_properties_set().

File

./themekey_build.inc, line 279

Code

function _themekey_properties_explode_conditions($conditions) {
  if (!is_array($conditions)) {
    $parts = array_filter(explode(';', $conditions));
    $conditions = array();
    foreach ($parts as $part) {
      if (preg_match('/(.*)([<>=!]+)(.*)/', $part, $matches)) {
        $conditions[] = array(
          'property' => trim($matches[1]),
          'operator' => trim($matches[2]),
          'value' => trim($matches[3]),
        );
      }
    }
  }
  return $conditions;
}