Documentation

Core extends Core
in package
implements IOverrideCore Uses Core, Core

Singleton core class which handles the main system for plugin. It includes registering of the autoload, all hooks (actions & filters) (see BaseCore class).

Table of Contents

Interfaces

IOverrideCore

Constants

ADD_MANAGE_MIN_CAPABILITY_TO_ALL_USERS_WITH  = 'manage_options'
Add the minimum required capability so a user can manage cookies to all users, which also have the `manage_options` capability.
MANAGE_MIN_CAPABILITY  = 'manage_real_cookie_banner'
The minimal required capability so a user can manage cookies.

Properties

$activator  : Activator
The plugins activator class.
$adInitiator  : AdInitiator
See AdInitiator.
$anonymousAssetBuilder  : AnonymousAssetBuilder
See AnonymousAssetBuilder.
$assets  : Assets
The plugins asset class.
$banner  : Banner
The banner.
$blocker  : Blocker
The blocker.
$compLanguage  : AbstractLanguagePlugin
See AbstractLanguagePlugin.
$configPage  : ConfigPage
The config page.
$cookieConsentManagement  : CookieConsentManagement
See CookieConsentManagement.
$excludeAssets  : ExcludeAssets
See ExcludeAssets.
$me  : Core
Singleton instance.
$notices  : Notices
See Notices.
$pageRequestUuid4  : string
An unique id for this page request. This is e. g. needed for unique overlay id.
$plugin_data  : mixed
The stored plugin data.
$realQueue  : Core
See RealQueue.
$rpmInitiator  : RpmInitiator
See RpmInitiator.
$scanner  : Scanner
See Scanner.
$service  : Service
The utils service class.
$tcfVendorListNormalizer  : TcfVendorListNormalizer
See TcfVendorListNormalizer.
$updater  : mixed
The updater instance.

Methods

customize_save_response()  : mixed
Check if any plugin specific setting got changed in customize.
getActivator()  : Activator
Getter.
getAdInitiator()  : mixed
Get ad initiator from `real-utils`.
getAnonymousAssetBuilder()  : mixed
Getter.
getAssets()  : Assets
Getter
getBanner()  : mixed
Get banner.
getBaseAssetsUrl()  : mixed
Return the base URL to assets specially for Real Cookie Banner.
getBlocker()  : mixed
Get blocker.
getCompLanguage()  : mixed
Get compatibility language class.
getConfigPage()  : mixed
Get config page.
getCookieConsentManagement()  : mixed
Getter.
getExcludeAssets()  : mixed
Getter.
getInstance()  : Core
Get singleton core class.
getInternalPackages()  : object
Get a list of internal packages (our own, symlinked from the monorepo).
getNotices()  : mixed
Getter.
getPageRequestUuid4()  : mixed
Get request uuid 4.
getPluginConstantPrefix()  : string
Get the prefix of this plugin so composer packages can dynamically build other constant values on it.
getPluginData()  : array<string|int, string>|string|null
Gets the plugin data.
getRealQueue()  : mixed
Getter.
getRpmInitiator()  : mixed
Get ad initiator from `real-product-manager-wp-client`.
getScanner()  : mixed
Getter.
getService()  : Service
Getter
getTcfVendorListNormalizer()  : mixed
Getter.
i18n()  : mixed
Define constants which relies on i18n localization loaded.
init()  : mixed
The init function is fired even the init hook of WordPress. If possible it should register all hooks to have them in one place.
isLicenseActive()  : mixed
Check if a license is active.
overrideConstruct()  : mixed
overrideInit()  : mixed
overrideInitCustomize()  : mixed
This method should be called in your 'init' action through your core.
overrideRegisterPostTypes()  : mixed
overrideRegisterSettings()  : mixed
queryArguments()  : mixed
See filter RCB/Query/Arguments.
registerPostTypes()  : mixed
Register post types and custom taxonomies.
registerSettings()  : mixed
Register settings.
updateDbCheck()  : mixed
Updates the database version in the options table.
versionCompareOlderThan()  : mixed
Checks if a previously installed version is lower than an expected version.
__construct()  : mixed
Application core constructor.
construct()  : mixed
The constructor handles the core startup mechanism.
persistEncodedHttpRefererInUrl()  : mixed
For apache2 servers we need to send the URL without any `?` characters, so we simply remove the query arguments, as this is disallowed by a fix for a [CVE](https://www.cve.org/CVERecord?id=CVE-2024-38474). Additionally, we send another `_wp_http_referer_b64` with base64-encoded URL so we can get the full URL in WordPress.

Constants

ADD_MANAGE_MIN_CAPABILITY_TO_ALL_USERS_WITH

Add the minimum required capability so a user can manage cookies to all users, which also have the `manage_options` capability.

public mixed ADD_MANAGE_MIN_CAPABILITY_TO_ALL_USERS_WITH = 'manage_options'

MANAGE_MIN_CAPABILITY

The minimal required capability so a user can manage cookies.

public mixed MANAGE_MIN_CAPABILITY = 'manage_real_cookie_banner'

Properties

$assets

The plugins asset class.

private Assets $assets

$me

Singleton instance.

private static Core $me = null

$pageRequestUuid4

An unique id for this page request. This is e. g. needed for unique overlay id.

private string $pageRequestUuid4

$plugin_data

The stored plugin data.

private mixed $plugin_data

$realQueue

See RealQueue.

private Core $realQueue

Methods

customize_save_response()

Check if any plugin specific setting got changed in customize.

public customize_save_response(array<string|int, mixed> $response) : mixed
Parameters
$response : array<string|int, mixed>

getAdInitiator()

Get ad initiator from `real-utils`.

public getAdInitiator() : mixed
Tags
codeCoverageIgnore

getAnonymousAssetBuilder()

Getter.

public getAnonymousAssetBuilder() : mixed
Tags
codeCoverageIgnore

getAssets()

Getter

public getAssets() : Assets
Tags
codeCoverageIgnore
Return values
Assets

getBanner()

Get banner.

public getBanner() : mixed
Tags
codeCoverageIgnore

getBaseAssetsUrl()

Return the base URL to assets specially for Real Cookie Banner.

public getBaseAssetsUrl(string $path) : mixed
Parameters
$path : string

getBlocker()

Get blocker.

public getBlocker() : mixed
Tags
codeCoverageIgnore

getCompLanguage()

Get compatibility language class.

public getCompLanguage() : mixed
Tags
codeCoverageIgnore

getConfigPage()

Get config page.

public getConfigPage() : mixed
Tags
codeCoverageIgnore

getCookieConsentManagement()

Getter.

public getCookieConsentManagement() : mixed
Tags
codeCoverageIgnore

getExcludeAssets()

Getter.

public getExcludeAssets() : mixed
Tags
codeCoverageIgnore

getInstance()

Get singleton core class.

public static getInstance() : Core
Return values
Core

getInternalPackages()

Get a list of internal packages (our own, symlinked from the monorepo).

public getInternalPackages() : object
Return values
object

getNotices()

Getter.

public getNotices() : mixed
Tags
codeCoverageIgnore

getPageRequestUuid4()

Get request uuid 4.

public getPageRequestUuid4() : mixed
Tags
codeCoverageIgnore

getPluginConstantPrefix()

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

public getPluginConstantPrefix() : string
Tags
codeCoverageIgnore

It only returns a string with the constant prefix

Return values
string

getRealQueue()

Getter.

public getRealQueue() : mixed
Tags
codeCoverageIgnore

getRpmInitiator()

Get ad initiator from `real-product-manager-wp-client`.

public getRpmInitiator() : mixed
Tags
codeCoverageIgnore

getScanner()

Getter.

public getScanner() : mixed
Tags
codeCoverageIgnore

getService()

Getter

public getService() : Service
Tags
codeCoverageIgnore
Return values
Service

getTcfVendorListNormalizer()

Getter.

public getTcfVendorListNormalizer() : mixed
Tags
codeCoverageIgnore

i18n()

Define constants which relies on i18n localization loaded.

public i18n() : mixed

init()

The init function is fired even the init hook of WordPress. If possible it should register all hooks to have them in one place.

public init() : mixed

isLicenseActive()

Check if a license is active.

public isLicenseActive() : mixed

overrideConstruct()

public overrideConstruct() : mixed

overrideInit()

public overrideInit() : mixed

overrideInitCustomize()

This method should be called in your 'init' action through your core.

public overrideInitCustomize() : mixed

overrideRegisterPostTypes()

public overrideRegisterPostTypes() : mixed

overrideRegisterSettings()

public overrideRegisterSettings() : mixed

queryArguments()

See filter RCB/Query/Arguments.

public queryArguments(array<string|int, mixed> $arguments, string $context) : mixed
Parameters
$arguments : array<string|int, mixed>
$context : string

registerPostTypes()

Register post types and custom taxonomies.

public registerPostTypes() : mixed

registerSettings()

Register settings.

public registerSettings() : mixed

updateDbCheck()

Updates the database version in the options table.

public updateDbCheck() : mixed

It also installs the needed database tables.

versionCompareOlderThan()

Checks if a previously installed version is lower than an expected version.

public static versionCompareOlderThan(string|false $installed, string $version[, array<string|int, string> $allowedPrerelease = [] ][, callable $prereleaseAdditionalCheck = null ]) : mixed

Additionally, we can check for a prerelease version, too. The $allowedPrerelease needs to be an array (e.g. ["2.15.1", "2.16.0"]), and if the installed version is a prerelease (e.g. 2.15.1-9507), the version 2.15.1 gets extracted and checked for existence in the array.

Usage with $prereleaseAdditionalCheck: You can pass an additional callback which is executed before returning true when a prerelease got found. An example scenario for this callable is to check for a specific database table if you drop a column. Why is this needed? Imagine you are sending multiple prerelease to a customer.

Parameters
$installed : string|false
$version : string
$allowedPrerelease : array<string|int, string> = []
$prereleaseAdditionalCheck : callable = null

($prereleaseVersion, $prereleaseCiIid) => boolean

__construct()

Application core constructor.

protected __construct() : mixed

construct()

The constructor handles the core startup mechanism.

protected construct() : mixed

The constructor is protected because a factory method should only create a Core object.

persistEncodedHttpRefererInUrl()

For apache2 servers we need to send the URL without any `?` characters, so we simply remove the query arguments, as this is disallowed by a fix for a [CVE](https://www.cve.org/CVERecord?id=CVE-2024-38474). Additionally, we send another `_wp_http_referer_b64` with base64-encoded URL so we can get the full URL in WordPress.

protected persistEncodedHttpRefererInUrl() : mixed

In general, this is bad practice to modify $_REQUEST directly, but we do not yet know another way of doing other.

Tags
see
https://app.clickup.com/t/86954236z

        
On this page

Search results