PluginManager
in package
FacturaScripts plugins manager.
Tags
Table of Contents
- CORE_VERSION = 2023
- FacturaScripts core version.
- PLUGIN_LIST_FILE = FS_FOLDER . DIRECTORY_SEPARATOR . 'MyFiles' . DIRECTORY_SEPARATOR . 'plugins.json'
- Path to list plugins on file.
- PLUGIN_PATH = FS_FOLDER . DIRECTORY_SEPARATOR . 'Plugins' . DIRECTORY_SEPARATOR
- Plugin path folder.
- $deploymentRequired : bool
- Indicates if a deployment is necessary.
- $enabledPlugins : array<string|int, mixed>
- List of active plugins.
- $lastPlugin : string
- Name of the last plugin installed or updated.
- __construct() : mixed
- PluginManager constructor.
- deploy() : mixed
- Deploy all the necessary files in the Dinamic folder to be able to use plugins with the autoloader, but following the priority system of FacturaScripts.
- deploymentRequired() : bool
- disable() : bool
- Disable the indicated plugin.
- enable() : bool
- Activate the indicated plugin.
- enabledPlugins() : array<string|int, mixed>
- Returns the list of active plugins.
- getLastPluginName() : string
- initPlugin() : mixed
- install() : bool
- Installs a new plugin.
- installedPlugins() : array<string|int, mixed>
- Returns the list of installed plugins.
- remove() : bool
- Remove a plugin only if it's disabled.
- checkRequire() : bool
- Check for plugins needed.
- disableByDependency() : mixed
- Disables plugins that depends on $pluginDisabled
- getPluginInfo() : array<string|int, mixed>
- Return plugin information.
- loadFromFile() : array<string|int, mixed>
- Returns an array with the list of plugins in the plugin.json file.
- save() : bool
- Save the list of plugins in a file.
- testZipFile() : bool
Constants
CORE_VERSION
FacturaScripts core version.
public
mixed
CORE_VERSION
= 2023
PLUGIN_LIST_FILE
Path to list plugins on file.
public
mixed
PLUGIN_LIST_FILE
= FS_FOLDER . DIRECTORY_SEPARATOR . 'MyFiles' . DIRECTORY_SEPARATOR . 'plugins.json'
PLUGIN_PATH
Plugin path folder.
public
mixed
PLUGIN_PATH
= FS_FOLDER . DIRECTORY_SEPARATOR . 'Plugins' . DIRECTORY_SEPARATOR
Properties
$deploymentRequired
Indicates if a deployment is necessary.
private
static bool
$deploymentRequired
= false
$enabledPlugins
List of active plugins.
private
static array<string|int, mixed>
$enabledPlugins
$lastPlugin
Name of the last plugin installed or updated.
private
static string
$lastPlugin
= ''
Methods
__construct()
PluginManager constructor.
public
__construct() : mixed
Return values
mixed —deploy()
Deploy all the necessary files in the Dinamic folder to be able to use plugins with the autoloader, but following the priority system of FacturaScripts.
public
deploy([bool $clean = true ][, bool $initControllers = false ]) : mixed
Parameters
- $clean : bool = true
- $initControllers : bool = false
Return values
mixed —deploymentRequired()
public
deploymentRequired() : bool
Return values
bool —disable()
Disable the indicated plugin.
public
disable(string $pluginName) : bool
Parameters
- $pluginName : string
Return values
bool —enable()
Activate the indicated plugin.
public
enable(string $pluginName) : bool
Parameters
- $pluginName : string
Return values
bool —enabledPlugins()
Returns the list of active plugins.
public
enabledPlugins() : array<string|int, mixed>
Return values
array<string|int, mixed> —getLastPluginName()
public
getLastPluginName() : string
Return values
string —initPlugin()
public
initPlugin(string $pluginName) : mixed
Parameters
- $pluginName : string
Return values
mixed —install()
Installs a new plugin.
public
install(string $zipPath[, string $zipName = 'plugin.zip' ][, bool $force = false ]) : bool
Parameters
- $zipPath : string
- $zipName : string = 'plugin.zip'
- $force : bool = false
Return values
bool —installedPlugins()
Returns the list of installed plugins.
public
installedPlugins() : array<string|int, mixed>
Return values
array<string|int, mixed> —remove()
Remove a plugin only if it's disabled.
public
remove(string $pluginName) : bool
Parameters
- $pluginName : string
Return values
bool —checkRequire()
Check for plugins needed.
private
checkRequire(array<string|int, mixed> $require) : bool
Parameters
- $require : array<string|int, mixed>
Return values
bool —disableByDependency()
Disables plugins that depends on $pluginDisabled
private
disableByDependency(string $pluginDisabled) : mixed
Parameters
- $pluginDisabled : string
Return values
mixed —getPluginInfo()
Return plugin information.
private
getPluginInfo(string $pluginName, string $iniContent) : array<string|int, mixed>
Parameters
- $pluginName : string
- $iniContent : string
Return values
array<string|int, mixed> —loadFromFile()
Returns an array with the list of plugins in the plugin.json file.
private
loadFromFile() : array<string|int, mixed>
Return values
array<string|int, mixed> —save()
Save the list of plugins in a file.
private
save() : bool
Return values
bool —testZipFile()
private
testZipFile(ZipArchive &$zipFile, string $zipPath, string $zipName) : bool
Parameters
- $zipFile : ZipArchive
- $zipPath : string
- $zipName : string