original_string: public function getLocation($info)
      {
          $ip = $this->getIpFromInfo($info);
  
          $result = array();
  
          // get location data
          if (self::isCityDatabaseAvailable()) {
              // Must hide errors because missing IPV6:
              $location = @geoip_record_by_name($ip);
              if (!empty($location)) {
                  $result[self::COUNTRY_CODE_KEY] = $location['country_code'];
                  $result[self::REGION_CODE_KEY] = $location['region'];
                  $result[self::CITY_NAME_KEY] = utf8_encode($location['city']);
                  $result[self::AREA_CODE_KEY] = $location['area_code'];
                  $result[self::LATITUDE_KEY] = $location['latitude'];
                  $result[self::LONGITUDE_KEY] = $location['longitude'];
                  $result[self::POSTAL_CODE_KEY] = $location['postal_code'];
              }
          } else if (self::isRegionDatabaseAvailable()) {
              $location = @geoip_region_by_name($ip);
              if (!empty($location)) {
                  $result[self::REGION_CODE_KEY] = $location['region'];
                  $result[self::COUNTRY_CODE_KEY] = $location['country_code'];
              }
          } else {
              $result[self::COUNTRY_CODE_KEY] = @geoip_country_code_by_name($ip);
          }
  
          // get organization data if the org database is available
          if (self::isOrgDatabaseAvailable()) {
              $org = @geoip_org_by_name($ip);
              if ($org !== false) {
                  $result[self::ORG_KEY] = utf8_encode($org);
              }
          }
  
          // get isp data if the isp database is available
          if (self::isISPDatabaseAvailable()) {
              $isp = @geoip_isp_by_name($ip);
              if ($isp !== false) {
                  $result[self::ISP_KEY] = utf8_encode($isp);
              }
          }
  
          if (empty($result)) {
              return false;
          }
  
          $this->completeLocationResult($result);
          return $result;
      }
code: public function getLocation($info)
      {
          $ip = $this->getIpFromInfo($info);
  
          $result = array();
  
          // get location data
          if (self::isCityDatabaseAvailable()) {
              // Must hide errors because missing IPV6:
              $location = @geoip_record_by_name($ip);
              if (!empty($location)) {
                  $result[self::COUNTRY_CODE_KEY] = $location['country_code'];
                  $result[self::REGION_CODE_KEY] = $location['region'];
                  $result[self::CITY_NAME_KEY] = utf8_encode($location['city']);
                  $result[self::AREA_CODE_KEY] = $location['area_code'];
                  $result[self::LATITUDE_KEY] = $location['latitude'];
                  $result[self::LONGITUDE_KEY] = $location['longitude'];
                  $result[self::POSTAL_CODE_KEY] = $location['postal_code'];
              }
          } else if (self::isRegionDatabaseAvailable()) {
              $location = @geoip_region_by_name($ip);
              if (!empty($location)) {
                  $result[self::REGION_CODE_KEY] = $location['region'];
                  $result[self::COUNTRY_CODE_KEY] = $location['country_code'];
              }
          } else {
              $result[self::COUNTRY_CODE_KEY] = @geoip_country_code_by_name($ip);
          }
  
          // get organization data if the org database is available
          if (self::isOrgDatabaseAvailable()) {
              $org = @geoip_org_by_name($ip);
              if ($org !== false) {
                  $result[self::ORG_KEY] = utf8_encode($org);
              }
          }
  
          // get isp data if the isp database is available
          if (self::isISPDatabaseAvailable()) {
              $isp = @geoip_isp_by_name($ip);
              if ($isp !== false) {
                  $result[self::ISP_KEY] = utf8_encode($isp);
              }
          }
  
          if (empty($result)) {
              return false;
          }
  
          $this->completeLocationResult($result);
          return $result;
      }
code_tokens: public function getLocation ( $ info ) { $ ip = $ this -> getIpFromInfo ( $ info ) ; $ result = array ( ) ; // get location data if ( self :: isCityDatabaseAvailable ( ) ) { // Must hide errors because missing IPV6: $ location = @ geoip_record_by_name ( $ ip ) ; if ( ! empty ( $ location ) ) { $ result [ self :: COUNTRY_CODE_KEY ] = $ location [ 'country_code' ] ; $ result [ self :: REGION_CODE_KEY ] = $ location [ 'region' ] ; $ result [ self :: CITY_NAME_KEY ] = utf8_encode ( $ location [ 'city' ] ) ; $ result [ self :: AREA_CODE_KEY ] = $ location [ 'area_code' ] ; $ result [ self :: LATITUDE_KEY ] = $ location [ 'latitude' ] ; $ result [ self :: LONGITUDE_KEY ] = $ location [ 'longitude' ] ; $ result [ self :: POSTAL_CODE_KEY ] = $ location [ 'postal_code' ] ; } } else if ( self :: isRegionDatabaseAvailable ( ) ) { $ location = @ geoip_region_by_name ( $ ip ) ; if ( ! empty ( $ location ) ) { $ result [ self :: REGION_CODE_KEY ] = $ location [ 'region' ] ; $ result [ self :: COUNTRY_CODE_KEY ] = $ location [ 'country_code' ] ; } } else { $ result [ self :: COUNTRY_CODE_KEY ] = @ geoip_country_code_by_name ( $ ip ) ; } // get organization data if the org database is available if ( self :: isOrgDatabaseAvailable ( ) ) { $ org = @ geoip_org_by_name ( $ ip ) ; if ( $ org !== false ) { $ result [ self :: ORG_KEY ] = utf8_encode ( $ org ) ; } } // get isp data if the isp database is available if ( self :: isISPDatabaseAvailable ( ) ) { $ isp = @ geoip_isp_by_name ( $ ip ) ; if ( $ isp !== false ) { $ result [ self :: ISP_KEY ] = utf8_encode ( $ isp ) ; } } if ( empty ( $ result ) ) { return false ; } $ this -> completeLocationResult ( $ result ) ; return $ result ; }
docstring: Uses the GeoIP PECL module to get a visitor's location based on their IP address.
  
  This function will return different results based on the data available. If a city
  database can be detected by the PECL module, it may return the country code,
  region code, city name, area code, latitude, longitude and postal code of the visitor.
  
  Alternatively, if only the country database can be detected, only the country code
  will be returned.
  
  The GeoIP PECL module will detect the following filenames:
  - GeoIP.dat
  - GeoIPCity.dat
  - GeoIPISP.dat
  - GeoIPOrg.dat
  
  Note how GeoLiteCity.dat, the name for the GeoLite city database, is not detected
  by the PECL module.
  
  @param array $info Must have an 'ip' field.
  @return array
docstring_tokens: Uses the GeoIP PECL module to get a visitor s location based on their IP address .