Skip to content

Commit bad09a3

Browse files
committed
Error handling and cleanup
1 parent ae29124 commit bad09a3

File tree

3 files changed

+7
-2
lines changed

3 files changed

+7
-2
lines changed

InlineHtmlGalleyBlockPlugin.inc.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ function getContents($templateMgr, $request = null) {
115115
if ($router->getRequestedPage($request) === 'article' && $router->getRequestedOp($request) === 'view') {
116116
$submission = $templateMgr->getTemplateVars('article');
117117
$galley = $templateMgr->getTemplateVars('galley');
118-
if ($submission && $galley) {
118+
if ($submission && $galley && $galley->getFileType() == 'text/html') {
119119
$templateMgr->assign('submissionId', $submission->getBestArticleId());
120120
$templateMgr->assign('galleyId', $galley->getBestGalleyId());
121121
return parent::getContents($templateMgr);

InlineHtmlGalleyPlugin.inc.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,9 @@ function articleViewCallback($hookName, $args) {
8888
function _extractBodyContents($html) {
8989
$bodyContent = '';
9090
try {
91+
if (!function_exists('libxml_use_internal_errors') || !class_exists('DOMDocument')) {
92+
throw new Exception('Missing libxml/dom requirements');
93+
}
9194
$errorsEnabled = libxml_use_internal_errors();
9295
libxml_use_internal_errors(true);
9396
$dom = DOMDocument::loadHTML($html);

README.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,9 @@ php lib/pkp/tools/installPluginVersion.php plugins/generic/inlineHtmlGalley/vers
2828

2929
Login as a Journal Manger and navigate to the Journal for which you wish to use inline display of HTML Galleys. Enable the plugin via Login -> Settings -> Website -> Plugins -> Inline HTML Galley -> Enable.
3030

31-
There is no settings configuration for this plugin. Once enabled, the view of an HTML Galley will extract the HTML `body` from the Galley and will place it inline in the Galley view. You will need to replicate any CSS or Javascript directives used in the `head` of the Galley in your website configuration. (Hint: see the Custom Headers plugin.)
31+
There are no settings to configure for this plugin. Once enabled, the view of an HTML Galley will extract the HTML `body` from the Galley and will place it inline in the Galley view. You will need to replicate any CSS or Javascript directives used in the `head` of the Galley in your website configuration. (Hint: see the Custom Headers plugin.)
32+
33+
The template will provide a link to the "download" handler for the galley above the extracted text of the Galley. The plugin also provides a sidebar block to link to the download, which may be enabled and positioned via the Website Settings.
3234

3335
## Author / License
3436

0 commit comments

Comments
 (0)