Skip to content

Commit

Permalink
refs #40214#note-13, gh-70, fixes html purifier allowed tags format
Browse files Browse the repository at this point in the history
  • Loading branch information
jimyhuang committed Apr 17, 2024
1 parent 8255568 commit 325ca8c
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions CRM/Utils/String.php
Original file line number Diff line number Diff line change
Expand Up @@ -446,10 +446,10 @@ static function htmlToText($html) {
return $converter->get_text();
}

static function htmlPurifier($html, $allowed_tags = array()) {
static function htmlPurifier($html, $allowedTags = array()) {
require_once 'packages/IDS/vendors/htmlpurifier/HTMLPurifier.auto.php';
static $_purifier;
$hash = md5(CRM_Utils_Array::implode('', $allowed_tags));
$hash = md5(CRM_Utils_Array::implode(',', $allowedTags));

if (!$_purifier[$hash]) {
$config = CRM_Core_Config::singleton();
Expand All @@ -467,7 +467,8 @@ static function htmlPurifier($html, $allowed_tags = array()) {
$purifierConfig->set('URI.SafeIframeRegexp', '%^(https?:)?//(www\.youtube(?:-nocookie)?\.com/embed/|player\.vimeo\.com/video/)%'); //allow YouTube and Vimeo

// allowed tags put at the end
$purifierConfig->set('HTML.Allowed', $allowed_tags);
$allowed = implode(', ', $allowedTags);
$purifierConfig->set('HTML.Allowed', $allowed);

// def needs after configure
// fullscreen
Expand Down

0 comments on commit 325ca8c

Please sign in to comment.