Constants

TABLE_NAME

TABLE_NAME ='presets'

TRANSIENT_CACHE_KEY

TRANSIENT_CACHE_KEY =RCB_OPT_PREFIX . '-%s-presets-%s'

TRANSIENT_CACHE_EXPIRE

TRANSIENT_CACHE_EXPIRE =12 * 60 * 60

CLASSES

CLASSES =array(\DevOwl\RealCookieBanner\presets\PresetIdentifierMap::REAL_COOKIE_BANNER => \DevOwl\RealCookieBanner\presets\free\RealCookieBannerPreset::class, \DevOwl\RealCookieBanner\presets\PresetIdentifierMap::WORDPRESS_USER_LOGIN => \DevOwl\RealCookieBanner\presets\free\WordPressUserLoginPreset::class, \DevOwl\RealCookieBanner\presets\PresetIdentifierMap::WORDPRESS_COMMENTS => \DevOwl\RealCookieBanner\presets\free\WordPressCommentsPreset::class, \DevOwl\RealCookieBanner\presets\PresetIdentifierMap::JETPACK_COMMENTS => \DevOwl\RealCookieBanner\presets\free\JetPackCommentsPreset::class, \DevOwl\RealCookieBanner\presets\PresetIdentifierMap::GOOGLE_FONTS => \DevOwl\RealCookieBanner\presets\free\GoogleFontsPreset::class, \DevOwl\RealCookieBanner\presets\PresetIdentifierMap::YOUTUBE => \DevOwl\RealCookieBanner\presets\free\YoutubePreset::class, \DevOwl\RealCookieBanner\presets\PresetIdentifierMap::JETPACK_SITE_STATS => \DevOwl\RealCookieBanner\presets\free\JetpackSiteStatsPreset::class, \DevOwl\RealCookieBanner\presets\PresetIdentifierMap::GRAVATAR => \DevOwl\RealCookieBanner\presets\free\GravatarPreset::class, \DevOwl\RealCookieBanner\presets\PresetIdentifierMap::WORDPRESS_EMOJIS => \DevOwl\RealCookieBanner\presets\free\WordPressEmojisPreset::class, \DevOwl\RealCookieBanner\presets\PresetIdentifierMap::ELEMENTOR => \DevOwl\RealCookieBanner\presets\free\ElementorPreset::class, \DevOwl\RealCookieBanner\presets\PresetIdentifierMap::FONTAWESOME => \DevOwl\RealCookieBanner\presets\free\FontAwesomePreset::class, \DevOwl\RealCookieBanner\presets\PresetIdentifierMap::WORDPRESS_PLUGIN_EMBED => \DevOwl\RealCookieBanner\presets\free\WordPressPluginEmbed::class)

PRESETS_TYPE

PRESETS_TYPE ='cookie'

Properties

$expireOption

$expireOption :\MatthiasWeb\Utils\ExpireOption

Cache of presets as they can be time-consuming to generate.

So, they are recalculated each x hours.

Type

\MatthiasWeb\Utils\ExpireOption

$type

$type :

Type

Methods

__construct()

__construct()

C'tor.

getClassList()

getClassList(boolean  $force = false)

Get all available presets and persist the metadata to cache.

Parameters

boolean $force

If true, the cache gets invalidated

fromClassList()

fromClassList(array<mixed,string>  $clazzes)

Create presets from `AbstractBlockerPreset` classes.

Parameters

array<mixed,string> $clazzes

getOtherMetaKeys()

getOtherMetaKeys()

Get a list of other meta keys which should be persist to metadata cache.

expandResult()

expandResult(array  $rows)

Expand the read rows with additional, recalculated tags (not cached!).

Parameters

array $rows

getAllFromCache()

getAllFromCache(boolean  $force = false)

Get presets from the cache.

Parameters

boolean $force

If true, the cache gets invalidated

getFromCache()

getFromCache(string  $identifier)

Get a preset from the cache. Returns `false` if preset not in cache.

Parameters

string $identifier

castReadRow()

castReadRow(array  $row)

Cast SQL types.

Parameters

array $row

getWithAttributes()

getWithAttributes(string  $identifier)

Get a preset with attributes resolved. Returns `false` if preset not found or no attributes are available. This function does currently not use the metadata cache!

Parameters

string $identifier

needsRecalculation()

needsRecalculation()

Check if the current preset type needs to be recalculated.

forceRegeneration()

forceRegeneration()

Force regeneration of presets.

persist()

persist(array  $items)

Persist a set of presets.

Parameters

array $items

getExpireOption()

getExpireOption()

Get the `ExpireOption` instance.

getType()

getType()

getContextKey()

getContextKey()

Get the context key for cache. Presets should be saved per-language.

getPluginConstantPrefix()

getPluginConstantPrefix(): string

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

Returns

string

createFromPreset()

createFromPreset(integer  $identifier,integer|false  $group,integer  $updatePostId = null)

Create a cookie from a cookie preset.

Parameters

integer $identifier
integer|false $group

Pass false if you do not want to set the cookie group

integer $updatePostId

Do not create the new preset, instead update it

applyMiddleware()

applyMiddleware(array<mixed,\DevOwl\RealCookieBanner\presets\WP_Post>  $existingCookies,array<mixed,\DevOwl\RealCookieBanner\presets\WP_Post>  $existingBlockers,array  $result)

See filter `RCB/Presets/Cookies/MiddlewareCallbacks`.

Parameters

array<mixed,\DevOwl\RealCookieBanner\presets\WP_Post> $existingCookies
array<mixed,\DevOwl\RealCookieBanner\presets\WP_Post> $existingBlockers
array $result

getCookiesWithPreset()

getCookiesWithPreset()

Get all available cookies with a preset.

getCreateUrl()

getCreateUrl(string  $identifier)

Get the URL to create a new cookie from a preset identifier.

Parameters

string $identifier