Core
extends Core
in package
implements
IOverrideCore
Uses
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
Properties
- $activator : Activator
- The plugins activator class.
- $assets : Assets
- The plugins asset class.
- $me : mixed
- Singleton instance.
- $plugin_data : mixed
- The stored plugin data.
- $rpmInitiator : RpmInitiator
- See RpmInitiator.
- $service : Service
- The utils service class.
- $updater : mixed
- Updater instance.
Methods
- getActivator() : Activator
- Getter.
- getAssets() : Assets
- Getter
- getInstance() : Core
- Get singleton core class.
- getInternalPackages() : object
- Get a list of internal packages (our own, symlinked from the monorepo).
- 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.
- getRpmInitiator() : mixed
- Get ad initiator from `real-product-manager-wp-client`.
- getService() : Service
- 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.
- overrideConstruct() : mixed
- overrideInit() : mixed
- tableName() : string
- Static method to get a RML table name.
- update_count() : mixed
- Use the wp die filter to make the last update count;
- 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.
- compatibilities() : mixed
- Allow a better compatibility for other plugins.
Properties
$activator
The plugins activator class.
private
Activator
$activator
$assets
The plugins asset class.
private
Assets
$assets
$me
Singleton instance.
private
static mixed
$me
$plugin_data
The stored plugin data.
private
mixed
$plugin_data
$rpmInitiator
See RpmInitiator.
private
RpmInitiator
$rpmInitiator
$service
The utils service class.
private
Service
$service
$updater
Updater instance.
private
mixed
$updater
Tags
Methods
getActivator()
Getter.
public
getActivator() : Activator
Tags
Return values
ActivatorgetAssets()
Getter
public
getAssets() : Assets
Tags
Return values
AssetsgetInstance()
Get singleton core class.
public
static getInstance() : Core
Return values
CoregetInternalPackages()
Get a list of internal packages (our own, symlinked from the monorepo).
public
getInternalPackages() : object
Return values
objectgetPluginConstantPrefix()
Get the prefix of this plugin so composer packages can dynamically build other constant values on it.
public
getPluginConstantPrefix() : string
Tags
Return values
stringgetPluginData()
Gets the plugin data.
public
getPluginData([string $key = null ]) : array<string|int, string>|string|null
Parameters
- $key : string = null
-
The key of the data to return
Tags
Return values
array<string|int, string>|string|nullgetRpmInitiator()
Get ad initiator from `real-product-manager-wp-client`.
public
getRpmInitiator() : mixed
Tags
getService()
Getter
public
getService() : Service
Tags
Return values
Servicei18n()
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
overrideConstruct()
public
overrideConstruct() : mixed
overrideInit()
public
overrideInit() : mixed
tableName()
Static method to get a RML table name.
public
static tableName([string $name = '' ]) : string
Parameters
- $name : string = ''
Tags
Return values
stringupdate_count()
Use the wp die filter to make the last update count;
public
update_count(mixed $result) : mixed
Parameters
- $result : 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.
compatibilities()
Allow a better compatibility for other plugins.
private
compatibilities(bool $init) : mixed
Have a look at the class' constructors for all needed filters and actions.
Parameters
- $init : bool