Class PluginManager
Plugin manager. Handles installing/uninstalling plugins through their
respective plugin handlers.
-
Model
-
AppModel
-
PluginManager
Methods summary
public
|
#
__construct( )
Initialize Plugin Manager
Initialize Plugin Manager
Overrides
|
public
array
|
#
getAll( integer $company_id, array $order = array('name'=>"asc") )
Lists all installed plugins
Lists all installed plugins
Parameters
- $company_id
integer $company_id The company ID
- $order
string $sort_by The field to sort by
Returns
array An array of stdClass objects representing installed gateways
|
public
array
|
#
getByDir( string $plugin_dir )
Fetches all plugins installed in the system for the given plugin
directory
Fetches all plugins installed in the system for the given plugin
directory
Parameters
- $plugin_dir
string $plugin_dir The directory name of the plugin to return results for
Returns
array An array of stdClass objects, each representing an installed plugin record
|
public
mixed
|
#
get( integer $plugin_id, boolean $detailed = false )
Fetches a single installed plugin.
Fetches a single installed plugin.
Parameters
- $plugin_id
integer $plugin_id The plugin ID to fetch
- $detailed
boolean $detailed True to return detailed information about the plugin, false otherwise
Returns
mixed A stdClass object representing the installed plugin, false if no such plugin
exists or is not installed
|
public
array
|
#
getAvailable( integer $company_id = null )
Lists all available plugins (those that exist on the file system)
Lists all available plugins (those that exist on the file system)
Parameters
- $company_id
integer $company_id The ID of the company to get available plugins for
Returns
array An array of stdClass objects representing available plugins
|
public
boolean
|
#
isInstalled( string $dir, string $company_id = null )
Checks whether the given plugin is installed for the specified company
Checks whether the given plugin is installed for the specified company
Parameters
- $dir
string $dir The plugin dir (in file_case)
- $company_id
string $company_id The ID of hte company to fetch for (null checks if the plugin is
installed across any company)
Returns
boolean True if the plugin is installed, false otherwise
|
public
integer
|
#
add( array $vars )
Adds the plugin to the system
Adds the plugin to the system
Parameters
- $vars
array $vars An array of plugin information including: - dir The dir name for the
plugin to be installed - company_id The ID of the company the plugin should be
installed for
Returns
integer The ID of the plugin installed, void on error
|
public
|
#
upgrade( integer $plugin_id )
Runs the plugin's upgrade method to upgrade the plugin to match that of the
plugin's file version. Sets errors in PluginManager::errors() if any errors are
set by the plugin's upgrade method.
Runs the plugin's upgrade method to upgrade the plugin to match that of the
plugin's file version. Sets errors in PluginManager::errors() if any errors are
set by the plugin's upgrade method.
Parameters
- $plugin_id
integer $plugin_id The ID of the plugin to upgrade
|
public
|
#
delete( integer $plugin_id )
Permanently and completely removes the plugin specified by $plugin_id
Permanently and completely removes the plugin specified by $plugin_id
Parameters
- $plugin_id
integer $plugin_id The ID of the plugin to permanently remove
|
public
|
#
addEvent( array $plugin_id, array $vars )
Adds an event to the system with a callback to be invoked when the event is
triggered
Adds an event to the system with a callback to be invoked when the event is
triggered
Parameters
- $plugin_id
array $vars An array of event info including: - plugin_id The ID of the plugin to
register the event under - event The event to register the callback under -
callback The public static callback to invoke.
- $vars
|
public
|
#
deleteEvent( integer $plugin_id, string $event )
Removes the event from the plugin so the event will no longer be
triggered
Removes the event from the plugin so the event will no longer be
triggered
Parameters
- $plugin_id
integer $plugin_id The ID of the plugin to remove the event from
- $event
string $event The event to remove from the plugin
|
public
|
#
addAction( integer $plugin_id, array $vars )
Adds an action to the system that may be used to access a particular view
Adds an action to the system that may be used to access a particular view
Parameters
- $plugin_id
integer $plugin_id The ID of the plugin to register the action under
- $vars
array $vars An array of action fields including: - action The action to register the
uri under - uri The URI that represents this action - name The language
definition naming this action
|
public
|
#
deleteAction( integer $plugin_id, string $action )
Removes the action from the plugin
Removes the action from the plugin
Parameters
- $plugin_id
integer $plugin_id The ID of the plugin to remove the action from
- $action
string $action The action to remove from the plugin
|
public
array
|
#
getEvents( integer $company_id, string $event )
Retrieves all callbacks that are registered for a particular event and
company
Retrieves all callbacks that are registered for a particular event and
company
Parameters
- $company_id
integer $company_id The ID of the company the event is registered under
- $event
string $event The event being requested
Returns
array An array of stdClass objects representing the registered callback events
|
public
mixed
|
#
getEvent( integer $plugin_id, string $event )
Retrieves the specified event of the given plugin
Retrieves the specified event of the given plugin
Parameters
- $plugin_id
integer $plugin_id The ID of the plugin to fetch the event under
- $event
string $event The event to fetch
Returns
mixed A stdClass object representing the plugin event, false if not such plugin event
exists.
|
public
array
|
#
getActions( integer $company_id, string $action )
Retrieves all actions that are registered for a particular action and
company
Retrieves all actions that are registered for a particular action and
company
Parameters
- $company_id
integer $company_id The ID of the company the action is registered under
- $action
string $action The action being requested
Returns
array An array of stdClass objects representing registered actions
|
public
mixed
|
#
getAction( integer $plugin_id, string $action )
Retrieves the specified action from the given plugin
Retrieves the specified action from the given plugin
Parameters
- $plugin_id
integer $plugin_id The ID of the plugin to fetch the action under
- $action
string $action The action to fetch
Returns
mixed A stdClass object representing the plugin action, false if not such plugin
action exists.
|
public
|
#
invokeEvents( integer $company_id, string $event, array $params = null )
Invoke a specific event for all plugins
Invoke a specific event for all plugins
Parameters
- $company_id
integer $company_id The ID of the company to fetch plugin events for
- $event
string $event The event to invoke on the plugin
- $params
array $params An array of parameters to pass to the event callback
|
private
|
#
setVersion( string $dir, string $version )
Updates all installed plugins with the version given
Updates all installed plugins with the version given
Parameters
- $dir
string $dir The directory name of the plugin to update
- $version
string $version The version number to set for each plugin instance
|
private
An
|
#
loadPlugin( string $dir )
Instantiates the given plugin and returns its instance
Instantiates the given plugin and returns its instance
Parameters
- $dir
string $dir The directory name of the plugin to load
Returns
An instance of the plugin specified
|
private
|
#
getPluginInfo( object $plugin, integer $company_id )
Fetch information about the given plugin object
Fetch information about the given plugin object
Parameters
- $plugin
object $plugin The plugin object to fetch info on
- $company_id
integer $company_id The ID of the company to fetch the plugin info for
|
private
array
|
#
getAddRules( array $vars )
Returns all common rules for plugins
Returns all common rules for plugins
Parameters
- $vars
array $vars The input vars
Returns
array Common plugin rules
|
Methods inherited from AppModel
_()
,
boolToInt()
,
currencyToDecimal()
,
dateToUtc()
,
errors()
,
getPerPage()
,
ifSet()
,
loadCrypto()
,
setDefaultIfEmpty()
,
setPerPage()
,
setRulesIfSet()
,
strToBool()
,
systemDecrypt()
,
systemEncrypt()
,
systemHash()
,
truncateDecimal()
,
validateExists()
,
validateStateCountry()
Methods inherited from Model
affectedRows()
,
begin()
,
commit()
,
getConnection()
,
lastInsertId()
,
makeDSN()
,
prepare()
,
query()
,
rollBack()
,
setAttribute()
,
setFetchMode()
Magic methods summary
Properties summary
Properties inherited from AppModel
$replacement_keys