From 2a5794e0995f7daca0ec9639c1a2be124f0bbc99 Mon Sep 17 00:00:00 2001 From: Frederic Massart Date: Thu, 19 Dec 2013 10:20:32 +0100 Subject: [PATCH] MDL-42995 mod_assign: Use new global function to strip content --- mod/assign/feedback/comments/locallib.php | 19 +------------------ 1 file changed, 1 insertion(+), 18 deletions(-) diff --git a/mod/assign/feedback/comments/locallib.php b/mod/assign/feedback/comments/locallib.php index 1f043cb5a5a..96dde23d982 100644 --- a/mod/assign/feedback/comments/locallib.php +++ b/mod/assign/feedback/comments/locallib.php @@ -214,23 +214,6 @@ class assign_feedback_comments extends assign_feedback_plugin { $mform->disabledIf('assignfeedback_comments_commentinline', 'assignfeedback_comments_enabled', 'notchecked'); } - /** - * A student submission may contain image tags that refer to images stored - * in the file area for the submission. We cannot allow these links to be copied to - * the feedback text fields, so we must strip them from the content. - * - * @param string $source The submission text - * @return string The stripped text - */ - protected function strip_moodle_content($source) { - $baseurl = '@@PLUGINFILE@@'; - // Looking for something like < .* "@@pluginfile@@.*" .* > - $pattern = '$<[^<>]+["\']' . $baseurl . '[^"\']*["\'][^<>]*>$'; - $stripped = preg_replace($pattern, '', $source); - // Use purify html to rebalence potentially mismatched tags and generally cleanup. - return purify_html($stripped); - } - /** * Convert the text from any submission plugin that has an editor field to * a format suitable for inserting in the feedback text field. @@ -247,7 +230,7 @@ class assign_feedback_comments extends assign_feedback_plugin { $fields = $plugin->get_editor_fields(); if ($plugin->is_enabled() && $plugin->is_visible() && !empty($fields)) { foreach ($fields as $key => $description) { - $rawtext = $this->strip_moodle_content($plugin->get_editor_text($key, $submission->id)); + $rawtext = strip_pluginfile_content($plugin->get_editor_text($key, $submission->id)); $newformat = $plugin->get_editor_format($key, $submission->id);