You are here

function googleanalytics_requirements in Google Analytics 7.2

Same name and namespace in other branches
  1. 5 googleanalytics.module \googleanalytics_requirements()
  2. 6.4 googleanalytics.install \googleanalytics_requirements()
  3. 6 googleanalytics.module \googleanalytics_requirements()
  4. 6.2 googleanalytics.install \googleanalytics_requirements()
  5. 6.3 googleanalytics.install \googleanalytics_requirements()
  6. 7 googleanalytics.install \googleanalytics_requirements()

Implements hook_requirements().

File

./googleanalytics.install, line 62
Installation file for Google Analytics module.

Code

function googleanalytics_requirements($phase) {
  $requirements = array();
  $t = get_t();
  if ($phase == 'runtime') {

    // Raise warning if Google user account has not been set yet.
    if (!preg_match('/^UA-\\d+-\\d+$/', variable_get('googleanalytics_account', 'UA-'))) {
      $requirements['googleanalytics_account'] = array(
        'title' => $t('Google Analytics module'),
        'description' => $t('Google Analytics module has not been configured yet. Please configure its settings from the <a href="@url">Google Analytics settings page</a>.', array(
          '@url' => url('admin/config/system/googleanalytics'),
        )),
        'severity' => REQUIREMENT_WARNING,
        'value' => $t('Not configured'),
      );
    }

    // Raise warning if debugging is enabled.
    if (variable_get('googleanalytics_debug', 0)) {
      $requirements['google_analytics_debugging'] = array(
        'title' => $t('Google Analytics module'),
        'description' => $t('Google Analytics module has debugging enabled. Please disable debugging setting in production sites from the <a href="@url">Google Analytics settings page</a>.', array(
          '@url' => url('admin/config/system/googleanalytics'),
        )),
        'severity' => REQUIREMENT_WARNING,
        'value' => $t('Debugging enabled'),
      );
    }
  }
  return $requirements;
}