You are here

function smart_ip_get_region_static in Smart IP 8.3

Same name and namespace in other branches
  1. 8.4 smart_ip.module \smart_ip_get_region_static()
  2. 8.2 smart_ip.module \smart_ip_get_region_static()
  3. 6.2 smart_ip.module \smart_ip_get_region_static()
  4. 6 smart_ip.module \smart_ip_get_region_static()
  5. 7.2 smart_ip.module \smart_ip_get_region_static()
  6. 7 smart_ip.module \smart_ip_get_region_static()

Helper function for grabbing region name (FIPS).

2 calls to smart_ip_get_region_static()
SmartIp::userLocationFallback in src/SmartIp.php
Use server's mod_geoip, X-GeoIP and Cloudflare IP Geolocation as fallback if the user's geolocation is empty.
SmartIpEventSubscriber::processQuery in modules/smart_ip_ipinfodb_web_service/src/EventSubscriber/SmartIpEventSubscriber.php
Act on \Drupal\smart_ip\SmartIp::query() when executed and if selected as Smart IP data source, query the IP address against its database.

File

./smart_ip.module, line 177
Determines country, geo location (longitude/latitude), region, city and postal code of the user, based on IP address

Code

function smart_ip_get_region_static($country_code, $region_code) {
  $region =& drupal_static(__FUNCTION__);
  if (!isset($region[$country_code][$region_code])) {
    module_load_include('inc', 'smart_ip', 'includes/smart_ip.region_lookup');
    $region[$country_code][$region_code] = smart_ip_get_region($country_code, $region_code);
  }
  return $region;
}