> IP-to-Country wordpress plugin resources analysis

IP-to-Country wordpress plugin resources analysis

Download This Plugin
Download Elegant Themes
Name IP-to-Country
Version 0.08
Author Pepak
Rating 60
Last updated 2014-06-24 06:21:00
Downloads
3565
Download Plugins Speed Test plugin for Wordpress

Home page

Delta: 0%

Post page

Delta: 0%
IP-to-Country plugin has no negative impact on PageSpeed score.

Home page PageSpeed score has been degraded by 0%, while Post page PageSpeed score has been degraded by 0%

IP-to-Country plugin added 3 bytes of resources to the Home page and 18 bytes of resources to the sample Post page.

IP-to-Country plugin added 0 new host(s) to the Home page and 0 new host(s) to the sample Post page.

IP-to-Country plugins ads the following DB table(s) to your Wordpress blog database:
Table name Table size (in bytes)
wp_ip2c_countries 32768
wp_ip2c_addresses 16384
wp_ip2c_ipv6 16384

IP-to-Country is a plugin which doesn't provide any output to users, but which may be used by plugin authors to quickly and easily find, in which country an IP address is located.

To do so the plugin uses data files from either http://ip-to-country.webhosting.info (IPv4 only) or http://software77.net/geo-ip/ (both IPv4 and IPv6). Other sources are possible as long as they have the same format: CSV file, fields enclosed with quotes (") and separated with comma (,), lines ending with LF (\n). Five columns:

  • Lower bound of an IP range.
  • Upper bound of an IP range. Both are represented as one 32-bit integer number, such as you can get by using funtion ip2long().
  • 2-character country code
  • 3-character country code
  • Country name

Note: In order to import IPv6 addresses, IPv4 must be imported first. The reason is, IPv6 database does not carry the full country information with it, while the IPv4 database does.

Operations:

  • To detect if IP-to-Country plugin is installed:

    $ip2c_available = class_exists('PepakIpToCountry');

  • To find information about a numeric IP address:

    $country = PepakIpToCountry::IP_to_Country_Full('8.8.8.8'); // returns 'UNITED STATES' $country = PepakIpToCountry::IP_to_Country('8.8.8.8'); $country = PepakIpToCountry::IP_to_Country_XX('8.8.8.8'); // both return 'US' $country = PepakIpToCountry::IP_to_Country_XXX('8.8.8.8'); // returns 'USA' $country = PepakIpToCountry::IP_to_Country_Info('8.8.8.8'); // returns Array('iso_name'=>'UNITED STATES', 'iso_code2'=>'US', 'iso_code3'=>'USA') $image = PepakIpToCountry::IP_to_Country_Flag('8.8.8.8'); // returns ''

    You may leave the IP address empty; in that case, IP address of currently active user is used instead.

    Note: All requests are cached, so there shouldn't be a noticeable difference between reading IP_to_Country_Info and reading all three pieces of information separately using the _Full, _XX and _XXX functions.

  • To interface your plugin's tables to IP-to-Country plugin's tables within SQL, a function Subselect is published:

    $subselect = PepakIpToCountry::Subselect($ip, $countryfield);

    • $ip is a field that contains IP address in the form of one 32bit number, e.g.
    1. If you store IP addresses in the usual form of four dot-separated numbers ('127.0.0.1'), you can use MySQL's function INET_ATON: $ip = 'INET_ATON(my_ip_address_field)'; It is strongly recommended to use qualified field names (with tablename in front, separated by a dot): $ip = 'INET_ATON(banlist.ip_address)';
    • $countryfield is the field you want returned. It can be one of the following: iso_name - returns the same string as PepakIpToCountry::IP_to_Country_Full(...) iso_code2 - returns the same string as PepakIpToCountry::IP_to_Country_XX(...) iso_code3 - returns the same string as PepakIpToCountry::IP_to_Country_XX(...)

    Note: No checking or validation is done on either of these parameters. It is assumed they are field names, NOT strings. DO NOT EVER USE VALUES THAT YOUR USERS CAN INFLUENCE! This is important! If you let users supply arguments to Subselect(), you are letting them to do whatever they like with your database!

    This function only works with IPv4 addresses.

    Example usage:

    if (class_exists('PepakIpToCountry')) $field = PepakIpToCountry("INET_ATON(b.ip_addr)", 'iso_code2'); else $field = 'NULL'; $sql = "SELECT b.*, ${field} country_code FROM ${wpdb->prefix}banlist b WHERE ...";

Note: This plugin requires PHP5. If you want it to work with ZIP files (e.g. for updating IP-country info from the default location), your PHP must have extension php_zip enabled.

Screenshots

Resources added by plugin to Home page/Post page in kB
Total size of resources for Home page/Post page in kB
Random Theme Tests
Panorama screenshot

Panorama

by: themocracy

52718
100%
Auto Dezmembrari screenshot

Auto Dezmembrari

by: costiasi

13027
0%