From c4ff8035b049557305f121867f552794eb633698 Mon Sep 17 00:00:00 2001 From: Andreas Walter Date: Mon, 18 Dec 2023 12:14:36 +0100 Subject: [PATCH] improve code styling --- .github/workflows/moodle-ci.yml | 6 +++--- RELEASE.md | 2 -- filter.php | 30 +++++++++++++++--------------- 3 files changed, 18 insertions(+), 20 deletions(-) diff --git a/.github/workflows/moodle-ci.yml b/.github/workflows/moodle-ci.yml index 8b0fa15..bb155b6 100644 --- a/.github/workflows/moodle-ci.yml +++ b/.github/workflows/moodle-ci.yml @@ -30,9 +30,9 @@ jobs: strategy: fail-fast: false matrix: - php: ['7.4', '8.0', '8.1'] - moodle-branch: ['MOODLE_402_STABLE', 'MOODLE_403_STABLE'] - database: [pgsql, mariadb] + php: ['8.1'] + moodle-branch: ['MOODLE_403_STABLE'] + database: [mariadb] steps: - name: Check out repository code diff --git a/RELEASE.md b/RELEASE.md index ed3dc80..cc2f787 100644 --- a/RELEASE.md +++ b/RELEASE.md @@ -21,6 +21,4 @@ To release a new version of JSXGraph into the filter follow the steps below: Use the release notes from GitHub. 10. Comment under the Google Groups post of JSXGraph release: https://groups.google.com/g/jsxgraph. -For seeing travis prechecks go here: https://travis-ci.org/github/jsxgraph/moodle-filter_jsxgraph - Moodle Plugin CI: https://moodlehq.github.io/moodle-plugin-ci/ \ No newline at end of file diff --git a/filter.php b/filter.php index f068caa..85ffe28 100644 --- a/filter.php +++ b/filter.php @@ -73,7 +73,7 @@ class filter_jsxgraph extends moodle_text_filter { * * @var String */ - private const BOARDID_CONST = "BOARDID"; + private const BOARDID_CONST = "BOARDID"; /** * Name for JavaScript constant array of board ids. @@ -160,14 +160,14 @@ class filter_jsxgraph extends moodle_text_filter { private $versionmoodle = null; /** - * Main filter function + * Main filter function. * - * @param String $text - * @param Array $options + * @param String $text Moodle standard. + * @param Array $options Moodle standard. * * @return String */ - public function filter($text, array $options = array()) { + public function filter($text, array $options = []) { // To optimize speed, search for a tag (avoiding to parse everything on every text). if (!is_int(strpos($text, '<' . static::TAG))) { return $text; @@ -311,7 +311,7 @@ private function get_replaced_node($node, $index) { /** * Combine global code and code contained in $node. Define some JavaScript constants. Apply this code to the dom. * - * @param $node domNode + * @param $node domNode JSXGraph node. * * @return void */ @@ -321,7 +321,7 @@ private function apply_js($node) { $code = ""; // Load global JavaScript code from administrator settings. - // -------------------------------------------------------- + // ........................................................ if ($this->settings['globalJS'] !== '' && $attributes['useGlobalJS'][0]) { $code .= @@ -332,7 +332,7 @@ private function apply_js($node) { } // Define BOARDID constants and some accessibility. - // ------------------------------------------------ + // ................................................ $code .= "// Define BOARDID constants.\n" . @@ -358,7 +358,7 @@ private function apply_js($node) { "}\n"; // Load code from -node. - // ------------------------------- + // ............................... $usercode = $this->document->saveHTML($node); // Remove tags. @@ -372,20 +372,20 @@ private function apply_js($node) { $code .= $usercode; // Surround the code with version-specific strings. - // ------------------------------------------------ + // ................................................ $surroundings = $this->get_code_surroundings(); $code = $surroundings["pre"] . "\n\n" . $code . $surroundings["post"]; // Convert HTML-entities in code. - // ------------------------------ + // .............................. if ($this->settings['HTMLentities'] && $attributes['entities']) { $code = html_entity_decode($code); } // Paste the code. - // --------------- + // ............... // POI: Version differences. if ($this->versionmoodle["is_newer_version"]) { @@ -423,7 +423,7 @@ private function apply_js($node) { private function get_code_surroundings() { $result = [ 'pre' => '', - 'post' => '' + 'post' => '', ]; $condition = ''; @@ -816,7 +816,7 @@ private function load_library($libname) { global $PAGE; $libs = [ - 'formulas' => 'formulas_extension/JSXQuestion.js' + 'formulas' => 'formulas_extension/JSXQuestion.js', ]; if (!array_key_exists($libname, $libs)) { @@ -951,7 +951,7 @@ private function get_adminsettings() { ]; $trims = [ - 'globalJS' + 'globalJS', ]; // Read and save settings.