read prism plugins from config.php

This commit is contained in:
Marcus 2023-06-22 15:06:12 +02:00
parent 0a3f88ada4
commit b0afedf4f2
2 changed files with 9 additions and 2 deletions

View file

@ -68,6 +68,8 @@ function plugin_syntaxhighlighter_foot() {
// convert the returned array into a json one, to have an easier time // convert the returned array into a json one, to have an easier time
// giving it to the javascript below // giving it to the javascript below
$used_languages = json_encode(plugin_syntaxhighlighter_add()); $used_languages = json_encode(plugin_syntaxhighlighter_add());
// put configured plugins into an json array
$used_plugins = json_encode($config['plugins']);
$pdir=plugin_geturl('syntaxhighlighter'); $pdir=plugin_geturl('syntaxhighlighter');
// javascript part // javascript part
@ -82,7 +84,8 @@ echo <<<PRISMBOX
<!-- call wrap_pre_tags() from syntaxhighlighter-ng.js --> <!-- call wrap_pre_tags() from syntaxhighlighter-ng.js -->
<script type="text/javascript"> <script type="text/javascript">
var used_languages = {$used_languages}; var used_languages = {$used_languages};
wrap_pre_tags(used_languages); var used_languages = {$used_plugins};
wrap_pre_tags(used_languages, used_plugins);
</script> </script>
<!-- end of prism.js footer --> <!-- end of prism.js footer -->

View file

@ -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 // iterate through all used_languages
for (let iUl = 0;iUl < used_languages.length; iUl++) for (let iUl = 0;iUl < used_languages.length; iUl++)
{ {