Open Monograph Press  1.1
 All Classes Namespaces Functions Variables Groups Pages
Plugin Class Reference
Inheritance diagram for Plugin:
AuthPlugin ImportExportPlugin MetadataPlugin OAIMetadataFormatPlugin PaymethodPlugin PKPAbntCitationOutputPlugin PKPApaCitationOutputPlugin PKPCrossrefCitationLookupPlugin PKPFreeciteCitationParserPlugin PKPIsbndbCitationLookupPlugin PKPMlaCitationOutputPlugin PKPParaciteCitationParserPlugin PKPParscitCitationParserPlugin PKPPubmedCitationLookupPlugin PKPRegexCitationParserPlugin PKPVancouverCitationOutputPlugin PKPWorldcatCitationLookupPlugin PubIdPlugin ReportPlugin

Public Member Functions

 _getContextSpecificInstallationHook ()
 
 addLocaleData ($locale=null)
 
 getCategory ()
 
 getContextSpecificPluginSettingsFile ()
 
 getContextSpecificSetting ($context, $name)
 
 getCurrentVersion ()
 
 getDescription ()
 
 getDisplayName ()
 
 getHideManagement ()
 
 getInstallDataFile ()
 
 getInstallEmailTemplateDataFile ()
 
 getInstallEmailTemplatesFile ()
 
 getInstallFilterConfigFiles ()
 
 getInstallSchemaFile ()
 
 getInstallSitePluginSettingsFile ()
 
 getLocaleFilename ($locale)
 
 getManagementVerbLinkAction ($request, $verb)
 
 getManagementVerbs ()
 
 getName ()
 
 getPluginPath ()
 
getRequest ()
 
 getSeq ()
 
 getSetting ($contextId, $name)
 
 getSettingMainContext ()
 
 getTemplatePath ($inCore=false)
 
 import ($class)
 
 installContextSpecificSettings ($hookName, $args)
 
 installData ($hookName, $args)
 
 installEmailTemplateData ($hookName, $args)
 
 installEmailTemplates ($hookName, $args)
 
 installFilters ($hookName, $args)
 
 installLocale ($hookName, $args)
 
 installSiteSettings ($hookName, $args)
 
 isSitePlugin ()
 
 manage ($verb, $args, &$message, &$messageParams, &$pluginModalContent=null)
 
 Plugin ()
 
 register ($category, $path)
 
 smartyPluginUrl ($params, &$smarty)
 
 updateContextSpecificSetting ($context, $name, $value, $type=null)
 
 updateSchema ($hookName, $args)
 
 updateSetting ($contextId, $name, $value, $type=null)
 

Public Attributes

 $pluginCategory
 
 $pluginPath
 
 $request
 

Detailed Description

Abstract class for plugins.

See Also
PluginRegistry, PluginSettingsDAO

For best performance, a plug-in should not be instantiated if it is disabled or the current page/operation does not require the plug-in's functionality.

Newer plug-ins support enable/disable and request filter settings that enable the PKP library plug-in framework to lazy-load plug-ins only when their functionality is actually being required for a request.

For backwards compatibility we need to assume that older plug-ins do not support lazy-load because their register() method and hooks may have side-effects required on all requests. We have no way of knowing on which pages these side effects are important so we need to load legacy plug-ins on all pages.

In these cases the register() function will be called on every request when the category the plug-in belongs to is being loaded. This was the default behavior before plug-in lazy load was introduced.

Plug-ins that want to enable lazy-load have to include a 'lazy-load' setting in their version.xml:

<lazy-load>1</lazy-load>

Definition at line 50 of file Plugin.inc.php.

Member Function Documentation

Plugin::_getContextSpecificInstallationHook ( )

The application specific context installation hook.

Returns
string

Definition at line 770 of file Plugin.inc.php.

Plugin::getCategory ( )

Get the name of the category this plugin is registered to.

Returns
String category

Definition at line 316 of file Plugin.inc.php.

Plugin::getContextSpecificPluginSettingsFile ( )

Get the filename of the settings data for this plugin to install when a new application context (e.g. journal, conference or press) is installed.

Subclasses using default settings should override this.

Returns
string

Definition at line 264 of file Plugin.inc.php.

Plugin::getContextSpecificSetting (   $context,
  $name 
)

Retrieve a plugin setting within the given context

Parameters
$contextarray an array of context ids
$namethe setting name

Definition at line 387 of file Plugin.inc.php.

Referenced by BlockPlugin\getBlockContext(), and BlockPlugin\getSeq().

Plugin::getCurrentVersion ( )

Get the current version of this plugin

Returns
Version

Definition at line 737 of file Plugin.inc.php.

Plugin::getDescription ( )

Get a description of this plugin.

Returns
string

Definition at line 152 of file Plugin.inc.php.

Plugin::getDisplayName ( )

Get the display name for this plugin.

Returns
string

Definition at line 143 of file Plugin.inc.php.

Referenced by GenericPlugin\manage(), PubIdPlugin\manage(), and ReportPlugin\setBreadcrumbs().

Plugin::getHideManagement ( )

Determine whether or not this plugin should be hidden from the management interface. Useful in the case of derivative plugins, i.e. when a generic plugin registers a feed plugin.

Returns
boolean

Definition at line 216 of file Plugin.inc.php.

Plugin::getInstallDataFile ( )

Get the filename of the install data for this plugin. Subclasses using SQL tables should override this.

Returns
string|array|null one or more data files to be installed.

Definition at line 240 of file Plugin.inc.php.

Referenced by installData().

Plugin::getInstallEmailTemplateDataFile ( )

Get the filename of the email template data for this plugin. Subclasses using email templates should override this.

Returns
string

Definition at line 284 of file Plugin.inc.php.

Plugin::getInstallEmailTemplatesFile ( )

Get the filename of the email templates for this plugin. Subclasses using email templates should override this.

Returns
string

Definition at line 274 of file Plugin.inc.php.

Plugin::getInstallFilterConfigFiles ( )

Get the filename(s) of the filter configuration data for this plugin. Subclasses using filters can override this.

The default implementation establishes "well known" locations for the filter configuration. If you keep your files in these locations then there's no need to override this method.

Returns
string|array one or more file locations.

Definition at line 298 of file Plugin.inc.php.

References $pluginCategory.

Plugin::getInstallSchemaFile ( )

Get the filename of the ADODB schema for this plugin. Subclasses using SQL tables should override this.

Returns
string

Definition at line 230 of file Plugin.inc.php.

Plugin::getInstallSitePluginSettingsFile ( )

Get the filename of the settings data for this plugin to install when the system is installed (i.e. site-level plugin settings). Subclasses using default settings should override this.

Returns
string

Definition at line 251 of file Plugin.inc.php.

Plugin::getLocaleFilename (   $locale)

Get the filename for the locale data for this plugin.

Parameters
$localestring
Returns
string|array the locale file names (the scalar return value is supported for backwards compatibility only).

Definition at line 482 of file Plugin.inc.php.

Plugin::getManagementVerbLinkAction (   $request,
  $verb 
)

Get a link action to be used in plugin's grid row action for the passed verb.

Parameters
$requestRequest
$verbarray The verb name and locale key.
Returns
LinkAction or null

Definition at line 787 of file Plugin.inc.php.

Plugin::getManagementVerbs ( )

Get a list of management actions in the form of a page => value pair. The management actions from this list are passed to the manage() function when called.

Returns
array

Definition at line 187 of file Plugin.inc.php.

Plugin::getName ( )

Protected methods (may be overridden by custom plugins) Get the name of this plugin. The name must be unique within its category, and should be suitable for part of a filename (ie short, no spaces, and no dependencies on cases being unique).

Returns
string name of plugin

Definition at line 134 of file Plugin.inc.php.

Referenced by ThemePlugin\_displayCssCallback(), PKPUsageStatsPlugin\getManagementVerbLinkAction(), ThemePlugin\getStyleCacheFilename(), MetadataPlugin\installData(), ReportPlugin\manage(), ThemePlugin\register(), ReportPlugin\setBreadcrumbs(), and ReportPlugin\smartyPluginUrl().

Plugin::getSeq ( )

Return a number indicating the sequence in which this plugin should be registered compared to others of its category. Higher = later.

Returns
integer

Definition at line 167 of file Plugin.inc.php.

Plugin::getSettingMainContext ( )

Generate the context for this plug-in's generic settings. This is an array with the id of the main context (e.g. journal, conference or press) as the first entry and all remaining entries set to 0. If the calling application doesn't support context then the this will return an empty array (e.g. harvester).

For site-wide plug-ins the context will be set to 0.

Returns
array

Definition at line 452 of file Plugin.inc.php.

Referenced by BlockPlugin\getBlockContext(), BlockPlugin\getSeq(), BlockPlugin\setBlockContext(), and BlockPlugin\setSeq().

Plugin::getTemplatePath (   $inCore = false)

Return the canonical template path of this plug-in

Parameters
$inCoreReturn the core template path if true.
Returns
string

Definition at line 333 of file Plugin.inc.php.

Referenced by AddThisPlugin\callbackSharingDisplay(), BlockPlugin\getContents(), and AddThisPlugin\manage().

Plugin::import (   $class)

Load a PHP file from this plugin's installation directory.

Parameters
$classstring

Definition at line 430 of file Plugin.inc.php.

References isSitePlugin().

Plugin::installContextSpecificSettings (   $hookName,
  $args 
)

Callback used to install settings on new context (e.g. journal, conference or press) creation.

Parameters
$hookNamestring
$argsarray
Returns
boolean

Definition at line 556 of file Plugin.inc.php.

Plugin::installData (   $hookName,
  $args 
)

Callback used to install data files.

Parameters
$hookNamestring
$argsarray
Returns
boolean

Definition at line 501 of file Plugin.inc.php.

References getInstallDataFile(), and AppLocale\requireComponents().

Plugin::installEmailTemplateData (   $hookName,
  $args 
)

Callback used to install email template data.

Parameters
$hookNamestring
$argsarray
Returns
boolean

Definition at line 623 of file Plugin.inc.php.

Plugin::installEmailTemplates (   $hookName,
  $args 
)

Callback used to install email templates.

Parameters
$hookNamestring
$argsarray
Returns
boolean

Definition at line 594 of file Plugin.inc.php.

Plugin::installFilters (   $hookName,
  $args 
)

Callback used to install filters.

Parameters
$hookNamestring
$argsarray

Definition at line 662 of file Plugin.inc.php.

Plugin::installLocale (   $hookName,
  $args 
)

Callback used to install email template data on locale install.

Parameters
$hookNamestring
$argsarray
Returns
boolean

Definition at line 649 of file Plugin.inc.php.

Plugin::installSiteSettings (   $hookName,
  $args 
)

Callback used to install settings on system install.

Parameters
$hookNamestring
$argsarray
Returns
boolean

Definition at line 531 of file Plugin.inc.php.

Plugin::isSitePlugin ( )

Site-wide plugins should override this function to return true.

Returns
boolean

Definition at line 176 of file Plugin.inc.php.

Referenced by GenericPlugin\getManagementVerbs(), and import().

Plugin::manage (   $verb,
  $args,
$message,
$messageParams,
$pluginModalContent = null 
)

Perform a management function.

Parameters
$verbstring
$argsarray
$messagestring If a message is returned from this by-ref argument then it will be displayed as a notification if (and only if) the method returns false.
$messageParamsarray additional notification settings
$pluginModalContentarray Reference to string that will receive new content for the plugin modal
Returns
boolean will redirect to the plugin category page if false, otherwise will remain on the same page

Definition at line 205 of file Plugin.inc.php.

Plugin::Plugin ( )

Constructor

Definition at line 72 of file Plugin.inc.php.

Plugin::register (   $category,
  $path 
)

Load and initialize the plug-in and register plugin hooks.

For backwards compatibility this method will be called whenever the plug-in's category is being loaded. If, however, registerOn() returns an array then this method will only be called when the plug-in is enabled and an entry in the result set of registerOn() matches the current request operation. An empty array matches all request operations.

Parameters
$categoryString Name of category plugin was registered to
$pathString The path the plugin was found in
Returns
boolean True iff plugin registered successfully; if false, the plugin will not be executed.

Definition at line 93 of file Plugin.inc.php.

References HookRegistry\register().

Plugin::smartyPluginUrl (   $params,
$smarty 
)

Extend the {url ...} smarty to support plugins.

Parameters
$paramsarray
$smartySmarty
Returns
string

Definition at line 720 of file Plugin.inc.php.

Plugin::updateContextSpecificSetting (   $context,
  $name,
  $value,
  $type = null 
)

Update a plugin setting within the given context.

Parameters
$contextarray an array of context ids
$namethe setting name
$valuemixed
$typestring optional

Definition at line 410 of file Plugin.inc.php.

Referenced by BlockPlugin\setBlockContext(), and BlockPlugin\setSeq().

Plugin::updateSchema (   $hookName,
  $args 
)

Called during the install process to install the plugin schema, if applicable.

Parameters
$hookNamestring
$argsarray
Returns
boolean

Definition at line 696 of file Plugin.inc.php.

Plugin::updateSetting (   $contextId,
  $name,
  $value,
  $type = null 
)

Convenience version of the generic updateContextSpecificSetting() method.

See Also
Plugin::updateContextSpecificSetting()
Parameters
$contextIdint Context ID
$namestring The name of the setting
$valuemixed Setting value
$typestring optional

Definition at line 378 of file Plugin.inc.php.

References Config\getVar().

Referenced by PKPAcronPlugin\_parseCrontab(), PKPUsageEventPlugin\buildUsageEvent(), PKPAcronPlugin\manage(), and PubIdPlugin\setEnabled().

Member Data Documentation

string Plugin::$pluginCategory

Category name this plugin is registered to

Definition at line 61 of file Plugin.inc.php.

Referenced by getInstallFilterConfigFiles().

string Plugin::$pluginPath

Path name to files for this plugin

Definition at line 55 of file Plugin.inc.php.

Referenced by MetadataPlugin\getInstallDataFile().


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