Use htmlentities with editor

Use htmlentities with editor

srushasrusha Posts: 5Questions: 2Answers: 0

For reasons, I need all editor input to go through htmlentities($string,ENT_QUOTES,'UTF-8');
I know I can do it manually and edit each and every one of my fields set function callbacks but this means 100+ fields to go through. is there a way to automatically convert ALL data that is going to the SQL using htmlentities? so that instead of " in the database I will have &qoute;?


  • srushasrusha Posts: 5Questions: 2Answers: 0


  • allanallan Posts: 51,954Questions: 1Answers: 7,882 Site admin

    Two options:

    1. You could add a set formatter to each field (that could be done programmatically if you didn't want to add that line for each field's definition.
    2. Loop over the input POST data and encode each value there before passing it on to Editor.

    Remember to be careful of double encoding when submitting the encoded data again :).


This discussion has been closed.