Class Omeka_Plugin_Broker

Description

Plugin Broker for Omeka.

Plugin Broker for Omeka. This handles installation, loading and calling hooks for plugins. The syntax for activating plugin hooks on the Broker is as simple as calling it as a method on the broker. For example, $broker->add_action_contexts($controller) would call the 'add_action_contexts' on all plugins, and it would provide the controller object as the first argument to all implementations of that hook.

Located in /application/libraries/Omeka/Plugin/Broker.php (line 21)


	
			
Variable Summary
Method Summary
 Omeka_Plugin_Broker __construct ( $db,  $pathToPlugins)
 void activate (string $pluginDirName)
 void addApplicationDirs (string $pluginDirName)
 void addControllerDir (string $pluginDirName, string $moduleName)
 void addHook (string $hook, string $callback)
 void addMediaAdapter (array|string $mimeTypes, callback $callback, [ $defaultOptions = array()])
 void addThemeDir (string $pluginDirName, string $path, string $themeType, string $moduleName)
 array callHook (string $hook, array $args)
 void config (string $pluginDirName)
 void deactivate (string $pluginDirName)
 array getAll ()
 void getHook (string $pluginDirName,  $hook, string $callback)
 array getMediaAdapters ()
 void getModuleViewScriptDirs ([ $moduleName = null])
 array getNew ()
 array getOptionalPluginDirNames (string $pluginDirName)
 string getPluginFilePath (string $pluginDirName)
 string getPluginIniFilePath (string $pluginDirName)
 null getPluginIniValue (string $pluginDirName, string $iniKeyName)
 array getRequiredPluginDirNames (string $pluginDirName)
 boolean hasNewVersion (string $pluginDirName)
 boolean hasPluginFile (string $pluginDirName)
 boolean hasPluginIniFile (string $pluginDirName)
 void install (string $pluginDirName)
 boolean isActive (string $pluginDirName)
 boolean isInstalled (string $pluginDirName)
 boolean isLoaded (string $pluginDirName)
 void load (string $pluginDirName, [array $pluginDirNamesWaitingToBeLoaded = array()])
 void loadActive ()
 bool meetsOmekaMinimumVersion (string $pluginDirName)
 bool meetsOmekaTestedUpTo (string $pluginDirName)
 void setCurrentPluginDirName (string $pluginDirName)
 void uninstall (string $pluginDirName)
 void upgrade (string $pluginDirName)
 string _getModuleName (string $pluginDirName)
 mixed __call ( $hook,  $args)
Variables
array $_active = array() (line 52)

An array of plugin directory names for currently activated plugins

An array of plugin directory names for currently activated plugins

  • access: protected
array $_all = array() (line 67)

An array of all plugin directory names for plugins (installed or not) that are currently located

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

  • access: protected
mixed $_basePath = array() (line 23)
  • access: protected
array $_callbacks = array() (line 37)

Array of hooks that have been implemented for plugins.

Array of hooks that have been implemented for plugins.

  • access: protected
string $_current (line 97)

The directory name of the current plugin (used for calling hooks)

The directory name of the current plugin (used for calling hooks)

  • access: protected
Omeka_Db $_db (line 30)

Database connection to use when interacting with the database

Database connection to use when interacting with the database

  • access: protected
array $_has_new_version = array() (line 90)

A list of plugin directory names that have a new version of the plugin according to the plugin.

A list of plugin directory names that have a new version of the plugin according to the plugin.ini file

  • access: protected
array $_installed = array() (line 45)

An array of plugin directory names for plugins that have been installed (but not necessarily activated and not necessarily have the plugin files).

An array of plugin directory names for plugins that have been installed (but not necessarily activated and not necessarily have the plugin files).

  • access: protected
array $_loaded = array() (line 59)

An array of all plugin directory names for plugins that have been loaded

An array of all plugin directory names for plugins that have been loaded

  • access: protected
array $_media = array('callbacks'=>array(),'options'=>array()) (line 104)
array $_optional = array() (line 75)

An associative array of all plugin directory names for plugins that are used optionally by another plugin.

An associative array of all plugin directory names for plugins that are used optionally by another plugin. The key is a pluginDirName and the value is an array of the plugin directory names of its optional plugins

  • access: protected
mixed $_pluginViewDirs = array() (line 107)
  • access: protected
array $_required = array() (line 83)

An associative array of all plugin directory names for plugins that are required by another plugin.

An associative array of all plugin directory names for plugins that are required by another plugin. The key is a pluginDirName and the value is an array of the plugin directory names of its required plugins

  • access: protected
Methods
Constructor __construct (line 109)
  • access: public
Omeka_Plugin_Broker __construct ( $db,  $pathToPlugins)
  • $db
  • $pathToPlugins
activate (line 461)

Activates the plugin

Activates the plugin

  • access: public
void activate (string $pluginDirName)
  • string $pluginDirName
addApplicationDirs (line 665)

Set up the following directory structure for plugins: controllers/ models/ libraries/ views/ admin/ public/ shared/ This also adds these folders to the correct include paths.

Set up the following directory structure for plugins: controllers/ models/ libraries/ views/ admin/ public/ shared/ This also adds these folders to the correct include paths.

  • access: public
void addApplicationDirs (string $pluginDirName)
  • string $pluginDirName
addControllerDir (line 643)

This will make an entire directory of controllers available to the front controller.

This will make an entire directory of controllers available to the front controller. This has to use addControllerDirectory() instead of addModuleDirectory() because module names are case-sensitive and module directories need to be lowercased to conform to Zend's weird naming conventions.

  • access: public
void addControllerDir (string $pluginDirName, string $moduleName)
  • string $pluginDirName
  • string $moduleName
addHook (line 278)

Check if the plugin is active, then enable the hook for it

Check if the plugin is active, then enable the hook for it

  • access: public
void addHook (string $hook, string $callback)
  • string $hook
  • string $callback
addMediaAdapter (line 747)

Adds a plugin hook to display files of a specific MIME type in a certain way.

Adds a plugin hook to display files of a specific MIME type in a certain way. This allows plugins to hook directly into the Omeka_View_Helper_Media class, so that plugins can override/define ways of displaying specific files. The most obvious example of where this would come in handy is to define ways of displaying uncommon files, such as QTVR, or novel ways of displaying more common files, such as using iPaper to display PDFs. The advantage is seemless integration with the themes, rather than forcing theme designers to use plugin-specific API calls in their themes.

void addMediaAdapter (array|string $mimeTypes, callback $callback, [ $defaultOptions = array()])
  • array|string $mimeTypes: Set of MIME types that this specific callback will respond to.
  • callback $callback: Any valid callback. This function should return a string containing valid XHTML, which will be used to display the file.
  • array $defaultOptions
addThemeDir (line 599)

used by the add_theme_pages() helper to create a list of directories that can store static pages that integrate into the themes

used by the add_theme_pages() helper to create a list of directories that can store static pages that integrate into the themes

  • access: protected
void addThemeDir (string $pluginDirName, string $path, string $themeType, string $moduleName)
  • string $pluginDirName
  • string $path
  • string $themeType
  • string $moduleName
callHook (line 944)
  • return: Keyed to the names of plugins, this will contain an array of all the return values of the hook implementations.
  • see: Omeka_Plugin_Broker::__call()
  • access: public
array callHook (string $hook, array $args)
  • string $hook: Name of the hook.
  • array $args: Arguments that are passed to each hook implementation.
config (line 495)

Configures the plugin

Configures the plugin

  • access: public
void config (string $pluginDirName)
  • string $pluginDirName
deactivate (line 478)

Deactivates the plugin

Deactivates the plugin

  • access: public
void deactivate (string $pluginDirName)
  • string $pluginDirName
getAll (line 377)

Returns an array of all of the plugin directory names in the plugin directory

Returns an array of all of the plugin directory names in the plugin directory

  • access: public
array getAll ()
getCurrentPluginDirName (line 311)
  • access: public
void getCurrentPluginDirName ()
getHook (line 291)

Gets the hook for a plugin

Gets the hook for a plugin

  • access: public
void getHook (string $pluginDirName,  $hook, string $callback)
  • string $pluginDirName
  • string $callback
  • $hook
getMediaAdapters (line 772)

Retrieve a list of all media display callbacks that are defined by

Retrieve a list of all media display callbacks that are defined by plugins. Currently called only within Omeka_View_Helper_Media

array getMediaAdapters ()
getModuleViewScriptDirs (line 625)
  • access: public
void getModuleViewScriptDirs ([ $moduleName = null])
  • $moduleName
getNew (line 387)

Return an array of plugin directory names for the plugins that have not been installed yet

Return an array of plugin directory names for the plugins that have not been installed yet

  • access: public
array getNew ()
getOptionalPluginDirNames (line 874)

Returns an array of the plugin directory names for the plugins that the plugin optionally uses

Returns an array of the plugin directory names for the plugins that the plugin optionally uses

  • access: public
array getOptionalPluginDirNames (string $pluginDirName)
  • string $pluginDirName
getPluginFilePath (line 255)

Returns the path to the plugin.

Returns the path to the plugin.php file

  • access: public
string getPluginFilePath (string $pluginDirName)
  • string $pluginDirName
getPluginIniFilePath (line 266)

Returns the path to the plugin.

Returns the path to the plugin.ini file

  • access: public
string getPluginIniFilePath (string $pluginDirName)
  • string $pluginDirName
getPluginIniValue (line 826)

Returns a value in plugin. Will return a null value if no value can be found in the ini file for the key.

Returns a value in plugin.ini for a key Will return a null value if no value can be found in the ini file for the key.

  • return: | string
  • access: public
null getPluginIniValue (string $pluginDirName, string $iniKeyName)
  • string $pluginDirName
  • string $iniKeyName
getRequiredPluginDirNames (line 847)

Returns an array of the plugin directory names for the plugins that the plugin requires

Returns an array of the plugin directory names for the plugins that the plugin requires

  • access: public
array getRequiredPluginDirNames (string $pluginDirName)
  • string $pluginDirName
hasNewVersion (line 398)

Return whether a plugin has a newer version in the plugin.

Return whether a plugin has a newer version in the plugin.ini file than the version in the database.

  • access: public
boolean hasNewVersion (string $pluginDirName)
  • string $pluginDirName
hasPluginFile (line 322)

Returns whether a plugin has a plugin.

Returns whether a plugin has a plugin.php file

  • access: public
boolean hasPluginFile (string $pluginDirName)
  • string $pluginDirName
hasPluginIniFile (line 334)

Returns whether a plugin has a plugin.

Returns whether a plugin has a plugin.ini file

  • access: public
boolean hasPluginIniFile (string $pluginDirName)
  • string $pluginDirName
install (line 532)

Installs the plugin

Installs the plugin

  • access: public
void install (string $pluginDirName)
  • string $pluginDirName
isActive (line 345)

Returns whether a plugin is active or not

Returns whether a plugin is active or not

  • access: public
boolean isActive (string $pluginDirName)
  • string $pluginDirName
isInstalled (line 356)

Returns whether a plugin is installed or not

Returns whether a plugin is installed or not

  • access: public
boolean isInstalled (string $pluginDirName)
  • string $pluginDirName
isLoaded (line 367)

Returns whether a plugin is loaded or not

Returns whether a plugin is loaded or not

  • access: public
boolean isLoaded (string $pluginDirName)
  • string $pluginDirName
load (line 192)

Loads a plugin (and make sure the plugin API is available) To be loaded, the plugin must be installed, active, and does not have a newer version.

Loads a plugin (and make sure the plugin API is available) To be loaded, the plugin must be installed, active, and does not have a newer version. If loaded, the plugin will attempt to first load all plugins, both required and optional, that the plugin uses. However, it will not load a plugin that it uses, if that plugin is not installed and activated

  • access: public
void load (string $pluginDirName, [array $pluginDirNamesWaitingToBeLoaded = array()])
  • string $pluginDirName: The directory name of the plugin to load
  • array $pluginDirNamesWaitingToBeLoaded: The array of the directory names of dependent plugins waiting to be loaded
loadActive (line 173)

Load all active plugins (and make sure the plugin API is available)

Load all active plugins (and make sure the plugin API is available)

  • access: public
void loadActive ()
meetsOmekaMinimumVersion (line 902)

Returns whether the current version of Omeka is greater than or equal to the minimum version required by the plugin.

Returns whether the current version of Omeka is greater than or equal to the minimum version required by the plugin.

  • access: public
bool meetsOmekaMinimumVersion (string $pluginDirName)
  • string $pluginDirName
meetsOmekaTestedUpTo (line 923)

Returns whether the current version of Omeka is greater than or equal to the minimum version required by the plugin.

Returns whether the current version of Omeka is greater than or equal to the minimum version required by the plugin.

  • access: public
bool meetsOmekaTestedUpTo (string $pluginDirName)
  • string $pluginDirName
setCurrentPluginDirName (line 306)

The plugin helper functions do not have any way of determining what plugin to is currently in focus. allow the broker to know how to delegate to specific plugins if necessary.

The plugin helper functions do not have any way of determining what plugin to is currently in focus. These get/setCurrentPluginDirName methods allow the broker to know how to delegate to specific plugins if necessary.

  • access: protected
void setCurrentPluginDirName (string $pluginDirName)
  • string $pluginDirName
uninstall (line 786)

Uninstall hook for plugins.

Uninstall hook for plugins. This will run the 'uninstall' hook for the given plugin, and then it will remove the entry in the DB corresponding to the plugin.

  • access: public
void uninstall (string $pluginDirName)
  • string $pluginDirName: Name of the plugin directory to uninstall
upgrade (line 409)

Upgrades the plugin

Upgrades the plugin

  • access: public
void upgrade (string $pluginDirName)
  • string $pluginDirName
_getModuleName (line 714)

Retrieve the module name for the plugin (based on the directory name of the plugin).

Retrieve the module name for the plugin (based on the directory name of the plugin).

  • access: protected
string _getModuleName (string $pluginDirName)
  • string $pluginDirName
__call (line 974)

This handles dispatching all plugin hooks.

This handles dispatching all plugin hooks. Check for delegating to other classes that handle plugin API stuff first, i.e. Omeka_Plugin_Filters etc.

mixed __call ( $hook,  $args)
  • $hook
  • $args

Documentation generated on Thu, 15 Oct 2009 15:35:55 -0400 by phpDocumentor 1.4.2