location_standardize_country_code

  1. drupal
    1. 6 location.inc function
    2. 7 location.inc function
Drupal 7 location_standardize_country_code(&$country)

Canonicalize a country code.

6 calls to location_standardize_country_code()

File

sites/all/modules/location/location.inc, line 544
An implementation of a universal API for location manipulation. Provides functions for postal_code proximity searching, deep-linking into online mapping services. Currently, some options are configured through an interface provided by location.module.

Code

function location_standardize_country_code(&$country) {
  $country = trim($country);
  // @@@ Double check the validity of this validity check. ;)
  if (!ctype_alpha($country) || strlen($country) != 2) {
    $country = 'xx';
    return FALSE;
  }
  else {
    $country = strtolower($country);
    return TRUE;
  }
}