You are here

function _features_sanitize in Features 7

Same name and namespace in other branches
  1. 6 features.export.inc \_features_sanitize()
  2. 7.2 features.export.inc \_features_sanitize()

"Sanitizes" an array recursively, performing two key operations:

  • Sort an array by its keys (assoc) or values (non-assoc)
  • Remove any null or empty values for associative arrays (array_filter()).
2 calls to _features_sanitize()
features_detect_overrides in ./features.export.inc
Detect differences between DB and code components of a feature.
features_get_signature in ./features.export.inc
Wrapper around features_get_[storage] to return an md5hash of a normalized defaults/normal object array. Can be used to compare normal/default states of a module's component.

File

./features.export.inc, line 863

Code

function _features_sanitize(&$array) {
  if (is_array($array)) {
    if (_features_is_assoc($array)) {
      ksort($array);
      $array = array_filter($array);
    }
    else {
      sort($array);
    }
    foreach ($array as $k => $v) {
      if (is_array($v)) {
        _features_sanitize($array[$k]);
      }
    }
  }
}