Consent
extends AbstractConsent
in package
implements
IOverrideConsent
Uses
Consent, UtilsProvider
Settings > Consent.
Table of Contents
Interfaces
Constants
- AGE_NOTICE_COUNTRY_AGE_MAP = ['INHERIT' => 0, 'GDPR' => 16, 'BE' => 13, 'DK' => 13, 'EE' => 13, 'FI' => 13, 'IS' => 13, 'LV' => 13, 'NO' => 13, 'PT' => 13, 'SE' => 13, 'MT' => 13, 'AT' => 14, 'BG' => 14, 'CY' => 14, 'IT' => 14, 'LT' => 14, 'ES' => 14, 'CZ' => 15, 'FR' => 15, 'GR' => 15, 'SI' => 15, 'DE' => 16, 'HR' => 16, 'HU' => 16, 'LI' => 16, 'LU' => 16, 'NL' => 16, 'PL' => 16, 'RO' => 16, 'SK' => 16, 'IE' => 16, 'CH' => 13]
- COOKIE_VERSION_1 = 1
- Search the coding for difference.
- COOKIE_VERSION_2 = 2
- COOKIE_VERSION_3 = 3
- CUSTOM_BYPASS_BANNER_LESS_CONSENT = 'bannerless'
- DEFAULT_ACCEPT_ALL_FOR_BOTS = true
- DEFAULT_AGE_NOTICE = true
- DEFAULT_AGE_NOTICE_AGE_LIMIT = 'INHERIT'
- DEFAULT_BANNER_LESS_CONSENT = false
- DEFAULT_BANNER_LESS_SHOW_ON_PAGE_IDS = ''
- DEFAULT_CONSENT_DURATION = 120
- DEFAULT_COOKIE_DURATION = 365
- DEFAULT_COOKIE_VERSION = self::COOKIE_VERSION_3
- DEFAULT_DATA_PROCESSING_IN_UNSAFE_COUNTRIES = false
- DEFAULT_FAILED_CONSENT_DOCUMENTATION_HANDLING = self::FAILED_CONSENT_DOCUMENTATION_HANDLING_ESSENTIALS_ONLY
- DEFAULT_LIST_SERVICES_NOTICE = true
- DEFAULT_RESPECT_DO_NOT_TRACK = false
- DEFAULT_SAVE_IP = false
- FAILED_CONSENT_DOCUMENTATION_HANDLING_ESSENTIALS_ONLY = 'essentials'
- FAILED_CONSENT_DOCUMENTATION_HANDLING_OPTIMISTIC = 'optimistic'
- FAILED_CONSENT_DOCUMENTATION_HANDLINGS = [self::FAILED_CONSENT_DOCUMENTATION_HANDLING_OPTIMISTIC, self::FAILED_CONSENT_DOCUMENTATION_HANDLING_ESSENTIALS_ONLY]
- OPTION_GROUP = 'options'
- PREDEFINED_DATA_PROCESSING_IN_SAFE_COUNTRIES_LISTS = [ // EU: https://reciprocitylabs.com/resources/what-countries-are-covered-by-gdpr/ // EEA: https://ec.europa.eu/eurostat/statistics-explained/index.php?title=Glossary:European_Economic_Area_(EEA) 'GDPR' => ['AT', 'BE', 'BG', 'HR', 'CY', 'CZ', 'DK', 'EE', 'FI', 'FR', 'DE', 'GR', 'HU', 'IE', 'IS', 'IT', 'LI', 'LV', 'LT', 'LU', 'MT', 'NL', 'NO', 'PL', 'PT', 'RO', 'SK', 'SI', 'ES', 'SE'], 'DSG' => ['CH'], 'GDPR+DSG' => [], 'ADEQUACY_EU' => ['AD', 'AR', 'CA', 'FO', 'GG', 'IL', 'IM', 'JP', 'JE', 'NZ', 'KR', 'CH', 'GB', 'UY', 'US'], 'ADEQUACY_CH' => ['DE', 'AD', 'AR', 'AT', 'BE', 'BG', 'CA', 'CY', 'HR', 'DK', 'ES', 'EE', 'FI', 'FR', 'GI', 'GR', 'GG', 'HU', 'IM', 'FO', 'IE', 'IS', 'IL', 'IT', 'JE', 'LV', 'LI', 'LT', 'LU', 'MT', 'MC', 'NO', 'NZ', 'NL', 'PL', 'PT', 'CZ', 'RO', 'GB', 'SK', 'SI', 'SE', 'UY', 'US'], ]
- A list of predefined lists for e.g. `GDPR` considered as secury country for data processing in unsafe countries.
- SETTING_ACCEPT_ALL_FOR_BOTS = RCB_OPT_PREFIX . '-accept-all-for-bots'
- SETTING_AGE_NOTICE = RCB_OPT_PREFIX . '-age-notice'
- SETTING_AGE_NOTICE_AGE_LIMIT = RCB_OPT_PREFIX . '-age-notice-age-limit'
- SETTING_BANNER_LESS_CONSENT = RCB_OPT_PREFIX . '-banner-less-consent'
- SETTING_BANNER_LESS_SHOW_ON_PAGE_IDS = RCB_OPT_PREFIX . '-banner-less-show-on-page-ids'
- SETTING_CONSENT_DURATION = RCB_OPT_PREFIX . '-consent-duration'
- SETTING_COOKIE_DURATION = RCB_OPT_PREFIX . '-cookie-duration'
- SETTING_COOKIE_VERSION = RCB_OPT_PREFIX . '-cookie-version'
- SETTING_DATA_PROCESSING_IN_UNSAFE_COUNTRIES = RCB_OPT_PREFIX . '-data-processing-in-unsafe-countries'
- SETTING_FAILED_CONSENT_DOCUMENTATION_HANDLING = RCB_OPT_PREFIX . '-failed-consent-documentation-handling'
- SETTING_LIST_SERVICES_NOTICE = RCB_OPT_PREFIX . '-list-services-notice'
- SETTING_RESPECT_DO_NOT_TRACK = RCB_OPT_PREFIX . '-respect-do-not-track'
- SETTING_SAVE_IP = RCB_OPT_PREFIX . '-save-ip'
- TRANSIENT_SCHEDULE_CONSENTS_DELETION = RCB_OPT_PREFIX . '-schedule-consents-deletion'
Properties
Methods
- calculateBannerlessConsentChecks() : array<string|int, mixed>
- Calculate if the bannerless consent check should be enabled.
- calculateServicesWithDataProcessingInUnsafeCountries() : mixed
- Calculate configured services which are processing data in unsafe countries.
- dynamicPredecision() : mixed
- Determines, if the current page request should be bypassed by bannerless mode.
- enableOptionsAutoload() : mixed
- Initially `add_option` to avoid autoloading issues.
- getAgeNoticeAgeLimit() : int
- Get the configured age limit for the age notice.
- getAgeNoticeAgeLimitRaw() : string|int
- Get the configured age limit for the age notice in raw format.
- getBannerLessConsentShowOnPageIds() : array<string|int, int>
- Get the page IDs where the banner less consent should be shown.
- getConsentDuration() : int
- Get the consent duration in months.
- getCookieDuration() : int
- Get the cookie duration for the consent cookies in days.
- getCookieVersion() : int
- Get the cookie version for the consent cookies.
- getFailedConsentDocumentationHandling() : string
- Get the behavior what should be done when documentating the consent fails. See als `FAILED_CONSENT_HANDLINGS`.
- getInstance() : mixed
- Get singleton instance.
- getPluginConstantPrefix() : string
- Get the prefix of this plugin so composer packages can dynamically build other constant values on it.
- getSettings() : mixed
- Getter.
- isAcceptAllForBots() : bool
- Check if bots should acceppt all cookies automatically.
- isAgeNoticeEnabled() : bool
- Check if age notice hint is enabled
- isBannerLessConsent() : bool
- Check if banner less consent is enabled.
- isDataProcessingInUnsafeCountries() : bool
- Check if data processing in unsafe countries is enabled.
- isListServicesNoticeEnabled() : bool
- Check if list-services notice hint is enabled
- isRespectDoNotTrack() : bool
- Check if "Do not Track" header is respected.
- isSaveIpEnabled() : bool
- Check if IPs should be saved in plain in database.
- option_consent_duration() : mixed
- The consent duration may not be greater than 120 months.
- option_cookie_duration() : mixed
- The cookie duration may not be greater than 365 days.
- overrideEnableOptionsAutoload() : mixed
- overrideRegister() : mixed
- probablyCreateBannerlessConsentTransaction() : mixed
- If bannerless consent is enabled, we can create a transaction which we can instantly use to `Consent#commit` so the user does not see any cookie banner.
- register() : mixed
- Register settings.
- setCookieVersion() : mixed
- Set the cookie version for the consent cookies.
- setSettings() : mixed
- Setter.
- update_option_consent_transient_deletion() : mixed
- Delete transient when settings are updated
- __construct() : mixed
- C'tor.
Constants
AGE_NOTICE_COUNTRY_AGE_MAP
public
mixed
AGE_NOTICE_COUNTRY_AGE_MAP
= ['INHERIT' => 0, 'GDPR' => 16, 'BE' => 13, 'DK' => 13, 'EE' => 13, 'FI' => 13, 'IS' => 13, 'LV' => 13, 'NO' => 13, 'PT' => 13, 'SE' => 13, 'MT' => 13, 'AT' => 14, 'BG' => 14, 'CY' => 14, 'IT' => 14, 'LT' => 14, 'ES' => 14, 'CZ' => 15, 'FR' => 15, 'GR' => 15, 'SI' => 15, 'DE' => 16, 'HR' => 16, 'HU' => 16, 'LI' => 16, 'LU' => 16, 'NL' => 16, 'PL' => 16, 'RO' => 16, 'SK' => 16, 'IE' => 16, 'CH' => 13]
COOKIE_VERSION_1
Search the coding for difference.
public
mixed
COOKIE_VERSION_1
= 1
COOKIE_VERSION_2
public
mixed
COOKIE_VERSION_2
= 2
COOKIE_VERSION_3
public
mixed
COOKIE_VERSION_3
= 3
CUSTOM_BYPASS_BANNER_LESS_CONSENT
public
mixed
CUSTOM_BYPASS_BANNER_LESS_CONSENT
= 'bannerless'
DEFAULT_ACCEPT_ALL_FOR_BOTS
public
mixed
DEFAULT_ACCEPT_ALL_FOR_BOTS
= true
DEFAULT_AGE_NOTICE
public
mixed
DEFAULT_AGE_NOTICE
= true
DEFAULT_AGE_NOTICE_AGE_LIMIT
public
mixed
DEFAULT_AGE_NOTICE_AGE_LIMIT
= 'INHERIT'
DEFAULT_BANNER_LESS_CONSENT
public
mixed
DEFAULT_BANNER_LESS_CONSENT
= false
DEFAULT_BANNER_LESS_SHOW_ON_PAGE_IDS
public
mixed
DEFAULT_BANNER_LESS_SHOW_ON_PAGE_IDS
= ''
DEFAULT_CONSENT_DURATION
public
mixed
DEFAULT_CONSENT_DURATION
= 120
DEFAULT_COOKIE_DURATION
public
mixed
DEFAULT_COOKIE_DURATION
= 365
DEFAULT_COOKIE_VERSION
public
mixed
DEFAULT_COOKIE_VERSION
= self::COOKIE_VERSION_3
DEFAULT_DATA_PROCESSING_IN_UNSAFE_COUNTRIES
public
mixed
DEFAULT_DATA_PROCESSING_IN_UNSAFE_COUNTRIES
= false
DEFAULT_FAILED_CONSENT_DOCUMENTATION_HANDLING
public
mixed
DEFAULT_FAILED_CONSENT_DOCUMENTATION_HANDLING
= self::FAILED_CONSENT_DOCUMENTATION_HANDLING_ESSENTIALS_ONLY
DEFAULT_LIST_SERVICES_NOTICE
public
mixed
DEFAULT_LIST_SERVICES_NOTICE
= true
DEFAULT_RESPECT_DO_NOT_TRACK
public
mixed
DEFAULT_RESPECT_DO_NOT_TRACK
= false
DEFAULT_SAVE_IP
public
mixed
DEFAULT_SAVE_IP
= false
FAILED_CONSENT_DOCUMENTATION_HANDLING_ESSENTIALS_ONLY
public
mixed
FAILED_CONSENT_DOCUMENTATION_HANDLING_ESSENTIALS_ONLY
= 'essentials'
FAILED_CONSENT_DOCUMENTATION_HANDLING_OPTIMISTIC
public
mixed
FAILED_CONSENT_DOCUMENTATION_HANDLING_OPTIMISTIC
= 'optimistic'
FAILED_CONSENT_DOCUMENTATION_HANDLINGS
public
mixed
FAILED_CONSENT_DOCUMENTATION_HANDLINGS
= [self::FAILED_CONSENT_DOCUMENTATION_HANDLING_OPTIMISTIC, self::FAILED_CONSENT_DOCUMENTATION_HANDLING_ESSENTIALS_ONLY]
OPTION_GROUP
public
mixed
OPTION_GROUP
= 'options'
PREDEFINED_DATA_PROCESSING_IN_SAFE_COUNTRIES_LISTS
A list of predefined lists for e.g. `GDPR` considered as secury country for data processing in unsafe countries.
public
mixed
PREDEFINED_DATA_PROCESSING_IN_SAFE_COUNTRIES_LISTS
= [
// EU: https://reciprocitylabs.com/resources/what-countries-are-covered-by-gdpr/
// EEA: https://ec.europa.eu/eurostat/statistics-explained/index.php?title=Glossary:European_Economic_Area_(EEA)
'GDPR' => ['AT', 'BE', 'BG', 'HR', 'CY', 'CZ', 'DK', 'EE', 'FI', 'FR', 'DE', 'GR', 'HU', 'IE', 'IS', 'IT', 'LI', 'LV', 'LT', 'LU', 'MT', 'NL', 'NO', 'PL', 'PT', 'RO', 'SK', 'SI', 'ES', 'SE'],
'DSG' => ['CH'],
'GDPR+DSG' => [],
'ADEQUACY_EU' => ['AD', 'AR', 'CA', 'FO', 'GG', 'IL', 'IM', 'JP', 'JE', 'NZ', 'KR', 'CH', 'GB', 'UY', 'US'],
'ADEQUACY_CH' => ['DE', 'AD', 'AR', 'AT', 'BE', 'BG', 'CA', 'CY', 'HR', 'DK', 'ES', 'EE', 'FI', 'FR', 'GI', 'GR', 'GG', 'HU', 'IM', 'FO', 'IE', 'IS', 'IL', 'IT', 'JE', 'LV', 'LI', 'LT', 'LU', 'MT', 'MC', 'NO', 'NZ', 'NL', 'PL', 'PT', 'CZ', 'RO', 'GB', 'SK', 'SI', 'SE', 'UY', 'US'],
]
SETTING_ACCEPT_ALL_FOR_BOTS
public
mixed
SETTING_ACCEPT_ALL_FOR_BOTS
= RCB_OPT_PREFIX . '-accept-all-for-bots'
SETTING_AGE_NOTICE
public
mixed
SETTING_AGE_NOTICE
= RCB_OPT_PREFIX . '-age-notice'
SETTING_AGE_NOTICE_AGE_LIMIT
public
mixed
SETTING_AGE_NOTICE_AGE_LIMIT
= RCB_OPT_PREFIX . '-age-notice-age-limit'
SETTING_BANNER_LESS_CONSENT
public
mixed
SETTING_BANNER_LESS_CONSENT
= RCB_OPT_PREFIX . '-banner-less-consent'
SETTING_BANNER_LESS_SHOW_ON_PAGE_IDS
public
mixed
SETTING_BANNER_LESS_SHOW_ON_PAGE_IDS
= RCB_OPT_PREFIX . '-banner-less-show-on-page-ids'
SETTING_CONSENT_DURATION
public
mixed
SETTING_CONSENT_DURATION
= RCB_OPT_PREFIX . '-consent-duration'
SETTING_COOKIE_DURATION
public
mixed
SETTING_COOKIE_DURATION
= RCB_OPT_PREFIX . '-cookie-duration'
SETTING_COOKIE_VERSION
public
mixed
SETTING_COOKIE_VERSION
= RCB_OPT_PREFIX . '-cookie-version'
SETTING_DATA_PROCESSING_IN_UNSAFE_COUNTRIES
public
mixed
SETTING_DATA_PROCESSING_IN_UNSAFE_COUNTRIES
= RCB_OPT_PREFIX . '-data-processing-in-unsafe-countries'
SETTING_FAILED_CONSENT_DOCUMENTATION_HANDLING
public
mixed
SETTING_FAILED_CONSENT_DOCUMENTATION_HANDLING
= RCB_OPT_PREFIX . '-failed-consent-documentation-handling'
SETTING_LIST_SERVICES_NOTICE
public
mixed
SETTING_LIST_SERVICES_NOTICE
= RCB_OPT_PREFIX . '-list-services-notice'
SETTING_RESPECT_DO_NOT_TRACK
public
mixed
SETTING_RESPECT_DO_NOT_TRACK
= RCB_OPT_PREFIX . '-respect-do-not-track'
SETTING_SAVE_IP
public
mixed
SETTING_SAVE_IP
= RCB_OPT_PREFIX . '-save-ip'
TRANSIENT_SCHEDULE_CONSENTS_DELETION
public
mixed
TRANSIENT_SCHEDULE_CONSENTS_DELETION
= RCB_OPT_PREFIX . '-schedule-consents-deletion'
Properties
$me
Singleton instance.
private
static Consent
$me
= null
$settings
See Settings
private
Settings
$settings
Methods
calculateBannerlessConsentChecks()
Calculate if the bannerless consent check should be enabled.
public
calculateBannerlessConsentChecks() : array<string|int, mixed>
Return values
array<string|int, mixed>calculateServicesWithDataProcessingInUnsafeCountries()
Calculate configured services which are processing data in unsafe countries.
public
calculateServicesWithDataProcessingInUnsafeCountries() : mixed
dynamicPredecision()
Determines, if the current page request should be bypassed by bannerless mode.
public
dynamicPredecision(false|string $result, WP_REST_Request $request) : mixed
Parameters
- $result : false|string
- $request : WP_REST_Request
enableOptionsAutoload()
Initially `add_option` to avoid autoloading issues.
public
enableOptionsAutoload() : mixed
getAgeNoticeAgeLimit()
Get the configured age limit for the age notice.
public
getAgeNoticeAgeLimit() : int
Return values
intgetAgeNoticeAgeLimitRaw()
Get the configured age limit for the age notice in raw format.
public
getAgeNoticeAgeLimitRaw() : string|int
Return values
string|int —Can be an integer or "INHERIT"
string
getBannerLessConsentShowOnPageIds()
Get the page IDs where the banner less consent should be shown.
public
abstract getBannerLessConsentShowOnPageIds() : array<string|int, int>
Return values
array<string|int, int>getConsentDuration()
Get the consent duration in months.
public
getConsentDuration() : int
Return values
intgetCookieDuration()
Get the cookie duration for the consent cookies in days.
public
getCookieDuration() : int
Return values
intgetCookieVersion()
Get the cookie version for the consent cookies.
public
getCookieVersion() : int
Return values
intgetFailedConsentDocumentationHandling()
Get the behavior what should be done when documentating the consent fails. See als `FAILED_CONSENT_HANDLINGS`.
public
getFailedConsentDocumentationHandling() : string
Return values
stringgetInstance()
Get singleton instance.
public
static getInstance() : mixed
Tags
getPluginConstantPrefix()
Get the prefix of this plugin so composer packages can dynamically build other constant values on it.
public
getPluginConstantPrefix() : string
Tags
Return values
stringgetSettings()
Getter.
public
getSettings() : mixed
Tags
isAcceptAllForBots()
Check if bots should acceppt all cookies automatically.
public
isAcceptAllForBots() : bool
Return values
boolisAgeNoticeEnabled()
Check if age notice hint is enabled
public
isAgeNoticeEnabled() : bool
Return values
boolisBannerLessConsent()
Check if banner less consent is enabled.
public
abstract isBannerLessConsent() : bool
Return values
boolisDataProcessingInUnsafeCountries()
Check if data processing in unsafe countries is enabled.
public
abstract isDataProcessingInUnsafeCountries() : bool
Return values
boolisListServicesNoticeEnabled()
Check if list-services notice hint is enabled
public
isListServicesNoticeEnabled() : bool
Return values
boolisRespectDoNotTrack()
Check if "Do not Track" header is respected.
public
isRespectDoNotTrack() : bool
Return values
boolisSaveIpEnabled()
Check if IPs should be saved in plain in database.
public
isSaveIpEnabled() : bool
Return values
booloption_consent_duration()
The consent duration may not be greater than 120 months.
public
option_consent_duration(mixed $value) : mixed
Parameters
- $value : mixed
option_cookie_duration()
The cookie duration may not be greater than 365 days.
public
option_cookie_duration(mixed $value) : mixed
Parameters
- $value : mixed
Tags
overrideEnableOptionsAutoload()
public
overrideEnableOptionsAutoload() : mixed
overrideRegister()
public
overrideRegister() : mixed
probablyCreateBannerlessConsentTransaction()
If bannerless consent is enabled, we can create a transaction which we can instantly use to `Consent#commit` so the user does not see any cookie banner.
public
probablyCreateBannerlessConsentTransaction(Consent $consent, Transaction $transaction, int $currentPageId, string $defaultTcfString) : mixed
Parameters
- $consent : Consent
-
The current consent
- $transaction : Transaction
-
A prepared transaction which has
userAgent
,ipAddress
filled - $currentPageId : int
-
The current page ID which is used to get the page ID from the
bannerLessConsentShowOnPageIds
array - $defaultTcfString : string
-
The default TCF string which is used if no TCF string is provided
register()
Register settings.
public
register() : mixed
setCookieVersion()
Set the cookie version for the consent cookies.
public
setCookieVersion(mixed $version) : mixed
Parameters
- $version : mixed
setSettings()
Setter.
public
setSettings(Settings $settings) : mixed
Parameters
- $settings : Settings
Tags
update_option_consent_transient_deletion()
Delete transient when settings are updated
public
update_option_consent_transient_deletion() : mixed
__construct()
C'tor.
private
__construct() : mixed