function flickrapi_admin_settings_validate in Flickr API 6
Same name and namespace in other branches
- 5 flickrapi.module \flickrapi_admin_settings_validate()
- 7.2 flickrapi.admin.inc \flickrapi_admin_settings_validate()
- 7 flickrapi.admin.inc \flickrapi_admin_settings_validate()
1 string reference to 'flickrapi_admin_settings_validate'
File
- ./
flickrapi.module, line 72
Code
function flickrapi_admin_settings_validate($form, &$form_state) {
$key = trim($form_state['values']['flickrapi_api_key']);
$secret = trim($form_state['values']['flickrapi_api_secret']);
$cache_dir = $form_state['values']['flickrapi_cache_path'];
if ($key && preg_match('/^[A-Fa-f\\d]{32}$/', $key) != 1) {
form_set_error('flickrapi_api_key', t('This does not appear to be a Flickr API key.'));
}
if ($secret && preg_match('/^[A-Fa-f\\d]{16}$/', $secret) != 1) {
form_set_error('flickrapi_api_secret', t('This does not appear to be a Flickr API secret.'));
}
if (!is_dir($cache_dir) || !is_writable($cache_dir)) {
form_set_error('flickrapi_cache_path', t('Folder does not exist or is not writable.'));
}
}