From 28023f5a4337ef3b2945a09bd1e81145c3074504 Mon Sep 17 00:00:00 2001
From: Andreas Walter <andreas.walter@uni-bayreuth.de>
Date: Mon, 18 Dec 2023 12:38:09 +0100
Subject: [PATCH] test 3

---
 filter.php         | 17 +++--------------
 thirdpartylibs.xml | 15 +++++++++++++++
 2 files changed, 18 insertions(+), 14 deletions(-)

diff --git a/filter.php b/filter.php
index 896b2b6..bcb0388 100644
--- a/filter.php
+++ b/filter.php
@@ -167,14 +167,13 @@ class filter_jsxgraph extends moodle_text_filter {
      *
      * @return String
      */
-    public function filter($text, array $options = []) {
+    public function filter($text, $options = []) {
         // To optimize speed, search for a <jsxgraph> tag (avoiding to parse everything on every text).
         if (!is_int(strpos($text, '<' . static::TAG))) {
             return $text;
         }
 
         // 0. STEP: Do some initial stuff.
-        //////////////////////////////////
 
         $this->settings = $this->get_adminsettings();
         $this->set_versions();
@@ -183,7 +182,6 @@ public function filter($text, array $options = []) {
         }
 
         // 1. STEP: Convert HTML string to a dom object.
-        ////////////////////////////////////////////////
 
         // Create a new dom object.
         $this->document = new domDocument('1.0', static::ENCODING);
@@ -204,12 +202,10 @@ public function filter($text, array $options = []) {
         $this->document->recover = true;
 
         // 2. STEP: Get tag elements.
-        /////////////////////////////
 
         $this->taglist = $this->document->getElementsByTagname(static::TAG);
 
         // 3.+4. STEP: Load library (if needed) and iterate backwards through the <jsxgraph> tags.
-        //////////////////////////////////////////////////////////////////////////////////////////
 
         if (!empty($this->taglist)) {
             $this->load_jsxgraph();
@@ -227,7 +223,6 @@ public function filter($text, array $options = []) {
         }
 
         // 5. STEP: Paste new div node in web page.
-        ///////////////////////////////////////////
 
         // Remove DOCTYPE.
         $this->document->removeChild($this->document->firstChild);
@@ -320,8 +315,7 @@ private function apply_js($node) {
         $attributes = $this->get_tagattributes($node);
         $code = "";
 
-        // Let's load global JavaScript code from administrator settings.
-        /////////////////////////////////////////////////////////////////
+        // Load global JavaScript code from administrator settings.
 
         if ($this->settings['globalJS'] !== '' && $attributes['useGlobalJS'][0]) {
             $code .=
@@ -331,8 +325,7 @@ private function apply_js($node) {
                 "\n\n";
         }
 
-        // Define the BOARDID constants and some attributes for accessibility.
-        //////////////////////////////////////////////////////////////////////
+        // Define BOARDID constants and some attributes for accessibility.
 
         $code .=
             "// Define BOARDID constants.\n" .
@@ -358,7 +351,6 @@ private function apply_js($node) {
             "}\n";
 
         // Load the code from <jsxgraph>-node.
-        //////////////////////////////////////
 
         $usercode = $this->document->saveHTML($node);
         // Remove <jsxgraph> tags.
@@ -372,20 +364,17 @@ private function apply_js($node) {
         $code .= $usercode;
 
         // Surround the code with version-specific strings, e.g. "require".
-        ///////////////////////////////////////////////////////////////////
 
         $surroundings = $this->get_code_surroundings();
         $code = $surroundings["pre"] . "\n\n" . $code . $surroundings["post"];
 
         // Convert the HTML-entities in the variable $code.
-        ///////////////////////////////////////////////////
 
         if ($this->settings['HTMLentities'] && $attributes['entities']) {
             $code = html_entity_decode($code);
         }
 
         // Paste the code.
-        //////////////////
 
         // POI: Version differences.
         if ($this->versionmoodle["is_newer_version"]) {
diff --git a/thirdpartylibs.xml b/thirdpartylibs.xml
index 073692d..c821d6c 100644
--- a/thirdpartylibs.xml
+++ b/thirdpartylibs.xml
@@ -1,5 +1,20 @@
 <?xml version="1.0"?>
 <libraries>
+    <library>
+        <location>/amd/build/jsxgraphcore-v1.6.2-lazy.js</location>
+        <name>JSXGraph 1.6.2</name>
+        <version>1.6.2</version>
+        <license>LGPL</license>
+        <licenseversion>3.0+</licenseversion>
+    </library>
+
+    <library>
+        <location>amd/build/jsxgraphcore-v1.6.1-lazy.js</location>
+        <name>JSXGraph 1.6.1</name>
+        <version>1.6.1</version>
+        <license>LGPL</license>
+        <licenseversion>3.0+</licenseversion>
+    </library>
 
     <library>
         <location>amd/build/jsxgraphcore-v1.6.0-lazy.js</location>