MaxMindDatabase
in package
Uses
UtilsProvider
A common service to download the MaxMind database to the WordPress `uploads` directory.
Table of Contents
Constants
- DATABASE_EXTENSION = '.mmdb'
- DATABASE_NAME = 'GeoLite2-Country'
Properties
- $me : MaxMindDatabase
- Singleton instance.
Methods
- clear() : mixed
- Delete the database.
- download() : WP_Error|true
- Download the database `gzip`ped and extract it.
- exists() : mixed
- Check if the database exists.
- getInstance() : mixed
- Get singleton instance.
- getPath() : mixed
- Get the absolute path where the database is located.
- getPluginConstantPrefix() : string
- Get the prefix of this plugin so composer packages can dynamically build other constant values on it.
- lookupCountryCode() : mixed
- Lookup country code by IP address. Can return `null` if not found.
- __construct() : mixed
- C'tor.
Constants
DATABASE_EXTENSION
public
mixed
DATABASE_EXTENSION
= '.mmdb'
DATABASE_NAME
public
mixed
DATABASE_NAME
= 'GeoLite2-Country'
Properties
$me
Singleton instance.
private
static MaxMindDatabase
$me
= null
Methods
clear()
Delete the database.
public
clear() : mixed
download()
Download the database `gzip`ped and extract it.
public
download([array<string|int, mixed> $args = [] ]) : WP_Error|true
Parameters
- $args : array<string|int, mixed> = []
-
Additional query arguments
Return values
WP_Error|trueexists()
Check if the database exists.
public
exists() : mixed
getInstance()
Get singleton instance.
public
static getInstance() : mixed
Tags
getPath()
Get the absolute path where the database is located.
public
getPath() : mixed
getPluginConstantPrefix()
Get the prefix of this plugin so composer packages can dynamically build other constant values on it.
public
getPluginConstantPrefix() : string
Tags
Return values
stringlookupCountryCode()
Lookup country code by IP address. Can return `null` if not found.
public
lookupCountryCode(string $ip) : mixed
Parameters
- $ip : string
__construct()
C'tor.
private
__construct() : mixed