Constants

TABLE_NAME

TABLE_NAME ='revision'

TABLE_NAME_INDEPENDENT

TABLE_NAME_INDEPENDENT ='revision_independent'

OPTION_PREFIX

OPTION_PREFIX ='SETTING_'

OPTION_NAME_CURRENT_HASH_PREFIX

OPTION_NAME_CURRENT_HASH_PREFIX =RCB_OPT_PREFIX . '-revision-current-hash'

OPTION_NAME_DISMISSED_HASH_PREFIX

OPTION_NAME_DISMISSED_HASH_PREFIX =RCB_OPT_PREFIX . '-revision-dismissed-hash'

EXCLUDE_OPTIONS_FROM_REVISION

EXCLUDE_OPTIONS_FROM_REVISION =array(\DevOwl\RealCookieBanner\settings\TCF::SETTING_TCF_FIRST_ACCEPTED_TIME, \DevOwl\RealCookieBanner\settings\TCF::SETTING_TCF_ACCEPTED_TIME, \DevOwl\RealCookieBanner\settings\TCF::SETTING_TCF_GVL_DOWNLOAD_TIME, \DevOwl\RealCookieBanner\settings\CountryBypass::SETTING_COUNTRY_BYPASS_DB_DOWNLOAD_TIME)

INDEPENDENT_OPTIONS

INDEPENDENT_OPTIONS =array(\DevOwl\RealCookieBanner\settings\General::SETTING_BANNER_ACTIVE, \DevOwl\RealCookieBanner\settings\General::SETTING_BLOCKER_ACTIVE, \DevOwl\RealCookieBanner\settings\General::SETTING_HIDE_PAGE_IDS, \DevOwl\RealCookieBanner\settings\Consent::SETTING_RESPECT_DO_NOT_TRACK, \DevOwl\RealCookieBanner\settings\Consent::SETTING_SAVE_IP, \DevOwl\RealCookieBanner\settings\Consent::SETTING_CONSENT_DURATION)

Properties

Methods

getPluginConstantPrefix()

getPluginConstantPrefix(): string

Get the prefix of this plugin so composer packages can dynamically build other constant values on it.

Returns

string

getCurrentHash()

getCurrentHash()

Get the current active revision. If there is not current revision (only after activating the plugin itself), the current revision hash gets calculated from initial settings.

create()

create(boolean|string  $persist = false,boolean  $forceNewConsent = true): array

Create a MD5 hash from all available settings of Real Cookie Banner and save also as "current".

If the hash differs, a new consent is needed! Note also, that some settings are excluded and prevent a retrigger. See also createIndependent.

Parameters

boolean|string $persist

Persist the revision in database, pass force to force-write into the database

boolean $forceNewConsent

Returns

array —

'revision' and 'hash'

createIndependent()

createIndependent(boolean  $persist = false): array

Create a MD5 hash from all available customize settings of Real Cookie Banner.

UI changes does not trigger any reconsent!

Parameters

boolean $persist

Persist the revision in database

Returns

array —

'revision' and 'hash'

needsRetrigger()

needsRetrigger(array  $revision): boolean

Checks if the given current revision (result of `getCurrent`) needs a retrigger.

Parameters

array $revision

Result of getCurrent

Returns

boolean

getCurrent()

getCurrent(boolean  $recreate = false)

Get the current revision as array. It also includes the following infos:

  • public_to_users: The revision hash currently published to users
  • calculated: The current revision hash from the latest settings
  • has_manager: Has a cookie with a valid Google/Matomo Tag Manager script (so you can show a notice in your config UI)
  • public_count: A total count of public cookies

Parameters

boolean $recreate

If true, a new revision gets created so new consents need to be made. Always recreates when no consents are given yet.

getPersistedContexts()

getPersistedContexts(): array<mixed,string>

Get all persisted contexts so they can be used e. g. to query statistics.

Returns

array<mixed,string>

fromOptions()

fromOptions(array<mixed,string>  $whiteBlackList = null,boolean  $isInArray = false,boolean  $asOptionName = false)

Read all available options. This does not impact the performance in any way, because all `autoload=yes` options are loaded already.

Parameters

array<mixed,string> $whiteBlackList

Allows to skip / only options by option name

boolean $isInArray

The needed result of in_array for $whiteBlackList

boolean $asOptionName

If true, the returned map contains the option name instead of value

getContextVariables()

getContextVariables(boolean  $implicit = false)

See filter RCB/Revision/Context.

Parameters

boolean $implicit

If true, implicit context variables are parsed

getContextVariablesString()

getContextVariablesString(boolean  $implicit = false)

Get context relevant options as string so they can be used as cookie name or option name.

Parameters

boolean $implicit

If true, implicit context variables are parsed

translateContextVariablesString()

translateContextVariablesString(string  $context): string

See filter RCB/Revision/Context/Translate.

Parameters

string $context

Returns

string

getCurrentHashOptionName()

getCurrentHashOptionName()

Get the option for the current hash option name in `wp_options`.

getDismissedHashOptionName()

getDismissedHashOptionName()

Get the option for the dismissed hash option name in `wp_options`.

getByHash()

getByHash(string|array<mixed,string>  $hash,boolean  $independent = false,boolean  $applyBackwardsCompatibility = false)

Get the revision(s) by hash(es).

Parameters

string|array<mixed,string> $hash
boolean $independent
boolean $applyBackwardsCompatibility

See method applyBackwardsCompatibility

applyBackwardsCompatibility()

applyBackwardsCompatibility(array  $revision,boolean  $independent = false)

See filter `RCB/Revision/BackwardsCompatibility`.

Parameters

array $revision
boolean $independent

ignoreCurrentRetriggers()

ignoreCurrentRetriggers()

If a revision changes, the user needs to retrigger consents again. But for some reasons (e.g. testing purposes) it should also be possible to dismiss this notice.

getInstance()

getInstance()

Get singleton instance.

__construct()

__construct()

C'tor.