function acquia_purge_manualpurge_form_validate in Acquia Purge 6
Callback to drupal_get_form: validate the form.
File
- ./
acquia_purge.admin.inc, line 123 - Admin page callbacks and theme functions for the Acquia Purge module.
Code
function acquia_purge_manualpurge_form_validate($form, &$form_state) {
$paths = array();
foreach ($form_state['values']['paths']['path'] as $id => $path) {
if (empty($path)) {
continue;
}
if (!is_string($path)) {
form_set_error('paths][path][' . $id, t("The path has to be a string!"));
}
elseif (stristr($path, 'http:') || stristr($path, 'https:')) {
form_set_error('paths][path][' . $id, t("You can't provide a URL, only paths!"));
}
elseif (preg_match('/\\s/', $path)) {
form_set_error('paths][path][' . $id, t('The path can not contain a space!'));
}
elseif (in_array($path, $paths)) {
form_set_error('paths][path][' . $id, t('You have already listed this path!'));
}
$paths[] = $path;
}
}