Modified slighty the format_text() function!!

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!!
This commit is contained in:
stronk7 2004-05-11 23:17:25 +00:00
parent 3eb2f7ecf8
commit ab892a4fa2

View 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:
?>