FAQ Database Discussion Community


HTMLPurifier - add name attribute to anchor tag

php,htmlpurifier
HTMLPurifier strips the name attribute from the anchor tag Using the documentation in the past, I've successfully created a new element "include". But I can't get the code to also add the name attribute for the anchor tag. My preference is NOT to limit the name values. Any help would...

Yii1 - HtmlPurifier removes allowfullscreen attribute

php,regex,iframe,yii,htmlpurifier
I am using below configuration to clean the input from user in my Yii project using its inbuilt support for HtmlPurifier array( 'URI.AllowedSchemes' => array( 'http' => true, 'https' => true, ), "HTML.SafeEmbed" => true, 'HTML.TargetBlank' => true, "HTML.SafeIframe" => true, "Filter.YouTube" => true, 'URI.SafeIframeRegexp' => '%^(https?:)?//(www\.youtube(?:-nocookie)?\.com/embed/|player\.vimeo\.com/video/)%' ), Example:- <iframe...

Limit children/nesting type with HTMLPurifier

php,html,htmlpurifier
How would I configure HTMLPurifier to prevent elements from having certain children? (or even another php solution would work) For example I would like to prevent things like the following: <p><p>text</p></p> <ul><li><ul><li>text</li></ul></li></ul> and would like them to convert to <p>text</p> <ul><li>text<li></ul> I have looked up the documentation and found that...

HTMLPurifier without XML declaration

php,xml,htmlpurifier
I am using HTMLPurifier on PHP to clean some dirty HTML, as follows: $H=new HTMLPurifier() $content_text_fixHTML = $H->purify($content_text); Note: Omited encoding set up, because it is UTF-8 But, it will output the XML encoding declaration at the top. <?xml encoding="utf-8" ?> I do not want it. How do I prevent...