15 import(
'lib.pkp.classes.plugins.GenericPlugin');
21 function register($category, $path, $mainContextId =
null) {
22 if (parent::register($category, $path, $mainContextId)) {
38 if (!$galley || $galley->getFileType() !=
'text/html')
return false;
40 ob_start(
function($buffer) {
41 return str_replace(
'<head>',
'<head><script async defer src="//hypothes.is/embed.js"></script>', $buffer);
54 if ($hookName !=
'TemplateManager::display')
return false;
55 $templateMgr = $args[0];
57 $plugin =
'plugins-generic-pdfJsViewer';
58 $tpl =
'submissionGalley.tpl';
60 if (strpos($template, $plugin) !==
false && strpos($template,
':'.$tpl, -1 - strlen($tpl)) !==
false) {
61 $templateMgr->registerFilter(
"output", array($this,
'changePdfjsPath'));
73 $newOutput = str_replace(
'pdfJsViewer/pdf.js/web/viewer.html?file=',
'hypothesis/pdf.js/viewer/web/viewer.html?file=', $output);
82 return __(
'plugins.generic.hypothesis.name');
90 return __(
'plugins.generic.hypothesis.description');