Changeset 1066221
- Timestamp:
- 01/12/2015 05:32:56 PM (11 years ago)
- Location:
- worldcurrency/trunk
- Files:
-
- 2 edited
-
readme.txt (modified) (2 diffs)
-
worldcurrency.php (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
worldcurrency/trunk/readme.txt
r1066207 r1066221 5 5 Requires at least: 2.8.0 6 6 Tested up to: 4.1 7 Stable tag: 1. 197 Stable tag: 1.20 8 8 9 9 Recognises users by IP address and shows them converted values in their local currency, you can write post/pages in multiple currencies. … … 98 98 == Changelog == 99 99 100 = 1.20 (12 January 2015) = 101 * Fix: Fix for servers which are ipv6 and ipv4, converts all visitor addresses to pure ipv4 format. Plugin has no support for native ipv6 at this time (the ip2c database is ipv4 only) 102 100 103 = 1.19 (12 January 2015) = 101 104 * Fix: Corrected error in readme -
worldcurrency/trunk/worldcurrency.php
r1066207 r1066221 4 4 Plugin URI: http://www.cometicucinoilweb.it/blog/en/worldcurrency-plugin-for-wordpress/ 5 5 Description: Recognises users by IP address and shows them converted values in their local currency, you can write post/pages in multiple currencies. 6 Version: 1. 197 Date: 12 Ja muary 20156 Version: 1.20 7 Date: 12 January 2015 8 8 Author: Daniele Tieghi 9 9 Author URI: www.cometicucinoilweb.it/blog/en/who-we-are/daniele-tieghi/ … … 224 224 require_once dirname(__FILE__).'/ip2c/ip2c.php'; 225 225 226 // Known prefix 227 $v4mapped_prefix_hex = '00000000000000000000ffff'; 228 $v4mapped_prefix_bin = pack("H*", $v4mapped_prefix_hex); 229 230 // Or more readable when using PHP >= 5.4 231 # $v4mapped_prefix_bin = hex2bin($v4mapped_prefix_hex); 232 233 // Parse 234 $addr = $_SERVER['REMOTE_ADDR']; 235 $addr_bin = inet_pton($addr); 236 if( $addr_bin === FALSE ) { 237 // Unparsable? How did they connect?!? 238 die('Invalid IP address'); 239 } 240 241 // Check prefix 242 if( substr($addr_bin, 0, strlen($v4mapped_prefix_bin)) == $v4mapped_prefix_bin) { 243 // Strip prefix 244 $addr_bin = substr($addr_bin, strlen($v4mapped_prefix_bin)); 245 } 246 247 // Convert back to printable address in canonical form 248 $addr = inet_ntop($addr_bin); 249 226 250 $ip2c = new ip2country(); 227 $res = $ip2c->get_country($ _SERVER['REMOTE_ADDR']);251 $res = $ip2c->get_country($addr); 228 252 229 253 if ($res == false) {
Note: See TracChangeset
for help on using the changeset viewer.