diff --git a/OrcidProfileHandler.php b/OrcidProfileHandler.php index 3a040c46..588761b1 100644 --- a/OrcidProfileHandler.php +++ b/OrcidProfileHandler.php @@ -18,6 +18,7 @@ use APP\core\Application; +use APP\core\Request; use APP\facades\Repo; use APP\handler\Handler; use APP\template\TemplateManager; @@ -35,10 +36,8 @@ class OrcidProfileHandler extends Handler protected $plugin; - public function __construct(\OrcidProfilePlugin $plugin) + public function __construct() { - $this->plugin = $plugin; - } /** @@ -189,7 +188,7 @@ public function orcidVerify($args, $request) $context = $request->getContext(); $contextId = $context == null ? \PKP\core\PKPApplication::CONTEXT_ID_NONE : $context->getId(); - $plugin = PluginRegistry::getPlugin('generic', 'orcidprofileplugin'); + $plugin = $this->plugin; $templatePath = $plugin->getTemplateResource(self::TEMPLATE); @@ -361,10 +360,10 @@ public function about($args, $request) $context = $request->getContext(); $contextId = $context == null ? \PKP\core\PKPApplication::CONTEXT_ID_NONE : $context->getId(); $templateMgr = TemplateManager::getManager($request); - $templateMgr->assign('orcidIcon', $this->plugin->getIcon()); - $templateMgr->assign('isMemberApi', $this->plugin->isMemberApiEnabled($contextId)); - $templateMgr->display($this->plugin->getTemplateResource('orcidAbout.tpl')); - return false; + $plugin = PluginRegistry::getPlugin('generic', 'orcidprofileplugin'); + $templateMgr->assign('orcidIcon', $plugin->getIcon()); + $templateMgr->assign('isMemberApi', $plugin->isMemberApiEnabled($contextId)); + $templateMgr->display($plugin->getTemplateResource('orcidAbout.tpl')); } diff --git a/OrcidProfilePlugin.php b/OrcidProfilePlugin.php index d21377ae..916eded8 100755 --- a/OrcidProfilePlugin.php +++ b/OrcidProfilePlugin.php @@ -52,7 +52,7 @@ use APP\plugins\generic\orcidProfile\classes\form\OrcidProfileSettingsForm; use APP\plugins\generic\orcidProfile\classes\form\OrcidProfileStatusForm; use APP\plugins\generic\orcidProfile\classes\OrcidValidator; -use APP\plugins\generic\orcidProfile\OrcidProfileHandler; + class OrcidProfilePlugin extends GenericPlugin @@ -286,22 +286,9 @@ public function getSetting($contextId, $name) public function setupCallbackHandler($hookName, $params) { $page = $params[0]; - $op = $params[1]; - if ($this->getEnabled() && $page == 'orcidapi') { - - $request = \Application::get()->getRequest(); - - switch ($op) { - case 'about': - $page = 'pages'; - $op = 'view'; - - $handler = new OrcidProfileHandler($this); - - - } - + define('HANDLER_CLASS', 'APP\plugins\generic\orcidProfile\OrcidProfileHandler'); + return true; } return false; }