WC_Integration_MaxMind_Database_Service
in package
The service class responsible for interacting with MaxMind databases.
Tags
Table of Contents
- DATABASE = 'GeoLite2-Country'
- The name of the MaxMind database to utilize.
- DATABASE_EXTENSION = '.mmdb'
- The extension for the MaxMind database.
- $database_prefix : string
- A prefix for the MaxMind database filename.
- __construct() : mixed
- WC_Integration_MaxMind_Database_Service constructor.
- download_database() : string|WP_Error
- Fetches the database from the MaxMind service.
- get_database_path() : string
- Fetches the path that the database should be stored.
- get_iso_country_code_for_ip() : string
- Fetches the ISO country code associated with an IP address.
Constants
DATABASE
The name of the MaxMind database to utilize.
public
mixed
DATABASE
= 'GeoLite2-Country'
DATABASE_EXTENSION
The extension for the MaxMind database.
public
mixed
DATABASE_EXTENSION
= '.mmdb'
Properties
$database_prefix
A prefix for the MaxMind database filename.
private
string
$database_prefix
Methods
__construct()
WC_Integration_MaxMind_Database_Service constructor.
public
__construct(string|null $database_prefix) : mixed
Parameters
- $database_prefix : string|null
-
A prefix for the MaxMind database filename.
Return values
mixed —download_database()
Fetches the database from the MaxMind service.
public
download_database(string $license_key) : string|WP_Error
Parameters
- $license_key : string
-
The license key to be used when downloading the database.
Return values
string|WP_Error — The path to the database file or an error if invalid.get_database_path()
Fetches the path that the database should be stored.
public
get_database_path() : string
Return values
string — The local database path.get_iso_country_code_for_ip()
Fetches the ISO country code associated with an IP address.
public
get_iso_country_code_for_ip(string $ip_address) : string
Parameters
- $ip_address : string
-
The IP address to find the country code for.