| Server IP : 27.254.86.99 / Your IP : 216.73.216.234 Web Server : LiteSpeed System : Linux wp1.hostneverdie.com 4.18.0-553.46.1.lve.el8.x86_64 #1 SMP Wed Apr 2 11:16:45 UTC 2025 x86_64 User : qtccargo ( 1078) PHP Version : 8.2.29 Disable Function : apache_child_terminate, apache_setenv, define_syslog_variables, escapeshellarg, escapeshellcmd,exec, fp, fput, highlight_file, ini_alter, ini_restore, inject_code, passthru,phpAds_remoteInfo, phpAds_XmlRpc,phpAds_xmlrpcDecode, phpAds_xmlrpcEncode, popen, posix_getpwuid, posix_kill, posix_mkfifo, posix_setpgid, posix_setsid,posix_setuid, posix_setuid, posix_uname,proc_open,proc_close, proc_get_status, proc_nice, proc_terminate, shell_exec, syslog, system, xmlrpc_entity_decode, show_source,pcntl_exec,virtual,suexec,dbmopen,dl,disk_free_space,diskfreespace,leak MySQL : OFF | cURL : ON | WGET : OFF | Perl : OFF | Python : OFF | Sudo : OFF | Pkexec : OFF Directory : /home/qtccargo/public_html/wp-content/plugins/wordfence/lib/ |
Upload File : |
<?php
class wfIpLocation {
const DATABASE_FILE_NAME = 'geoip.mmdb'; //Also defined in bootstrap.php
const LANGUAGE_DEFAULT = 'en';
const LANGUAGE_SEPARATOR = '_';
private $record;
public function __construct($record) {
$this->record = is_array($record) ? $record : array();
}
public function getCountryRecord() {
if (array_key_exists('country', $this->record)) {
$country = $this->record['country'];
if (is_array($country))
return $country;
}
return array();
}
public function getCountryField($field) {
$country = $this->getCountryRecord();
if (array_key_exists($field, $country))
return $country[$field];
return null;
}
public function getCountryCode() {
$isoCode = $this->getCountryField('iso_code');
if (is_string($isoCode) && strlen($isoCode) === 2)
return $isoCode;
return null;
}
private function findBestLanguageMatch($options, $preferredLanguage = self::LANGUAGE_DEFAULT) {
$languages = array();
if (is_string($preferredLanguage))
$languages[] = $preferredLanguage;
if (strpos($preferredLanguage, self::LANGUAGE_SEPARATOR) !== false) {
$components = explode(self::LANGUAGE_SEPARATOR, $preferredLanguage);
$baseLanguage = $components[0];
if ($baseLanguage !== self::LANGUAGE_DEFAULT)
$languages[] = $baseLanguage;
}
if ($preferredLanguage !== self::LANGUAGE_DEFAULT)
$languages[] = self::LANGUAGE_DEFAULT;
foreach ($languages as $language) {
if (array_key_exists($language, $options))
return $options[$language];
}
if (!empty($options))
return reset($options);
return null;
}
public function getCountryName($preferredLanguage = self::LANGUAGE_DEFAULT) {
$names = $this->getCountryField('names');
if (is_array($names) && !empty($names))
return $this->findBestLanguageMatch($names, $preferredLanguage);
return null;
}
}