Downloader
in package
Download the TCF list from a remote address.
Table of Contents
Constants
- FILENAME_PURPOSES_TRANSLATION = 'v3/purposes.json'
- FILENAME_VENDOR_LIST = 'v3/vendor-list.json'
- TCF_DEFAULT_LANGUAGE = 'en'
Properties
- $normalizer : TcfVendorListNormalizer
- The normalizer.
Methods
- __construct() : mixed
- C'tor.
- fetchTranslation() : WP_Error|array<string|int, mixed>
- Fetch the `purpose-{language}.json` from an external URL.
- fetchVendorList() : WP_Error|array<string|int, mixed>
- Fetch the `vendor-list.json` from an external URL.
- getNormalizer() : 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
$normalizer
The normalizer.
private
TcfVendorListNormalizer
$normalizer
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|array<string|int, mixed>
Parameters
- $url : string
- $queryArgs : array<string|int, mixed> = []
-
Additional query parameters, e.g. license key
Return values
WP_Error|array<string|int, mixed>getNormalizer()
Getter.
public
getNormalizer() : mixed
Tags
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>