1<?php
2
3if(!defined('DOKU_INC')) die();
4
5class action_plugin_svgelement extends DokuWiki_Action_Plugin {
6
7    public function register(Doku_Event_Handler $controller) {
8        $controller->register_hook('TPL_METAHEADER_OUTPUT', 'BEFORE', $this, 'handle_js_addition');
9    }
10
11    public function handle_js_addition(Doku_Event $event, $param) {
12        $event->data['script'][] = array (
13            'type'    => 'text/javascript',
14            'src'     => DOKU_BASE . 'lib/plugins/svgelement/svgelement.js',
15            '_data'   => '',
16        );
17    }
18
19    public function getInfo() {
20        return array(
21            'author' => 'Albert Palacios',
22            'email'  => 'mail@exemple.com',
23            'date'   => '2023-09-22',
24            'name'   => 'SVG Element Plugin',
25            'desc'   => 'Display SVG elements in an appropriate SVG element, but removing any potential script to prevent security issues.',
26            'url'    => 'https://github.com/optimisme/DokuWiki-SVGElement');
27    }
28}