mirror of
https://git.friendi.ca/friendica/friendica-addons.git
synced 2024-11-16 15:53:58 +00:00
203672cf27
- All hooks (current and obsolete) are removed automatically during addon uninstall
34 lines
800 B
PHP
34 lines
800 B
PHP
<?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\Hook;
|
|
use Friendica\DI;
|
|
|
|
function highlightjs_install()
|
|
{
|
|
Hook::register('head' , __FILE__, 'highlightjs_head');
|
|
Hook::register('footer', __FILE__, 'highlightjs_footer');
|
|
}
|
|
|
|
function highlightjs_head(App $a, &$b)
|
|
{
|
|
if ($a->getCurrentTheme() == 'frio') {
|
|
$style = 'bootstrap';
|
|
} else {
|
|
$style = 'default';
|
|
}
|
|
|
|
DI::page()->registerStylesheet(__DIR__ . '/asset/styles/' . $style . '.css');
|
|
}
|
|
|
|
function highlightjs_footer(App $a, &$b)
|
|
{
|
|
DI::page()->registerFooterScript(__DIR__ . '/asset/highlight.pack.js');
|
|
DI::page()->registerFooterScript(__DIR__ . '/highlightjs.js');
|
|
}
|