PHP clean or normalize html text -
it seems question not asked, that's why asking me.
i have chunk of html code when in <textarea>
tag created wysiwyg editor.
now before saving, on form submit, normalize text inside removing unneccessary whitespaces/spaces, have code formated tabs, etc.
here code:
27 Июня 17:51:58 Познакомлюсь с девчонками из прибалтики Категория: Знакомства > Контакты по интересам Просмотров: 7
i wish text going in 1 row (single lined), correct use of spaces, dots etc. possible somehow php without need write function ?
sanitizing text never task composed of 1 line of text, i'm afraid. however, procedures common simple cleansing. example, $output = preg_replace("/\s+/", " ", $input);
rid of excess whitespaces worry lot more possible malicious code injections through <textarea>
element.
maybe should give htmlpurifier look, it's quite complete if it's still not html5 compliant. sort out majority of concerns filtered content.
hope helps :)
Comments
Post a Comment