In the last article I briefly described the possibilities of formal grammars. Now I want to introduce you to an interesting application of acquired skills - HTML Cleaner in PHP. In short, the task was to clean the text entered by the user in the MCE editor. Of course, a standard KSES solution was found right away , but somehow I didn’t make friends with it and, because of my unemployment, today I decided to write an analogue that would be quite reliable, flexible and simpler / clearer (in KSES over 1k lines of code). Actually , that's what happened . I suggest everyone to use it, to help test it (put the most inadequate HTML pieces into it and see how to eat it).
Benefits: 1. simple config syntax 2. the ability to generate from the class of his heir with the aim of fine validation of the entered data 3. built on the principle of formal grammars (although I do not build a tree or stack, I considered it unnecessary for the task)
UPD: tidy is consolidated - with all the advantages and disadvantages.