2018-09-19 22:03:15 -04:00
|
|
|
<?php
|
|
|
|
/**
|
|
|
|
* Name: Syntax Highlighting
|
|
|
|
* Description: Highlights syntax of code blocks with highlight.js
|
|
|
|
* Version: 1.0
|
|
|
|
* Author: Hypolite Petovan <hypolite@mrpetovan.com>
|
|
|
|
*/
|
|
|
|
|
|
|
|
use Friendica\App;
|
|
|
|
use Friendica\Core\Addon;
|
|
|
|
|
|
|
|
function highlightjs_install()
|
|
|
|
{
|
2018-09-20 21:32:47 -04:00
|
|
|
Addon::registerHook('head' , __FILE__, 'highlightjs_head');
|
|
|
|
Addon::registerHook('footer', __FILE__, 'highlightjs_footer');
|
2018-09-19 22:03:15 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
function highlightjs_uninstall()
|
|
|
|
{
|
2018-09-20 21:32:47 -04:00
|
|
|
Addon::unregisterHook('head' , __FILE__, 'highlightjs_head');
|
|
|
|
Addon::unregisterHook('footer', __FILE__, 'highlightjs_footer');
|
2018-09-19 22:03:15 -04:00
|
|
|
}
|
|
|
|
|
2018-09-20 21:32:47 -04:00
|
|
|
function highlightjs_head(App $a, &$b)
|
2018-09-19 22:03:15 -04:00
|
|
|
{
|
|
|
|
if ($a->getCurrentTheme() == 'frio') {
|
|
|
|
$style = 'bootstrap';
|
|
|
|
} else {
|
|
|
|
$style = 'default';
|
|
|
|
}
|
|
|
|
|
2018-09-20 21:32:47 -04:00
|
|
|
$a->registerStylesheet(__DIR__ . '/asset/styles/' . $style . '.css');
|
|
|
|
}
|
2018-09-19 22:03:15 -04:00
|
|
|
|
2018-09-20 21:32:47 -04:00
|
|
|
function highlightjs_footer(App $a, &$b)
|
|
|
|
{
|
|
|
|
$a->registerFooterScript(__DIR__ . '/asset/highlight.pack.js');
|
|
|
|
$a->registerFooterScript(__DIR__ . '/highlightjs.js');
|
2018-09-19 22:03:15 -04:00
|
|
|
}
|