You are here

function analytics_get_service_info in Analytics 7

4 calls to analytics_get_service_info()
analytics_features_export_alter in ./analytics.module
Implements hook_features_export_alter().
analytics_get_service_instance in ./analytics.module
analytics_service_add_service_options in ./analytics.module
analytics_service_edit_form in lib/export_ui/analytics_service_export_ui.inc

File

./analytics.module, line 109

Code

function analytics_get_service_info($service = NULL, $reset = FALSE) {
  $info =& drupal_static(__FUNCTION__, array());
  if ($reset) {
    $info = NULL;
    cache_clear_all('analytics-info:', 'cache', TRUE);
  }
  $cid = 'analytics-info:' . $GLOBALS['language']->language;
  if (!isset($info[$cid])) {
    $info[$cid] = array();
    if ($cache = cache_get($cid)) {
      $info[$cid] = $cache->data;
    }
    else {
      foreach (module_implements('analytics_service_info') as $module) {
        if ($module_info = module_invoke($module, 'analytics_service_info')) {
          foreach ($module_info as $key => $value) {
            $module_info[$key]['module'] = $module;
          }
          $info[$cid] = array_merge_recursive($info[$cid], $module_info);
        }
      }
      drupal_alter('analytics_service_info', $info[$cid]);
      cache_set($cid, $info[$cid]);
    }
  }
  if (isset($service)) {
    return !empty($info[$cid][$service]) ? $info[$cid][$service] : FALSE;
  }
  else {
    return $info[$cid];
  }
}