From: Michael M Slusarz Date: Wed, 14 Jul 2010 21:49:58 +0000 (-0600) Subject: Remove lingering horde/Core reference in horde/Nls X-Git-Url: https://git.internetallee.de/?a=commitdiff_plain;h=00ab09d46b9dff7e3b9e48fcb0af952b12b9d7d6;p=horde.git Remove lingering horde/Core reference in horde/Nls --- diff --git a/framework/Nls/lib/Horde/Nls.php b/framework/Nls/lib/Horde/Nls.php index ec721c803..b02520594 100644 --- a/framework/Nls/lib/Horde/Nls.php +++ b/framework/Nls/lib/Horde/Nls.php @@ -112,14 +112,16 @@ class Horde_Nls /** * Get country information from a hostname or IP address. * - * @param string $host The hostname or IP address. + * @param string $host The hostname or IP address. + * @param string $datafile The datafile for the GeoIP lookup. If not set, + * will skip this lookup. * * @return mixed On success, return an array with the following entries: * 'code' => Country Code * 'name' => Country Name * On failure, return false. */ - static public function getCountryByHost($host) + static public function getCountryByHost($host, $datafile = null) { /* List of generic domains that we know is not in the country TLD list. See: http://www.iana.org/gtld/gtld.htm */ @@ -162,8 +164,7 @@ class Horde_Nls } /* Try GeoIP lookup next. */ - $geoip = Horde_Nls_Geoip::singleton(!empty($GLOBALS['conf']['geoip']['datafile']) ? $GLOBALS['conf']['geoip']['datafile'] : null); - + $geoip = new Horde_Nls_Geoip($datafile); return $geoip->getCountryInfo($checkHost); } diff --git a/framework/Nls/lib/Horde/Nls/Geoip.php b/framework/Nls/lib/Horde/Nls/Geoip.php index 77df03e21..156b6d832 100644 --- a/framework/Nls/lib/Horde/Nls/Geoip.php +++ b/framework/Nls/lib/Horde/Nls/Geoip.php @@ -19,8 +19,9 @@ * See the enclosed file COPYING for license information (LGPL). If you * did not receive this file, see http://www.fsf.org/copyleft/lgpl.html. * - * @author Michael Slusarz - * @package Horde_NLS + * @author Michael Slusarz + * @category Horde + * @package Nls */ class Horde_Nls_Geoip { @@ -30,13 +31,6 @@ class Horde_Nls_Geoip const STANDARD_RECORD_LENGTH = 3; /** - * The singleton instance. - * - * @var Horde_Nls_Geoip - */ - static protected $_instance; - - /** * Country list. * * @var array @@ -82,26 +76,6 @@ class Horde_Nls_Geoip protected $_fh; /** - * Returns a reference to the global Horde_Nls_GeoIP object, only creating - * it if it doesn't already exist. - * - * This method must be invoked as: - * $geoip = Horde_Nls_Geoip::singleton($datafile); - * - * @param string $datafile The location of the GeoIP database. - * - * @return object Horde_Nls_Geoip The object instance. - */ - static public function singleton($datafile) - { - if (!isset(self::$_instance)) { - self::$_instance = new self($datafile); - } - - return self::$_instance; - } - - /** * Constructor. * * @param string $datafile The location of the GeoIP database. diff --git a/framework/Ui/lib/Horde/Ui/FlagImage.php b/framework/Ui/lib/Horde/Ui/FlagImage.php index ab1cf4a2a..aeb41bce8 100644 --- a/framework/Ui/lib/Horde/Ui/FlagImage.php +++ b/framework/Ui/lib/Horde/Ui/FlagImage.php @@ -25,7 +25,8 @@ class Horde_Ui_FlagImage */ static public function generateFlagImageByHost($host) { - $data = Horde_Nls::getCountryByHost($host); + $data = Horde_Nls::getCountryByHost($host, empty($GLOBALS['conf']['geoip']['datafile']) ? null : $GLOBALS['conf']['geoip']['datafile']); + ); if ($data === false) { return ''; }