Removed the count_chars funtion (not in use, and exists in PHP4.0b4)
[squirrelmail.git] / functions / strings.php
index 8d5385b903b130832c5c43ada9f5264c8f88eef7..44f1d12265a22808a31384c9bc5d3c844a2eabd4 100644 (file)
@@ -91,7 +91,7 @@
       return $to_line;
    }
 
-   function translateText($body, $wrap_at) {
+   function translateText($body, $wrap_at, $charset) {
       /** Add any parsing you want to in here */
       $body = trim($body);
       $body_ary = explode("\n", $body);
          $line = $body_ary[$i];
          $line = "^^$line";
 
-         $line = str_replace(">", ">", $line);
-         $line = str_replace("<", "&lt;", $line);
+         //$line = str_replace(">", "&gt;", $line);
+         //$line = str_replace("<", "&lt;", $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(" ", "&nbsp;", $line);
          $line = str_replace("\t", "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;", $line);
          $line = nl2br($line);
    function replace_escaped_spaces ($string) {
       return str_replace("&nbsp;", " ", $string);
    }
-
-   function count_chars($string) {
-      for ($i = 0; $i < strlen($string); $i++) {
-         $ch = substr($string, $i, 1);
-         $size++;
-         if ($ch == "\\") {
-            $i++;   
-            $ch = substr($string, $i, 1);
-            if ($ch == "n")
-               $i--;
-            if ($ch == "r")
-               $i--;
-         }   
-      }   
-      return $size;
-   }
 ?>