+ function translateText($body, $wrap_at, $charset) {
+ include ("../functions/url_parser.php");
+ /** Add any parsing you want to in here */
+ $body_ary = explode("\n", $body);
+
+ for ($i = 0; $i < count($body_ary); $i++) {
+ $line = $body_ary[$i];
+ $line = "^^$line";
+
+ //$line = str_replace(">", ">", $line);
+ //$line = str_replace("<", "<", $line);
+ //$line = htmlspecialchars($line);
+
+ if (strlen($line) >= $wrap_at) // -2 because of the ^^ at the beginning
+ $line = wordWrap($line, $wrap_at);
+
+ $line = charset_decode($charset, $line);
+
+ $line = str_replace(" ", " ", $line);
+ $line = str_replace("\t", " ", $line);
+ $line = nl2br($line);
+
+ if (strpos(trim(str_replace(" ", "", $line)), ">>") == 2) {
+ $line = substr($line, 2, strlen($line));
+ $line = "<TT><FONT COLOR=FF0000>$line</FONT></TT><BR>\n";
+ } else if (strpos(trim(str_replace(" ", "", $line)), ">") == 2) {
+ $line = substr($line, 2, strlen($line));
+ $line = "<TT><FONT COLOR=800000>$line</FONT></TT><BR>\n";
+ } else {
+ $line = substr($line, 2, strlen($line));
+ $line = "<TT><FONT COLOR=000000>$line</FONT></TT><BR>\n";
+ }
+
+ $line = parseEmail ($line);
+ $line = parseUrl ($line);
+ $new_body[$i] = "$line";
+ }
+ $bdy = implode("\n", $new_body);
+ return $bdy;