mirror of
https://github.com/silverstripe/silverstripe-comments
synced 2024-10-22 11:05:49 +02:00
FIX: The AutoFormat.AutoParagraph injector of HTMLPurifier fails if the p tag is not allowed. Make a check for this
This commit is contained in:
parent
eba88fe869
commit
8dc36df7a4
@ -619,8 +619,14 @@ class Comment extends DataObject {
|
|||||||
*/
|
*/
|
||||||
public function getHtmlPurifierService() {
|
public function getHtmlPurifierService() {
|
||||||
$config = HTMLPurifier_Config::createDefault();
|
$config = HTMLPurifier_Config::createDefault();
|
||||||
$config->set('HTML.AllowedElements', $this->getOption('html_allowed_elements'));
|
$allowedElements = $this->getOption('html_allowed_elements');
|
||||||
$config->set('AutoFormat.AutoParagraph', true);
|
$config->set('HTML.AllowedElements', $allowedElements);
|
||||||
|
|
||||||
|
// This injector cannot be set unless the 'p' element is allowed
|
||||||
|
if (in_array('p', $allowedElements)) {
|
||||||
|
$config->set('AutoFormat.AutoParagraph', true);
|
||||||
|
}
|
||||||
|
|
||||||
$config->set('AutoFormat.Linkify', true);
|
$config->set('AutoFormat.Linkify', true);
|
||||||
$config->set('URI.DisableExternalResources', true);
|
$config->set('URI.DisableExternalResources', true);
|
||||||
$config->set('Cache.SerializerPath', getTempFolder());
|
$config->set('Cache.SerializerPath', getTempFolder());
|
||||||
|
Loading…
Reference in New Issue
Block a user