1<?php 2/** 3 * Plugin DokuCrypt2: 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_dokucrypt2 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 { 27 28 //$event->data['script'][]=array('type'=>'text/javascript','charset'=>'utf-8','_data'=>'','_data'=>"addInitEvent(function() { return(decryptEditSetup()); });"); 29 30 //$event->data['script'][]=array('type'=>'text/javascript', 'defer' => 'defer', 'charset'=>'utf-8', '_data'=>'', '_data'=>"jQuery(function(){ return(decryptEditSetup()); });"); 31 32 //$event->data['script'][]=array('type'=>'text/javascript', 'defer' => 'defer', 'charset'=>'utf-8', '_data'=>'', '_data'=>"window.addEventListener('DOMContentLoaded', decryptEditSetup, false);"); 33 34 35 $event->data["script"][] = array( 36 "type" => "text/javascript", 37 "src" => DOKU_BASE."lib/plugins/dokucrypt2/init.js", 38 "defer" => "defer", 39 "_data" => "", 40 ); 41 } 42 43 public function _addconfig(&$event, $param) 44 { 45 global $JSINFO; 46 $JSINFO['plugin_dokucrypt2_CONFIG_copytoclipboard'] = $this->getConf('copytoclipboard'); 47 $JSINFO['plugin_dokucrypt2_CONFIG_hidepasswordoncopytoclipboard'] = $this->getConf('hidepasswordoncopytoclipboard'); 48 $JSINFO['plugin_dokucrypt2_TEXT_copied_to_clipboard'] = $this->getLang('copied_to_clipboard'); 49 } 50} 51