From 3f093b3f99a50d4885547af4bd53a01fa957ace0 Mon Sep 17 00:00:00 2001 From: Justus Dieckmann <justusdieckmann@wwu.de> Date: Mon, 4 Mar 2024 21:16:14 +0100 Subject: [PATCH] Make filter work properly with linebreaks --- filter.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/filter.php b/filter.php index 62d28f4..e5c3c44 100644 --- a/filter.php +++ b/filter.php @@ -81,6 +81,9 @@ class filter_opencast extends moodle_text_filter { $height = false; foreach ($matches as $match) { + if (empty(trim($match))) { + continue; + } // Check if the match is a video tag. if (substr($match, 0, 6) === "<video") { $video = true; @@ -163,7 +166,7 @@ class filter_opencast extends moodle_text_filter { } // Replace video tag. - $text = preg_replace('/<video(?:(?!<\/video>).)*?' . preg_quote($match, '/') . '.*?<\/video>/', + $text = preg_replace('/<video(?:(?!<\/video>).)*?' . preg_quote($match, '/') . '.*?<\/video>/s', $newtext, $text, 1); } $width = $height = false; -- GitLab