View Full Version : CKeditor - Removing \r before submit to mySQL

12-23-2010, 08:03 AM
Hi all,
Thanks for taking the time to read my post.

I'm 99% done on a CMS using PHP with AJAX & mySQL that powers a flash file using XML generated from the database.

I'm having an issue with str_replace on the text editor content, as i have to convert / strip out some characters that would break the XML.

When using ckeditor, the str_replace works fine if enter is pressed once, but when i double return to generate \r carriage return, the str_replace isn't stripping it out, it just generates " ", even though i specify "". This whitespace is causing an issue when the page is refreshed and ckeditor tries to load the whitespace, it just appears blank.

function convertMiscTags($string) {
$find = array("’","…","–","<p>","</p>","","‘"," ","‘","&nbsp;"," <br />","<br /> "," </li>","</li> ","","","<br /> <br />","<br /> </li>","”","“","\r"," <br />");
$replace = array("'","...","-","","","","'","","'","","<br />","<br />","</li>","</li>","e","c","<br />","<br /></li>","'","'","","<br />");
$replacedstring = str_replace($find, $replace, $string);
$nl2pagebreakstring = nl2br($replacedstring);
$cleansedstring = trim($nl2pagebreakstring);
return $cleansedstring;

Does anyone know what i'm doing wrong, or have any ideas from their own experiences, as to what can be done to strip this out please?

Thank you.


EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum