Use Horde_Nls::getCountryISO()
authorMichael M Slusarz <slusarz@curecanti.org>
Sat, 28 Aug 2010 07:22:41 +0000 (01:22 -0600)
committerMichael M Slusarz <slusarz@curecanti.org>
Sat, 28 Aug 2010 18:22:08 +0000 (12:22 -0600)
turba/lib/Driver.php

index 29faf27..a110d43 100644 (file)
@@ -1695,7 +1695,7 @@ class Turba_Driver implements Countable
                 Horde_Icalendar_Vcard::ADR_POSTCODE => isset($hash['commonPostalCode'])
                     ? $hash['commonPostalCode'] : '',
                 Horde_Icalendar_Vcard::ADR_COUNTRY  => isset($hash['commonCountry'])
-                    ? Turba_Driver::getCountry($hash['commonCountry']) : '',
+                    ? Horde_Nls::getCountryISO($hash['commonCountry']) : '',
             );
 
             $val = implode(';', $a);
@@ -1750,7 +1750,7 @@ class Turba_Driver implements Countable
                 Horde_Icalendar_Vcard::ADR_POSTCODE => isset($hash['homePostalCode'])
                     ? $hash['homePostalCode'] : '',
                 Horde_Icalendar_Vcard::ADR_COUNTRY  => isset($hash['homeCountry'])
-                    ? Turba_Driver::getCountry($hash['homeCountry']) : '',
+                    ? Horde_Nls::getCountryISO($hash['homeCountry']) : '',
             );
 
             $val = implode(';', $a);
@@ -1805,7 +1805,7 @@ class Turba_Driver implements Countable
                 Horde_Icalendar_Vcard::ADR_POSTCODE => isset($hash['workPostalCode'])
                     ? $hash['workPostalCode'] : '',
                 Horde_Icalendar_Vcard::ADR_COUNTRY  => isset($hash['workCountry'])
-                    ? Turba_Driver::getCountry($hash['workCountry']) : '',
+                    ? Horde_Nls::getCountryISO($hash['workCountry']) : '',
             );
 
             $val = implode(';', $a);
@@ -1826,24 +1826,6 @@ class Turba_Driver implements Countable
     }
 
     /**
-     * Returns the (localized) country name.
-     *
-     * @param string $country  The two-letter country code.
-     *
-     * @return string  The country name or the country code if a name cannot be
-     *                 found.
-     */
-    function getCountry($country)
-    {
-        static $countries;
-        if (!isset($countries)) {
-            include 'Horde/Nls/Countries.php';
-        }
-
-        return isset($countries[$country]) ? $countries[$country] : $country;
-    }
-
-    /**
      * Function to convert a Horde_Icalendar_Vcard object into a Turba
      * Object Hash with Turba attributes suitable as a parameter for add().
      *
@@ -2317,7 +2299,7 @@ class Turba_Driver implements Countable
                 $message->homepostalcode = Horde_String::convertCharset($hash['homePostalCode'], $charset, 'utf-8');
                 break;
             case 'homeCountry':
-                $message->homecountry = Horde_String::convertCharset(self::getCountry($hash['homeCountry']), $charset, 'utf-8');
+                $message->homecountry = Horde_String::convertCharset(Horde_Nls::getCountryISO($hash['homeCountry']), $charset, 'utf-8');
                 break;
             case 'workStreet':
                 $message->businessstreet = Horde_String::convertCharset($hash['workStreet'], $charset, 'utf-8');