Exemplo n.º 1
0
 public function ipToCountryCode3($ip)
 {
     if (!$this->isServiceAvailable()) {
         return;
     }
     return $this->ipCountryDao->ipToCountryCode3($ip);
 }
 /**
  * Returns an instance of class (singleton pattern implementation).
  *
  * @return BOL_GeolocationIpToCountryDao
  */
 public static function getInstance()
 {
     if (self::$classInstance === null) {
         self::$classInstance = new self();
     }
     return self::$classInstance;
 }
Exemplo n.º 3
0
 public function detectCountry()
 {
     try {
         $sql = 'SELECT `cc2` FROM `' . BOL_GeolocationIpToCountryDao::getInstance()->getTableName() . '`
             WHERE inet_aton(:ip) >= ipFrom AND inet_aton(:ip) <= ipTo';
         return OW::getDbo()->queryForColumn($sql, array('ip' => OW::getRequest()->getRemoteAddress()));
     } catch (Exception $e) {
         return null;
     }
 }