]> git.mjollnir.org Git - moodle.git/commitdiff
Modified slighty the format_text() function!!
authorstronk7 <stronk7>
Tue, 11 May 2004 23:17:25 +0000 (23:17 +0000)
committerstronk7 <stronk7>
Tue, 11 May 2004 23:17:25 +0000 (23:17 +0000)
Now, in PLAIN AND WIKI formats, the rebuildnolinktag() function
is called to rebuild:

    &lt;nolink&gt;  to <nolink> again (open and close tags)

This should avoid showing the "<nolink>" word always in this formats!!

Used to solve Bug 1232 and potentially, others...
(http://moodle.org/bugs/bug.php?op=show&bugid=1232)

Please check it because it's really a CORE change!!

lib/weblib.php

index 6d98074d5565728e990792c919d0f5f87b5817f8..a58b7a5720950f7312ad3199e08b6f27aa559f8d 100644 (file)
@@ -564,6 +564,7 @@ function format_text($text, $format=FORMAT_MOODLE, $options=NULL, $courseid=NULL
 
         case FORMAT_PLAIN:
             $text = htmlentities($text);
+            $text = rebuildnolinktag($text);
             $text = str_replace("  ", "&nbsp; ", $text);
             replace_smilies($text);
             $text = nl2br($text);
@@ -571,6 +572,7 @@ function format_text($text, $format=FORMAT_MOODLE, $options=NULL, $courseid=NULL
 
         case FORMAT_WIKI:
             $text = wiki_to_html($text);
+            $text = rebuildnolinktag($text);
             $text = filter_text($text, $courseid);
             break;
 
@@ -2179,5 +2181,14 @@ function print_paging_bar($totalcount, $page, $perpage, $baseurl) {
     }
 }
 
+//This function is used to rebuild the <nolink> tag because some formats (PLAIN and WIKI)
+//will transform it to html entities
+function rebuildnolinktag($text) {
+    
+    $text = preg_replace('/&lt;(\/*nolink)&gt;/i','<$1>',$text);
+
+    return $text;
+}
+
 // vim:autoindent:expandtab:shiftwidth=4:tabstop=4:tw=140:
 ?>