Skip to content
Snippets Groups Projects
Unverified Commit 48c2bf80 authored by Nina Herrmann's avatar Nina Herrmann Committed by GitHub
Browse files

Merge pull request #43 from justusdieckmann/fix/linebreak-filtering

Make filter work properly with linebreaks
parents 5f6e9318 3f093b3f
No related branches found
No related tags found
No related merge requests found
...@@ -81,6 +81,9 @@ class filter_opencast extends moodle_text_filter { ...@@ -81,6 +81,9 @@ class filter_opencast extends moodle_text_filter {
$height = false; $height = false;
foreach ($matches as $match) { foreach ($matches as $match) {
if (empty(trim($match))) {
continue;
}
// Check if the match is a video tag. // Check if the match is a video tag.
if (substr($match, 0, 6) === "<video") { if (substr($match, 0, 6) === "<video") {
$video = true; $video = true;
...@@ -163,7 +166,7 @@ class filter_opencast extends moodle_text_filter { ...@@ -163,7 +166,7 @@ class filter_opencast extends moodle_text_filter {
} }
// Replace video tag. // 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); $newtext, $text, 1);
} }
$width = $height = false; $width = $height = false;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment