global $THEME, $CFG;
+ static $formattedtext; // Cached version of formatted text for a post
+ static $formattedtextid; // The ID number of the post
+
+ if (empty($formattedtextid) or $formattedtextid != $post->id) { // Recalculate the formatting
+ $formattedtext = format_text($post->message, $post->format, NULL, $course->id);
+ $formattedtextid = $post->id;
+ }
+
$output = "";
$output .= "<style> <!--"; /// Styles for autolinks
$output .= "</div>";
}
- $output .= format_text($post->message, $post->format, NULL, $course->id);
+ $output .= $formattedtext;
$output .= "<p align=right><font size=-1>";