FacturaScripts

PluginManager

FacturaScripts plugins manager.

Table of Contents

CORE_VERSION FacturaScripts core version. 2022.06
PLUGIN_LIST_FILE Path to list plugins on file. FS_FOLDER . DIRECTORY_SEPARATOR . 'MyFiles' . DIRECTORY_SEPARATOR . 'plugins.json'
PLUGIN_PATH Plugin path folder. FS_FOLDER . DIRECTORY_SEPARATOR . 'Plugins' . DIRECTORY_SEPARATOR
$deploymentRequired Indicates if a deployment is necessary. bool
$enabledPlugins List of active plugins. array
$lastPlugin Name of the last plugin installed or updated. string
__construct() PluginManager constructor. 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. mixed
deploymentRequired() bool
disable() Disable the indicated plugin. bool
enable() Activate the indicated plugin. bool
enabledPlugins() Returns the list of active plugins. array
getLastPluginName() string
initPlugin() mixed
install() Installs a new plugin. bool
installedPlugins() Returns the list of installed plugins. array
remove() Remove a plugin only if it's disabled. bool
checkRequire() Check for plugins needed. bool
disableByDependency() Disables plugins that depends on $pluginDisabled mixed
getPluginInfo() Return plugin information. array
loadFromFile() Returns an array with the list of plugins in the plugin.json file. array
save() Save the list of plugins in a file. bool
testZipFile() bool

Constants

CORE_VERSION

FacturaScripts core version.

mixed $CORE_VERSION = 2022.06

PLUGIN_LIST_FILE

Path to list plugins on file.

mixed $PLUGIN_LIST_FILE = FS_FOLDER . DIRECTORY_SEPARATOR . 'MyFiles' . DIRECTORY_SEPARATOR . 'plugins.json'

PLUGIN_PATH

Plugin path folder.

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 $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( [ $clean : bool = true ] [, $initControllers : bool = 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( $pluginName : string ) : bool
Parameters
$pluginName : string
Return values
bool

enable()

Activate the indicated plugin.

public enable( $pluginName : string ) : bool
Parameters
$pluginName : string
Return values
bool

enabledPlugins()

Returns the list of active plugins.

public enabledPlugins( ) : array
Return values
array

getLastPluginName()

public getLastPluginName( ) : string
Return values
string

initPlugin()

public initPlugin( $pluginName : string ) : mixed
Parameters
$pluginName : string
Return values
mixed

install()

Installs a new plugin.

public install( $zipPath : string [, $zipName : string = 'plugin.zip' ] [, $force : bool = 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
Return values
array

remove()

Remove a plugin only if it's disabled.

public remove( $pluginName : string ) : bool
Parameters
$pluginName : string
Return values
bool

checkRequire()

Check for plugins needed.

private checkRequire( $require : array ) : bool
Parameters
$require : array
Return values
bool

disableByDependency()

Disables plugins that depends on $pluginDisabled

private disableByDependency( $pluginDisabled : string ) : mixed
Parameters
$pluginDisabled : string
Return values
mixed

getPluginInfo()

Return plugin information.

private getPluginInfo( $pluginName : string , $iniContent : string ) : array
Parameters
$pluginName : string
$iniContent : string
Return values
array

loadFromFile()

Returns an array with the list of plugins in the plugin.json file.

private loadFromFile( ) : array
Return values
array

save()

Save the list of plugins in a file.

private save( ) : bool
Return values
bool

testZipFile()

private testZipFile( &$zipFile : ZipArchive , $zipPath : string , $zipName : string ) : bool
Parameters
$zipFile : ZipArchive
$zipPath : string
$zipName : string
Return values
bool

Search results