kaero598/htmlpurifier-conditionalcomments-filter

IE conditional comments filter for HTMLPurifier

1.0.0 2023-11-16 08:47 UTC

This package is not auto-updated.

Last update: 2024-05-02 10:45:28 UTC


README

HTMLPurifier always removes IE conditional comments from HTML and there is no way to alter that behavior without touching the sources.

Conditional comments filter disguises IE conditional comments as plain tags and reverts them back after HTMLPurifier has purified HTML. This also means that HTML inside conditional comments also gets purified.

Example

<?php

$config = HTMLPurifier_Config::createDefault();

$config->set('Filter.Custom', [
    new HTMLCleaner\Filter\ConditionalComments(),
]);

$purifier = new HTMLPurifier($config);

$purified_html = $purifier->purify($html);