コード例 #1
0
ファイル: Country.php プロジェクト: mygento/geoip
 public function getCountryByIp($ip)
 {
     if (!$this->isFileExists()) {
         return null;
     }
     $SxGeo = new GeoIP_SxGeo($this->local_file);
     $country = $SxGeo->getCountry($ip);
     if ($country) {
         return $country;
     }
     return Mage::getStoreConfig('geoip/general/country');
 }
コード例 #2
0
ファイル: City.php プロジェクト: mygento/geoip
 public function getCityByIp($ip)
 {
     if (!$this->isFileExists()) {
         return null;
     }
     $SxGeo = new GeoIP_SxGeo($this->local_file);
     $city_full = $SxGeo->getCity($ip);
     unset($SxGeo);
     if ($city_full['city']['name_ru'] != '') {
         return $city_full['city']['name_ru'];
     }
     return Mage::getStoreConfig('geoip/general/city');
 }