corretta gestione stringhe
[brisk.git] / web / brisk.phh
index 03ec212..df4c3f1 100644 (file)
@@ -36,7 +36,10 @@ define(BRISK_DEBUG, FALSE);
 
 function xcape($s)
 {
-  return (str_replace('\\', '\\\\', str_replace('@', '@', str_replace('|', '¦', htmlentities($s,ENT_COMPAT,"UTF-8")))));
+  $from = array (   '\\',     '@',        '|' );
+  $to   = array ( '\\\\', '@', '¦' );
+
+  return (str_replace($from, $to, htmlentities($s,ENT_COMPAT,"UTF-8")));
 }