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::GOOGLE_FONTS => \DevOwl\RealCookieBanner\presets\free\blocker\GoogleFontsPreset::class, \DevOwl\RealCookieBanner\presets\PresetIdentifierMap::YOUTUBE => \DevOwl\RealCookieBanner\presets\free\blocker\YoutubePreset::class, \DevOwl\RealCookieBanner\presets\PresetIdentifierMap::JETPACK_SITE_STATS => \DevOwl\RealCookieBanner\presets\free\blocker\JetPackSiteStatsPreset::class, \DevOwl\RealCookieBanner\presets\PresetIdentifierMap::JETPACK_COMMENTS => \DevOwl\RealCookieBanner\presets\free\blocker\JetPackCommentsPreset::class, \DevOwl\RealCookieBanner\presets\PresetIdentifierMap::GRAVATAR => \DevOwl\RealCookieBanner\presets\free\blocker\GravatarPreset::class, \DevOwl\RealCookieBanner\presets\PresetIdentifierMap::WORDPRESS_EMOJIS => \DevOwl\RealCookieBanner\presets\free\blocker\WordPressEmojisPreset::class, \DevOwl\RealCookieBanner\presets\PresetIdentifierMap::FONTAWESOME => \DevOwl\RealCookieBanner\presets\free\blocker\FontAwesomePreset::class, \DevOwl\RealCookieBanner\presets\PresetIdentifierMap::WORDPRESS_USER_LOGIN => \DevOwl\RealCookieBanner\presets\free\blocker\WordPressUserLoginPreset::class, \DevOwl\RealCookieBanner\presets\PresetIdentifierMap::WORDPRESS_PLUGIN_EMBED => \DevOwl\RealCookieBanner\presets\free\blocker\WordPressPluginEmbed::class, \DevOwl\RealCookieBanner\presets\PresetIdentifierMap::WORDPRESS_COMMENTS => \DevOwl\RealCookieBanner\presets\free\blocker\WordPressCommentsPreset::class, \DevOwl\RealCookieBanner\presets\PresetIdentifierMap::AWIN_PUBLISHER_MASTERTAG => \DevOwl\RealCookieBanner\presets\pro\blocker\AwinPublisherMasterTagPreset::class, \DevOwl\RealCookieBanner\presets\PresetIdentifierMap::FOUND_EE => \DevOwl\RealCookieBanner\presets\pro\blocker\FoundEePreset::class, \DevOwl\RealCookieBanner\presets\PresetIdentifierMap::FRESHCHAT => \DevOwl\RealCookieBanner\presets\pro\blocker\FreshchatPreset::class, \DevOwl\RealCookieBanner\presets\PresetIdentifierMap::GOOGLE_ADS => \DevOwl\RealCookieBanner\presets\pro\blocker\GoogleAdsPreset::class, \DevOwl\RealCookieBanner\presets\PresetIdentifierMap::GOOGLE_AD_SENSE => \DevOwl\RealCookieBanner\presets\pro\blocker\GoogleAdsensePreset::class, \DevOwl\RealCookieBanner\presets\PresetIdentifierMap::GTM => \DevOwl\RealCookieBanner\presets\pro\blocker\GtmPreset::class, \DevOwl\RealCookieBanner\presets\PresetIdentifierMap::HCAPTCHA => \DevOwl\RealCookieBanner\presets\pro\blocker\HCaptchaPreset::class, \DevOwl\RealCookieBanner\presets\PresetIdentifierMap::HELP_CRUNCH_CHAT => \DevOwl\RealCookieBanner\presets\pro\blocker\HelpCrunchChatPreset::class, \DevOwl\RealCookieBanner\presets\PresetIdentifierMap::HELP_SCOUT_CHAT => \DevOwl\RealCookieBanner\presets\pro\blocker\HelpScoutChatPreset::class, \DevOwl\RealCookieBanner\presets\PresetIdentifierMap::LUCKY_ORANGE => \DevOwl\RealCookieBanner\presets\pro\blocker\LuckyOrangePreset::class, \DevOwl\RealCookieBanner\presets\PresetIdentifierMap::MATOMO => \DevOwl\RealCookieBanner\presets\pro\blocker\MatomoPreset::class, \DevOwl\RealCookieBanner\presets\PresetIdentifierMap::MTM => \DevOwl\RealCookieBanner\presets\pro\blocker\MtmPreset::class, \DevOwl\RealCookieBanner\presets\PresetIdentifierMap::BING_ADS => \DevOwl\RealCookieBanner\presets\pro\blocker\BingAdsPreset::class, \DevOwl\RealCookieBanner\presets\PresetIdentifierMap::PADDLE_COM => \DevOwl\RealCookieBanner\presets\pro\blocker\PaddleComPreset::class, \DevOwl\RealCookieBanner\presets\PresetIdentifierMap::REAMAZE_CHAT => \DevOwl\RealCookieBanner\presets\pro\blocker\ReamazeChatPreset::class, \DevOwl\RealCookieBanner\presets\PresetIdentifierMap::AMAZON_ASSOCIATES_WIDGET => \DevOwl\RealCookieBanner\presets\pro\blocker\AmazonAssociatesWidgetPreset::class, \DevOwl\RealCookieBanner\presets\PresetIdentifierMap::TIKTOK_PIXEL => \DevOwl\RealCookieBanner\presets\pro\blocker\TikTokPixelPreset::class)

PRESETS_TYPE

PRESETS_TYPE ='blocker'

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

resolveAvailableCookies()

resolveAvailableCookies(array  $preset)

Resolve `attributes.cookies` so we can e.g. show created cookies in "Connected cookies" in blocker edit form.

Parameters

array $preset

Result of getWithAttributes()

applyMiddleware()

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

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

Parameters

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

getBlockerWithPreset()

getBlockerWithPreset()

Get all available blocker with a preset.