You are here

function geoip_get_api_version in GeoIP API 7.2

Returns the version of the api to use.

Defaults to 2.

Return value

int The version number of the api to use. Defaults to 2.

1 call to geoip_get_api_version()
geoip_instance in ./geoip.module
Returns the instance to handle the configured file.

File

./geoip.module, line 54
API for using the MaxMind GeoLite Country database.

Code

function geoip_get_api_version() {

  // Check if it is configured.
  if ($version = variable_get('geoip_db_version', FALSE)) {
    return $version;
  }

  // Try our luck with the db file.
  if ($db_file = variable_get('geoip_data_file', NULL)) {
    $extension = pathinfo($db_file, PATHINFO_EXTENSION);
    if ($extension == 'dat') {
      return 1;
    }
  }

  // Default to 2.
  return 2;
}