Skip to content

Commit

Permalink
added wrap plugin to CKEditor
Browse files Browse the repository at this point in the history
  • Loading branch information
turnermm committed Jun 20, 2017
1 parent 4903a40 commit 253e359
Show file tree
Hide file tree
Showing 4 changed files with 78 additions and 18 deletions.
44 changes: 39 additions & 5 deletions action/meta.php
Expand Up @@ -31,9 +31,6 @@ function __construct() {
if(!plugin_isdisabled('captcha')) {
$this->captcha = true;
}
if( class_exists('GeSHi')) {
if(defined('GESHI_LANG_ROOT') ) $geshi_dir =GESHI_LANG_ROOT;
}
}
/*
* Register its handlers with the dokuwiki's event controller
Expand Down Expand Up @@ -84,7 +81,30 @@ function handle_profile_form(Doku_Event $event, $param) {
}

function _ajax_call(Doku_Event $event, $param) {
if ($event->data == 'cked_selector') {
if ($event->data == 'wrap_lang') { //choose profile editor priority
$event->stopPropagation();
$event->preventDefault();
global $INPUT;
$which = $INPUT->str('lang');
$path = DOKU_PLUGIN . 'wrap/lang/' . $which . '/lang.php';
if(file_exists($path)) {
$data = file($path, FILE_IGNORE_NEW_LINES|FILE_SKIP_EMPTY_LINES );
array_shift($data);
}
$result = array();
for($i=0; $i<count($data); $i++) {
list($name, $val) = explode('=',$data[$i]);
$name = str_replace('$lang',"",$name);
$name = trim($name,' ][\'');
if($name == 'picker') $name ='title';
$val = trim($val,' ;\'');
$result[$name] = $val;
}
echo json_encode($result);
return;
}

if ($event->data == 'cked_selector') { //choose profile editor priority
$event->stopPropagation();
$event->preventDefault();
global $INPUT, $USERINFO,$INFO;
Expand All @@ -106,7 +126,7 @@ function _ajax_call(Doku_Event $event, $param) {
if ($event->data == 'geshi_sel') { //get geshi file names , return as ;; separated string w/o php extensions
$event->stopPropagation();
$event->preventDefault();
// $gdir = '/var/www/html/devel/vendor/easybook/geshi/geshi/';

if( class_exists('GeSHi')) {
if(defined('GESHI_LANG_ROOT') ) $geshi_dir =GESHI_LANG_ROOT;
}
Expand Down Expand Up @@ -621,6 +641,19 @@ function file_type(Doku_Event $event, $param) {
if($onoff == 'off') $JSINFO['ckg_dbl_click'] = "";
$JSINFO['ckg_canonical'] =$conf['canonical'];
$JSINFO['doku_base'] = DOKU_BASE;
if($this->helper->has_plugin('tag')) $JSINFO['has_tags'] = "Tag";
if($this->helper->has_plugin('wrap')) $JSINFO['has_wrap'] = "Wrap";
$wrap_helper = plugin_load('helper',wrap);
$syntaxDiv = $wrap_helper->getConf('syntaxDiv');
if(!empty($syntaxDiv)) {
$JSINFO['wrapDiv'] = $syntaxDiv;
}
else $JSINFO['wrapDiv'] = "";
$syntaxSpan = $wrap_helper->getConf('syntaxSpan');
if(!empty($syntaxSpan)) {
$JSINFO['wrapSpan'] = $syntaxSpan;
}
else $JSINFO['wrapSpan'] = "";

$this->check_userfiles();
$this->profile_dwpriority=($this->dokuwiki_priority && $this->in_dwpriority_group()) ? 1 : 0;
Expand Down Expand Up @@ -740,6 +773,7 @@ function reset_user_rewrite_check() {
$this->user_rewrite = $conf['userewrite'];
$conf['userewrite'] = 0;
}

if($conf['htmlok'] || $this->getConf('htmlblock_ok')) {
$JSINFO['htmlok'] = 1;
}
Expand Down

0 comments on commit 253e359

Please sign in to comment.