From: relpats_eht <rel...@us...> - 2005-07-10 23:46:52
|
Update of /cvsroot/bboard/birdboard/engine In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv9762/engine Modified Files: functions.inc.php Log Message: fixed the slash replacement bug (added slash_replace function) Index: functions.inc.php =================================================================== RCS file: /cvsroot/bboard/birdboard/engine/functions.inc.php,v retrieving revision 1.22 retrieving revision 1.23 diff -C2 -d -r1.22 -r1.23 *** functions.inc.php 29 Jun 2005 18:51:47 -0000 1.22 --- functions.inc.php 10 Jul 2005 23:46:44 -0000 1.23 *************** *** 59,62 **** --- 59,77 ---- } + //# Slash Replacer + function slash_replace($value, $slashes, $replacements){ + foreach($slashes as $key => $slash){ + $slashes[$key] = "#(<br \/>|^| )".$slash."(<br \/>|$| )#i"; + } + + foreach($replacements as $key => $replacement){ + $replacements[$key] = "\\1".$replacement."\\2"; + } + + $result = preg_replace($slashes, $replacements, $value); + + return $result; + } + //# Remove Breaks function bb_fix($value, $type) { |