]> git.p6c8.net - selfforum.git/blobdiff - selfforum-cgi/shared/Encode/Plain.pm
improved the behavior of get_all_threads and create_forum_xml_string
[selfforum.git] / selfforum-cgi / shared / Encode / Plain.pm
index 17c749c1e6b6f1419ed1836b69669b5a43a1e0ce..2379e3862003cdde559134d89c0fc44590c1817e 100644 (file)
@@ -4,7 +4,7 @@ package Encode::Plain;
 #                                                                              #
 # File:        shared/Encode/Plain.pm                                          #
 #                                                                              #
 #                                                                              #
 # File:        shared/Encode/Plain.pm                                          #
 #                                                                              #
-# Authors:     AndrĂ© Malo <nd@o3media.de>, 2001-04-12                          #
+# Authors:     AndrĂ© Malo <nd@o3media.de>                                      #
 #                                                                              #
 # Description: Encode text for HTML Output (entities, spaces)                  #
 #                                                                              #
 #                                                                              #
 # Description: Encode text for HTML Output (entities, spaces)                  #
 #                                                                              #
@@ -19,6 +19,16 @@ use vars qw(
   $v56
 );
 
   $v56
 );
 
+################################################################################
+#
+# Version check
+#
+# last modified:
+#    $Date$ (GMT)
+# by $Author$
+#
+sub VERSION {(q$Revision$ =~ /([\d.]+)\s*$/)[0] or '0.0'}
+
 $v56 = eval {local $SIG{__DIE__}; require 5.6.0;};
 
 ################################################################################
 $v56 = eval {local $SIG{__DIE__}; require 5.6.0;};
 
 ################################################################################
@@ -129,7 +139,6 @@ sub plain ($;$) {
   if ($except) {
     $new =~ s/($exreg)|</defined($1)?$1:'&lt;'/eg;
     $new =~ s/($exreg)|>/defined($1)?$1:'&gt;'/eg;
   if ($except) {
     $new =~ s/($exreg)|</defined($1)?$1:'&lt;'/eg;
     $new =~ s/($exreg)|>/defined($1)?$1:'&gt;'/eg;
-    $new =~ s/($exreg)|\|/defined($1)?$1:'&#124;'/eg;
     $new =~ s/($exreg)|"/defined($1)?$1:'&quot;'/eg;
 
     # the big hash
     $new =~ s/($exreg)|"/defined($1)?$1:'&quot;'/eg;
 
     # the big hash
@@ -164,7 +173,6 @@ sub plain ($;$) {
     #
     $new =~ s/</&lt;/g;
     $new =~ s/>/&gt;/g;
     #
     $new =~ s/</&lt;/g;
     $new =~ s/>/&gt;/g;
-    $new =~ s/\|/&#124;/g;
     $new =~ s/"/&quot;/g;
 
     # the big hash
     $new =~ s/"/&quot;/g;
 
     # the big hash
@@ -225,7 +233,7 @@ sub multiline ($) {
 
   # turn \n into <br>
   #
 
   # turn \n into <br>
   #
-  $string=~s/\n/<br>/g;
+  $string=~s!\n!<br />!g;
 
   # more than 1 space => &nbsp;
   #
 
   # more than 1 space => &nbsp;
   #
@@ -234,7 +242,7 @@ sub multiline ($) {
   # Single Spaces after <br> => &nbsp;
   # (save ascii arts ;)
   #
   # Single Spaces after <br> => &nbsp;
   # (save ascii arts ;)
   #
-  $string=~s/(?:^|(<br>))\s/($1?$1:'').'&nbsp;'/eg;
+  $string=~s!(?:^|(<br(?:\s*/)?>))\s!($1?$1:'').'&nbsp;'!eg;
 
   # return
   #
 
   # return
   #
@@ -255,17 +263,11 @@ sub toUTF8 ($) {
     ? $$ref
     : $ref;
 
     ? $$ref
     : $ref;
 
-# if ($v56) {
-#   no warnings 'utf8';
-#   $string =~ tr/\x80-\xff//CU;
-# }
-# else {
-    $string =~ s
-      {([\x80-\xff])}
-      { chr((ord ($1) >> 6) | 192)
-       .chr((ord ($1) & 191))
-      }eg;
-# }
+  $string =~ s
+    {([\x80-\xff])}
+    { chr((ord ($1) >> 6) | 192)
+     .chr((ord ($1) & 191))
+    }eg;
 
   ref($ref)
     ? \$string
 
   ref($ref)
     ? \$string
@@ -526,9 +528,9 @@ BEGIN {
   );
 }
 
   );
 }
 
-# keeping require happy
+# keep 'require' happy
 1;
 
 #
 #
 1;
 
 #
 #
-### end of Encode::Plain #######################################################
+### end of Encode::Plain #######################################################
\ No newline at end of file

patrick-canterino.de