| @@ 24-36 (lines=13) @@ | ||
| 21 | } |
|
| 22 | } |
|
| 23 | ||
| 24 | public function getCityByIp($ip) |
|
| 25 | { |
|
| 26 | if (!$this->isFileExists()) { |
|
| 27 | return null; |
|
| 28 | } |
|
| 29 | $SxGeo = new GeoIP_SxGeo($this->local_file); |
|
| 30 | $city_full = $SxGeo->getCity($ip); |
|
| 31 | unset($SxGeo); |
|
| 32 | if ($city_full['city']['name_ru'] != '') { |
|
| 33 | return $city_full['city']['name_ru']; |
|
| 34 | } |
|
| 35 | return Mage::getStoreConfig('geoip/general/city'); |
|
| 36 | } |
|
| 37 | ||
| 38 | public function getCity() |
|
| 39 | { |
|
| @@ 13-25 (lines=13) @@ | ||
| 10 | class Mygento_Geoip_Model_Detect extends Mygento_Geoip_Model_Abstract |
|
| 11 | { |
|
| 12 | ||
| 13 | public function getCityByIp($ip) |
|
| 14 | { |
|
| 15 | if (!$this->isFileExists()) { |
|
| 16 | return null; |
|
| 17 | } |
|
| 18 | $SxGeo = new GeoIP_SxGeo($this->local_file); |
|
| 19 | $city_full = $SxGeo->getCity($ip); |
|
| 20 | unset($SxGeo); |
|
| 21 | if ($city_full['city']['name_ru'] != '') { |
|
| 22 | return $city_full['city']['name_ru']; |
|
| 23 | } |
|
| 24 | return null; |
|
| 25 | } |
|
| 26 | } |
|
| 27 | ||