You are here

function w3c_validator_admin_settings in W3C Validator 6

Same name and namespace in other branches
  1. 7 w3c_validator.admin.inc \w3c_validator_admin_settings()

Module settings.

Parameters

string $form_state:

Return value

void

1 string reference to 'w3c_validator_admin_settings'
w3c_validator_menu in ./w3c_validator.module
Implementation of hook_menu().

File

./w3c_validator.pages.inc, line 14
Page callbacks for the w3c validator module.

Code

function w3c_validator_admin_settings($form_state) {
  $form = array();
  $tidy_available = function_exists('tidy_get_output');
  $method = variable_get('w3c_validator_method', 'w3c_markup_validator');
  if (!$tidy_available) {
    $method = 'w3c_markup_validator';
  }
  $form['w3c_validator_method'] = array(
    '#type' => 'radios',
    '#title' => t('Validation method'),
    '#options' => array(
      'w3c_markup_validator' => t('W3C Markup Validator'),
    ),
    '#default_value' => $method,
  );
  if ($tidy_available) {
    $form['w3c_validator_method']['#options']['tidy'] = t('Tidy library');
  }
  $form['w3c_markup_validator'] = array(
    '#type' => 'fieldset',
    '#title' => t('W3C Markup validator settings'),
    '#description' => t('This module uses the official W3c Validator scripts. You must install the official w3c validator on your own server and provide the url here or you could use the official w3c validator.') . '<br />' . t('For instructions on how to install an instance of the w3c validator scripts you have instructions at <a href="http://validator.w3.org/docs/install.html">http://validator.w3.org/docs/install.html</a>.') . '<br />' . t('Debian based distributions comes with a package called w3c_markup_validator which provides a ready to use install of the validator.') . '<br />' . t('Using the official w3c validator endpoint url for high volume of validations could be considered abuse of service.'),
    '#collapsible' => TRUE,
    '#collapsed' => $method != 'w3c_markup_validator',
  );
  $form['w3c_markup_validator']['w3c_validator_api_endpoint_uri'] = array(
    '#type' => 'textfield',
    '#title' => t('W3C Validator API endpoint URI'),
    '#description' => t('URI of the validator script where API calls will be targeted. You could use http://validator.w3.org/check althought its not recommended.'),
    '#default_value' => variable_get('w3c_validator_api_endpoint_uri', 'http://validator.w3.org/check'),
  );
  if ($tidy_available) {
    $form['tidy'] = array(
      '#type' => 'fieldset',
      '#title' => t('Tidy Library settings'),
      '#collapsible' => TRUE,
      '#collapsed' => $method != 'tidy',
    );
    $form['tidy']['w3c_validator_tidy_authenticated'] = array(
      '#type' => 'checkbox',
      '#title' => t('Allow validation of authenticated pages'),
      '#description' => t('The validation process will have the same access rights as the user running the validation. If not checked all validation is done as anonymous user.'),
      '#default_value' => variable_get('w3c_validator_tidy_authenticated', FALSE),
    );
  }
  return system_settings_form($form);
}