Removed a small bit of debugging code

This commit is contained in:
moodler 2004-02-09 12:33:44 +00:00
parent cb3a448415
commit f0aa2fed24

View file

@ -491,6 +491,14 @@ function format_text($text, $format=FORMAT_MOODLE, $options=NULL, $courseid=NULL
global $CFG, $course; global $CFG, $course;
if (!empty($CFG->cachetext)) {
$time = time() - $CFG->cachetext;
$md5key = md5($text);
if ($cacheitem = get_record_select('text_cache', "md5key = '$md5key' AND timemodified > '$time'")) {
return $cacheitem->formattedtext;
}
}
if (empty($courseid)) { if (empty($courseid)) {
if (!empty($course->id)) { // An ugly hack for better compatibility if (!empty($course->id)) { // An ugly hack for better compatibility
$courseid = $course->id; $courseid = $course->id;
@ -500,7 +508,7 @@ function format_text($text, $format=FORMAT_MOODLE, $options=NULL, $courseid=NULL
switch ($format) { switch ($format) {
case FORMAT_HTML: case FORMAT_HTML:
replace_smilies($text); replace_smilies($text);
return filter_text($text, $courseid); $text = filter_text($text, $courseid);
break; break;
case FORMAT_PLAIN: case FORMAT_PLAIN:
@ -508,12 +516,11 @@ function format_text($text, $format=FORMAT_MOODLE, $options=NULL, $courseid=NULL
$text = str_replace(" ", "  ", $text); $text = str_replace(" ", "  ", $text);
replace_smilies($text); replace_smilies($text);
$text = nl2br($text); $text = nl2br($text);
return $text;
break; break;
case FORMAT_WIKI: case FORMAT_WIKI:
$text = wiki_to_html($text); $text = wiki_to_html($text);
return filter_text($text, $courseid); $text = filter_text($text, $courseid);
break; break;
default: // FORMAT_MOODLE or anything else default: // FORMAT_MOODLE or anything else
@ -524,10 +531,18 @@ function format_text($text, $format=FORMAT_MOODLE, $options=NULL, $courseid=NULL
$options->para=true; $options->para=true;
} }
$text = text_to_html($text, $options->smiley, $options->para); $text = text_to_html($text, $options->smiley, $options->para);
return filter_text($text, $courseid); $text = filter_text($text, $courseid);
break; break;
} }
if (!empty($CFG->cachetext)) {
$newrecord->md5key = $md5key;
$newrecord->formattedtext = addslashes($text);
$newrecord->timemodified = time();
insert_record('text_cache', $newrecord);
}
return $text;
} }
function format_text_email($text, $format) { function format_text_email($text, $format) {