From: moodler Date: Wed, 2 Jul 2003 11:59:20 +0000 (+0000) Subject: For plain format, retain multiple spaces X-Git-Url: http://git.mjollnir.org/gw?a=commitdiff_plain;h=3405b2123f073af8e81862f5b0919042870e5049;p=moodle.git For plain format, retain multiple spaces --- 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); }