Difference between revisions of "API:EPrints/Plugin"
(New page: <!-- Pod2Wiki=_preamble_ This page has been automatically generated from the EPrints source. Any wiki changes made between the 'Pod2Wiki=*' and 'End of Pod2Wiki' comments will be lost. -...) |
|||
(4 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
<!-- Pod2Wiki=_preamble_ | <!-- Pod2Wiki=_preamble_ | ||
− | This page has been automatically generated from the EPrints source. Any wiki changes made between the 'Pod2Wiki=*' and ' | + | This page has been automatically generated from the EPrints 3.2 source. Any wiki changes made between the 'Pod2Wiki=*' and 'Edit below this comment' comments will be lost. |
− | -->{{Pod2Wiki}}{{API:Source|file=EPrints/Plugin.pm|package_name=EPrints::Plugin}}[[Category:API|Plugin]]< | + | -->{{API}}{{Pod2Wiki}}{{API:Source|file=perl_lib/EPrints/Plugin.pm|package_name=EPrints::Plugin}}[[Category:API|PLUGIN]][[Category:API:EPrints/Plugin|PLUGIN]]<div><!-- Edit below this comment --> |
− | <!-- | ||
− | |||
− | <!-- | + | |
− | <!-- Pod2Wiki=head_description -->=DESCRIPTION= | + | <!-- Pod2Wiki=_private_ --><!-- Pod2Wiki=head_name --> |
+ | ==NAME== | ||
+ | EPrints::Plugin - base class of all EPrints Plugins | ||
+ | |||
+ | <!-- Edit below this comment --> | ||
+ | |||
+ | |||
+ | <!-- Pod2Wiki= --> | ||
+ | <!-- Pod2Wiki=head_synopsis --> | ||
+ | ==SYNOPSIS== | ||
+ | <source lang="perl">$plugin = $repo->plugin( "Export::XML" );</source> | ||
+ | |||
+ | <!-- Edit below this comment --> | ||
+ | |||
+ | |||
+ | <!-- Pod2Wiki= --> | ||
+ | <!-- Pod2Wiki=head_description --> | ||
+ | ==DESCRIPTION== | ||
This class provides the basic methods used by all EPrints Plugins. | This class provides the basic methods used by all EPrints Plugins. | ||
− | <!-- | + | <!-- Edit below this comment --> |
− | <!-- Pod2Wiki= | + | |
+ | |||
+ | <!-- Pod2Wiki= --> | ||
+ | <!-- Pod2Wiki=head_methods --> | ||
+ | ==METHODS== | ||
+ | <!-- Pod2Wiki=head_new --> | ||
+ | ===new=== | ||
+ | |||
+ | <source lang="perl">$plugin = EPrints::Plugin->new( %params ); | ||
+ | |||
+ | </source> | ||
+ | Create a new instance of a plugin. Defines the following parameters: | ||
+ | |||
+ | * repository | ||
+ | : Required handle to the current repository object. | ||
+ | |||
+ | * name | ||
+ | : Human-readable name of the plugin. | ||
+ | |||
+ | * alias | ||
+ | : Array reference of plugin id's that this plugin is aliasing (replacing). | ||
+ | |||
+ | <!-- Edit below this comment --> | ||
+ | |||
+ | |||
+ | <!-- Pod2Wiki= --> | ||
+ | <!-- Pod2Wiki=head_mime_type --> | ||
+ | ===mime_type=== | ||
+ | |||
+ | <source lang="perl">$mime_type = EPrints::Plugin->mime_type() | ||
+ | |||
+ | </source> | ||
+ | Returns the MIME type for this plugin. | ||
− | + | Returns undef if there is no relevant MIME type for this plugin type. | |
− | + | <!-- Edit below this comment --> | |
− | |||
− | |||
− | + | <!-- Pod2Wiki= --> | |
+ | <!-- Pod2Wiki=head_local_uri --> | ||
+ | ===local_uri=== | ||
+ | <source lang="perl">$value = EPrints::Plugin->local_uri | ||
+ | |||
+ | </source> | ||
Return a unique ID for this plugin as it relates to the current repository. This can be used to distinguish that XML import for different repositories may have minor differences. | Return a unique ID for this plugin as it relates to the current repository. This can be used to distinguish that XML import for different repositories may have minor differences. | ||
This URL will not resolve to anything useful. | This URL will not resolve to anything useful. | ||
− | <!-- | + | <!-- Edit below this comment --> |
− | <!-- Pod2Wiki= | + | |
+ | |||
+ | <!-- Pod2Wiki= --> | ||
+ | <!-- Pod2Wiki=head_global_uri --> | ||
+ | ===global_uri=== | ||
− | + | <source lang="perl">$value = EPrints::Plugin->global_uri | |
+ | </source> | ||
Return a unique ID for this plugin, but not just in this repository but for any repository. This can be used for fuzzier tools which do not care about the minor differences between EPrints repositories. | Return a unique ID for this plugin, but not just in this repository but for any repository. This can be used for fuzzier tools which do not care about the minor differences between EPrints repositories. | ||
This URL will not resolve to anything useful. | This URL will not resolve to anything useful. | ||
− | <!-- | + | <!-- Edit below this comment --> |
− | |||
− | |||
+ | <!-- Pod2Wiki= --> | ||
+ | <!-- Pod2Wiki=head_id --> | ||
+ | ===id=== | ||
+ | |||
+ | <source lang="perl">$id = $plugin->id | ||
+ | |||
+ | </source> | ||
Return the ID of this plugin. | Return the ID of this plugin. | ||
− | <!-- | + | <!-- Edit below this comment --> |
− | |||
− | |||
+ | <!-- Pod2Wiki= --> | ||
+ | <!-- Pod2Wiki=head_name --> | ||
+ | ===name=== | ||
+ | |||
+ | <source lang="perl">$name = $plugin->name | ||
+ | |||
+ | </source> | ||
Return the ID of this plugin. | Return the ID of this plugin. | ||
− | <!-- | + | <!-- Edit below this comment --> |
− | <!-- Pod2Wiki= | + | |
+ | |||
+ | <!-- Pod2Wiki= --> | ||
+ | <!-- Pod2Wiki=head_type --> | ||
+ | ===type=== | ||
− | + | <source lang="perl">$name = $plugin->type | |
+ | </source> | ||
Return the type of this plugin. eg. Export | Return the type of this plugin. eg. Export | ||
− | <!-- | + | <!-- Edit below this comment --> |
− | <!-- Pod2Wiki= | + | |
+ | |||
+ | <!-- Pod2Wiki= --> | ||
+ | <!-- Pod2Wiki=head_subtype --> | ||
+ | ===subtype=== | ||
− | + | <source lang="perl">$name = $plugin->subtype | |
+ | </source> | ||
Return the sub-type of this plugin. eg. BibTex | Return the sub-type of this plugin. eg. BibTex | ||
This is the ID with the type stripped from the front. | This is the ID with the type stripped from the front. | ||
− | <!-- | + | <!-- Edit below this comment --> |
− | + | ||
− | + | <!-- Pod2Wiki= --> | |
+ | <!-- Pod2Wiki=head_error_message --> | ||
+ | ===error_message=== | ||
+ | <source lang="perl">$msg = $plugin->error_message | ||
+ | |||
+ | </source> | ||
Return the error message, if this plugin can't be used. | Return the error message, if this plugin can't be used. | ||
− | <!-- | + | <!-- Edit below this comment --> |
− | <!-- Pod2Wiki= | + | |
+ | |||
+ | <!-- Pod2Wiki= --> | ||
+ | <!-- Pod2Wiki=head_broken --> | ||
+ | ===broken=== | ||
− | + | <source lang="perl">$boolean = $plugin->broken | |
+ | </source> | ||
Return the value of a parameter in the current plugin. | Return the value of a parameter in the current plugin. | ||
− | <!-- | + | <!-- Edit below this comment --> |
− | |||
− | |||
+ | <!-- Pod2Wiki= --> | ||
+ | <!-- Pod2Wiki=head_matches --> | ||
+ | ===matches=== | ||
+ | |||
+ | <source lang="perl">$name = $plugin->matches( $test, $param ) | ||
+ | |||
+ | </source> | ||
Return true if this plugin matches the test, false otherwise. If the test is not known then return false. | Return true if this plugin matches the test, false otherwise. If the test is not known then return false. | ||
− | <!-- | + | <!-- Edit below this comment --> |
− | |||
− | |||
− | + | <!-- Pod2Wiki= --> | |
+ | <!-- Pod2Wiki=head_param --> | ||
+ | ===param=== | ||
− | < | + | <source lang="perl">$value = $plugin->param( $paramid ) |
− | |||
− | + | </source> | |
+ | Return the parameter with the given id. This uses the hard wired parameter unless an override has been configured for this repository: | ||
+ | <pre> $c->{plugins}->{"Export::XML"}->{params}->{name} = "My EP3 XML"; | ||
+ | $c->{plugins}->{"Export::Ids"}->{params}->{disable} = 1;</pre> | ||
+ | |||
+ | <!-- Edit below this comment --> | ||
+ | |||
+ | |||
+ | <!-- Pod2Wiki= --> | ||
+ | <!-- Pod2Wiki=head_html_phrase_id --> | ||
+ | ===html_phrase_id=== | ||
+ | |||
+ | <source lang="perl">$phraseid = $plugin->html_phrase_id( $id ) | ||
+ | |||
+ | </source> | ||
Returns the fully-qualified phrase identifier for the $id phrase for this plugin. | Returns the fully-qualified phrase identifier for the $id phrase for this plugin. | ||
− | <!-- | + | <!-- Edit below this comment --> |
− | |||
− | |||
+ | <!-- Pod2Wiki= --> | ||
+ | <!-- Pod2Wiki=head_html_phrase --> | ||
+ | ===html_phrase=== | ||
+ | |||
+ | <source lang="perl">$xhtml = $plugin->html_phrase( $id, %bits ) | ||
+ | |||
+ | </source> | ||
Return the phrase belonging to this plugin, with the given id. | Return the phrase belonging to this plugin, with the given id. | ||
Returns a DOM tree. | Returns a DOM tree. | ||
− | <!-- | + | <!-- Edit below this comment --> |
− | |||
− | |||
+ | <!-- Pod2Wiki= --> | ||
+ | <!-- Pod2Wiki=head_phrase --> | ||
+ | ===phrase=== | ||
+ | |||
+ | <source lang="perl">$utf8 = $plugin->phrase( $id, %bits ) | ||
+ | |||
+ | </source> | ||
Return the phrase belonging to this plugin, with the given id. | Return the phrase belonging to this plugin, with the given id. | ||
Returns a utf-8 encoded string. | Returns a utf-8 encoded string. | ||
− | <!-- | + | <!-- Edit below this comment --> |
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | + | <!-- Pod2Wiki= --> | |
+ | <!-- Pod2Wiki=head_copyright --> | ||
+ | ==COPYRIGHT== | ||
+ | Copyright 2000-2011 University of Southampton. | ||
− | + | This file is part of EPrints http://www.eprints.org/. | |
− | + | EPrints is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. | |
− | + | EPrints is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. | |
− | |||
− | + | You should have received a copy of the GNU Lesser General Public License along with EPrints. If not, see http://www.gnu.org/licenses/. | |
− | + | <!-- Edit below this comment --> | |
− | |||
− | |||
− | |||
− | |||
− | <!-- | + | <!-- Pod2Wiki= --> |
− | <!-- Pod2Wiki=_postamble_ --><!-- | + | <!-- Pod2Wiki=_postamble_ --> |
+ | <!-- Edit below this comment --> |
Latest revision as of 09:56, 22 January 2013
EPrints 3 Reference: Directory Structure - Metadata Fields - Repository Configuration - XML Config Files - XML Export Format - EPrints data structure - Core API - Data Objects
Latest Source Code (3.4, 3.3) | Revision Log | Before editing this page please read Pod2Wiki
Contents
NAME
EPrints::Plugin - base class of all EPrints Plugins
SYNOPSIS
$plugin = $repo->plugin( "Export::XML" );
DESCRIPTION
This class provides the basic methods used by all EPrints Plugins.
METHODS
new
$plugin = EPrints::Plugin->new( %params );
Create a new instance of a plugin. Defines the following parameters:
- repository
- Required handle to the current repository object.
- name
- Human-readable name of the plugin.
- alias
- Array reference of plugin id's that this plugin is aliasing (replacing).
mime_type
$mime_type = EPrints::Plugin->mime_type()
Returns the MIME type for this plugin.
Returns undef if there is no relevant MIME type for this plugin type.
local_uri
$value = EPrints::Plugin->local_uri
Return a unique ID for this plugin as it relates to the current repository. This can be used to distinguish that XML import for different repositories may have minor differences.
This URL will not resolve to anything useful.
global_uri
$value = EPrints::Plugin->global_uri
Return a unique ID for this plugin, but not just in this repository but for any repository. This can be used for fuzzier tools which do not care about the minor differences between EPrints repositories.
This URL will not resolve to anything useful.
id
$id = $plugin->id
Return the ID of this plugin.
name
$name = $plugin->name
Return the ID of this plugin.
type
$name = $plugin->type
Return the type of this plugin. eg. Export
subtype
$name = $plugin->subtype
Return the sub-type of this plugin. eg. BibTex
This is the ID with the type stripped from the front.
error_message
$msg = $plugin->error_message
Return the error message, if this plugin can't be used.
broken
$boolean = $plugin->broken
Return the value of a parameter in the current plugin.
matches
$name = $plugin->matches( $test, $param )
Return true if this plugin matches the test, false otherwise. If the test is not known then return false.
param
$value = $plugin->param( $paramid )
Return the parameter with the given id. This uses the hard wired parameter unless an override has been configured for this repository:
$c->{plugins}->{"Export::XML"}->{params}->{name} = "My EP3 XML"; $c->{plugins}->{"Export::Ids"}->{params}->{disable} = 1;
html_phrase_id
$phraseid = $plugin->html_phrase_id( $id )
Returns the fully-qualified phrase identifier for the $id phrase for this plugin.
html_phrase
$xhtml = $plugin->html_phrase( $id, %bits )
Return the phrase belonging to this plugin, with the given id.
Returns a DOM tree.
phrase
$utf8 = $plugin->phrase( $id, %bits )
Return the phrase belonging to this plugin, with the given id.
Returns a utf-8 encoded string.
COPYRIGHT
Copyright 2000-2011 University of Southampton.
This file is part of EPrints http://www.eprints.org/.
EPrints is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
EPrints is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License along with EPrints. If not, see http://www.gnu.org/licenses/.