function linkchecker_admin_settings_form_validate in Link checker 7
Same name and namespace in other branches
- 5.2 linkchecker.module \linkchecker_admin_settings_form_validate()
- 6.2 includes/linkchecker.admin.inc \linkchecker_admin_settings_form_validate()
Implements hook_admin_settings_form_validate().
File
- ./
linkchecker.admin.inc, line 263 - Administrative page callbacks for the linkchecker module.
Code
function linkchecker_admin_settings_form_validate($form, &$form_state) {
$form_state['values']['linkchecker_disable_link_check_for_urls'] = trim($form_state['values']['linkchecker_disable_link_check_for_urls']);
$form_state['values']['linkchecker_ignore_response_codes'] = trim($form_state['values']['linkchecker_ignore_response_codes']);
$ignore_response_codes = preg_split('/(\\r\\n?|\\n)/', $form_state['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_state['values']['linkchecker_disable_link_check_for_urls']));
$form_state['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)));
// Validate impersonation user name.
$linkchecker_impersonate_user = user_load_by_name($form_state['values']['linkchecker_impersonate_user']);
if (empty($linkchecker_impersonate_user->uid)) {
form_set_error('linkchecker_impersonate_user', t('User account %name cannot found.', array(
'%name' => $form_state['values']['linkchecker_impersonate_user'],
)));
}
}