function location_standardize_country_code in Location 7.3
Same name and namespace in other branches
- 5.3 location.inc \location_standardize_country_code()
- 6.3 location.inc \location_standardize_country_code()
- 7.5 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.
- location_load_country in ./
location.inc - Load support for a country.
- location_search_form_alter in contrib/
location_search/ location_search.module - Implements hook_form_alter().
File
- ./
location.inc, line 672 - Public API for the 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;
}
}