Import
in package
Uses
UtilsProvider, ImportGroups, ImportSettings, ImportCookies, ImportBlocker, ImportBannerLinks, ImportTcfVendorConfigurations, ImportCustomizeBanner, ImportMessages
Allows to import a JSON string with specific options. If you want to learn more about the scheme, please have a look at the output of the export.
Table of Contents
Constants
- IMPORT_POST_STATI = ['keep', 'publish', 'private', 'draft']
Properties
- $mapCookies : mixed
- A map of post_name -> duplicate ID so it can be used for blocker import.
- $mapTcfVendorConfigurations : mixed
- A map of post_name -> duplicate ID so it can be used for blocker import.
- $blockerSkipExisting : bool
- Skip existing blocker.
- $blockerStatus : string
- Force or "keep" a given post status.
- $cookieGroup : int
- Default cookie group when it can not be assigned to one.
- $cookieSkipExisting : bool
- Skip already existing services.
- $cookieStatus : string
- Force or "keep" a given post status.
- $json : mixed
- The importing JSON as associative array.
- $messages : mixed
- Messages occured while importing.
- $tcfVendorConfigurationStatus : string
- Force or "keep" a given post status.
Methods
- getBlockerStatus() : mixed
- Get content blocker status.
- getCookieGroup() : mixed
- Get cookie group.
- getCookieStatus() : mixed
- Get cookie status.
- getJSON() : mixed
- Get JSON.
- getMessages() : mixed
- Get happened messages.
- getPluginConstantPrefix() : string
- Get the prefix of this plugin so composer packages can dynamically build other constant values on it.
- getTcfVendorConfigurationStatus() : mixed
- Get TCF Vendor configuration status.
- import() : mixed
- Import all available settings in the passed JSON. This also respects the correct order of imports.
- importBannerLinks() : mixed
- Import banner links.
- importBlocker() : mixed
- Import content blocker.
- importCookieGroups() : mixed
- Import cookie groups.
- importCookies() : mixed
- Import cookies.
- importCustomizeBanner() : mixed
- Import customize banner settings.
- importSettings() : mixed
- Import settings.
- importTcfVendorConfigurations() : mixed
- Import TCF Vendor configurations.
- instance() : mixed
- Get singleton instance.
- isBlockerSkipExisting() : mixed
- Get blocker skip existing.
- isCookieSkipExisting() : mixed
- Get cookie skip existing.
- optionsMap() : mixed
- Read all available options.
- setBlockerSkipExisting() : mixed
- Set blocker to skip existing.
- setBlockerStatus() : mixed
- Set blocker status.
- setCookieGroup() : mixed
- Set default cookie group.
- setCookieSkipExisting() : mixed
- Set cookies to skip existing.
- setCookieStatus() : mixed
- Set service status.
- setTcfVendorConfigurationStatus() : mixed
- Set TCF Vendor configuration status.
- addMessage() : mixed
- Add a message to the message container.
- addMessageBannerLinkPageId() : mixed
- Add message for banner link with configured page ID.
- addMessageBlockerVisualMediaThumbnail() : mixed
- Add message for blocker with configured media library item
- addMessageCookieAssignFailure() : mixed
- Cookie could not be assigned to cookie.
- addMessageCookieGroupUpdatedInfo() : mixed
- Cookie group is not created instead it was updated.
- addMessageCookieGroupUpdateFailure() : mixed
- Cookie group could not be updated.
- addMessageCreateFailure() : mixed
- `wp_insert_post` failed for given type.
- addMessageCreateFailureImportingProInFreeVersion() : mixed
- User is trying to import PRO template in free version.
- addMessageCreateFailureImportingTemplateButNoLicenseActive() : mixed
- User is trying to import template without license active, so a synchronization is never possible.
- addMessageMissingProperties() : mixed
- A type definition is incorrect.
- addMessageOptionMultisite() : mixed
- Multisite options can not be imported due to reference issues.
- addMessageOptionOutdated() : mixed
- Option not related to RCB.
- addMessageOptionRelatesMedia() : mixed
- An option relates to a media, it can never be imported.
- addMessageOptionRelatesPageId() : mixed
- An option relates to a page ID, it can never be imported.
- addMessageSkipExistingBannerLink() : mixed
- The banner link got not created because already exists.
- addMessageSkipExistingBlocker() : mixed
- The content blocker got not created because already exists.
- addMessageSkipExistingCookie() : mixed
- The cookie got not created because already exists.
- addMessageSkipExistingTcfVendorConfiguration() : mixed
- The TCF vendor configuration got not created because already exists.
- addMessageUpdateOptionFailure() : mixed
- `update_option` failured.
- addMessageWrongUsageKey() : mixed
- A top-level cookie type has incorrect scheme.
- correctAssociationIdsForBlocker() : mixed
- Fetch the correct cookie / TCF vendor ids for the meta.
- doImportBannerLinks() : mixed
- Import banner links from JSON.
- doImportBlocker() : mixed
- Import content blocker from JSON.
- doImportCookieGroups() : mixed
- Import cookie groups from JSON.
- doImportCookies() : mixed
- Import cookies from JSON.
- doImportCustomizeBanner() : mixed
- Import customize banner settings from JSON.
- doImportSettings() : mixed
- Import settings from JSON.
- doImportTcfVendorConfigurations() : mixed
- Import TCF Vendor configurations from JSON.
- handleCookieAssign() : mixed
- Assign a created cookie to a given group.
- handleCorruptBannerLink() : mixed
- Check missing meta of passed banner link.
- handleCorruptBlocker() : mixed
- Check missing meta of passed blocker.
- handleCorruptCookie() : mixed
- Check missing meta of passed cookie.
- handleCorruptGroup() : mixed
- Check missing meta of passed group.
- handleCorruptTcfVendorConfiguration() : mixed
- Check missing meta of passed configuration.
- handleGroupCreate() : mixed
- Handle to create a new group.
- handleGroupUpdate() : mixed
- Handle to update an existing group instead of creating a new one.
- handleSepcialCustomizeBanner() : mixed
- Handle special cases for customize banner settings.
- handleSepcialSetting() : mixed
- Handle special cases for settings.
- probablyAddMessageBlockerAssociation() : mixed
- Add message for non-associated cookies / TCF vendors.
- probablyAddMessageCookieGroupNotFound() : mixed
- The cookie could not be associated to the given group, did fallback.
- probablyAddMessageDuplicateBlocker() : mixed
- The content blocker got duplicated.
- probablyAddMessageDuplicateCookie() : mixed
- The cookie got duplicated.
- probablyAddMessageSettingOnlyPro() : mixed
- A PRO-only setting can not be imported in lite.
- __construct() : mixed
- C'tor.
Constants
IMPORT_POST_STATI
public
mixed
IMPORT_POST_STATI
= ['keep', 'publish', 'private', 'draft']
Properties
$mapCookies
A map of post_name -> duplicate ID so it can be used for blocker import.
protected
mixed
$mapCookies
= []
E. g. if a new cookie is created through import, the new ID should be used instead
of the defined one in blocker
.
$mapTcfVendorConfigurations
A map of post_name -> duplicate ID so it can be used for blocker import.
protected
mixed
$mapTcfVendorConfigurations
= []
E. g. if a new TCF vendor configuration is created through import, the new ID should be used instead
of the defined one in blocker
.
$blockerSkipExisting
Skip existing blocker.
private
bool
$blockerSkipExisting
= true
$blockerStatus
Force or "keep" a given post status.
private
string
$blockerStatus
= 'keep'
$cookieGroup
Default cookie group when it can not be assigned to one.
private
int
$cookieGroup
= null
$cookieSkipExisting
Skip already existing services.
private
bool
$cookieSkipExisting
= true
$cookieStatus
Force or "keep" a given post status.
private
string
$cookieStatus
= 'keep'
$json
The importing JSON as associative array.
private
mixed
$json
= []
$messages
Messages occured while importing.
private
mixed
$messages
= []
$tcfVendorConfigurationStatus
Force or "keep" a given post status.
private
string
$tcfVendorConfigurationStatus
= 'keep'
Methods
getBlockerStatus()
Get content blocker status.
public
getBlockerStatus() : mixed
Tags
getCookieGroup()
Get cookie group.
public
getCookieGroup() : mixed
Tags
getCookieStatus()
Get cookie status.
public
getCookieStatus() : mixed
Tags
getJSON()
Get JSON.
public
getJSON() : mixed
Tags
getMessages()
Get happened messages.
public
& getMessages() : 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
stringgetTcfVendorConfigurationStatus()
Get TCF Vendor configuration status.
public
getTcfVendorConfigurationStatus() : mixed
Tags
import()
Import all available settings in the passed JSON. This also respects the correct order of imports.
public
import() : mixed
importBannerLinks()
Import banner links.
public
importBannerLinks() : mixed
importBlocker()
Import content blocker.
public
importBlocker() : mixed
importCookieGroups()
Import cookie groups.
public
importCookieGroups() : mixed
importCookies()
Import cookies.
public
importCookies() : mixed
importCustomizeBanner()
Import customize banner settings.
public
importCustomizeBanner() : mixed
importSettings()
Import settings.
public
importSettings() : mixed
importTcfVendorConfigurations()
Import TCF Vendor configurations.
public
importTcfVendorConfigurations() : mixed
instance()
Get singleton instance.
public
static instance(array<string|int, mixed> $json) : mixed
Parameters
- $json : array<string|int, mixed>
Tags
isBlockerSkipExisting()
Get blocker skip existing.
public
isBlockerSkipExisting() : mixed
Tags
isCookieSkipExisting()
Get cookie skip existing.
public
isCookieSkipExisting() : mixed
Tags
optionsMap()
Read all available options.
public
optionsMap([bool $asOptionName = false ]) : mixed
Parameters
- $asOptionName : bool = false
-
If true, the returned map contains the option name instead of value
setBlockerSkipExisting()
Set blocker to skip existing.
public
setBlockerSkipExisting(bool $value) : mixed
Parameters
- $value : bool
Tags
setBlockerStatus()
Set blocker status.
public
setBlockerStatus(string $value) : mixed
Parameters
- $value : string
Tags
setCookieGroup()
Set default cookie group.
public
setCookieGroup(int $value) : mixed
Parameters
- $value : int
Tags
setCookieSkipExisting()
Set cookies to skip existing.
public
setCookieSkipExisting(bool $value) : mixed
Parameters
- $value : bool
Tags
setCookieStatus()
Set service status.
public
setCookieStatus(string $value) : mixed
Parameters
- $value : string
Tags
setTcfVendorConfigurationStatus()
Set TCF Vendor configuration status.
public
setTcfVendorConfigurationStatus(string $value) : mixed
Parameters
- $value : string
Tags
addMessage()
Add a message to the message container.
protected
addMessage(string $message, string $severity[, string $fix = null ][, string $args = [] ]) : mixed
Parameters
- $message : string
- $severity : string
-
Can be: info, warning, error, success
- $fix : string = null
-
See
import.post.tsx
- $args : string = []
-
See
import.post.tsx
addMessageBannerLinkPageId()
Add message for banner link with configured page ID.
protected
addMessageBannerLinkPageId(string $post_title) : mixed
Parameters
- $post_title : string
addMessageBlockerVisualMediaThumbnail()
Add message for blocker with configured media library item
protected
addMessageBlockerVisualMediaThumbnail(string $post_title, int $blockerId) : mixed
Parameters
- $post_title : string
- $blockerId : int
addMessageCookieAssignFailure()
Cookie could not be assigned to cookie.
protected
addMessageCookieAssignFailure(int $postId, WP_Error $error) : mixed
Parameters
- $postId : int
- $error : WP_Error
addMessageCookieGroupUpdatedInfo()
Cookie group is not created instead it was updated.
protected
addMessageCookieGroupUpdatedInfo(string $name) : mixed
Parameters
- $name : string
addMessageCookieGroupUpdateFailure()
Cookie group could not be updated.
protected
addMessageCookieGroupUpdateFailure(string $name, WP_Error $error) : mixed
Parameters
- $name : string
- $error : WP_Error
addMessageCreateFailure()
`wp_insert_post` failed for given type.
protected
addMessageCreateFailure(string $post_title, string $type, WP_Error $error) : mixed
Parameters
- $post_title : string
- $type : string
- $error : WP_Error
addMessageCreateFailureImportingProInFreeVersion()
User is trying to import PRO template in free version.
protected
addMessageCreateFailureImportingProInFreeVersion(string $post_title) : mixed
Parameters
- $post_title : string
addMessageCreateFailureImportingTemplateButNoLicenseActive()
User is trying to import template without license active, so a synchronization is never possible.
protected
addMessageCreateFailureImportingTemplateButNoLicenseActive(string $post_title) : mixed
Parameters
- $post_title : string
addMessageMissingProperties()
A type definition is incorrect.
protected
addMessageMissingProperties(int $index, string $type, string $properties) : mixed
Parameters
- $index : int
- $type : string
- $properties : string
addMessageOptionMultisite()
Multisite options can not be imported due to reference issues.
protected
addMessageOptionMultisite(string $name, string $key) : mixed
Parameters
- $name : string
- $key : string
addMessageOptionOutdated()
Option not related to RCB.
protected
addMessageOptionOutdated(string $key) : mixed
Parameters
- $key : string
addMessageOptionRelatesMedia()
An option relates to a media, it can never be imported.
protected
addMessageOptionRelatesMedia(string $name, string $key) : mixed
Parameters
- $name : string
- $key : string
addMessageOptionRelatesPageId()
An option relates to a page ID, it can never be imported.
protected
addMessageOptionRelatesPageId(string $name, string $key) : mixed
Parameters
- $name : string
- $key : string
addMessageSkipExistingBannerLink()
The banner link got not created because already exists.
protected
addMessageSkipExistingBannerLink(string $post_name) : mixed
Parameters
- $post_name : string
addMessageSkipExistingBlocker()
The content blocker got not created because already exists.
protected
addMessageSkipExistingBlocker(string $post_name) : mixed
Parameters
- $post_name : string
addMessageSkipExistingCookie()
The cookie got not created because already exists.
protected
addMessageSkipExistingCookie(string $post_name) : mixed
Parameters
- $post_name : string
addMessageSkipExistingTcfVendorConfiguration()
The TCF vendor configuration got not created because already exists.
protected
addMessageSkipExistingTcfVendorConfiguration(int $vendorId) : mixed
Parameters
- $vendorId : int
addMessageUpdateOptionFailure()
`update_option` failured.
protected
addMessageUpdateOptionFailure(string $optionName) : mixed
Parameters
- $optionName : string
addMessageWrongUsageKey()
A top-level cookie type has incorrect scheme.
protected
addMessageWrongUsageKey(string $type) : mixed
Parameters
- $type : string
correctAssociationIdsForBlocker()
Fetch the correct cookie / TCF vendor ids for the meta.
protected
correctAssociationIdsForBlocker(array<string|int, string> $post_names, string $mapName, string $association_post_type) : mixed
Parameters
- $post_names : array<string|int, string>
- $mapName : string
-
Can be
mapCookies
ormapTcfVendorConfigurations
- $association_post_type : string
doImportBannerLinks()
Import banner links from JSON.
protected
doImportBannerLinks(array<string|int, mixed> $bannerLinks) : mixed
Parameters
- $bannerLinks : array<string|int, mixed>
doImportBlocker()
Import content blocker from JSON.
protected
doImportBlocker(array<string|int, mixed> $blockers) : mixed
Parameters
- $blockers : array<string|int, mixed>
doImportCookieGroups()
Import cookie groups from JSON.
protected
doImportCookieGroups(array<string|int, mixed> $groups) : mixed
Parameters
- $groups : array<string|int, mixed>
doImportCookies()
Import cookies from JSON.
protected
doImportCookies(array<string|int, mixed> $cookies) : mixed
Parameters
- $cookies : array<string|int, mixed>
doImportCustomizeBanner()
Import customize banner settings from JSON.
protected
doImportCustomizeBanner(array<string|int, mixed> $sections) : mixed
Parameters
- $sections : array<string|int, mixed>
doImportSettings()
Import settings from JSON.
protected
doImportSettings(array<string|int, mixed> $settings) : mixed
Parameters
- $settings : array<string|int, mixed>
doImportTcfVendorConfigurations()
Import TCF Vendor configurations from JSON.
protected
doImportTcfVendorConfigurations(array<string|int, mixed> $tcfVendorConfiguration) : mixed
Parameters
- $tcfVendorConfiguration : array<string|int, mixed>
handleCookieAssign()
Assign a created cookie to a given group.
protected
handleCookieAssign(int $postId, int $groupId) : mixed
Parameters
- $postId : int
- $groupId : int
handleCorruptBannerLink()
Check missing meta of passed banner link.
protected
handleCorruptBannerLink(array<string|int, mixed> $bannerLink, int $index) : mixed
Parameters
- $bannerLink : array<string|int, mixed>
- $index : int
handleCorruptBlocker()
Check missing meta of passed blocker.
protected
handleCorruptBlocker(array<string|int, mixed> $blocker, int $index) : mixed
Parameters
- $blocker : array<string|int, mixed>
- $index : int
handleCorruptCookie()
Check missing meta of passed cookie.
protected
handleCorruptCookie(array<string|int, mixed> $cookie, int $index) : mixed
Parameters
- $cookie : array<string|int, mixed>
- $index : int
handleCorruptGroup()
Check missing meta of passed group.
protected
handleCorruptGroup(array<string|int, mixed> $group, int $index) : mixed
Parameters
- $group : array<string|int, mixed>
- $index : int
handleCorruptTcfVendorConfiguration()
Check missing meta of passed configuration.
protected
handleCorruptTcfVendorConfiguration(array<string|int, mixed> $tcfVendorConfiguration, int $index) : mixed
Parameters
- $tcfVendorConfiguration : array<string|int, mixed>
- $index : int
handleGroupCreate()
Handle to create a new group.
protected
handleGroupCreate(string $slug, string $name, string $description, int $order) : mixed
Parameters
- $slug : string
- $name : string
- $description : string
- $order : int
handleGroupUpdate()
Handle to update an existing group instead of creating a new one.
protected
handleGroupUpdate(string $slug, int $term_id, string $name, string $description) : mixed
Parameters
- $slug : string
- $term_id : int
- $name : string
- $description : string
handleSepcialCustomizeBanner()
Handle special cases for customize banner settings.
protected
handleSepcialCustomizeBanner(string $optionName, string $section, mixed $setting, string $value) : mixed
Parameters
- $optionName : string
- $section : string
- $setting : mixed
- $value : string
handleSepcialSetting()
Handle special cases for settings.
protected
handleSepcialSetting(string $optionName, mixed $value, string $key) : mixed
Parameters
- $optionName : string
- $value : mixed
- $key : string
probablyAddMessageBlockerAssociation()
Add message for non-associated cookies / TCF vendors.
protected
probablyAddMessageBlockerAssociation(int $count, int $associatedCount, string $post_title, int $blockerId) : mixed
Parameters
- $count : int
- $associatedCount : int
- $post_title : string
- $blockerId : int
probablyAddMessageCookieGroupNotFound()
The cookie could not be associated to the given group, did fallback.
protected
probablyAddMessageCookieGroupNotFound(bool $groupNotFound, string $post_title, int $group, int $created) : mixed
Parameters
- $groupNotFound : bool
- $post_title : string
- $group : int
- $created : int
probablyAddMessageDuplicateBlocker()
The content blocker got duplicated.
protected
probablyAddMessageDuplicateBlocker(bool|WP_Post $found, string $post_name, int $original, int $duplicate) : mixed
Parameters
- $found : bool|WP_Post
- $post_name : string
- $original : int
- $duplicate : int
probablyAddMessageDuplicateCookie()
The cookie got duplicated.
protected
probablyAddMessageDuplicateCookie(bool|WP_Post $found, string $post_name, int $group, int $created) : mixed
Parameters
- $found : bool|WP_Post
- $post_name : string
- $group : int
- $created : int
probablyAddMessageSettingOnlyPro()
A PRO-only setting can not be imported in lite.
protected
probablyAddMessageSettingOnlyPro(bool $onlyPro, string $key) : mixed
Parameters
- $onlyPro : bool
- $key : string
__construct()
C'tor.
private
__construct(array<string|int, mixed> $json) : mixed
Parameters
- $json : array<string|int, mixed>