You are here

function flickrapi_admin_settings_validate in Flickr API 5

Same name and namespace in other branches
  1. 6 flickrapi.module \flickrapi_admin_settings_validate()
  2. 7.2 flickrapi.admin.inc \flickrapi_admin_settings_validate()
  3. 7 flickrapi.admin.inc \flickrapi_admin_settings_validate()

File

./flickrapi.module, line 55

Code

function flickrapi_admin_settings_validate($form_id, $form) {
  $key = trim($form['flickrapi_api_key']);
  $sec = trim($form['flickrapi_api_secret']);
  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 ($sec && preg_match('/^[A-Fa-f\\d]{16}$/', $sec) != 1) {
    form_set_error('flickrapi_api_secret', t('This does not appear to be a Flickr API secret.'));
  }
}