\MatthiasWeb\RealMediaLibraryCore

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

Summary

Methods
Properties
Constants
overrideConstruct()
overrideInit()
getPluginConstantPrefix()
i18n()
updateDbCheck()
getInternalPackages()
getPluginData()
getActivator()
getAssets()
getService()
versionCompareOlderThan()
init()
update_count()
tableName()
getRpmInitiator()
getInstance()
No public properties found
No constants found
__construct()
construct()
No protected properties found
N/A
compatibilities()
$updater
$plugin_data
$activator
$assets
$service
$me
$rpmInitiator
N/A

Properties

$updater

$updater :

Updater instance.

Type

$plugin_data

$plugin_data :

The stored plugin data.

Type

$activator

$activator :

The plugins activator class.

Type

$assets

$assets :

The plugins asset class.

Type

$service

$service :

The utils service class.

Type

$me

$me :

Singleton instance.

Type

Methods

overrideConstruct()

overrideConstruct()

overrideInit()

overrideInit()

getPluginConstantPrefix()

getPluginConstantPrefix(): string

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

Returns

string

i18n()

i18n()

Define constants which relies on i18n localization loaded.

updateDbCheck()

updateDbCheck()

Updates the database version in the options table.

It also installs the needed database tables.

getInternalPackages()

getInternalPackages(): object

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

Returns

object

getPluginData()

getPluginData(string  $key = null): array<mixed,string>|string|null

Gets the plugin data.

Parameters

string $key

The key of the data to return

Returns

array<mixed,string>|string|null

versionCompareOlderThan()

versionCompareOlderThan(string|false  $installed,string  $version,array<mixed,string>  $allowedPrerelease = array(),callable  $prereleaseAdditionalCheck = null)

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

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

string|false $installed
string $version
array<mixed,string> $allowedPrerelease
callable $prereleaseAdditionalCheck

($prereleaseVersion, $prereleaseCiIid) => boolean

init()

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.

update_count()

update_count(mixed  $result): mixed

Use the wp die filter to make the last update count;

Parameters

mixed $result

Returns

mixed

tableName()

tableName(string  $name = ''): string

Static method to get a RML table name.

Parameters

string $name

Returns

string

getRpmInitiator()

getRpmInitiator()

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

__construct()

__construct()

Application core constructor.

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

construct()

construct()

The constructor handles the core startup mechanism.

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

compatibilities()

compatibilities(boolean  $init)

Allow a better compatibility for other plugins.

Have a look at the class' constructors for all needed filters and actions.

Parameters

boolean $init