You are here

function siteimprove_admin_settings_form_validate in Siteimprove 7

Extra validation of the settings form.

1 string reference to 'siteimprove_admin_settings_form_validate'
siteimprove_admin_settings_form in ./siteimprove.admin.inc
Implements hook_admin_settings() for module settings configuration.

File

./siteimprove.admin.inc, line 61
Administrative page callbacks for the siteimprove module.

Code

function siteimprove_admin_settings_form_validate(&$form, &$form_state) {
  $domain = $form_state['values']['siteimprove_frontend_domain'];
  if (!empty($domain) && !preg_match('/^(https?:\\/\\/)?([a-zA-Z0-9][a-zA-Z0-9-_]*\\.)*[a-zA-Z0-9]*[a-zA-Z0-9-_]*[[a-zA-Z0-9]+(:\\d+)?$/', $domain)) {
    form_set_error('siteimprove_frontend_domain', t('Only use valid domain names in this field - no trailing slash, no trailing whitespace.'));
  }
}