Which is the best way to "sanitize" content? An example...
Example - Before sanitize:
Morbi mollis ante vitae massa suscipit a tempus est pellentesque. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Nulla mattis iaculis consectetur.
Morbi mollis ante vitae est pellentesque. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Nulla mattis iaculis consectetur.
Example - After sanitize:
<p>Morbi mollis ante vitae massa suscipit a tempus est pellentesque. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Nulla mattis iaculis consectetur.</p>
<p>Morbi mollis ante vitae est pellentesque. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Nulla mattis iaculis consectetur.</p>
What it should do
Right know I use the str_replace
function and it should be a better solution for this?
I want the function to look like this:
function sanitize($content)
{
// Do the magic!
return $content;
}
Run it through something like the Textile interpreter, or Markdown, or any another humane markup language which suits your needs.
Why bother? When HTML is rendered as a document, multiple white space characters are reduced to a single space, no? Most of your problems solve themselves.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With