function location_standardize_country_code in Location 7.5
Same name and namespace in other branches
- 5.3 location.inc \location_standardize_country_code()
- 6.3 location.inc \location_standardize_country_code()
- 7.3 location.inc \location_standardize_country_code()
- 7.4 location.inc \location_standardize_country_code()
Canonicalize a country code.
6 calls to location_standardize_country_code()
- location_country_name in ./location.inc 
- Get the translated name of a country code.
- location_get_provinces in ./location.inc 
- Fetch the provinces for a country.
- location_latlon_exact in ./location.inc 
- Currently, this is not a priority until there is an implementable use for exact longitude, latitude coordinates for an location. The idea is that this call will eventually retrieve information through a web-service. Whereas location_latlon_rough()…
- location_load_country in ./location.inc 
- Load support for a country.
- location_search_form_alter in contrib/location_search/ location_search.module 
File
- ./location.inc, line 544 
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;
  }
}