SxGeoIP integration

Integration of SxGeo IP base (geo names supplied in Russian and English). This DB contains Geo coordinates related to user IP-address. SxGeoIP created, developed and maintained by https://sypexgeo.net/ and distributed under BSD licence.

#1. SxGeoIP base

Extension for Cotonti CMF. Integration of SxGeo IP base (geo names supplied in Russian and English)

Authors: Andrey Matsovkin, Kalnov Alexey

Github: https://github.com/Cotonti-Extensions/sxgeo

 

#1.1. Description

Integration of SxGeoIP database in Cotonti CMF. This DB contains Geo coordinates related to user IP-address. SxGeoIP created, developed and maintained by https://sypexgeo.net/ and distributed under BSD licence.

 

#1.2. Features

  • Fast query speed
  • Country and city detection
  • Good data cover for ex-USSR area
  • All cities names in english and russian locales

 

#1.3. DataBase updates

 

#1.4. Demo page

You can view demo page at https://sypexgeo.net/ site.

 

#1.5. Requirements

Current version requires Cotonti Siena v0.9.23 and newer.

 

#1.6. Comments

Plugin works out from the box. For better results check config settings in admin panel.

 

#1.7. How extension works

Extension use GeoIP data packed in SxGeoIP format files. Country and city info stored in separate files. More info about SxGeoIP format you can find on https://sypexgeo.net/.

 

#1.8. Install

  • Unpack, copy files to root folder of your site.
  • Install via Admin → Extensions menu (Administration panel → Extensions)
  • Checks setting in config (Administration panel → Extensions → sxgeo → Configuration).

 

#1.9. Usage

You can use this extension data in 2 ways:

1) Through functions call for sx_getCity($ip) and sx_getCountry($ip). These functions return string with Country and City name respectively. You can ommit IP address. In this case you get info according to current user info.

Examples:
{PHP|sx_getCity('8.8.8.8')}
{PHP.usr.ip|sx_getCountry($this)}

Important notes! Country names are always geted in current Cotonti locale (user selected language), according to countries.*.lang.php file. City names are returned by plugin in english or russian (as it sored in SxGeoIP DB).

 

2) You can turn on Auto initialization mode, so you can use direct values for current user country and city info.

 

Data format:


    /**
  * Contains data for country code and id from last sx_getCountry*() call.
  */
    $sx_country = [
   'iso' => '', // ISO 3166-1 code in appear case
   'name' => '', // Country name with Cotonti locale as defined in countries.*.lang.php file
   'id'  => 0, // Country ID used in SxGeoIP base
    ];

    /**
  * Contains info about city from last sx_getCity*() call.
  */
    $sx_city = [
   'info' => [],  // basic info, see sx_getCity() function for details
   'ext_info' => [], //extended info, see sx_getCityExt() function for details
    ];

Use this calls in TPL:
city - {PHP.sx_city.info.city}
country - {PHP.sx_country.name}

 

#1.10. Licence

Distributed under BSD license.

 

#1.11. Author

Andrey Matsovkin - author of Cotonti extension. All other rights belongs to https://sypexgeo.net/ as DB creator.

 

#1.12. References


1. Uch  2013-11-11 10:39

Спасибо!
Добавил файл для comments.loop и стало просто замечательно :)

Only registered users can post new comments