Downloader
in package
Download the TCF list from a remote address. It holds all the data of the downloaded GVL in a memory-efficient way with the help of `JsonMachine`.
Table of Contents
Constants
- FILENAME_PURPOSES_TRANSLATION = 'v3/purposes.json'
- FILENAME_VENDOR_LIST = 'v3/vendor-list.json'
- TCF_DEFAULT_LANGUAGE = 'en'
Properties
- $dataCategories : array<string|int, mixed>
- Data categories.
- $features : array<string|int, mixed>
- Features.
- $gvlSpecificationVersion : int
- GVL specification version.
- $lastUpdated : string
- Last updated timestamp.
- $normalizer : TcfVendorListNormalizer
- The normalizer.
- $purposes : array<string|int, mixed>
- Purposes.
- $specialFeatures : array<string|int, mixed>
- Special features.
- $specialPurposes : array<string|int, mixed>
- Special purposes.
- $stacks : array<string|int, mixed>
- Stacks.
- $tcfPolicyVersion : int
- TCF policy version.
- $vendorListVersion : int
- Vendor list version.
- $vendors : Items|array<string|int, mixed>
- Vendors as stream.
Methods
- __construct() : mixed
- C'tor.
- fetchTranslation() : WP_Error|array<string|int, mixed>
- Fetch the `purpose-{language}.json` from an external URL.
- fetchVendorList() : WP_Error|true
- Fetch the `vendor-list.json` from an external URL.
- getDataCategories() : mixed
- Getter.
- getFeatures() : mixed
- Getter.
- getGvlSpecificationVersion() : mixed
- Getter.
- getLastUpdated() : mixed
- Getter.
- getNormalizer() : mixed
- Getter.
- getPurposes() : mixed
- Getter.
- getSpecialFeatures() : mixed
- Getter.
- getSpecialPurposes() : mixed
- Getter.
- getStacks() : mixed
- Getter.
- getTcfPolicyVersion() : mixed
- Getter.
- getVendorListVersion() : mixed
- Getter.
- getVendors() : mixed
- Getter.
- requestToArray() : WP_Error|string
- Convert a result of `wp_remote_get` to a PHP array.
Constants
FILENAME_PURPOSES_TRANSLATION
public
mixed
FILENAME_PURPOSES_TRANSLATION
= 'v3/purposes.json'
FILENAME_VENDOR_LIST
public
mixed
FILENAME_VENDOR_LIST
= 'v3/vendor-list.json'
TCF_DEFAULT_LANGUAGE
public
mixed
TCF_DEFAULT_LANGUAGE
= 'en'
Properties
$dataCategories
Data categories.
private
array<string|int, mixed>
$dataCategories
= []
$features
Features.
private
array<string|int, mixed>
$features
= []
$gvlSpecificationVersion
GVL specification version.
private
int
$gvlSpecificationVersion
$lastUpdated
Last updated timestamp.
private
string
$lastUpdated
$normalizer
The normalizer.
private
TcfVendorListNormalizer
$normalizer
$purposes
Purposes.
private
array<string|int, mixed>
$purposes
= []
$specialFeatures
Special features.
private
array<string|int, mixed>
$specialFeatures
= []
$specialPurposes
Special purposes.
private
array<string|int, mixed>
$specialPurposes
= []
$stacks
Stacks.
private
array<string|int, mixed>
$stacks
= []
$tcfPolicyVersion
TCF policy version.
private
int
$tcfPolicyVersion
$vendorListVersion
Vendor list version.
private
int
$vendorListVersion
$vendors
Vendors as stream.
private
Items|array<string|int, mixed>
$vendors
Methods
__construct()
C'tor.
public
__construct(TcfVendorListNormalizer $normalizer) : mixed
Parameters
- $normalizer : TcfVendorListNormalizer
fetchTranslation()
Fetch the `purpose-{language}.json` from an external URL.
public
fetchTranslation(string $url, string $language[, array<string|int, mixed> $queryArgs = [] ]) : WP_Error|array<string|int, mixed>
Parameters
- $url : string
-
Add
%s
to your URL so the language code gets added to it - $language : string
-
The 2-letter code
- $queryArgs : array<string|int, mixed> = []
-
Additional query parameters, e.g. license key
Return values
WP_Error|array<string|int, mixed>fetchVendorList()
Fetch the `vendor-list.json` from an external URL.
public
fetchVendorList(string $url[, array<string|int, mixed> $queryArgs = [] ]) : WP_Error|true
Parameters
- $url : string
- $queryArgs : array<string|int, mixed> = []
-
Additional query parameters, e.g. license key
Return values
WP_Error|truegetDataCategories()
Getter.
public
getDataCategories() : mixed
getFeatures()
Getter.
public
getFeatures() : mixed
getGvlSpecificationVersion()
Getter.
public
getGvlSpecificationVersion() : mixed
getLastUpdated()
Getter.
public
getLastUpdated() : mixed
getNormalizer()
Getter.
public
getNormalizer() : mixed
Tags
getPurposes()
Getter.
public
getPurposes() : mixed
getSpecialFeatures()
Getter.
public
getSpecialFeatures() : mixed
getSpecialPurposes()
Getter.
public
getSpecialPurposes() : mixed
getStacks()
Getter.
public
getStacks() : mixed
getTcfPolicyVersion()
Getter.
public
getTcfPolicyVersion() : mixed
getVendorListVersion()
Getter.
public
getVendorListVersion() : mixed
getVendors()
Getter.
public
getVendors() : mixed
requestToArray()
Convert a result of `wp_remote_get` to a PHP array.
protected
requestToArray(WP_Error|array<string|int, mixed> $request) : WP_Error|string
Parameters
- $request : WP_Error|array<string|int, mixed>