You are here

function w3c_validator_requirements in W3C Validator 7

Same name and namespace in other branches
  1. 6 w3c_validator.module \w3c_validator_requirements()

Implements hook_requirements().

File

./w3c_validator.module, line 120

Code

function w3c_validator_requirements($phase) {
  $requirements = array();
  if ($phase == 'runtime' && variable_get('w3c_validator_method', 'w3c_markup_validator') == 'w3c_markup_validator') {
    $endpoint = variable_get('w3c_validator_api_endpoint_uri', 'http://validator.w3.org/check');
    $severity = REQUIREMENT_OK;
    $description = '';
    if ($endpoint == 'http://validator.w3.org/check') {
      $severity = REQUIREMENT_WARNING;
      $description = t('W3C Validator module is configured to use the official W3C validator API endpoint. You should <a href="!url">change the configuration</a> to point to your own instance of the validator, using the official endpoint intensively could be considered abuse of service. See the module documentation on how to install your own instance of the validator.', array(
        '!url' => url('admin/settings/w3c_validator'),
      ));
    }
    else {
      if (empty($endpoint)) {
        $severity = REQUIREMENT_ERROR;
        $description = t('W3C Validator module is not configured to use a proper API endpoint. You should <a href="!url">change the onfiguration</a> to point to your own instance of the validator, using the official endpoint intensively could be considered abuse of service. See the module documentation on how to install your own instance of the validator.', array(
          '!url' => url('admin/settings/w3c_validator'),
        ));
      }
    }
    $requirements['w3c_validator'] = array(
      'title' => t('W3C Validator endpoint'),
      'value' => $endpoint,
      'description' => $description,
      'severity' => $severity,
    );
  }
  return $requirements;
}