Open Journal Systems  2.4.3
 All Classes Namespaces Functions Variables Groups Pages
PKPPlugin Class Reference
Inheritance diagram for PKPPlugin:
Plugin AuthPlugin CitationPlugin GatewayPlugin ImplicitAuthPlugin ImportExportPlugin MetadataPlugin OAIMetadataFormatPlugin PaymethodPlugin PKPAbntCitationOutputPlugin PKPApaCitationOutputPlugin PKPCrossrefCitationLookupPlugin PKPFreeciteCitationParserPlugin PKPIsbndbCitationLookupPlugin PKPMlaCitationOutputPlugin PKPParaciteCitationParserPlugin PKPParscitCitationParserPlugin PKPPubmedCitationLookupPlugin PKPRegexCitationParserPlugin PKPVancouverCitationOutputPlugin PKPWorldcatCitationLookupPlugin PubIdPlugin ReportPlugin ThemePlugin

Public Member Functions

 _getContextSpecificInstallationHook ()
 
 addHelpData ($locale=null)
 
 addLocaleData ($locale=null)
 
 getCategory ()
 
 getContextSpecificPluginSettingsFile ()
 
 getContextSpecificSetting ($context, $name)
 
 getCurrentVersion ()
 
 getDescription ()
 
 getDisplayName ()
 
 getHelpMappingFilename ()
 
 getHideManagement ()
 
 getInstallDataFile ()
 
 getInstallEmailTemplateDataFile ()
 
 getInstallEmailTemplatesFile ()
 
 getInstallFilterConfigFiles ()
 
 getInstallSchemaFile ()
 
 getInstallSitePluginSettingsFile ()
 
 getLocaleFilename ($locale)
 
 getManagementVerbs ()
 
 getName ()
 
 getPluginPath ()
 
 getSeq ()
 
 getSettingMainContext ()
 
 getTemplatePath ()
 
 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, $request=null)
 
 PKPPlugin ()
 
 register ($category, $path)
 
 smartyPluginUrl ($params, &$smarty)
 
 updateContextSpecificSetting ($context, $name, $value, $type=null)
 
 updateSchema ($hookName, $args)
 

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 48 of file PKPPlugin.inc.php.

Member Function Documentation

PKPPlugin::_getContextSpecificInstallationHook ( )

The application specific context installation hook.

Returns
string

Definition at line 749 of file PKPPlugin.inc.php.

References PKPApplication\getApplication().

Referenced by register().

PKPPlugin::addHelpData (   $locale = null)

Add help data for this plugin.

Parameters
$localestring
Returns
boolean

Definition at line 348 of file PKPPlugin.inc.php.

References PKPHelp\getHelp(), and AppLocale\getLocale().

PKPPlugin::addLocaleData (   $locale = null)

Load locale data for this plugin.

Parameters
$localestring
Returns
boolean

Definition at line 329 of file PKPPlugin.inc.php.

References AppLocale\getLocale(), and getLocaleFilename().

Referenced by AbntCitationPlugin\register(), CounterReportPlugin\register(), PubMedExportPlugin\register(), ResolverPlugin\register(), SampleImportExportPlugin\register(), SubscriptionReportPlugin\register(), DuraCloudImportExportPlugin\register(), ArticleReportPlugin\register(), CrossRefExportPlugin\register(), LDAPAuthPlugin\register(), ReviewReportPlugin\register(), UsageStatsReportPlugin\register(), BackupPlugin\register(), CustomThemePlugin\register(), METSGatewayPlugin\register(), QuickSubmitPlugin\register(), URNPubIdPlugin\register(), DOIPubIdPlugin\register(), UserImportExportPlugin\register(), EruditExportPlugin\register(), AcronPlugin\register(), ViewReportPlugin\register(), DOAJPlugin\register(), OAIMetadataFormatPlugin\register(), NativeImportExportPlugin\register(), PubIdImportExportPlugin\register(), TimedViewReportPlugin\register(), PKPCrossrefCitationLookupPlugin\register(), PKPParaciteCitationParserPlugin\register(), PKPVancouverCitationOutputPlugin\register(), PKPRegexCitationParserPlugin\register(), PKPAbntCitationOutputPlugin\register(), PKPIsbndbCitationLookupPlugin\register(), PKPFreeciteCitationParserPlugin\register(), PKPParscitCitationParserPlugin\register(), PKPApaCitationOutputPlugin\register(), PKPMlaCitationOutputPlugin\register(), PKPPubmedCitationLookupPlugin\register(), PKPWorldcatCitationLookupPlugin\register(), MetadataPlugin\register(), ManualPaymentPlugin\register(), PayPalPlugin\register(), and DOIExportPlugin\register().

PKPPlugin::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 249 of file PKPPlugin.inc.php.

Referenced by installContextSpecificSettings(), and register().

PKPPlugin::getContextSpecificSetting (   $context,
  $name 
)

Retrieve a plugin setting within the given context

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

Definition at line 364 of file PKPPlugin.inc.php.

References PKPApplication\getApplication(), DAORegistry\getDAO(), getName(), and Config\getVar().

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

PKPPlugin::getCurrentVersion ( )

Get the current version of this plugin

Returns
Version

Definition at line 727 of file PKPPlugin.inc.php.

References DAORegistry\getDAO(), and getPluginPath().

PKPPlugin::getDescription ( )

Get a description of this plugin.

Returns
string

Definition at line 138 of file PKPPlugin.inc.php.

PKPPlugin::getDisplayName ( )

Get the display name for this plugin.

Returns
string

Definition at line 129 of file PKPPlugin.inc.php.

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

PKPPlugin::getHelpMappingFilename ( )

Get the path and filename of the help mapping file, if this plugin includes help files.

Returns
string

Definition at line 477 of file PKPPlugin.inc.php.

References getPluginPath().

PKPPlugin::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 201 of file PKPPlugin.inc.php.

PKPPlugin::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 225 of file PKPPlugin.inc.php.

Referenced by installData(), installEmailTemplateData(), installEmailTemplates(), and register().

PKPPlugin::getInstallEmailTemplateDataFile ( )

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

Returns
string

Definition at line 269 of file PKPPlugin.inc.php.

Referenced by installEmailTemplateData(), installLocale(), and register().

PKPPlugin::getInstallEmailTemplatesFile ( )

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

Returns
string

Definition at line 259 of file PKPPlugin.inc.php.

Referenced by installEmailTemplates(), and register().

PKPPlugin::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 283 of file PKPPlugin.inc.php.

References getPluginPath().

Referenced by installFilters().

PKPPlugin::getInstallSchemaFile ( )

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

Returns
string

Definition at line 215 of file PKPPlugin.inc.php.

Referenced by register(), and updateSchema().

PKPPlugin::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 236 of file PKPPlugin.inc.php.

Referenced by installSiteSettings(), and register().

PKPPlugin::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 459 of file PKPPlugin.inc.php.

References getPluginPath().

Referenced by addLocaleData().

PKPPlugin::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 173 of file PKPPlugin.inc.php.

PKPPlugin::getPluginPath ( )

Get the path this plugin's files are located in.

Returns
String pathname

Definition at line 309 of file PKPPlugin.inc.php.

Referenced by ThemePlugin\activate(), UsageStatsPlugin\callbackLoadCategory(), SwordPlugin\callbackLoadHandler(), LucenePlugin\callbackLoadHandler(), UsageStatsPlugin\callbackParseCronTab(), LucenePlugin\callbackTemplateDisplay(), RoleBlockPlugin\getContextSpecificPluginSettingsFile(), InformationBlockPlugin\getContextSpecificPluginSettingsFile(), SubscriptionBlockPlugin\getContextSpecificPluginSettingsFile(), NavigationBlockPlugin\getContextSpecificPluginSettingsFile(), DonationBlockPlugin\getContextSpecificPluginSettingsFile(), ResolverPlugin\getContextSpecificPluginSettingsFile(), UserBlockPlugin\getContextSpecificPluginSettingsFile(), DevelopedByBlockPlugin\getContextSpecificPluginSettingsFile(), LanguageToggleBlockPlugin\getContextSpecificPluginSettingsFile(), HelpBlockPlugin\getContextSpecificPluginSettingsFile(), NotificationBlockPlugin\getContextSpecificPluginSettingsFile(), FontSizeBlockPlugin\getContextSpecificPluginSettingsFile(), TinyMCEPlugin\getContextSpecificPluginSettingsFile(), WebFeedPlugin\getContextSpecificPluginSettingsFile(), DOIExportPlugin\getContextSpecificPluginSettingsFile(), ReferralPlugin\getContextSpecificPluginSettingsFile(), getCurrentVersion(), ExternalFeedPlugin\getDefaultStyleSheetFile(), BrowsePlugin\getHandlerPath(), getHelpMappingFilename(), MetadataPlugin\getInstallDataFile(), ManualPaymentPlugin\getInstallEmailTemplateDataFile(), LucenePlugin\getInstallEmailTemplateDataFile(), PayPalPlugin\getInstallEmailTemplateDataFile(), ManualPaymentPlugin\getInstallEmailTemplatesFile(), LucenePlugin\getInstallEmailTemplatesFile(), PayPalPlugin\getInstallEmailTemplatesFile(), getInstallFilterConfigFiles(), XMLGalleyPlugin\getInstallSchemaFile(), ThesisPlugin\getInstallSchemaFile(), ExternalFeedPlugin\getInstallSchemaFile(), UsageStatsPlugin\getInstallSchemaFile(), StaticPagesPlugin\getInstallSchemaFile(), ReferralPlugin\getInstallSchemaFile(), PayPalPlugin\getInstallSchemaFile(), NavigationBlockPlugin\getInstallSitePluginSettingsFile(), DonationBlockPlugin\getInstallSitePluginSettingsFile(), UserBlockPlugin\getInstallSitePluginSettingsFile(), NotificationBlockPlugin\getInstallSitePluginSettingsFile(), LanguageToggleBlockPlugin\getInstallSitePluginSettingsFile(), DevelopedByBlockPlugin\getInstallSitePluginSettingsFile(), HelpBlockPlugin\getInstallSitePluginSettingsFile(), FontSizeBlockPlugin\getInstallSitePluginSettingsFile(), CoinsPlugin\getInstallSitePluginSettingsFile(), TinyMCEPlugin\getInstallSitePluginSettingsFile(), AcronPlugin\getInstallSitePluginSettingsFile(), UsageStatsPlugin\getInstallSitePluginSettingsFile(), LucenePlugin\getInstallSitePluginSettingsFile(), DOIExportPlugin\getLocaleFilename(), getLocaleFilename(), getTemplatePath(), and import().

PKPPlugin::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 153 of file PKPPlugin.inc.php.

PKPPlugin::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 429 of file PKPPlugin.inc.php.

References PKPApplication\getApplication(), and isSitePlugin().

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

PKPPlugin::import (   $class)

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

Parameters
$classstring

Definition at line 407 of file PKPPlugin.inc.php.

References getPluginPath().

PKPPlugin::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 546 of file PKPPlugin.inc.php.

References PKPApplication\getApplication(), getContextSpecificPluginSettingsFile(), DAORegistry\getDAO(), and getName().

PKPPlugin::installData (   $hookName,
  $args 
)

Callback used to install data files.

Parameters
$hookNamestring
$argsarray
Returns
boolean

Definition at line 488 of file PKPPlugin.inc.php.

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

PKPPlugin::installEmailTemplateData (   $hookName,
  $args 
)

Callback used to install email template data.

Parameters
$hookNamestring
$argsarray
Returns
boolean

Definition at line 613 of file PKPPlugin.inc.php.

References DAORegistry\getDAO(), getInstallDataFile(), and getInstallEmailTemplateDataFile().

PKPPlugin::installEmailTemplates (   $hookName,
  $args 
)

Callback used to install email templates.

Parameters
$hookNamestring
$argsarray
Returns
boolean

Definition at line 584 of file PKPPlugin.inc.php.

References DAORegistry\getDAO(), getInstallDataFile(), and getInstallEmailTemplatesFile().

PKPPlugin::installFilters (   $hookName,
  $args 
)

Callback used to install filters.

Parameters
$hookNamestring
$argsarray

Definition at line 652 of file PKPPlugin.inc.php.

References getInstallFilterConfigFiles().

PKPPlugin::installLocale (   $hookName,
  $args 
)

Callback used to install email template data on locale install.

Parameters
$hookNamestring
$argsarray
Returns
boolean

Definition at line 639 of file PKPPlugin.inc.php.

References DAORegistry\getDAO(), and getInstallEmailTemplateDataFile().

PKPPlugin::installSiteSettings (   $hookName,
  $args 
)

Callback used to install settings on system install.

Parameters
$hookNamestring
$argsarray
Returns
boolean

Definition at line 518 of file PKPPlugin.inc.php.

References PKPApplication\getApplication(), DAORegistry\getDAO(), getInstallSitePluginSettingsFile(), and getName().

PKPPlugin::isSitePlugin ( )

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

Returns
boolean

Definition at line 162 of file PKPPlugin.inc.php.

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

PKPPlugin::manage (   $verb,
  $args,
$message,
$messageParams,
  $request = 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
$requestRequest
Returns
boolean will redirect to the plugin category page if false, otherwise will remain on the same page

Definition at line 190 of file PKPPlugin.inc.php.

PKPPlugin::PKPPlugin ( )

Constructor

Definition at line 58 of file PKPPlugin.inc.php.

PKPPlugin::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 79 of file PKPPlugin.inc.php.

References _getContextSpecificInstallationHook(), getContextSpecificPluginSettingsFile(), getInstallDataFile(), getInstallEmailTemplateDataFile(), getInstallEmailTemplatesFile(), getInstallSchemaFile(), getInstallSitePluginSettingsFile(), and HookRegistry\register().

PKPPlugin::smartyPluginUrl (   $params,
$smarty 
)

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

Parameters
$paramsarray
$smartySmarty
Returns
string

Definition at line 710 of file PKPPlugin.inc.php.

References getCategory(), and getName().

PKPPlugin::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 387 of file PKPPlugin.inc.php.

References PKPApplication\getApplication(), DAORegistry\getDAO(), and getName().

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

PKPPlugin::updateSchema (   $hookName,
  $args 
)

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

Parameters
$hookNamestring
$argsarray
Returns
boolean

Definition at line 686 of file PKPPlugin.inc.php.

References getInstallSchemaFile().


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