Mark Twig content filter as HTML safe
This commit is contained in:
parent
cb3bdd149f
commit
be0812fb55
24
lib/Pico.php
24
lib/Pico.php
@ -2098,17 +2098,21 @@ class Pico
|
|||||||
// this is the reason why we can't register this filter as part of PicoTwigExtension
|
// this is the reason why we can't register this filter as part of PicoTwigExtension
|
||||||
$pico = $this;
|
$pico = $this;
|
||||||
$pages = &$this->pages;
|
$pages = &$this->pages;
|
||||||
$this->twig->addFilter(new Twig_SimpleFilter('content', function ($page) use ($pico, &$pages) {
|
$this->twig->addFilter(new Twig_SimpleFilter(
|
||||||
if (isset($pages[$page])) {
|
'content',
|
||||||
$pageData = &$pages[$page];
|
function ($page) use ($pico, &$pages) {
|
||||||
if (!isset($pageData['content'])) {
|
if (isset($pages[$page])) {
|
||||||
$pageData['content'] = $pico->prepareFileContent($pageData['raw_content'], $pageData['meta']);
|
$pageData = &$pages[$page];
|
||||||
$pageData['content'] = $pico->parseFileContent($pageData['content']);
|
if (!isset($pageData['content'])) {
|
||||||
|
$pageData['content'] = $pico->prepareFileContent($pageData['raw_content'], $pageData['meta']);
|
||||||
|
$pageData['content'] = $pico->parseFileContent($pageData['content']);
|
||||||
|
}
|
||||||
|
return $pageData['content'];
|
||||||
}
|
}
|
||||||
return $pageData['content'];
|
return null;
|
||||||
}
|
},
|
||||||
return null;
|
array('is_safe' => array('html'))
|
||||||
}));
|
));
|
||||||
|
|
||||||
// trigger onTwigRegistration event
|
// trigger onTwigRegistration event
|
||||||
$this->triggerEvent('onTwigRegistered', array(&$this->twig));
|
$this->triggerEvent('onTwigRegistered', array(&$this->twig));
|
||||||
|
Loading…
x
Reference in New Issue
Block a user