xref: /plugin/dokucrypt3/action.php (revision 797968255e9ba6155195c27ffca9f6fce5f65776)
1<?php
2/**
3 * Plugin dokucrypt3: Enables client side encryption
4 *
5 * @license    GPL 2 (http://www.gnu.org/licenses/gpl.html)
6 * @author     Scott Moser <smoser@brickies.net>, Maintainer Sherri W. ( contact me at syntaxseed.com)
7 */
8
9if (!defined('DOKU_INC')) {
10    die();
11}
12if (!defined('DOKU_PLUGIN')) {
13    define('DOKU_PLUGIN', DOKU_INC.'lib/plugins/');
14}
15require_once(DOKU_PLUGIN.'action.php');
16
17class action_plugin_dokucrypt3 extends DokuWiki_Action_Plugin
18{
19    public function register($controller)
20    {
21        $controller->register_hook('TPL_METAHEADER_OUTPUT', 'BEFORE', $this, 'c_hookjs');
22        $controller->register_hook('DOKUWIKI_STARTED', 'AFTER', $this, '_addconfig');
23    }
24
25    public function c_hookjs(&$event, $param) {
26        $event->data["script"][] = array(
27            "type" => "text/javascript",
28            "src" => DOKU_BASE."lib/plugins/dokucrypt3/init.js",
29            "defer" => "defer",
30            "_data" => ""
31        );
32    }
33
34    public function _addconfig(&$event, $param)
35    {
36        global $JSINFO;
37        $JSINFO['plugin_dokucrypt3_CONFIG_copytoclipboard'] = $this->getConf('copytoclipboard');
38        $JSINFO['plugin_dokucrypt3_CONFIG_hidepasswordoncopytoclipboard'] = $this->getConf('hidepasswordoncopytoclipboard');
39        $JSINFO['plugin_dokucrypt3_TEXT_copied_to_clipboard'] = $this->getLang('copied_to_clipboard');
40	}
41}
42