You are here

function geoip_views_query_substitutions in GeoIP API 7.2

Implements hook_views_query_substitutions().

File

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

Code

function geoip_views_query_substitutions($view) {
  $cache =& drupal_static(__FUNCTION__, array());

  // Since evaluating all the details can take some time we cache this per
  // request, so multiple views won't slow down the execution.
  if (empty($cache)) {
    $cache = array(
      '***GEOIP_CONTINENT_CODE***' => geoip_continent_code(),
      '***GEOIP_CONTINENT_NAME***' => geoip_continent_name(),
      '***GEOIP_COUNTRY_CODE***' => geoip_country_code(),
      '***GEOIP_COUNTRY_NAME***' => geoip_country_name(),
      '***GEOIP_REGION_CODE***' => geoip_region_code(),
      '***GEOIP_REGION_NAME***' => geoip_region_name(),
    );
  }
  return $cache;
}