Sanitize XML Importer PHP function
This is an open discussion with 1 reply, filed under General.
Search
I solved the problem by placing the function inside the XML Importer Helpers class. The same code works there without a issues.
str_replace( ' string to remove' , '', htmlspecialchars($string, ENT_NOQUOTES, 'UTF-8'));
Does anyone can explain me why?
Create an account or sign in to comment.
What I’m trying to do is to remove a certain string from the value of a field that is imported from an XML with the XML Importer plugin.
To do so in the “PHP function” field I've set:
it works flawlessly… except when there is an apostrophe ( ' ) in the value. In that case the resulting field is empty.
I’ve tried with the htmlspecialchars() function but it didn’t work (or I couldn’t make it work).
Does anyone knows how I could fix this?
Thank you