Welcome! » Log In » Create A New Profile

HtmlPurifier as ZendFramework 2 filter

Posted by Jaimie 
Jaimie
HtmlPurifier as ZendFramework 2 filter
November 21, 2015 01:44AM

Im using HtmlPurifier as a ZendFramework 2 Filter. Works rather nice I know there is a better way to autoload the HtmlPurifier class but not sure, maybe some one chime in??

http://pastebin.com/ZK12ve4c

Jaimie
Another Issue
November 21, 2015 01:45AM

Another issue is if the filter only has say script to strip out it returns an empty value and causes the form to have Validation error if you set field to required and use NotEmpty validator. This also places the script tag back in the Textarea and the JavaScript can be executed. Not exactly the behavior I want.

I set up the filter and validation this way: http://pastebin.com/LkjwT3Wp

Re: Another Issue
November 21, 2015 06:24PM

Sorry, I don't know anything about ZendFramework 2 and can't really help you here. Perhaps the ZF people would know more about how to setup filters.

Author:
Your Email:

Subject:

HTML input is enabled. Make sure you escape all HTML and angled brackets with < and >.

Auto-paragraphing is enabled. Double newlines will be converted to paragraphs; for single newlines, use the pre tag.

Allowed tags: a, abbr, acronym, b, blockquote, caption, cite, code, dd, del, dfn, div, dl, dt, em, i, ins, kbd, li, ol, p, pre, s, strike, strong, sub, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, var.

For inputting literal code such as HTML and PHP for display, use CDATA tags to auto-escape your angled brackets, and pre to preserve newlines:

<pre><![CDATA[
Place code here
]]></pre>

Power users, you can hide this notice with:

.htmlpurifier-help {display:none;}

Message: