Loading ArticleImageDataHandler.inc.php +1 −6 Original line number Diff line number Diff line Loading @@ -5,13 +5,8 @@ import('pages.article.ArticleHandler'); class ArticleImageDataHandler extends ArticleHandler { /** * Image from zip archive galley file * @param array $args * @param Request $request * @return mixed */ public function zimage(array $args, Request $request) { Loading BookImageDataHandler.inc.php +45 −50 Original line number Diff line number Diff line Loading @@ -5,8 +5,6 @@ import('pages.catalog.CatalogBookHandler'); class BookImageDataHandler extends CatalogBookHandler { // /** // * @param array $args // * @param Request $request Loading Loading @@ -45,9 +43,6 @@ class BookImageDataHandler extends CatalogBookHandler /** * Image from zip archive submission file * @param array $args * @param Request $request * @return mixed */ public function zimage(array $args, Request $request) { Loading @@ -60,7 +55,7 @@ class BookImageDataHandler extends CatalogBookHandler 'assocTypes' => [ASSOC_TYPE_PUBLICATION_FORMAT], ]); $publicationFile = NULL; $publicationFile = null; foreach ($pubFormatFiles as $file) { if ($file->getData('assocId') == $pubId) { $publicationFile = $file; Loading ImageUtils.php +8 −4 Original line number Diff line number Diff line <?php use APP\handler\Handler; use League\Flysystem\Filesystem; use League\Flysystem\Local\LocalFilesystemAdapter; use League\Flysystem\UnixVisibility\PortableVisibilityConverter; use PKP\config\Config; use PKP\file\FileManager; use PKP\plugins\Hook; use APP\handler\Handler; class ImageUtils { public static function buildFileSystem(Handler $handler) : Filesystem{ public static function buildFileSystem(Handler $handler): Filesystem { $umask = Config::getVar('files', 'umask', 0022); $adapter = new LocalFilesystemAdapter( Config::getVar('files', 'files_dir'), Loading @@ -31,7 +34,8 @@ class ImageUtils return new Filesystem($adapter); } public static function downloadImage(Filesystem $fs, string $path, string $name){ public static function downloadImage(Filesystem $fs, string $path, string $name) { $mimetype = 'application/octet-stream'; $filesize = $fs->fileSize($path); $encodedFilename = urlencode($name); Loading XML2HTMLPlugin.php +44 −39 Original line number Diff line number Diff line Loading @@ -351,53 +351,58 @@ class XML2HTMLPlugin extends GenericPlugin . '/resources/custom/' . $filename; } public static function transform( string $xmlFilePath, string $format ) { public static function transform(string $xmlFilePath, string $format) { $xsltDir = dirname(__FILE__) . DIRECTORY_SEPARATOR . 'xsl' . DIRECTORY_SEPARATOR . strtolower($format) . DIRECTORY_SEPARATOR; $xsltDir = dirname(__FILE__) . DIRECTORY_SEPARATOR . 'xsl' . DIRECTORY_SEPARATOR . strtolower($format) . DIRECTORY_SEPARATOR; $xslFiles = glob($xsltDir . '*.xsl'); sort($xslFiles, SORT_NATURAL); $result = null; foreach (glob($xsltDir . '*.xsl') as $xsltPath) { if (basename($xsltPath) == strtolower($format) . XML2HTMLPlugin::$META_XSL_SUFFIX) { foreach ($xslFiles as $xsltPath) { $basename = basename($xsltPath); if ($basename == strtolower($format) . XML2HTMLPlugin::$META_XSL_SUFFIX) { continue; // ex: tei-metas2html.xsl } if (preg_match('/_core\.xsl$/i', $basename)) { continue; }//do not apply metas xsl } libxml_use_internal_errors(true); $xml = new DOMDocument(); if ($result == null) { // Load the XML source $xml->load($xmlFilePath); } else { //Load previous xsl result $xml->loadXML($result); $loaded = ($result === null) ? $xml->load($xmlFilePath) : $xml->loadXML($result); if (!$loaded) { foreach (libxml_get_errors() as $e) { error_log('XML2HTML: échec de chargement avant ' . $basename . ' : ' . $e->message); } libxml_clear_errors(); return null; } $xsl = new DOMDocument(); $xsl->load($xsltPath, LIBXML_DTDATTR); // Configure the transformer $proc = new XSLTProcessor(); $proc->importStyleSheet($xsl); // attach the xsl rules //lang param $locale = AppLocale::getLocale(); $proc->setParameter('', 'lang', $locale); $proc->importStyleSheet($xsl); $proc->setParameter('', 'lang', Applocale::getLocale()); try { $result = $proc->transformToXML($xml); } catch (Exception $e) { $result = null; var_dump($e); if ($result === false) { foreach (libxml_get_errors() as $e) { error_log('XML2HTML: échec transformToXML sur ' . $basename . ' : ' . $e->message); } libxml_clear_errors(); return null; } } catch (\Exception $e) { error_log('XML2HTML exception sur ' . $basename . ' : ' . $e->getMessage()); return null; } } return $result; } Loading index.php +1 −0 Original line number Diff line number Diff line <?php /** * Created by PhpStorm. * User: dje Loading Loading
ArticleImageDataHandler.inc.php +1 −6 Original line number Diff line number Diff line Loading @@ -5,13 +5,8 @@ import('pages.article.ArticleHandler'); class ArticleImageDataHandler extends ArticleHandler { /** * Image from zip archive galley file * @param array $args * @param Request $request * @return mixed */ public function zimage(array $args, Request $request) { Loading
BookImageDataHandler.inc.php +45 −50 Original line number Diff line number Diff line Loading @@ -5,8 +5,6 @@ import('pages.catalog.CatalogBookHandler'); class BookImageDataHandler extends CatalogBookHandler { // /** // * @param array $args // * @param Request $request Loading Loading @@ -45,9 +43,6 @@ class BookImageDataHandler extends CatalogBookHandler /** * Image from zip archive submission file * @param array $args * @param Request $request * @return mixed */ public function zimage(array $args, Request $request) { Loading @@ -60,7 +55,7 @@ class BookImageDataHandler extends CatalogBookHandler 'assocTypes' => [ASSOC_TYPE_PUBLICATION_FORMAT], ]); $publicationFile = NULL; $publicationFile = null; foreach ($pubFormatFiles as $file) { if ($file->getData('assocId') == $pubId) { $publicationFile = $file; Loading
ImageUtils.php +8 −4 Original line number Diff line number Diff line <?php use APP\handler\Handler; use League\Flysystem\Filesystem; use League\Flysystem\Local\LocalFilesystemAdapter; use League\Flysystem\UnixVisibility\PortableVisibilityConverter; use PKP\config\Config; use PKP\file\FileManager; use PKP\plugins\Hook; use APP\handler\Handler; class ImageUtils { public static function buildFileSystem(Handler $handler) : Filesystem{ public static function buildFileSystem(Handler $handler): Filesystem { $umask = Config::getVar('files', 'umask', 0022); $adapter = new LocalFilesystemAdapter( Config::getVar('files', 'files_dir'), Loading @@ -31,7 +34,8 @@ class ImageUtils return new Filesystem($adapter); } public static function downloadImage(Filesystem $fs, string $path, string $name){ public static function downloadImage(Filesystem $fs, string $path, string $name) { $mimetype = 'application/octet-stream'; $filesize = $fs->fileSize($path); $encodedFilename = urlencode($name); Loading
XML2HTMLPlugin.php +44 −39 Original line number Diff line number Diff line Loading @@ -351,53 +351,58 @@ class XML2HTMLPlugin extends GenericPlugin . '/resources/custom/' . $filename; } public static function transform( string $xmlFilePath, string $format ) { public static function transform(string $xmlFilePath, string $format) { $xsltDir = dirname(__FILE__) . DIRECTORY_SEPARATOR . 'xsl' . DIRECTORY_SEPARATOR . strtolower($format) . DIRECTORY_SEPARATOR; $xsltDir = dirname(__FILE__) . DIRECTORY_SEPARATOR . 'xsl' . DIRECTORY_SEPARATOR . strtolower($format) . DIRECTORY_SEPARATOR; $xslFiles = glob($xsltDir . '*.xsl'); sort($xslFiles, SORT_NATURAL); $result = null; foreach (glob($xsltDir . '*.xsl') as $xsltPath) { if (basename($xsltPath) == strtolower($format) . XML2HTMLPlugin::$META_XSL_SUFFIX) { foreach ($xslFiles as $xsltPath) { $basename = basename($xsltPath); if ($basename == strtolower($format) . XML2HTMLPlugin::$META_XSL_SUFFIX) { continue; // ex: tei-metas2html.xsl } if (preg_match('/_core\.xsl$/i', $basename)) { continue; }//do not apply metas xsl } libxml_use_internal_errors(true); $xml = new DOMDocument(); if ($result == null) { // Load the XML source $xml->load($xmlFilePath); } else { //Load previous xsl result $xml->loadXML($result); $loaded = ($result === null) ? $xml->load($xmlFilePath) : $xml->loadXML($result); if (!$loaded) { foreach (libxml_get_errors() as $e) { error_log('XML2HTML: échec de chargement avant ' . $basename . ' : ' . $e->message); } libxml_clear_errors(); return null; } $xsl = new DOMDocument(); $xsl->load($xsltPath, LIBXML_DTDATTR); // Configure the transformer $proc = new XSLTProcessor(); $proc->importStyleSheet($xsl); // attach the xsl rules //lang param $locale = AppLocale::getLocale(); $proc->setParameter('', 'lang', $locale); $proc->importStyleSheet($xsl); $proc->setParameter('', 'lang', Applocale::getLocale()); try { $result = $proc->transformToXML($xml); } catch (Exception $e) { $result = null; var_dump($e); if ($result === false) { foreach (libxml_get_errors() as $e) { error_log('XML2HTML: échec transformToXML sur ' . $basename . ' : ' . $e->message); } libxml_clear_errors(); return null; } } catch (\Exception $e) { error_log('XML2HTML exception sur ' . $basename . ' : ' . $e->getMessage()); return null; } } return $result; } Loading
index.php +1 −0 Original line number Diff line number Diff line <?php /** * Created by PhpStorm. * User: dje Loading