You are here

function _themekey_properties_explode_conditions in ThemeKey 7.2

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

Function _themekey_properties_explode_conditions() converts conditions formatted as string into an array. It was part of themekey_build.inc up to version 6.x-1.2. Now it's only required one more time to perform themekey_update_6200()

Parameters

$conditions: ThemeKey conditions as string

Return value

ThemeKey conditions as array

1 call to _themekey_properties_explode_conditions()
themekey_update_6200 in ./themekey.install
Implements hook_update_N().

File

./themekey.install, line 290
Database schema of

Code

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