diff --git a/classes/template/PKPTemplateManager.inc.php b/classes/template/PKPTemplateManager.inc.php index e0f18445ce1..f146e0a1f98 100644 --- a/classes/template/PKPTemplateManager.inc.php +++ b/classes/template/PKPTemplateManager.inc.php @@ -1988,19 +1988,40 @@ function loadHtmlGalleyStyles($htmlContent, $embeddedFiles) { return $htmlContent; } - $links = ''; $styles = $this->getResourcesByContext($this->_styleSheets, 'htmlGalley'); if (!empty($styles)) { ksort($styles); + $links = ''; foreach ($styles as $priorityGroup) { foreach ($priorityGroup as $htmlStyle) { - $links .= '' . "\n"; + $links .= !empty($htmlStyle['inline']) + ? '' + : ''; + $links .= "\n"; } } + $htmlContent = str_ireplace('', '' . "\n" . $links, $htmlContent); } - return str_ireplace('', '' . "\n" . $links, $htmlContent); + + $scripts = $this->getResourcesByContext($this->_javaScripts, 'htmlGalley'); + + if (!empty($scripts)) { + $links = ''; + ksort($scripts); + foreach ($scripts as $priorityGroup) { + foreach ($priorityGroup as $script) { + $links .= !empty($script['inline']) + ? '' + : ''; + $links .= "\n"; + } + } + $htmlContent = str_ireplace('', $links . "\n", $htmlContent); + } + + return $htmlContent; } /**