diff --git a/includes/services/HtmlPurifierService.php b/includes/services/HtmlPurifierService.php index 2d5e1dba4..97da4bcd6 100644 --- a/includes/services/HtmlPurifierService.php +++ b/includes/services/HtmlPurifierService.php @@ -50,6 +50,10 @@ public function cleanHTML(string $dirty_html): string '_top', ]); + // allow iframe + $config->set('HTML.SafeIframe', true); + $config->set('HTML.SafeIframeRegexp', '%^https?://.*%'); + // set the cache folder // doc : http://htmlpurifier.org/live/configdoc/plain.html#Cache.SerializerPath if (!is_dir(self::HTMLPURIFIER_CACHE_FOLDER)) { @@ -57,6 +61,9 @@ public function cleanHTML(string $dirty_html): string } $config->set('Cache.SerializerPath', realpath(self::HTMLPURIFIER_CACHE_FOLDER)); + $def = $config->getHTMLDefinition(true); + $def->addAttribute('iframe', 'allowfullscreen', 'Bool'); + $this->purifier = new HTMLPurifier($config); }