You are here

function hosting_get_features in Hosting 5

Same name and namespace in other branches
  1. 6.2 hosting.features.inc \hosting_get_features()
  2. 7.4 hosting.features.inc \hosting_get_features()
  3. 7.3 hosting.features.inc \hosting_get_features()
5 calls to hosting_get_features()
hosting_feature in ./hosting.features.inc
hosting_features_form in ./hosting.features.inc
hosting_features_form_submit in ./hosting.features.inc
hosting_feature_node_types in ./hosting.features.inc
hosting_menu in ./hosting.module
Implementation of hook_menu()

File

./hosting.features.inc, line 95
Hosting features

Code

function hosting_get_features($refresh = FALSE) {
  $cache = cache_get('hosting_features');
  if (!$cache->data || $refresh) {

    ## include any optional hosting.feature.*.inc files
    $files = drupal_system_listing("hosting\\.feature\\.[a-zA-Z_]*\\.inc\$", "modules");
    if (sizeof($files)) {
      foreach ($files as $name => $info) {
        include_once $info->filename;
      }
    }
    $functions = get_defined_functions();
    foreach ($functions['user'] as $function) {
      if (preg_match('/_hosting_feature$/', $function)) {
        $hooks[] = $function;
      }
    }
    $features = array();
    foreach ($hooks as $func) {
      $features = array_merge($features, $func());
    }
    cache_set('hosting_features', 'cache', serialize($features));
    return $features;
  }
  else {
    return unserialize($cache->data);
  }
}