From 402f94143a713c959c520a8b86a48885542764d6 Mon Sep 17 00:00:00 2001 From: buttle Date: Fri, 30 Jul 2021 00:25:30 +0200 Subject: [PATCH] adds consition to parsedown include --- README.md | 6 ++++-- src/Site/BlockLayout/SimpleMDText.php | 11 ++++++++++- 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index e7e6d76..efe02d8 100644 --- a/README.md +++ b/README.md @@ -8,9 +8,11 @@ that does some markdown rendering. ``` cd ./modules -https://git.hangar.org/arcHIVE-tech/SimpleMDText/archive/main.zip +https://git.hangar.org/arcHIVE-tech/SimpleMarkdown-omeka-module/archive/main.zip unzip main.zip -mv simpletext/ SimpleMDText +rm main.zip +mv simplemarkdown-omeka-module/ SimpleMDText +cd SimpleMDText composer install ``` diff --git a/src/Site/BlockLayout/SimpleMDText.php b/src/Site/BlockLayout/SimpleMDText.php index b521743..838753e 100644 --- a/src/Site/BlockLayout/SimpleMDText.php +++ b/src/Site/BlockLayout/SimpleMDText.php @@ -10,7 +10,16 @@ use Laminas\View\Renderer\PhpRenderer; use Laminas\Form\FormElementManager; use SimpleMDText\Form\SimpleMDTextBlockForm; -require_once(dirname(__DIR__, 3) . '/vendor/erusev/parsedown/Parsedown.php'); +$list_of_includes = get_included_files(); +$parsedown_included=false; +foreach ($list_of_includes as $file_path) { + if (false !== strpos($file_path, "Parsedown.php")) { + $parsedown_included=true; + } +} +if ($parsedown_included == false){ + require_once(dirname(__DIR__, 3) . '/vendor/autoload.php'); +} use Parsedown;