| xXziroXx |
09-16-2013 12:38 AM |
HTML Filter
I wrote a function that removes all HTML from a string.
PHP Code:
function onCreated() filterHTML("Hi my name is definitely not <b>dylan</b> and I <a href=http//google.com/>may or may</a> not be slightly insane.<br>");
function filterHTML(temp.text) { echo("Unfiltered:" SPC temp.text); do { temp.htmlStart = temp.text.pos("<"); temp.htmlEnd = temp.text.pos(">"); temp.text = temp.text.substring(0, temp.htmlStart) @ temp.text.substring(temp.htmlEnd + 1); } while (temp.text.pos("<") > -1); echo("Filtered:" SPC temp.text);
return temp.text; }
PHP Code:
Unfiltered: Hi my name is definitely not <b>dylan</b> and I <a href=http//google.com/>may or may</a> not be slightly insane.<br> Filtered: Hi my name is definitely not dylan and I may or may not be slightly insane.
Enjoy!
|