You are here

function _ip_geoloc_reinit_location in IP Geolocation Views & Maps 7

Same name and namespace in other branches
  1. 8 ip_geoloc.module \_ip_geoloc_reinit_location()

Reinitialises the supplied location array.

Parameters

array $location:

int $reverse_geocode_client_timeout:

1 call to _ip_geoloc_reinit_location()
ip_geoloc_init in ./ip_geoloc.module
Implements hook_init().

File

./ip_geoloc.module, line 330
IPGV&M is a mapping engine for Views that contain locations of entities and/or visitors. Google Maps, Leaflet and OpenLayers2 maps are all supported. and available through this module. Using a number of optional sources IPGV&M also retrieves…

Code

function _ip_geoloc_reinit_location(&$location, $reverse_geocode_client_timeout) {
  $location = array(
    'fixed_address' => isset($location['fixed_address']) ? (int) $location['fixed_address'] : NULL,
    'regions' => isset($location['regions']) ? $location['regions'] : NULL,
  );

  // Calls below are synchronous, $location is filled upon return.
  if (ip_geoloc_use_smart_ip_if_enabled($location) || ip_geoloc_use_geoip_api_if_enabled($location)) {
    if ($reverse_geocode_client_timeout) {
      watchdog('IPGV&M', 'Location timeout (waited %sec s). Fallback: %address.', array(
        '%sec' => number_format($reverse_geocode_client_timeout, 1),
        '%address' => isset($location['formatted_address']) ? $location['formatted_address'] : '',
      ), WATCHDOG_NOTICE);
    }
  }
  else {
    ip_geoloc_debug(t('Smart IP and GeoIP API fallbacks NOT enabled.'));
  }
}