You are here

function antispam_requirements in AntiSpam 6

Same name and namespace in other branches
  1. 7 antispam.install \antispam_requirements()

Implementation of hook_requirement().

File

./antispam.module, line 111

Code

function antispam_requirements($phase) {
  $t = get_t();
  $provider = antispam_get_service_provider();
  if ($phase == 'runtime') {
    if ($provider == AKISMET_SERVICE) {
      if (variable_get('antispam_wpapikey', '') == '') {
        $requirements['antispam_key'] = array(
          'title' => t('Akismet API key'),
          'value' => t('Not present'),
          'description' => t("Akismet spam protection service requires a <a href='!wpapikey'>WordPress.com API key</a> to function. Obtain a key by signing up for a free account at <a href='!wordpress-com'>WordPress.com</a>, then enter the key on the <a href='!antispam-settings'>AntiSpam settings page</a>.", array(
            '!wpapikey' => url('http://wordpress.com/api-keys/'),
            '!wordpress-com' => url('http://wordpress.com'),
            '!antispam-settings' => url('admin/settings/antispam'),
          )),
          'severity' => REQUIREMENT_ERROR,
        );
        return $requirements;
      }
    }
    else {
      if ($provider == TYPEPAD_SERVICE) {
        if (variable_get('antispam_tpapikey', '') == '') {
          $requirements['antispam_key'] = array(
            'title' => t('TypePad AntiSpam API key'),
            'value' => t('Not present'),
            'description' => t("TypePad AntiSpam service requires a <a href='!tpapikey'>TypePad.com AntiSpam API key</a> to function. Obtain a key by signing up for a free account at <a href='!typepad-com'>Typepad.com</a>. Once you get a free account, visit the <a href='!tpapikey'>TypePad AntiSpam Service</a> and get your free TypePad AntiSpam API Key there, then enter the key on the <a href='!antispam-settings'>AntiSpam settings page</a>.", array(
              '!tpapikey' => url('http://antispam.typepad.com/info/get-api-key.html'),
              '!typepad-com' => url('http://typepad.com/connect/register'),
              '!antispam-settings' => url('admin/settings/antispam'),
            )),
            'severity' => REQUIREMENT_ERROR,
          );
          return $requirements;
        }
      }
      else {
        if ($provider == DEFENSIO_SERVICE) {
          if (variable_get('antispam_deapikey', '') == '') {
            $requirements['antispam_key'] = array(
              'title' => t('Defensio AntiSpam API key'),
              'value' => t('Not present'),
              '#description' => t("Defensio spam protection service requires a <a href='!defensio-com'>Defensio API key</a> to function. Obtain a key by signing up for a free account at <a href='!defensio-key'>Defensio.com</a> and get your free Defensio API key there, then enter the key on the <a href='!antispam-settings'>AntiSpam settings page</a>.", array(
                '!defensio-com' => url('http://defensio.com/'),
                '!defensio-key' => url('http://defensio.com/signup/'),
                '!antispam-settings' => url('admin/settings/antispam'),
              )),
              'severity' => REQUIREMENT_ERROR,
            );
            return $requirements;
          }
        }
      }
    }
  }
}