1
0
mirror of https://github.com/typemill/typemill.git synced 2025-07-30 19:00:32 +02:00

Version 1.5.3 Fix dispatcher in plugins, parsedown setAllowedShortcodes

This commit is contained in:
trendschau
2022-01-21 23:04:08 +01:00
parent d33d6f725d
commit 9926c24307
2 changed files with 18 additions and 2 deletions

View File

@@ -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]))
{

View File

@@ -85,7 +85,7 @@ abstract class Plugin implements EventSubscriberInterface
protected function getDispatcher()
{
return $this->$dispatcher;
return $this->$container['dispatcher'];
}
protected function getTwig()