private function sanitizeCDATA($text) { $text = str_replace("]]>", "]]>", $text); $text = str_replace("<![CDATA[", "<![CDATA[", $text); return $text; }