Does a validator exist for validating a subset of HTML tags from text field

I’m using TinyMCE to provide a WYSIWYG editor, I’ve restricted the UI to only showing a few tags.

Are there any existing validators or extensions that allow me to specify a range of HTML tags that are allowed in the content (with any other HTML removed or replaced with (e.g.) <script…>) ?

Unfortunately searching for ‘validate HTML tags yii’ brings up a lot of irrelevant pages for this problem!


use strip_tags.

Yes, CHtmlPurifier.

For configuration options see Html Purifier configuration documentation.

Thanks both, I’ll look into these!