TransientHandler
in package
FinalYes
Handle site-wide transients for a specific plugin. It is static-only access and set.
Do not use this handler for other data than timestamps and booleans!
All your used transient keys should be in constants so they are readable in code and as short as possible in database.
Table of Contents
Constants
- OPTION_NAME = 'real_utils-transients'
- TRANSIENT_CROSS_COUNTER = 'cc'
- TRANSIENT_CROSS_SKIP = 'cs'
- TRANSIENT_INITIATOR_CROSS = 'cross'
- TRANSIENT_NEXT_CROSS_SELLING = 'ncs'
- TRANSIENT_NEXT_RATING = 'nr'
- TRANSIENT_REDIRECT_AFTER_ACTIVATE = 'raa'
- Note: E.g WPML does creation of the settings `_icl_sitepress_settings` option when entering the plugins page again. Real Cookie Banners' taxonomies are not registered to the ICL cache if we do a redirect at plugin activation time.
- TRANSIENT_REDIRECT_AFTER_ACTIVATE_AWAITING_REDIRECT = 0
- TRANSIENT_REDIRECT_AFTER_ACTIVATE_NOT_REGISTERED = false
- TRANSIENT_REDIRECT_AFTER_ACTIVATE_REDIRECTED = true
Methods
- get() : mixed
- Get a value for a given plugin.
- set() : bool
- Set a value for a given plugin.
- json() : mixed
- Get the JSON from database option.
Constants
OPTION_NAME
public
mixed
OPTION_NAME
= 'real_utils-transients'
TRANSIENT_CROSS_COUNTER
public
mixed
TRANSIENT_CROSS_COUNTER
= 'cc'
TRANSIENT_CROSS_SKIP
public
mixed
TRANSIENT_CROSS_SKIP
= 'cs'
TRANSIENT_INITIATOR_CROSS
public
mixed
TRANSIENT_INITIATOR_CROSS
= 'cross'
TRANSIENT_NEXT_CROSS_SELLING
public
mixed
TRANSIENT_NEXT_CROSS_SELLING
= 'ncs'
TRANSIENT_NEXT_RATING
public
mixed
TRANSIENT_NEXT_RATING
= 'nr'
TRANSIENT_REDIRECT_AFTER_ACTIVATE
Note: E.g WPML does creation of the settings `_icl_sitepress_settings` option when entering the plugins page again. Real Cookie Banners' taxonomies are not registered to the ICL cache if we do a redirect at plugin activation time.
public
mixed
TRANSIENT_REDIRECT_AFTER_ACTIVATE
= 'raa'
Possible values:
-
false
= Default, no redirection registered, yet (backwards-compatibility, instead of another number) -
1
= Plugin got activated, we can redirect -
true
= Redirection done for this plugin (backwards-compatibility, instead of another number)
TRANSIENT_REDIRECT_AFTER_ACTIVATE_AWAITING_REDIRECT
public
mixed
TRANSIENT_REDIRECT_AFTER_ACTIVATE_AWAITING_REDIRECT
= 0
TRANSIENT_REDIRECT_AFTER_ACTIVATE_NOT_REGISTERED
public
mixed
TRANSIENT_REDIRECT_AFTER_ACTIVATE_NOT_REGISTERED
= false
TRANSIENT_REDIRECT_AFTER_ACTIVATE_REDIRECTED
public
mixed
TRANSIENT_REDIRECT_AFTER_ACTIVATE_REDIRECTED
= true
Methods
get()
Get a value for a given plugin.
public
static get(AbstractInitiator|string $initiator, string $key[, mixed $default = null ]) : mixed
Parameters
- $initiator : AbstractInitiator|string
- $key : string
- $default : mixed = null
set()
Set a value for a given plugin.
public
static set(AbstractInitiator $initiator, string $key, mixed $value) : bool
Parameters
- $initiator : AbstractInitiator
- $key : string
- $value : mixed
Return values
booljson()
Get the JSON from database option.
protected
static json([array<string|int, mixed> $set = null ]) : mixed
Parameters
- $set : array<string|int, mixed> = null
-
Write back to database