From 84c948d31644fef20e26fde5fb130a1f307c2b64 Mon Sep 17 00:00:00 2001
From: TamaraGunkel <tamara.nrw@web.de>
Date: Wed, 6 Dec 2017 12:27:39 +0100
Subject: [PATCH] [WIP] filter implementatino

---
 filter.php | 26 ++++++++++++++++++++++++++
 1 file changed, 26 insertions(+)

diff --git a/filter.php b/filter.php
index ba0fd0e..6aa47e2 100644
--- a/filter.php
+++ b/filter.php
@@ -39,6 +39,32 @@ class filter_opencastfilter extends moodle_text_filter {
 
 
     public function filter($text, array $options = array()) {
+    	//Checks momentarily only for videos embedded in <video> tag
+
+	    if (stripos($text, '</video>') === false) {
+		    // Performance shortcut - if there are no </video> tags, nothing can match.
+		    return $text;
+	    }
+
+	    // Looking for tags.
+	    $matches = preg_split('/(<[^>]*>)/i', $text, -1, PREG_SPLIT_NO_EMPTY | PREG_SPLIT_DELIM_CAPTURE);
+
+	    if (!$matches) {
+		   foreach($matches as $match) {
+		   	    if(substr($match, 0, 6) === "<video") {
+		   	    	// Replace it
+		        }
+		   }
+
+		      return $text;
+	    }
+
+	    $newtext = $text;
+
+
+
+	    // Return the same string except processed by the above.
+	    return $newtext;
     }
 
 
-- 
GitLab