Omeka_Plugin_Loader

class Omeka_Plugin_Loader

Package: Plugin\Loader

Loads plugins for any given request.

This will iterate through the plugins root directory and load all plugin.phpfiles by require()’ing them.

property _broker

Plugin broker object.

property _iniReader

Plugin INI reader object.

property _mvc

Plugin MVC object.

property _basePath

Plugins directory.

property _plugins

An array of all plugins (installed or not) that are currently located in the plugins/ directory.

__construct(Omeka_Plugin_Broker $broker, Omeka_Plugin_Ini $iniReader, Omeka_Plugin_Mvc $mvc, string $pluginsBaseDir)
Parameters:
loadPlugins(array $plugins, boolean $force =)

Load a list of plugins.

Parameters:
  • $plugins (array) – List of Plugin records to load.
  • $force (boolean) – If true, throws exceptions for plugins that cannot be loaded for some reason.
Returns:

void

registerPlugin(Plugin $plugin)

Register a plugin so that it can be accessed by other plugins (if necessary) during the load process.

There should only be a single instance of a plugin per directory name.Registering a plugin more than once, i.e. loading a plugin again after thefirst time failed, will not cause a problem as long as the same instancewas registered.

Parameters:
  • $plugin (Plugin) – Record of plugin to register.
Returns:

void

isRegistered(Plugin $plugin)

Return whether a plugin is registered or not.

Parameters:
Returns:

boolean Whether the plugin is registered or not.

load(Plugin $plugin, boolean $force =, array $pluginsWaitingToLoad = Array)

Load a plugin (and make sure the plugin API is available).

To be loaded, the plugin must be installed, active, and not have a newerversion. If loaded, the plugin will attempt to first load all plugins,both required and optional, that the plugin uses. However, it will notload a plugin that it uses if that plugin is not installed and activated.

Parameters:
  • $plugin (Plugin) –
  • $force (boolean) – If true, throws exceptions if a plugin can’t be loaded.
  • $pluginsWaitingToLoad (array) – Plugins waiting to be loaded
Returns:

void

_canLoad(Plugin $plugin, boolean $force)

Determine whether or not a plugin can be loaded. To be loaded, it must meet the following criteria: - Has a plugin.php file. - Is installed. - Is active. - Meets the minimum required version of Omeka (in plugin.ini). - Is not already loaded. - Does not have a new version available.

Parameters:
  • $plugin (Plugin) – Plugin to test.
  • $force (boolean) – If true, throw an exception if the plugin can’t be loaded.
Returns:

boolean

hasPluginBootstrap(string|Plugin $pluginDirName)

Check whether a plugin has a bootstrap file.

Parameters:
  • $pluginDirName (string|Plugin) –
Returns:

boolean

getPluginClassName(string $pluginDirName)

Return the valid plugin class name.

Parameters:
  • $pluginDirName (string) –
Returns:

string

getPluginFilePath(string $pluginDirName)

Return the path to the plugin.php file.

Parameters:
  • $pluginDirName (string) –
Returns:

string

getPluginClassFilePath(string $pluginDirName)

Return the path to the plugin class file.

Parameters:
  • $pluginDirName (string) –
Returns:

string

getPlugins()

Return a list of all the plugins that have been loaded (or attempted to be loaded) thus far.

Returns:array List of Plugin objects.
getPlugin(string $directoryName)

Get a plugin object by name (plugin subdirectory name).

Parameters:
  • $directoryName (string) – Plugin name.
Returns:

Plugin|null

_loadPluginBootstrap(Plugin $plugin)

Loads the plugin bootstrap file for a plugin.

Parameters:
Returns:

void