From 3405b2123f073af8e81862f5b0919042870e5049 Mon Sep 17 00:00:00 2001 From: moodler Date: Wed, 2 Jul 2003 11:59:20 +0000 Subject: [PATCH] For plain format, retain multiple spaces --- lib/weblib.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/weblib.php b/lib/weblib.php index 868b8d97b4..f4ce8adbce 100644 --- a/lib/weblib.php +++ b/lib/weblib.php @@ -455,6 +455,7 @@ function format_text($text, $format=FORMAT_MOODLE, $options=NULL) { case FORMAT_PLAIN: $text = htmlentities($text); + $text = str_replace(" ", "  ", $text); replace_smilies($text); convert_urls_into_links($text); $text = nl2br($text); @@ -608,11 +609,11 @@ function convert_urls_into_links(&$text) { /// Given some text, it converts any URLs it finds into HTML links. /// Make lone URLs into links. eg http://moodle.com/ - $text = eregi_replace("([[:space:]]|^|\(|\[|\<)([[:alnum:]]+)://([^[:space:]]*)([[:alnum:]#?/&=])", + $text = eregi_replace("([[:space:]]|^|\(|\[)([[:alnum:]]+)://([^[:space:]]*)([[:alnum:]#?/&=])", "\\1\\2://\\3\\4", $text); /// eg www.moodle.com - $text = eregi_replace("([[:space:]]|^|\(|\[|\<)www\.([^[:space:]]*)([[:alnum:]#?/&=])", + $text = eregi_replace("([[:space:]]|^|\(|\[)www\.([^[:space:]]*)([[:alnum:]#?/&=])", "\\1www.\\2\\3", $text); } -- 2.39.5