Skip to content

Commit

Permalink
IPv6 support does not only depend on AF_INET6 ... yiisoft/yii2#13984
Browse files Browse the repository at this point in the history
  • Loading branch information
Benjamin Pick committed Nov 15, 2018
1 parent b0798cd commit 5c73880
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion init.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,21 @@ function geoip_detect_defines() {


if (!defined('GEOIP_DETECT_IPV6_SUPPORTED'))
define('GEOIP_DETECT_IPV6_SUPPORTED', defined('AF_INET6'));
define('GEOIP_DETECT_IPV6_SUPPORTED', geoip_detect_check_ipv6_support());

if (!defined('GEOIP_DETECT_USER_AGENT'))
define('GEOIP_DETECT_USER_AGENT', 'GeoIP Detect ' . GEOIP_DETECT_VERSION);
}
add_action('plugins_loaded', 'geoip_detect_defines');


function geoip_detect_check_ipv6_support() {
if (defined('AF_INET6')) {
return true;
}
return @inet_pton('::1') !== false;
}

// Load Locales
function geoip_detect_load_textdomain() {
load_plugin_textdomain( 'geoip-detect', false, GEOIP_PLUGIN_DIR . '/languages' );
Expand Down

0 comments on commit 5c73880

Please sign in to comment.