SyntaxHighlighter-NG (forked from Arvid's forum post, using now prism.js)
Author: 2005 NoWhereMan, 2023 DeltaLima
Author URI: https://deltalima.org
*/
function plugin_syntaxhighlighter_add($lang=null) {
static $languages = array();
$pdir=plugin_geturl('syntaxhighlighter');
// create array containing the used languages
$languages[] = "{$lang}";
// remove unique
$languages = array_unique($languages);
return $languages;
}
function plugin_syntaxhighlighter_head() {
$pdir=plugin_geturl('syntaxhighlighter');
echo <<
PRISMJS;
}
add_action('wp_head', 'plugin_syntaxhighlighter_head');
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());
$pdir=plugin_geturl('syntaxhighlighter');
// javascript part
echo <<
PRISMBOX;
}
add_action('wp_footer', 'plugin_syntaxhighlighter_foot');
?>