function resource_hints_admin_form_validate in Resource Hints 7.2
Same name and namespace in other branches
- 7 resource_hints.admin.inc \resource_hints_admin_form_validate()
Implements hook_form_validate().
1 string reference to 'resource_hints_admin_form_validate'
- resource_hints_dns_prefetch_admin in ./
resource_hints.admin.inc - Form constructor for the resource hints admin form.
File
- ./
resource_hints.admin.inc, line 128 - Admin page callbacks for the resource hints module.
Code
function resource_hints_admin_form_validate($form, &$form_state) {
$fields = array(
'resource_hints_dns_prefetch_resources',
'resource_hints_preconnect_resources',
'resource_hints_prefetch_resources',
'resource_hints_prerender_resources',
);
foreach ($fields as $field) {
$values = $form_state['values'][$field];
$values = explode(PHP_EOL, $values);
foreach ($values as $value) {
$value = trim($value);
if (strlen($value) && (drupal_strip_dangerous_protocols($value) != $value || !valid_url($value))) {
form_set_error($field, t('Please enter valid URLs.'));
break 2;
}
}
}
}