There are in fact many false positives ...
[friendica-addons.git/.git] / highlightjs / highlightjs.php
1 <?php
2 /**
3  * Name: Syntax Highlighting
4  * Description: Highlights syntax of code blocks with highlight.js
5  * Version: 1.0
6  * Author: Hypolite Petovan <hypolite@mrpetovan.com>
7  */
8
9 use Friendica\App;
10 use Friendica\Core\Hook;
11
12 function highlightjs_install()
13 {
14         Hook::register('head'  , __FILE__, 'highlightjs_head');
15         Hook::register('footer', __FILE__, 'highlightjs_footer');
16 }
17
18 function highlightjs_uninstall()
19 {
20         Hook::unregister('head'  , __FILE__, 'highlightjs_head');
21         Hook::unregister('footer', __FILE__, 'highlightjs_footer');
22 }
23
24 function highlightjs_head(App $a, &$b)
25 {
26         if ($a->getCurrentTheme() == 'frio') {
27                 $style = 'bootstrap';
28         } else {
29                 $style = 'default';
30         }
31
32         $a->registerStylesheet(__DIR__ . '/asset/styles/' . $style . '.css');
33 }
34
35 function highlightjs_footer(App $a, &$b)
36 {
37         $a->registerFooterScript(__DIR__ . '/asset/highlight.pack.js');
38         $a->registerFooterScript(__DIR__ . '/highlightjs.js');
39 }