What is or might be the best practice to integrate the HTMLPurifier in Zend Framework 2?
The goal is to filter Zend Form Elements and input fields, which where not generated with Zend Form.
How would you do this?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
From my point of view I would say you can create a new filter. If Purifier were already a ‘part’ of Zend then it might be name Zend\Filter\HtmlPurifier. That’s where I see it fitting the most.
You could also make it a Validator (Zend\Validator\HtmlPurifier) so you can tell if a piece of text ‘passes’ or not. Depends on what you want to do.
If you want to reject bad input, use the validator path. If you want to filter out bad input use the filter path.
After you’ve made your Zend filter/validator, use it like you would any other filter/validator.