Documentation

rex_plugin extends rex_package
in package
implements rex_plugin_interface

Class for plugins.

Tags
author

gharlan

Table of Contents

Interfaces

rex_plugin_interface
Interface for plugins.

Constants

FILE_BOOT  = 'boot.php'
FILE_INSTALL  = 'install.php'
FILE_INSTALL_SQL  = 'install.sql'
FILE_PACKAGE  = 'package.yml'
FILE_UNINSTALL  = 'uninstall.php'
FILE_UNINSTALL_SQL  = 'uninstall.sql'
FILE_UPDATE  = 'update.php'

Methods

__construct()  : mixed
boot()  : void
clearCache()  : void
Clears the cache of the package.
enlist()  : void
exists()  : bool
Returns if the plugin exists.
get()  : rex_plugin_interface
Returns the plugin by the given name.
getAddon()  : rex_addon
getAssetsPath()  : mixed
getAssetsUrl()  : mixed
getAuthor()  : string|null
Returns the author.
getAvailablePackages()  : array<string, self>
Returns the available packages.
getAvailablePlugins()  : array<string, self>
Returns the available plugins of the given addons.
getCachePath()  : mixed
getConfig()  : mixed
getDataPath()  : mixed
getInstalledPackages()  : array<string, self>
Returns the installed packages.
getInstalledPlugins()  : array<string, self>
Returns the installed plugins of the given addons.
getName()  : non-empty-string
Returns the name of the package.
getPackageId()  : string
Returns the package ID.
getPath()  : mixed
getProperty()  : mixed
Returns a property.
getRegisteredPackages()  : array<string, self>
Returns the registered packages.
getRegisteredPlugins()  : array<string, self>
Returns the registered plugins of the given addon.
getSetupPackages()  : array<string, self>
Returns the setup packages.
getSupportPage()  : string|null
Returns the supportpage.
getSystemPackages()  : array<string, self>
Returns the system packages.
getSystemPlugins()  : array<string, self>
Returns the system plugins of the given addons.
getType()  : mixed
getVersion()  : string
Returns the version.
hasConfig()  : bool
hasProperty()  : bool
Returns if a property is set.
i18n()  : mixed
includeFile()  : mixed
Includes a file in the package context.
isAvailable()  : bool
Returns if the package is available (activated and installed).
isInstalled()  : bool
Returns if the package is installed.
isSystemPackage()  : mixed
loadProperties()  : void
Loads the properties of package.yml.
removeConfig()  : bool
removeProperty()  : void
Removes a property.
require()  : self
Returns the plugin by the given name.
setConfig()  : bool
setProperty()  : void
Sets a property.
splitId()  : array{: string, : ?string}
Splits the package id into a tuple of addon id and plugin id (if existing).

Constants

FILE_BOOT

public mixed FILE_BOOT = 'boot.php'

FILE_INSTALL

public mixed FILE_INSTALL = 'install.php'

FILE_INSTALL_SQL

public mixed FILE_INSTALL_SQL = 'install.sql'

FILE_PACKAGE

public mixed FILE_PACKAGE = 'package.yml'

FILE_UNINSTALL

public mixed FILE_UNINSTALL = 'uninstall.php'

FILE_UNINSTALL_SQL

public mixed FILE_UNINSTALL_SQL = 'uninstall.sql'

FILE_UPDATE

public mixed FILE_UPDATE = 'update.php'

Methods

__construct()

public __construct(string $name, rex_addon $addon) : mixed
Parameters
$name : string

Name

$addon : rex_addon

Parent addon

exists()

Returns if the plugin exists.

public static exists(string $addon[, string $plugin = null ]) : bool
Parameters
$addon : string

Name of the addon

$plugin : string = null

Name of the plugin

Tags
psalm-suppress

ParamNameMismatch

Return values
bool

get()

Returns the plugin by the given name.

public static get(string $addon[, string $plugin = null ]) : rex_plugin_interface
Parameters
$addon : string

Name of the addon

$plugin : string = null

Name of the plugin

Tags
throws
InvalidArgumentException
psalm-suppress

ParamNameMismatch

Return values
rex_plugin_interface

If the plugin exists, a rex_plugin is returned, otherwise a rex_null_plugin

getAssetsPath()

public getAssetsPath([mixed $file = '' ]) : mixed
Parameters
$file : mixed = ''

getAssetsUrl()

public getAssetsUrl([mixed $file = '' ]) : mixed
Parameters
$file : mixed = ''

getAuthor()

Returns the author.

public getAuthor([mixed $default = null ]) : string|null
Parameters
$default : mixed = null

Default value, will be returned if the property isn't set

Return values
string|null

getAvailablePackages()

Returns the available packages.

public static getAvailablePackages() : array<string, self>
Return values
array<string, self>

getAvailablePlugins()

Returns the available plugins of the given addons.

public static getAvailablePlugins(string $addon) : array<string, self>
Parameters
$addon : string

Addon name

Return values
array<string, self>

getCachePath()

public getCachePath([mixed $file = '' ]) : mixed
Parameters
$file : mixed = ''

getConfig()

public getConfig([mixed $key = null ][, mixed $default = null ]) : mixed
Parameters
$key : mixed = null

The associated key

$default : mixed = null

Default return value if no associated-value can be found

Return values
mixed

the value for $key or $default if $key cannot be found in the given $namespace

getDataPath()

public getDataPath([mixed $file = '' ]) : mixed
Parameters
$file : mixed = ''

getInstalledPackages()

Returns the installed packages.

public static getInstalledPackages() : array<string, self>
Return values
array<string, self>

getInstalledPlugins()

Returns the installed plugins of the given addons.

public static getInstalledPlugins(string $addon) : array<string, self>
Parameters
$addon : string

Addon name

Return values
array<string, self>

getName()

Returns the name of the package.

public getName() : non-empty-string
Return values
non-empty-string

Name

getPackageId()

Returns the package ID.

public getPackageId() : string
Return values
string

getPath()

public getPath([mixed $file = '' ]) : mixed
Parameters
$file : mixed = ''

getProperty()

Returns a property.

public getProperty(mixed $key[, mixed $default = null ]) : mixed
Parameters
$key : mixed

Key of the property

$default : mixed = null

Default value, will be returned if the property isn't set

getRegisteredPackages()

Returns the registered packages.

public static getRegisteredPackages() : array<string, self>
Return values
array<string, self>

getRegisteredPlugins()

Returns the registered plugins of the given addon.

public static getRegisteredPlugins(string $addon) : array<string, self>
Parameters
$addon : string

Addon name

Return values
array<string, self>

getSetupPackages()

Returns the setup packages.

public static getSetupPackages() : array<string, self>
Return values
array<string, self>

getSupportPage()

Returns the supportpage.

public getSupportPage([mixed $default = null ]) : string|null
Parameters
$default : mixed = null

Default value, will be returned if the property isn't set

Return values
string|null

getSystemPackages()

Returns the system packages.

public static getSystemPackages() : array<string, self>
Return values
array<string, self>

getSystemPlugins()

Returns the system plugins of the given addons.

public static getSystemPlugins(string $addon) : array<string, self>
Parameters
$addon : string

Addon name

Return values
array<string, self>

getType()

public getType() : mixed

getVersion()

Returns the version.

public getVersion([mixed $format = null ]) : string
Parameters
$format : mixed = null

See

Return values
string

hasConfig()

public hasConfig([mixed $key = null ]) : bool
Parameters
$key : mixed = null

The associated key

Return values
bool

hasProperty()

Returns if a property is set.

public hasProperty(mixed $key) : bool
Parameters
$key : mixed

Key of the property

Return values
bool

i18n()

public i18n(mixed $key, mixed ...$replacements) : mixed
Parameters
$key : mixed
$replacements : mixed

includeFile()

Includes a file in the package context.

public includeFile(mixed $file[, array<string|int, mixed> $context = [] ]) : mixed
Parameters
$file : mixed

Filename

$context : array<string|int, mixed> = []

Context values, available as variables in given file

isAvailable()

Returns if the package is available (activated and installed).

public isAvailable() : bool
Return values
bool

isInstalled()

Returns if the package is installed.

public isInstalled() : bool
Return values
bool

isSystemPackage()

public isSystemPackage() : mixed

loadProperties()

Loads the properties of package.yml.

public loadProperties([bool $force = false ]) : void
Parameters
$force : bool = false

removeConfig()

public removeConfig(mixed $key) : bool
Parameters
$key : mixed

The associated key

Return values
bool

removeProperty()

Removes a property.

public removeProperty(mixed $key) : void
Parameters
$key : mixed

Key of the property

require()

Returns the plugin by the given name.

public static require(string $addon[, string|null $plugin = null ]) : self
Parameters
$addon : string
$plugin : string|null = null
Tags
throws
RuntimeException

if the plugin does not exist

psalm-suppress

ParamNameMismatch

Return values
self

setConfig()

public setConfig(mixed $key[, mixed $value = null ]) : bool
Parameters
$key : mixed

The associated key or an associative array of key/value pairs

$value : mixed = null

The value to save

Return values
bool

TRUE when an existing value was overridden, otherwise FALSE

setProperty()

Sets a property.

public setProperty(mixed $key, mixed $value) : void
Parameters
$key : mixed

Key of the property

$value : mixed

New value for the property

splitId()

Splits the package id into a tuple of addon id and plugin id (if existing).

public static splitId(string $packageId) : array{: string, : ?string}
Parameters
$packageId : string
Return values
array{: string, : ?string}

        
On this page

Search results