Reputation:
I am running a blog which other visitors can post on. I want to allow certain HTML tags like headers, linebreaks or links. What is a good or best piece of plugin software I can use for this?
Additionally, is it best practise to save the raw data and then whitelist it when it is time for display in the blog. Or shall I whitelist the data before saving it to the database, so that it is saved clean?
Upvotes: 0
Views: 65
Reputation: 191789
The built in function strip_tags
already has whitelist functionality that works quite nicely.
As for storage, it's a judgment call, but I recommend storing everything in its raw state and encoding for display only. It's only a concern if you think you may accidentally forget to strip/encode on display.
Upvotes: 1