bcosca/fatfree — pull request #179 by telephone (2012-11-28 14:10:49+00:00)
Title: NEW: location() uses geoip_* if available; fallback to geoPlugin

- Changed locaiton() to use PECL geoip_* if requirements are met:
- PECL geoip installed
- Maxmind Country database
- Maxmind City database
- Otherwise, fallback to geoPlugin.net
- Changed default behavior for $ip if null:
- If null, use clients IP address
- If null, and 'REMOTE_ADDR' is empty, fallback to geoPlugin (uses servers ip)
- Changed array keys from camel case to snake case (unify with geoip_*)
- Resulting array content/s unified (geoip & geoPlugin will output the same array)

Returned array keys:
```
area_code
city
continent_code
country_code
country_name
dma_code
latitude
longitude
region
region_code
region_name
request
```
Demo using geoPlugin.net: http://f3.iamtelephone.com/dev/geo

Demo using PECL geoip: http://f3.iamtelephone.com/geo/geo

As you can see from the demo, using the binary GeoIP database (PECL geoip) requests are 3,000% - 4,000% quicker, with little to no cost to those using the fallback.