Update geonames

This commit is contained in:
Romain Neutron
2012-09-21 15:48:05 +02:00
parent f228893161
commit ce9b070282

View File

@@ -1,16 +1,28 @@
<?php
/*
* This file is part of Phraseanet
*
* (c) 2005-2012 Alchemy
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
use Alchemy\Phrasea\Application;
class geonames
{
protected static $NamesFromId = array();
protected static $CountryFromId = array();
protected static $CountryCodeFromId = array();
protected static $GeonameFromIp = array();
protected static $Searches = array();
private $app;
public function __construct(Application $app)
{
$this->app = $app;
}
public function name_from_id($geonameid)
{
$registry = registry::get_instance();
$registry = $this->app['phraseanet.registry'];
$url = $registry->get('GV_i18n_service', 'http://localization.webservice.alchemyasp.com/')
. 'get_name.php?geonameid='
. $geonameid;
@@ -36,7 +48,7 @@ class geonames
return '';
}
$registry = registry::get_instance();
$registry = $this->app['phraseanet.registry'];
$url = $registry->get('GV_i18n_service', 'http://localization.webservice.alchemyasp.com/')
. 'get_name.php?geonameid='
. $geonameid;
@@ -56,7 +68,7 @@ class geonames
public function get_country_code($geonameid)
{
$registry = registry::get_instance();
$registry = $this->app['phraseanet.registry'];
$url = $registry->get('GV_i18n_service', 'http://localization.webservice.alchemyasp.com/')
. 'get_name.php?geonameid='
. $geonameid;
@@ -95,7 +107,7 @@ class geonames
return $output;
}
$registry = registry::get_instance();
$registry = $this->app['phraseanet.registry'];
$url = $registry->get('GV_i18n_service', 'http://localization.webservice.alchemyasp.com/')
. 'find_city.php?city='
. urlencode($cityName) . '&maxResult=30';
@@ -142,7 +154,7 @@ class geonames
'latitude' => ''
);
$registry = registry::get_instance();
$registry = $this->app['phraseanet.registry'];
$url = $registry->get('GV_i18n_service', 'http://localization.webservice.alchemyasp.com/')
. 'geoip.php?ip='
. urlencode($ip);