From 7b3be1b12d35e8dceea8db1015c515e72a2e7783 Mon Sep 17 00:00:00 2001 From: martin Date: Thu, 22 Aug 2002 08:31:29 +0000 Subject: [PATCH] New space-removal works better if done before adding link tags :-) --- lib/weblib.php | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/lib/weblib.php b/lib/weblib.php index 80c19443886..4f528c7eb50 100644 --- a/lib/weblib.php +++ b/lib/weblib.php @@ -265,6 +265,13 @@ function text_to_html($text, $smiley=true, $para=true) { global $CFG; + // Remove any whitespace that may be between HTML tags + $text = eregi_replace(">([[:space:]]+)<", "><", $text); + + // Remove any returns that precede or follow HTML tags + $text = eregi_replace("([\n\r])+<", " <", $text); + $text = eregi_replace(">([\n\r])+", "> ", $text); + // Make URLs into links. eg http://moodle.com/ $text = eregi_replace("([[:alnum:]]+)://([^[:space:]]*)([[:alnum:]#?/&=])", "\\1://\\2\\3", $text); @@ -273,13 +280,6 @@ function text_to_html($text, $smiley=true, $para=true) { $text = eregi_replace("([[:space:]])www.([^[:space:]]*)([[:alnum:]#?/&=])", "\\1www.\\2\\3", $text); - // Remove any whitespace that may be between HTML tags - $text = eregi_replace(">([[:space:]]+)<", "><", $text); - - // Remove any returns that precede or follow HTML tags - $text = eregi_replace("([\n\r])+<", " <", $text); - $text = eregi_replace(">([\n\r])+", "> ", $text); - // Make returns into HTML newlines. $text = nl2br($text);