You are here

function linkchecker_admin_settings_form_validate in Link checker 5.2

Same name and namespace in other branches
  1. 6.2 includes/linkchecker.admin.inc \linkchecker_admin_settings_form_validate()
  2. 7 linkchecker.admin.inc \linkchecker_admin_settings_form_validate()

File

./linkchecker.module, line 331
This module periodically check links in given node types, blocks, cck fields, etc.

Code

function linkchecker_admin_settings_form_validate($form_id, &$form_values) {
  $form_values['linkchecker_disable_link_check_for_urls'] = trim($form_values['linkchecker_disable_link_check_for_urls']);
  $form_values['linkchecker_ignore_response_codes'] = trim($form_values['linkchecker_ignore_response_codes']);
  $ignore_response_codes = preg_split('/(\\r\\n?|\\n)/', $form_values['linkchecker_ignore_response_codes']);
  foreach ($ignore_response_codes as $ignore_response_code) {
    if (!_linkchecker_isvalid_response_code($ignore_response_code)) {
      form_set_error('linkchecker_ignore_response_codes', t('Invalid response code %code found.', array(
        '%code' => $ignore_response_code,
      )));
    }
  }

  // Prevent the removal of RFC documentation domains. This are the official and
  // reserved documentation domains and not "example" hostnames!
  $linkchecker_disable_link_check_for_urls = array_filter(preg_split('/(\\r\\n?|\\n)/', $form_values['linkchecker_disable_link_check_for_urls']));
  $form_values['linkchecker_disable_link_check_for_urls'] = implode("\n", array_unique(array_merge(explode("\n", LINKCHECKER_RESERVED_DOCUMENTATION_DOMAINS), $linkchecker_disable_link_check_for_urls)));
}