helper = plugin_load('helper', 'ckgedit');
$this->dokuwiki_priority = false;
$this->dw_priority_group = "NOT_SET";
$this->dw_priority_metafn=metaFN(':ckgedit:dw_priority', '.ser');
if(!file_exists($this->dw_priority_metafn)) {
io_saveFile($this->dw_priority_metafn, serialize(array()));
}
}
/*
* Register its handlers with the dokuwiki's event controller
*/
function register(Doku_Event_Handler $controller) {
if($this->helper->is_outOfScope()) return;
$controller->register_hook( 'TPL_METAHEADER_OUTPUT', 'AFTER', $this, 'loadScript');
$controller->register_hook( 'HTML_EDITFORM_INJECTION', 'AFTER', $this, 'preprocess');
$controller->register_hook( 'HTML_EDITFORM_OUTPUT', 'BEFORE', $this, 'insertFormElement');
$controller->register_hook( 'FORM_EDIT_OUTPUT', 'BEFORE', $this, 'insertFormElement');
$controller->register_hook('DOKUWIKI_STARTED', 'BEFORE', $this, 'file_type');
$controller->register_hook('TPL_CONTENT_DISPLAY', 'AFTER', $this, 'setupDWEdit');
$controller->register_hook('DOKUWIKI_STARTED', 'AFTER', $this, 'reset_user_rewrite_check');
$controller->register_hook('DOKUWIKI_DONE', 'BEFORE', $this, 'restore_conf');
$controller->register_hook('AJAX_CALL_UNKNOWN', 'BEFORE', $this,'_ajax_call');
//$controller->register_hook('HTML_UPDATEPROFILEFORM_OUTPUT', 'BEFORE', $this, 'handle_profile_form');
$controller->register_hook('ACTION_SHOW_REDIRECT', 'BEFORE', $this, 'handle_redirect');
}
function handle_redirect(Doku_Event $event, $param) {
global $INPUT;
$ckg_redirect = $INPUT->str('ckgedit_redirect',"");
if($ckg_redirect) $event->data['id'] = $ckg_redirect;
//msg($ckg_redirect);
}
function handle_profile_form(Doku_Event $event, $param) {
if(!$this->getConf('dw_priority')) { return; }
global $INFO;
$client = $_SERVER['REMOTE_USER']; //$INFO['client'];
$ar = unserialize(file_get_contents($this->dw_priority_metafn));
$which = $ar[$client];
$dwed = ""; $cked = "";
if($which == 'N') {
$cked = "checked";
}
else if($which == 'Y') {
$dwed = "checked";
}
$pos = $event->data->findElementByAttribute('type', 'reset');
$_form = '