well after I wrote that note I realized that I was maybe going about the whole problem wrong. I actually went ahead and changed that function back to its original state. And instead I put this in the php file that writes the text to the external file:
$receivedFromFlashData = str_replace(" ", "", $receivedFromFlashData);
$receivedFromFlashData = str_replace(""", "\"", $receivedFromFlashData);
$receivedFromFlashData = str_replace("'", "'", $receivedFromFlashData);
$receivedFromFlashData = str_replace("&", "*", $receivedFromFlashData);
$receivedFromFlashData = str_replace("<", "*", $receivedFromFlashData);
$receivedFromFlashData = str_replace(">", "*", $receivedFromFlashData);
$receivedFromFlashData = str_replace("+", "{plus}", $receivedFromFlashData);
(how do you mark something as code)
Again I am not sure that everything isn't going to blow up so I would still like to hear from someone who is more experienced than me.
And did I miss any dangerous characters?
Ive got: ', ", , &, <, >, +
I hope that wraps it up
