You are here

function _addressfield_tokens_country_abbr in Addressfield Tokens 7

Gets the abbreviation of the country with the given name.

Parameters

string $country: The name of the country.

Return value

string The 2-letter abbreviation of the country, or FALSE.

File

./addressfield_tokens.module, line 335
Main components.

Code

function _addressfield_tokens_country_abbr($country) {
  $countries = array_flip(array_map('strtolower', _addressfield_tokens_countries()));
  if (isset($countries[strtolower($country)])) {
    return check_plain($countries[strtolower($country)]);
  }
  return check_plain($country);
}