Beispiel #1
0
 /**
  * @return integer
  */
 public function getCountryId()
 {
     if (!$this->SxGeo) {
         $this->loadSxGeo();
     }
     return $this->SxGeo->getCountryId($this->getUserIp());
 }
Beispiel #2
0
 /**
  * @param string $ip
  *
  * @return number
  */
 public function getCountryId($ip = '')
 {
     return $this->sxGeo->getCountryId($this->getIp($ip));
 }
Beispiel #3
0
 /**
  * @return integer
  */
 public function getCountryId()
 {
     return $this->SxGeo->getCountryId($this->getUserIp());
 }
/**
 * Return Country ID for further work with SxGeoIP base
 * @param string $ip IP address in xxx.xxx.xxx.xxx notation
 * @return integer Country code used in SxGeoIP base
 */
function sx_getCountryId($ip = null)
{
    global $SxCountry, $sx_bulkmode, $sx_country, $sx_ip;
    if (is_null($ip)) {
        $ip = $sx_ip;
    }
    if (!$SxCountry) {
        $SxCountry = new SxGeo('plugins/sxgeo/data/SxGeo.dat');
    }
    // Режим по умолчанию, файл бд SxGeo.dat
    $sx_country['id'] = $result = @$SxCountry->getCountryId($ip);
    // возвращает номер страны
    if (!$sx_bulkmode) {
        unset($SxCountry);
    }
    return $result;
}