Open Journal Systems  3.3.0
OrcidProfilePlugin Class Reference
Inheritance diagram for OrcidProfilePlugin:
GenericPlugin LazyLoadPlugin Plugin

Public Member Functions

 authorFormFilter ($output, $templateMgr)
 
 buildOAuthUrl ($handlerMethod, $redirectParams)
 
 buildOrcidWork ($publication, $context, $authors, $request, $issue=null)
 
 collectUserOrcidId ($hookName, $params)
 
 getActions ($request, $actionArgs)
 
 getDescription ()
 
 getDisplayName ()
 
 getHandlerPath ()
 
 getIcon ()
 
 getInstallEmailTemplatesFile ()
 
 getMailTemplate ($emailKey, $context=null)
 
 getOauthPath ()
 
 getOrcidUrl ()
 
 getSetting ($contextId, $name)
 
 getStyleSheet ()
 
 handleAdditionalFieldNames ($hookName, $params)
 
 handleAuthorFormExecute ($hookname, $args)
 
 handleEditorAction ($hookName, $args)
 
 handleFormDisplay ($hookName, $args)
 
 handlePublicationStatusChange ($hookName, $args)
 
 handleSubmissionSubmitStep3FormExecute ($hookName, $params)
 
 handleTemplateDisplay ($hookName, $args)
 
 handleUserPublicProfileDisplay ($hookName, $params)
 
 isGloballyConfigured ()
 
 isMemberApiEnabled ($contextId)
 
 logError ($message)
 
 logInfo ($message)
 
 manage ($args, $request)
 
 register ($category, $path, $mainContextId=null)
 
 registrationFilter ($output, $templateMgr)
 
 removeOrcidAccessToken ($author, $saveAuthor=true)
 
 sendAuthorMail ($author, $updateAuthor=false)
 
 sendSubmissionToOrcid ($publication, $request)
 
 setCurrentContextId ($contextId)
 
 setupCallbackHandler ($hookName, $params)
 
 smartyPluginUrl ($params, $smarty)
 
- Public Member Functions inherited from LazyLoadPlugin
 getCanDisable ()
 
 getCanEnable ()
 
 getCurrentContextId ()
 
 getEnabled ($contextId=null)
 
 getName ()
 
 setEnabled ($enabled)
 
- Public Member Functions inherited from Plugin
 __construct ()
 
 _overridePluginTemplates ($hookName, $args)
 
 addLocaleData ($locale=null)
 
 getCategory ()
 
 getContextSpecificPluginSettingsFile ()
 
 getCurrentVersion ()
 
 getDirName ()
 
 getEnabled ()
 
 getHideManagement ()
 
 getInstallControlledVocabFiles ()
 
 getInstallDataFile ()
 
 getInstallEmailTemplateDataFile ()
 
 getInstallFilterConfigFiles ()
 
 getInstallMigration ()
 
 getInstallSchemaFile ()
 
 getInstallSitePluginSettingsFile ()
 
 getLocaleFilename ($locale)
 
 getPluginPath ()
 
getRequest ()
 
 getSeq ()
 
 getTemplatePath ($inCore=false)
 
 getTemplateResource ($template=null, $inCore=false)
 
 import ($class)
 
 installContextSpecificSettings ($hookName, $args)
 
 installControlledVocabs ($hookName, $args)
 
 installData ($hookName, $args)
 
 installEmailTemplateData ($hookName, $args)
 
 installEmailTemplates ($hookName, $args)
 
 installFilters ($hookName, $args)
 
 installLocale ($hookName, $args)
 
 installSiteSettings ($hookName, $args)
 
 isSitePlugin ()
 
 updateSchema ($hookName, $args)
 
 updateSetting ($contextId, $name, $value, $type=null)
 

Static Public Member Functions

static logFilePath ()
 

Data Fields

const PUBID_TO_ORCID_EXT_ID = ["doi" => "doi", "other::urn" => "urn"]
 
const USER_GROUP_TO_ORCID_ROLE = ["Author" => "AUTHOR", "Translator" => "CHAIR_OR_TRANSLATOR","Journal manager"=>"AUTHOR"]
 
- Data Fields inherited from Plugin
 $pluginCategory
 
 $pluginPath
 
 $request
 

Additional Inherited Members

- Protected Member Functions inherited from Plugin
 _registerTemplateResource ($inCore=false)
 

Detailed Description

ORCID Profile plugin class.

Definition at line 35 of file OrcidProfilePlugin.inc.php.

Member Function Documentation

◆ authorFormFilter()

OrcidProfilePlugin::authorFormFilter (   $output,
  $templateMgr 
)

Output filter adds ORCiD interaction to contributors metadata add/edit form.

Parameters
$outputstring
$templateMgrTemplateManager
Returns
string

Definition at line 409 of file OrcidProfilePlugin.inc.php.

References getIcon(), and Plugin\getTemplateResource().

◆ buildOAuthUrl()

OrcidProfilePlugin::buildOAuthUrl (   $handlerMethod,
  $redirectParams 
)

Return an ORCID OAuth authorization link with

Parameters
$handlerMethodstring containting a valid method of the OrcidHandler
$redirectParamsArray associative array with additional request parameters for the redirect URL

Definition at line 313 of file OrcidProfilePlugin.inc.php.

References Plugin\$request, PKPApplication\get(), getOauthPath(), getSetting(), and isMemberApiEnabled().

Referenced by handleUserPublicProfileDisplay(), registrationFilter(), and sendAuthorMail().

◆ buildOrcidWork()

OrcidProfilePlugin::buildOrcidWork (   $publication,
  $context,
  $authors,
  $request,
  $issue = null 
)

Build an associative array with submission meta data, which can be encoded to a valid ORCID work JSON structure.

See also
https://github.com/ORCID/ORCID-Source/blob/master/orcid-model/src/main/resources/record_2.1/samples/write_sample/bulk-work-2.1.json Example of valid ORCID JSON for adding works to an ORCID record.
Parameters
Submission$submissionthe submission we want to extract data from.
Publication$publicationextract data from this Article
Journal$contextContext object the Submission is part of
Author[]$authorsArray of Author objects, the contributors of the publication
Issue$issueIssue the Article is part of
Request$requestthe current request
Returns
array an associative array with article meta data corresponding to ORCID work JSON structure

Definition at line 985 of file OrcidProfilePlugin.inc.php.

References Plugin\$request, PKPServices\get(), PluginRegistry\getPlugin(), and PluginRegistry\loadCategory().

Referenced by sendSubmissionToOrcid().

◆ collectUserOrcidId()

OrcidProfilePlugin::collectUserOrcidId (   $hookName,
  $params 
)

Collect the ORCID when registering a user.

Parameters
$hookNamestring
$paramsarray
Returns
bool

Definition at line 456 of file OrcidProfilePlugin.inc.php.

◆ getActions()

OrcidProfilePlugin::getActions (   $request,
  $actionArgs 
)

◆ getDescription()

OrcidProfilePlugin::getDescription ( )

Get a description of this plugin.

Returns
string

Reimplemented from Plugin.

Definition at line 533 of file OrcidProfilePlugin.inc.php.

◆ getDisplayName()

OrcidProfilePlugin::getDisplayName ( )

Get the display name for this plugin.

Returns
string

Reimplemented from Plugin.

Definition at line 526 of file OrcidProfilePlugin.inc.php.

Referenced by getActions().

◆ getHandlerPath()

OrcidProfilePlugin::getHandlerPath ( )

Get page handler path for this plugin.

Returns
string Path to plugin's page handler

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

References Plugin\getPluginPath().

◆ getIcon()

OrcidProfilePlugin::getIcon ( )

Return a string of the ORCiD SVG icon

Returns
string

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

References Core\getBaseDir(), and Plugin\getPluginPath().

Referenced by authorFormFilter(), handleTemplateDisplay(), handleUserPublicProfileDisplay(), and registrationFilter().

◆ getInstallEmailTemplatesFile()

OrcidProfilePlugin::getInstallEmailTemplatesFile ( )
See also
PKPPlugin::getInstallEmailTemplatesFile()

Reimplemented from Plugin.

Definition at line 540 of file OrcidProfilePlugin.inc.php.

References Plugin\getPluginPath().

◆ getMailTemplate()

OrcidProfilePlugin::getMailTemplate (   $emailKey,
  $context = null 
)

Instantiate a MailTemplate

Parameters
string$emailKey
Context$context
Returns
MailTemplate

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

Referenced by sendAuthorMail().

◆ getOauthPath()

OrcidProfilePlugin::getOauthPath ( )

Return the OAUTH path (prod or sandbox) based on the current API configuration

Returns
string

Definition at line 285 of file OrcidProfilePlugin.inc.php.

References getOrcidUrl().

Referenced by buildOAuthUrl().

◆ getOrcidUrl()

OrcidProfilePlugin::getOrcidUrl ( )

Return the ORCID website url (prod or sandbox) based on the current API configuration

Returns
string

Definition at line 294 of file OrcidProfilePlugin.inc.php.

References Plugin\$request, PKPApplication\get(), and getSetting().

Referenced by getOauthPath(), handleUserPublicProfileDisplay(), and registrationFilter().

◆ getSetting()

OrcidProfilePlugin::getSetting (   $contextId,
  $name 
)

Load a setting for a specific journal or load it from the config.inc.php if it is specified there.

Parameters
$contextIdint The id of the journal from which the plugin settings should be loaded.
$namestring Name of the setting.
Returns
mixed The setting value, either from the database for this context or from the global configuration file.

Reimplemented from Plugin.

Definition at line 165 of file OrcidProfilePlugin.inc.php.

References Config\getVar().

Referenced by buildOAuthUrl(), getOrcidUrl(), handleUserPublicProfileDisplay(), isMemberApiEnabled(), logInfo(), register(), and sendSubmissionToOrcid().

◆ getStyleSheet()

OrcidProfilePlugin::getStyleSheet ( )

Return the location of the plugin's CSS file

Returns
string

Definition at line 640 of file OrcidProfilePlugin.inc.php.

References Plugin\getPluginPath().

◆ handleAdditionalFieldNames()

OrcidProfilePlugin::handleAdditionalFieldNames (   $hookName,
  $params 
)

Add additional ORCID specific fields to the Author and User objects

Parameters
$hookNamestring
$paramsarray
Returns
bool

Definition at line 511 of file OrcidProfilePlugin.inc.php.

◆ handleAuthorFormExecute()

OrcidProfilePlugin::handleAuthorFormExecute (   $hookname,
  $args 
)

handleAuthorFormexecute sends an e-mail to the author if a specific checkbox was ticked in the author form.

Parameters
$hooknamestring
$argsAuthorForm[]
See also
AuthorForm::execute() The function calling the hook.

Definition at line 431 of file OrcidProfilePlugin.inc.php.

References removeOrcidAccessToken(), and sendAuthorMail().

◆ handleEditorAction()

OrcidProfilePlugin::handleEditorAction (   $hookName,
  $args 
)

handleEditorAction handles promoting a submission to copyediting.

Parameters
$hookNamestring Name the hook was registered with
$argsarray Hook arguments, &$submission, &$editorDecision, &$result, &$recommendation.
See also
EditorAction::recordDecision() The function calling the hook.

Definition at line 758 of file OrcidProfilePlugin.inc.php.

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

◆ handleFormDisplay()

OrcidProfilePlugin::handleFormDisplay (   $hookName,
  $args 
)

Hook callback to handle form display. Registers output filter for public user profile and author form.

Parameters
$hookNamestring
$argsForm[]
Returns
bool
See also
Form::display()

Definition at line 206 of file OrcidProfilePlugin.inc.php.

References Plugin\$request, PKPApplication\get(), and PKPTemplateManager\getManager().

◆ handlePublicationStatusChange()

OrcidProfilePlugin::handlePublicationStatusChange (   $hookName,
  $args 
)

handlePublishIssue sends all submissions for which the authors hava an ORCID and access token to ORCID. This hook will be called on publication of a new issue.

Parameters
$hookNamestring
$argsIssue[] Issue object that will be published
See also

Definition at line 732 of file OrcidProfilePlugin.inc.php.

References Plugin\$request, PKPApplication\get(), and sendSubmissionToOrcid().

◆ handleSubmissionSubmitStep3FormExecute()

OrcidProfilePlugin::handleSubmissionSubmitStep3FormExecute (   $hookName,
  $params 
)

Output filter adds ORCiD interaction to the 3rd step submission form.

Parameters
$outputstring
$templateMgrTemplateManager
Returns
bool

Definition at line 472 of file OrcidProfilePlugin.inc.php.

References Plugin\$request, PKPApplication\get(), and DAORegistry\getDAO().

◆ handleTemplateDisplay()

OrcidProfilePlugin::handleTemplateDisplay (   $hookName,
  $args 
)

Hook callback: register output filter for user registration and article display.

Parameters
$hookNamestring
$argsarray
Returns
bool
See also
TemplateManager::display()

Definition at line 241 of file OrcidProfilePlugin.inc.php.

References Plugin\$request, PKPApplication\get(), and getIcon().

◆ handleUserPublicProfileDisplay()

OrcidProfilePlugin::handleUserPublicProfileDisplay (   $hookName,
  $params 
)

Renders additional content for the PublicProfileForm.

Called by

Parameters
$outputstring
$templateMgrTemplateManager
Returns
bool
See also
lib/pkp/templates/user/publicProfileForm.tpl

Definition at line 379 of file OrcidProfilePlugin.inc.php.

References Plugin\$request, buildOAuthUrl(), PKPApplication\get(), getIcon(), getOrcidUrl(), getSetting(), and Plugin\getTemplateResource().

◆ isGloballyConfigured()

OrcidProfilePlugin::isGloballyConfigured ( )

Check if there exist a valid orcid configuration section in the global config.inc.php of OJS.

Returns
boolean True, if the config file has api_url, client_id and client_secret set in an [orcid] section

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

References Config\getVar().

◆ isMemberApiEnabled()

OrcidProfilePlugin::isMemberApiEnabled (   $contextId)
Returns
bool True if the ORCID Member API has been selected in this context.

Definition at line 1275 of file OrcidProfilePlugin.inc.php.

References getSetting().

Referenced by buildOAuthUrl(), sendAuthorMail(), and sendSubmissionToOrcid().

◆ logError()

OrcidProfilePlugin::logError (   $message)

Write error message to log.

Parameters
$messagestring Message to write
Returns
void

Definition at line 1233 of file OrcidProfilePlugin.inc.php.

Referenced by sendSubmissionToOrcid().

◆ logFilePath()

static OrcidProfilePlugin::logFilePath ( )
static
Returns
string Path to a custom ORCID log file.

Definition at line 1223 of file OrcidProfilePlugin.inc.php.

References Config\getVar().

◆ logInfo()

OrcidProfilePlugin::logInfo (   $message)

Write info message to log.

Parameters
$messagestring Message to write
Returns
void

Definition at line 1243 of file OrcidProfilePlugin.inc.php.

References getSetting().

Referenced by sendSubmissionToOrcid().

◆ manage()

OrcidProfilePlugin::manage (   $args,
  $request 
)
See also
Plugin::manage()

Reimplemented from Plugin.

Definition at line 600 of file OrcidProfilePlugin.inc.php.

References Plugin\$request, and PKPTemplateManager\getManager().

◆ register()

OrcidProfilePlugin::register (   $category,
  $path,
  $mainContextId = null 
)

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
$mainContextIdinteger To identify if the plugin is enabled we need a context. This context is usually taken from the request but sometimes there is no context in the request (e.g. when executing CLI commands). Then the main context can be given as an explicit ID.
Returns
boolean True iff plugin registered successfully; if false, the plugin will not be executed.

Reimplemented from LazyLoadPlugin.

Definition at line 45 of file OrcidProfilePlugin.inc.php.

References LazyLoadPlugin\getCurrentContextId(), Plugin\getEnabled(), getSetting(), Config\getVar(), and HookRegistry\register().

◆ registrationFilter()

OrcidProfilePlugin::registrationFilter (   $output,
  $templateMgr 
)

Output filter adds ORCiD interaction to registration form.

Parameters
$outputstring
$templateMgrTemplateManager
Returns
string

Definition at line 346 of file OrcidProfilePlugin.inc.php.

References Plugin\$request, buildOAuthUrl(), PKPApplication\get(), getIcon(), getOrcidUrl(), and Plugin\getTemplateResource().

◆ removeOrcidAccessToken()

OrcidProfilePlugin::removeOrcidAccessToken (   $author,
  $saveAuthor = true 
)

Remove all data fields, which belong to an ORCID access token from the given Author object. Also updates fields in the db.

Parameters
$authorAuthor object with ORCID access token
Returns
void

Definition at line 1207 of file OrcidProfilePlugin.inc.php.

References DAORegistry\getDAO().

Referenced by handleAuthorFormExecute(), and sendSubmissionToOrcid().

◆ sendAuthorMail()

OrcidProfilePlugin::sendAuthorMail (   $author,
  $updateAuthor = false 
)

Send mail with ORCID authorization link to the e-mail address of the supplied Author object.

Parameters
Author$author
bool$updateAuthorIf true update the author fields in the database. Use this only if not called from a function, which does this anyway.

Definition at line 674 of file OrcidProfilePlugin.inc.php.

References Plugin\$request, buildOAuthUrl(), PKPApplication\get(), DAORegistry\getDAO(), getMailTemplate(), and isMemberApiEnabled().

Referenced by handleAuthorFormExecute(), and handleEditorAction().

◆ sendSubmissionToOrcid()

OrcidProfilePlugin::sendSubmissionToOrcid (   $publication,
  $request 
)

sendSubmissionToOrcid posts JSON consisting of submission, journal and issue meta data to ORCID profiles of submission authors.

See also
https://github.com/ORCID/ORCID-Source/tree/master/orcid-model/src/main/resources/record_2.1 for documentation and examples of the ORCID JSON format.
Parameters
$publicationPublication for which the data will be sent to ORCID
$submissionSubmission for which the data will be sent to ORCID
Returns
bool||bool[]

Definition at line 795 of file OrcidProfilePlugin.inc.php.

References Plugin\$request, buildOrcidWork(), PKPServices\get(), DAORegistry\getDAO(), getSetting(), Config\getVar(), isMemberApiEnabled(), logError(), logInfo(), and removeOrcidAccessToken().

Referenced by handlePublicationStatusChange().

◆ setCurrentContextId()

OrcidProfilePlugin::setCurrentContextId (   $contextId)

Set the current id of the context (atm only considered for logging settings).

Parameters
$contextIdint the Id of the currently active context (journal)

Definition at line 1268 of file OrcidProfilePlugin.inc.php.

◆ setupCallbackHandler()

OrcidProfilePlugin::setupCallbackHandler (   $hookName,
  $params 
)

Hook callback: register pages for each sushi-lite method This URL is of the form: orcidapi/{$orcidrequest}

See also
PKPPageRouter::route()

Definition at line 147 of file OrcidProfilePlugin.inc.php.

References Plugin\getEnabled().

◆ smartyPluginUrl()

OrcidProfilePlugin::smartyPluginUrl (   $params,
  $smarty 
)

Extend the {url ...} smarty to support this plugin.

Reimplemented from Plugin.

Definition at line 547 of file OrcidProfilePlugin.inc.php.

References Plugin\getCategory(), and LazyLoadPlugin\getName().

Field Documentation

◆ PUBID_TO_ORCID_EXT_ID

const OrcidProfilePlugin::PUBID_TO_ORCID_EXT_ID = ["doi" => "doi", "other::urn" => "urn"]

Definition at line 36 of file OrcidProfilePlugin.inc.php.

◆ USER_GROUP_TO_ORCID_ROLE

const OrcidProfilePlugin::USER_GROUP_TO_ORCID_ROLE = ["Author" => "AUTHOR", "Translator" => "CHAIR_OR_TRANSLATOR","Journal manager"=>"AUTHOR"]

Definition at line 37 of file OrcidProfilePlugin.inc.php.


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