質問

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?

役に立ちましたか?

解決

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.

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top