You are here

function _device_geolocation_allowed_pages_validate in Smart IP 7

Same name and namespace in other branches
  1. 6 modules/device_geolocation/device_geolocation.module \_device_geolocation_allowed_pages_validate()

Validation handler to update the "Geolocate on specific pages".

1 string reference to '_device_geolocation_allowed_pages_validate'
device_geolocation_form_alter in modules/device_geolocation/device_geolocation.module
Implements hook_form_alter()

File

modules/device_geolocation/device_geolocation.module, line 153
Provides visitor's geographical location using client device location source that implements W3C Geolocation API and Google Geocoding service.

Code

function _device_geolocation_allowed_pages_validate($form, &$form_state) {
  $list = check_plain($form_state['values']['device_geolocation_allowed_pages']);
  $form_state['values']['device_geolocation_allowed_pages'] = str_replace('&lt;front&gt;', '<front>', $list);
  $value = $form_state['values']['device_geolocation_check_frequency'];
  if ($value !== '' && (!is_numeric($value) || $value < 0)) {
    form_set_error('device_geolocation_check_frequency', t("Frequency of user's geolocation checking must be a positive number."));
  }
  else {

    // Convert from hours to seconds
    $form_state['values']['device_geolocation_check_frequency'] = $value * 3600;
  }
}