diff --git a/system/Extensions/ParsedownExtension.php b/system/Extensions/ParsedownExtension.php index fe2cc5a..25b6230 100644 --- a/system/Extensions/ParsedownExtension.php +++ b/system/Extensions/ParsedownExtension.php @@ -81,7 +81,6 @@ class ParsedownExtension extends \ParsedownExtra # convert to markup $markup = $this->elements($Elements); - # die(); # trim line breaks $markup = trim($markup, "\n"); @@ -755,8 +754,20 @@ class ParsedownExtension extends \ParsedownExtra } } + protected $allowedShortcodes = false; + + public function setAllowedShortcodes(array $shortcodelist) + { + $this->allowedShortcodes = $shortcodelist; + } + protected function createShortcodeArray($matches, $block) { + if(is_array($this->allowedShortcodes) && empty($this->allowedShortcodes)) + { + return false; + } + $shortcodeString = substr($matches[0], 2, -2); $shortcodeArray = explode(' ', $shortcodeString, 2); $shortcode = []; @@ -764,6 +775,11 @@ class ParsedownExtension extends \ParsedownExtra $shortcode['name'] = $shortcodeArray[0]; $shortcode['params'] = false; + if(is_array($this->allowedShortcodes) && !in_array($shortcode['name'], $this->allowedShortcodes)) + { + return false; + } + # are there params? if(isset($shortcodeArray[1])) { diff --git a/system/Plugin.php b/system/Plugin.php index 464cb29..d1a66f1 100644 --- a/system/Plugin.php +++ b/system/Plugin.php @@ -85,7 +85,7 @@ abstract class Plugin implements EventSubscriberInterface protected function getDispatcher() { - return $this->$dispatcher; + return $this->$container['dispatcher']; } protected function getTwig()