]> git.mjollnir.org Git - moodle.git/commitdiff
For plain format, retain multiple spaces
authormoodler <moodler>
Wed, 2 Jul 2003 11:59:20 +0000 (11:59 +0000)
committermoodler <moodler>
Wed, 2 Jul 2003 11:59:20 +0000 (11:59 +0000)
lib/weblib.php

index 868b8d97b4fd1750eae733c5590c4450ad04fed4..f4ce8adbcebf6e187310b6104f6cca8ef12527e0 100644 (file)
@@ -455,6 +455,7 @@ function format_text($text, $format=FORMAT_MOODLE, $options=NULL) {
 
         case FORMAT_PLAIN:
             $text = htmlentities($text);
+            $text = str_replace("  ", "&nbsp; ", $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<a href=\"\\2://\\3\\4\" TARGET=\"newpage\">\\2://\\3\\4</a>", $text);
 
 /// eg www.moodle.com
-    $text = eregi_replace("([[:space:]]|^|\(|\[|\<)www\.([^[:space:]]*)([[:alnum:]#?/&=])", 
+    $text = eregi_replace("([[:space:]]|^|\(|\[)www\.([^[:space:]]*)([[:alnum:]#?/&=])", 
                           "\\1<a href=\"http://www.\\2\\3\" TARGET=\"newpage\">www.\\2\\3</a>", $text);
 }