$format_restrictions =
$format->
getHtmlRestrictions();
if ($original_format !== NULL
) { $original_format_restrictions =
$original_format->
getHtmlRestrictions();
} // Any tags that are explicitly whitelisted by the text format must be
// removed from the list of default dangerous tags: if they're explicitly
// allowed, then we must respect that configuration.
// When switching from another format, we must use the intersection of
// allowed tags: if either format is more restrictive, then the safety
// expectations of *both* formats apply.
$allowed_tags = self::
getAllowedTags($format_restrictions);
if ($original_format !== NULL
) { $allowed_tags =
array_intersect($allowed_tags, self::
getAllowedTags($original_format_restrictions));
} // Don't blacklist dangerous tags that are explicitly allowed in both text
// formats.
$blacklisted_tags =
array_diff($dangerous_tags,
$allowed_tags);
$output =
static::
filter($html,
$blacklisted_tags);
// Since data-attributes can contain encoded HTML markup that could be