From b0afedf4f260e22fe146e33b32be8f0acc6b5f19 Mon Sep 17 00:00:00 2001 From: Marcus Date: Thu, 22 Jun 2023 15:06:12 +0200 Subject: [PATCH] read prism plugins from config.php --- plugin.syntaxhighlighter.php | 5 ++++- res/syntaxhighlighter-ng.js | 6 +++++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/plugin.syntaxhighlighter.php b/plugin.syntaxhighlighter.php index dbf7db6..aa788f7 100644 --- a/plugin.syntaxhighlighter.php +++ b/plugin.syntaxhighlighter.php @@ -68,6 +68,8 @@ function plugin_syntaxhighlighter_foot() { // convert the returned array into a json one, to have an easier time // giving it to the javascript below $used_languages = json_encode(plugin_syntaxhighlighter_add()); + // put configured plugins into an json array + $used_plugins = json_encode($config['plugins']); $pdir=plugin_geturl('syntaxhighlighter'); // javascript part @@ -82,7 +84,8 @@ echo << diff --git a/res/syntaxhighlighter-ng.js b/res/syntaxhighlighter-ng.js index 0e8b43a..0259a91 100644 --- a/res/syntaxhighlighter-ng.js +++ b/res/syntaxhighlighter-ng.js @@ -24,7 +24,11 @@ -function wrap_pre_tags(used_languages) { +function wrap_pre_tags(used_languages, used_plugins) { + + // convert used_plugins array to a space seperated string + var used_plugins = used_plugins.join(' '); + alert(used_plugins); // iterate through all used_languages for (let iUl = 0;iUl < used_languages.length; iUl++) {