CWIS Developer Documentation
Public Member Functions | Static Public Member Functions | List of all members
PluginManager Class Reference

Manager to load and invoke plugins. More...

Public Member Functions

 __construct ($AppFramework, $PluginDirectories)
 PluginManager class constructor. More...
 
 LoadPlugins ()
 Load and initialize plugins. More...
 
 GetErrorMessages ()
 Retrieve any error messages generated during plugin loading. More...
 
 GetPlugin ($PluginName, $EvenIfNotReady=FALSE)
 Retrieve specified plugin. More...
 
 GetPlugins ()
 Retrieve all loaded plugins. More...
 
 GetPluginForCurrentPage ()
 Retrieve plugin for current page (if any). More...
 
 GetPluginAttributes ()
 Retrieve info about currently loaded plugins. More...
 
 GetDependents ($PluginName)
 Returns a list of plugins dependent on the specified plugin. More...
 
 GetActivePluginList ()
 Get list of active (i.e. More...
 
 PluginEnabled ($PluginName, $NewValue=NULL)
 Get/set whether specified plugin is enabled. More...
 
 UninstallPlugin ($PluginName)
 Uninstall plugin and (optionally) delete any associated data. More...
 

Static Public Member Functions

static SetConfigValueLoader ($Func)
 Set function to load plugin configuration values from data. More...
 

Detailed Description

Manager to load and invoke plugins.

Definition at line 13 of file PluginManager.php.

Constructor & Destructor Documentation

PluginManager::__construct (   $AppFramework,
  $PluginDirectories 
)

PluginManager class constructor.

Parameters
ApplicationFramework$AppFrameworkApplicationFramework within which plugins should run.
array$PluginDirectoriesArray of names of directories containing plugins, in the order they should be searched.

Definition at line 25 of file PluginManager.php.

References ApplicationFramework\ORDER_LAST, and Plugin\SetApplicationFramework().

Referenced by SetConfigValueLoader().

Here is the caller graph for this function:

Member Function Documentation

PluginManager::GetActivePluginList ( )

Get list of active (i.e.

enabled and ready) plugins.

Returns
Array of base names of active plugins.

Definition at line 260 of file PluginManager.php.

PluginManager::GetDependents (   $PluginName)

Returns a list of plugins dependent on the specified plugin.

Parameters
string$PluginNameBase name of plugin.
Returns
Array of base names of dependent plugins.

Definition at line 240 of file PluginManager.php.

References GetPluginAttributes().

PluginManager::GetErrorMessages ( )

Retrieve any error messages generated during plugin loading.

Returns
Array of arrays of error messages, indexed by plugin base (class) name.

Definition at line 155 of file PluginManager.php.

PluginManager::GetPlugin (   $PluginName,
  $EvenIfNotReady = FALSE 
)

Retrieve specified plugin.

Parameters
string$PluginNameBase name of plugin.
bool$EvenIfNotReadyReturn the plugin even if it's not marked as ready for use. (OPTIONAL, defaults to FALSE)
Returns
Plugin object or NULL if no plugin found with specified name.
Exceptions
ExceptionIf plugin is not initialized and ready.

Definition at line 168 of file PluginManager.php.

Referenced by GetPluginForCurrentPage().

Here is the caller graph for this function:

PluginManager::GetPluginAttributes ( )

Retrieve info about currently loaded plugins.

Returns
Array of arrays of plugin info, indexed by plugin base (class) name and sorted by case-insensitive plugin name.

Definition at line 208 of file PluginManager.php.

Referenced by GetDependents().

Here is the caller graph for this function:

PluginManager::GetPluginForCurrentPage ( )

Retrieve plugin for current page (if any).

This method relies on the current page having been found within the plugin directory (usually via a "P_" prefix on the page name) via a call to the hooked FindPluginPhpFile() or FindPluginHtmlFile() methods..

Returns
Plugin object or NULL if no plugin associated with current page.

Definition at line 198 of file PluginManager.php.

References GetPlugin().

Referenced by SetConfigValueLoader().

Here is the caller graph for this function:

PluginManager::GetPlugins ( )

Retrieve all loaded plugins.

Returns
array Plugin objects, with base names for the index.

Definition at line 186 of file PluginManager.php.

PluginManager::LoadPlugins ( )

Load and initialize plugins.

Returns
TRUE if load was successful (no problems encountered), otherwise FALSE.

Definition at line 49 of file PluginManager.php.

PluginManager::PluginEnabled (   $PluginName,
  $NewValue = NULL 
)

Get/set whether specified plugin is enabled.

Parameters
string$PluginNameBase name of plugin.
bool$NewValueTRUE to enable, FALSE to disable. (OPTIONAL)
Returns
TRUE if plugin is enabled, otherwise FALSE.

Definition at line 279 of file PluginManager.php.

static PluginManager::SetConfigValueLoader (   $Func)
static

Set function to load plugin configuration values from data.

Parameters
callable$FuncLoading function.
Exceptions
InvalidArgumentExceptionIf function is not callable.

Definition at line 323 of file PluginManager.php.

References __construct(), ApplicationFramework\AddObjectDirectory(), and GetPluginForCurrentPage().

PluginManager::UninstallPlugin (   $PluginName)

Uninstall plugin and (optionally) delete any associated data.

Parameters
string$PluginNameBase name of plugin.
Returns
Error message or NULL if uninstall succeeded.

Definition at line 290 of file PluginManager.php.


The documentation for this class was generated from the following file: