check if $name is already a country-code, before attempting to find a matching one, which can fail in certain areas of setup

This commit is contained in:
Ralf Becker 2012-01-05 21:58:28 +00:00
parent 89f46c6a3b
commit 19dcc2e654

View File

@ -387,6 +387,11 @@ class country
{ {
if (!$name) return ''; // nothing to do if (!$name) return ''; // nothing to do
if (strlen($name) == 2 && isset($this->country_array[$name]))
{
return $name; // $name is already a country-code
}
if (($code = array_search(strtoupper($name),$this->country_array)) !== false) if (($code = array_search(strtoupper($name),$this->country_array)) !== false)
{ {
return $code; return $code;