/** * [Custom event handler which performs action] * * @param Doku_Event $event event object by reference * @param mixed $param [the parameters passed as fifth argument to register_hook() when this * handler was registered] * @return void */ public function handle_auth_user_change(Doku_Event &$event, $param) { if ($event->data['type'] !== 'create') { return; } $domains = array_map(function ($domain) { return trim($domain); }, explode(';', $this->getConf('_domainWhiteList'))); $email = $event->data['params'][3]; $checks = array(in_array(trim(substr(strrchr($email, "@"), 1)), $domains), (bool) preg_match($this->getConf('_emailRegex', '/@/'), $email)); if ($this->getConf('checksAnd', true)) { $status = array_reduce($checks, function ($a, $b) { return $a && $b; }, true); } else { $status = array_reduce($checks, function ($a, $b) { return $a || $b; }, false); } if (!$status) { $event->preventDefault(); $event->stopPropagation(); $event->result = false; msg($this->getConf('_domainlistErrorMEssage'), -1); } }
/** * Display the tag page * * @param Doku_Event $event The TPL_ACT_UNKNOWN event * @param array $param optional parameters (unused) */ function _handle_tpl_act(Doku_Event &$event, $param) { global $lang; if ($event->data != 'showtag') { return; } $event->preventDefault(); $tagns = $this->getConf('namespace'); $flags = explode(',', str_replace(" ", "", $this->getConf('pagelist_flags'))); $tag = trim(str_replace($this->getConf('namespace') . ':', '', $_REQUEST['tag'])); $ns = trim($_REQUEST['ns']); /* @var helper_plugin_tag $helper */ if ($helper = $this->loadHelper('tag')) { $pages = $helper->getTopic($ns, '', $tag); } if (!empty($pages)) { // let Pagelist Plugin do the work for us if (!($pagelist = $this->loadHelper('pagelist'))) { return false; } /* @var helper_plugin_pagelist $pagelist */ $pagelist->setFlags($flags); $pagelist->startList(); foreach ($pages as $page) { $pagelist->addPage($page); } print '<h1>TAG: ' . hsc(str_replace('_', ' ', $_REQUEST['tag'])) . '</h1>' . DOKU_LF; print '<div class="level1">' . DOKU_LF; print $pagelist->finishList(); print '</div>' . DOKU_LF; } else { print '<div class="level1"><p>' . $lang['nothingfound'] . '</p></div>'; } }
/** * @param Doku_Event$event * @param $param */ public function ajax(Doku_Event $event, $param) { if ($event->data !== 'bureaucracy_user_field') { return; } $event->stopPropagation(); $event->preventDefault(); $search = $_REQUEST['search']; /** @var DokuWiki_Auth_Plugin $auth */ global $auth; $users = array(); foreach ($auth->retrieveUsers() as $username => $data) { if ($search === '' || stripos($username, $search) === 0 || stripos($data['name'], $search) !== false) { // Full name $users[$username] = $data['name']; } if (count($users) === 10) { break; } } if (count($users) === 1 && key($users) === $search) { $users = array(); } require_once DOKU_INC . 'inc/JSON.php'; $json = new JSON(); echo $json->encode($users); }
public function onAjaxCallUnknown(\Doku_Event $event, $action) { if ($event->data != 'yk') { return; } // skip if not our plugin $do = $this->G['INPUT']->post->str('action', ''); if ($action !== $do) { return; // not match. skip this, continue with another } $event->preventDefault(); // what does it do? $event->stopPropagation(); //our hooker found, skip others $pageId = $this->G['INPUT']->post->str('id', ''); $pageNewId = $this->G['INPUT']->post->str('new_page_id', null); $json = new \stdClass(); $json->error = false; try { $this->logger(strtoupper($do), 'PAGE ' . $pageId); $json->result = $this->doAction($pageId, $pageNewId); $this->logger('SUCCESS'); } catch (\Exception $e) { $json->error = date('H:i:s') . ' ' . $e->getMessage(); $this->logger('ERROR', $e->getMessage()); } //header('Content-Type: application/json'); echo json_encode($json); }
/** * Step up * * @param Doku_Event $event */ public function handle_ajax(Doku_Event $event) { if ($event->data != 'plugin_move_progress') { return; } $event->preventDefault(); $event->stopPropagation(); global $INPUT; global $USERINFO; if (!auth_ismanager($_SERVER['REMOTE_USER'], $USERINFO['grps'])) { http_status(403); exit; } $return = array('error' => '', 'complete' => false, 'progress' => 0); /** @var helper_plugin_move_plan $plan */ $plan = plugin_load('helper', 'move_plan'); if (!$plan->isCommited()) { // There is no plan. Something went wrong $return['complete'] = true; } else { $todo = $plan->nextStep($INPUT->bool('skip')); $return['progress'] = $plan->getProgress(); $return['error'] = $plan->getLastError(); if ($todo === 0) { $return['complete'] = true; } } $json = new JSON(); header('Content-Type: application/json'); echo $json->encode($return); }
/** * Rename a single page */ public function handle_ajax(Doku_Event $event) { if ($event->data != 'plugin_move_rename') { return; } $event->preventDefault(); $event->stopPropagation(); global $MSG; global $INPUT; $src = cleanID($INPUT->str('id')); $dst = cleanID($INPUT->str('newid')); /** @var helper_plugin_move_op $MoveOperator */ $MoveOperator = plugin_load('helper', 'move_op'); $JSON = new JSON(); header('Content-Type: application/json'); if ($this->renameOkay($src) && $MoveOperator->movePage($src, $dst)) { // all went well, redirect echo $JSON->encode(array('redirect_url' => wl($dst, '', true, '&'))); } else { if (isset($MSG[0])) { $error = $MSG[0]; // first error } else { $error = $this->getLang('cantrename'); } echo $JSON->encode(array('error' => $error)); } }
/** * @param Doku_Event $event event object by reference * @param mixed $param [the parameters passed as fifth argument to register_hook() when this * handler was registered] * @return void */ public function handle_ajax_call_unknown(Doku_Event &$event, $param) { if ($event->data !== 'tagapi_list') { return; } $event->stopPropagation(); $event->preventDefault(); if ($this->tagplugin = $this->loadHelper('tag')) { $tags = $this->tagplugin->tagOccurrences(array(), NULL, true); $a = print_r($tags, true); // file_put_contents(DOKU_INC . 'tags.txt', $a); } else { $tags = array(); } // sort tags by name ($tags is in the form $tag => $count) ksort($tags); echo '{"tags":['; $firstelement = true; foreach (array_keys($tags) as $tag) { if ($firstelement) { $firstelement = false; } else { echo ','; } echo '{"name":"' . $this->tagToName($tag) . '","id":"' . $tag . '"}'; } echo ']}'; }
/** * Create the detail info for a single plugin * * @param Doku_Event $event * @param $param */ public function info(Doku_Event &$event, $param) { global $USERINFO; global $INPUT; if ($event->data != 'plugin_extension') { return; } $event->preventDefault(); $event->stopPropagation(); if (empty($_SERVER['REMOTE_USER']) || !auth_isadmin($_SERVER['REMOTE_USER'], $USERINFO['grps'])) { http_status(403); echo 'Forbidden'; exit; } header('Content-Type: text/html; charset=utf-8'); $ext = $INPUT->str('ext'); if (!$ext) { echo 'no extension given'; return; } /** @var helper_plugin_extension_extension $extension */ $extension = plugin_load('helper', 'extension_extension'); $extension->setExtension($ext); /** @var helper_plugin_extension_list $list */ $list = plugin_load('helper', 'extension_list'); echo $list->make_info($extension); }
/** * Load a whole schema as fields * * @param Doku_Event $event event object by reference * @param mixed $param [the parameters passed as fifth argument to register_hook() when this * handler was registered] * @return bool */ public function handle_schema(Doku_Event $event, $param) { $args = $event->data['args']; if ($args[0] != 'struct_schema') { return false; } $event->preventDefault(); $event->stopPropagation(); /** @var helper_plugin_bureaucracy_field $helper */ $helper = plugin_load('helper', 'bureaucracy_field'); $helper->initialize($args); $schema = new Schema($helper->opt['label']); if (!$schema->getId()) { msg('This schema does not exist', -1); return false; } foreach ($schema->getColumns(false) as $column) { /** @var helper_plugin_struct_field $field */ $field = plugin_load('helper', 'struct_field'); // we don't initialize the field but set the appropriate values $field->opt = $helper->opt; // copy all the settings to each field $field->opt['label'] = $column->getFullQualifiedLabel(); $field->column = $column; $event->data['fields'][] = $field; } return true; }
/** * Handles input from the newform and redirects to the edit mode * * @author Andreas Gohr <*****@*****.**> * @author Gina Haeussge <*****@*****.**> * * @param Doku_Event $event event object by reference * @param array $param empty array as passed to register_hook() * @return bool */ function handle_act_preprocess(Doku_Event $event, $param) { global $TEXT; global $ID; if ($event->data != 'btngnew') { return true; } /** @var helper_plugin_blogtng_tools $tools */ $tools = plugin_load('helper', 'blogtng_tools'); if (!$tools->getParam('new/title')) { msg($this->getLang('err_notitle'), -1); $event->data = 'show'; return true; } $event->preventDefault(); $new = $tools->mkpostid($tools->getParam('new/format'), $tools->getParam('new/title')); if ($ID != $new) { $urlparams = array('do' => 'btngnew', 'btng[post][blog]' => $tools->getParam('post/blog'), 'btng[post][tags]' => $tools->getParam('post/tags'), 'btng[post][commentstatus]' => $tools->getParam('post/commentstatus'), 'btng[new][format]' => $tools->getParam('new/format'), 'btng[new][title]' => $tools->getParam('new/title')); send_redirect(wl($new, $urlparams, true, '&')); return false; //never reached } else { $TEXT = $this->_prepare_template($new, $tools->getParam('new/title')); $event->data = 'preview'; return false; } }
/** * Gets the thumbnail * * @param Doku_Event $event event object by reference * @param mixed $param [the parameters passed as fifth argument to register_hook() when this * handler was registered] * @return void */ public function handle_do_action(Doku_Event &$event, $param) { if ($event->data !== 'obsaudioupload_frame_thumbnail') { return; } //no other ajax call handlers needed $event->stopPropagation(); $event->preventDefault(); // get the url of the image to make into a thumbnail $url = $GLOBALS['INPUT']->str('img'); $imageInfo = getimagesize($url); // 0=width, 1=height, 2=format if ($imageInfo[2] == IMG_PNG) { $img = imagecreatefrompng($url); } else { $img = imagecreatefromjpeg($url); } $newHeight = 50; $newWidth = (int) ($imageInfo[0] * $newHeight / $imageInfo[1]); $newImg = imagecreatetruecolor($newWidth, $newHeight); imagecopyresized($newImg, $img, 0, 0, 0, 0, $newWidth, $newHeight, $imageInfo[0], $imageInfo[1]); // output header('Content-Type: application/jpeg'); imagejpeg($newImg, null, 60); exit; }
/** * @param Doku_Event $event event object by reference * @param array $param empty array as passed to register_hook() */ function handle_ajax_call(Doku_Event $event, $param) { /** @var DokuWiki_Auth_Plugin $auth */ global $auth; if ($event->data != 'blogtng__comment_preview') { return; } $event->preventDefault(); $event->stopPropagation(); require_once DOKU_PLUGIN . 'blogtng/helper/comments.php'; $comment = new blogtng_comment(); $comment->data['text'] = $_REQUEST['text']; $comment->data['name'] = $_REQUEST['name']; $comment->data['mail'] = $_REQUEST['mail']; $comment->data['web'] = isset($_REQUEST['web']) ? $_REQUEST['web'] : ''; $comment->data['cid'] = 'preview'; $comment->data['created'] = time(); $comment->data['status'] = 'visible'; if (!$comment->data['name'] && $_SERVER['REMOTE_USER']) { if ($auth and $info = $auth->getUserData($_SERVER['REMOTE_USER'])) { $comment->data['name'] = $info['name']; $comment->data['mail'] = $info['mail']; } } $comment->output($_REQUEST['tplname']); }
/** * Hook js script into page headers. * * @author Samuele Tognini <*****@*****.**> */ public function _handle_before(Doku_Event $event, $param) { $act = act_clean($event->data); if ($act != 'diff') { return; } $event->preventDefault(); revisionsfull_html_diff(); }
/** * @param Doku_Event $event event object by reference * @param mixed $param [the parameters passed as fifth argument to register_hook() when this * handler was registered] * @return void */ public function handle_register_action(Doku_Event &$event, $param) { if ($event->data !== 'register') { return; } //no other action handlers needed $event->stopPropagation(); $event->preventDefault(); $this->override_html_register(); }
/** * @param Doku_Event $event event object by reference * @param mixed $param [the parameters passed as fifth argument to register_hook() when this * handler was registered] * @return void */ public function handle_ajax_call_unknown(Doku_Event &$event, $param) { if ($event->data !== 'iwiki_list') { return; } $event->stopPropagation(); $event->preventDefault(); $a = getInterwiki(); ksort($a); echo json_encode($a); }
/** * Handler to load page template. * * @param Doku_Event $event event object by reference * @param mixed $param [the parameters passed as fifth argument to register_hook() when this * handler was registered] * @return void */ public function get_template(Doku_Event &$event, $param) { if (strlen($_REQUEST['copyfrom']) > 0) { $template_id = $_REQUEST['copyfrom']; if (auth_quickaclcheck($template_id) >= AUTH_READ) { $tpl = io_readFile(wikiFN($template_id)); $event->data['tpl'] = $tpl; $event->preventDefault(); } } }
/** * Create event for tools menues * * @author Anika Henke <*****@*****.**> */ function _tpl_toolsevent($toolsname, $items, $view = 'main') { $data = array('view' => $view, 'items' => $items); $hook = 'TEMPLATE_' . strtoupper($toolsname) . '_DISPLAY'; $evt = new Doku_Event($hook, $data); if ($evt->advise_before()) { foreach ($evt->data['items'] as $k => $html) { echo $html; } } $evt->advise_after(); }
/** * Handle the event */ public function handle_tpl_content_display(Doku_Event &$event, $param) { global $ACT; # If user is not logged in and access to page is denied, show login form if ($ACT == 'denied' && !$_SERVER['REMOTE_USER']) { $event->preventDefault(); // prevent "Access denied" page from showing html_login(); // show login dialog instead } # .. or show regular access denied page }
/** * * @param Doku_Event $event event object by reference * @param mixed $param [the parameters passed as fifth argument to register_hook() when this * handler was registered] * @return void */ public function handle_ajax_call(Doku_Event &$event, $param) { // do we have a handler defined for this call? if (empty($this->handlers[$event->data])) { return; } //no other ajax call handlers needed $event->stopPropagation(); $event->preventDefault(); $handler = $this->handlers[$event->data]; $handler[0]->{$handler}[1]($event); }
/** * Ajax handler */ function _ajax_call(Doku_Event $event, $param) { if ($event->data !== 'plugin_textvar') { return; } $event->stopPropagation(); $event->preventDefault(); $json = new JSON(); $data = array('%SERVER_ADDR%' => $_SERVER['SERVER_ADDR'], '%REMOTE_ADDR%' => $_SERVER['REMOTE_ADDR']); header('Content-Type: application/json'); echo $json->encode($data); }
/** * Analyze the next chunk of data * * @param Doku_Event $event * @param $param */ function handle_run(&$event, $param) { echo "logfile analysis started.\n"; /** @var $log helper_plugin_statdisplay_log */ $log = plugin_load('helper', 'statdisplay_log'); $lines = $log->parseLogData(); // did we do any work? if ($lines) { $event->preventDefault(); $event->stopPropagation(); } echo "logfile analysis finished analyzing {$lines} lines.\n"; }
/** * Wraps an event around the parent function * * @triggers HTTPCLIENT_REQUEST_SEND * @author Andreas Gohr <*****@*****.**> */ function sendRequest($url, $data = '', $method = 'GET') { $httpdata = array('url' => $url, 'data' => $data, 'method' => $method); $evt = new Doku_Event('HTTPCLIENT_REQUEST_SEND', $httpdata); if ($evt->advise_before()) { $url = $httpdata['url']; $data = $httpdata['data']; $method = $httpdata['method']; } $evt->advise_after(); unset($evt); return parent::sendRequest($url, $data, $method); }
public function handle_ajax_call_unknown(Doku_Event &$event, $param) { if ($event->data != 'plugin_imgpaste') { return; } global $lang; // get data global $INPUT; $data = $INPUT->post->str('data'); list($type, $data) = explode(';', $data); if (!$data) { $this->fail(400, $this->getLang('e_nodata')); } // process data encoding $type = strtolower(substr($type, 5)); // strip 'data:' prefix $data = substr($data, 7); // strip 'base64,' prefix $data = base64_decode($data); // check for supported mime type $mimetypes = array_flip(getMimeTypes()); if (!isset($mimetypes[$type])) { $this->fail(415, $lang['uploadwrong']); } // prepare file names $tempname = $this->storetemp($data); $filename = $this->getConf('filename'); $filename = str_replace(array('@NS@', '@ID@', '@USER@'), array(getNS($INPUT->post->str('id')), $INPUT->post->str('id'), $_SERVER['REMOTE_USER']), $filename); $filename = strftime($filename); $filename .= '.' . $mimetypes[$type]; $filename = cleanID($filename); // check ACLs $auth = auth_quickaclcheck($filename); if ($auth < AUTH_UPLOAD) { $this->fail(403, $lang['uploadfail']); } // do the actual saving $result = media_save(array('name' => $tempname, 'mime' => $type, 'ext' => $mimetypes[$type]), $filename, false, $auth, 'copy'); if (is_array($result)) { $this->fail(500, $result[0]); } //Still here? We had a successful upload $this->clean(); header('Content-Type: application/json'); $json = new JSON(); echo $json->encode(array('message' => $lang['uploadsucc'], 'id' => $result)); $event->preventDefault(); $event->stopPropagation(); }
/** * [Custom event handler which performs action] * * @param Doku_Event $event event object by reference * @param mixed $param [the parameters passed as fifth argument to register_hook() when this * handler was registered] * @return void */ public function handle_ajax_call_unknown(Doku_Event &$event, $param) { if ($event->data != 'rating') { return; } $event->preventDefault(); $event->stopPropagation(); global $ID; $ID = getID(); // let the other handler do it $this->handle_vote($event, $param); /** @var helper_plugin_rating $hlp */ $hlp = plugin_load('helper', 'rating'); $hlp->tpl(true); }
/** * Handle section edit buttons, prevents section buttons inside the wrap plugin from being rendered * * @param Doku_Event $event The event object * @param array $args Parameters for the event */ public function handle_secedit_button($event, $args) { // counter of the number of currently opened wraps static $wraps = 0; $data = $event->data; if ($data['target'] == 'plugin_wrap_start') { ++$wraps; } elseif ($data['target'] == 'plugin_wrap_end') { --$wraps; } elseif ($wraps > 0 && $data['target'] == 'section') { $event->preventDefault(); $event->stopPropagation(); $event->result = ''; } }
public function check_spammer_database(Doku_Event $event, $param) { $can_modify = true; if ($event->data['type'] == 'create') { $username = $event->data['params'][0]; $email = $event->data['params'][3]; $ip = $_SERVER['REMOTE_ADDR']; $response = $this->do_check($username, $email, $ip); if ($this->checker->userIsValid($response) === false) { msg('Potentially a spammer', -1); $event->preventDefault(); } $this->logger->LogAttempt($username, $email, $ip, $this->checker->trigger, $this->checker->confidence, $this->checker->accepted); } }
/** * Prepares and prints an JavaScript array with all toolbar buttons * * @emits TOOLBAR_DEFINE * @param string $varname Name of the JS variable to fill * @author Andreas Gohr <*****@*****.**> */ function toolbar_JSdefines($varname) { global $lang; $menu = array(); $evt = new Doku_Event('TOOLBAR_DEFINE', $menu); if ($evt->advise_before()) { // build button array $menu = array_merge($menu, array(array('type' => 'format', 'title' => $lang['qb_bold'], 'icon' => 'bold.png', 'key' => 'b', 'open' => '**', 'close' => '**', 'block' => false), array('type' => 'format', 'title' => $lang['qb_italic'], 'icon' => 'italic.png', 'key' => 'i', 'open' => '//', 'close' => '//', 'block' => false), array('type' => 'format', 'title' => $lang['qb_underl'], 'icon' => 'underline.png', 'key' => 'u', 'open' => '__', 'close' => '__', 'block' => false), array('type' => 'format', 'title' => $lang['qb_code'], 'icon' => 'mono.png', 'key' => 'c', 'open' => "''", 'close' => "''", 'block' => false), array('type' => 'format', 'title' => $lang['qb_strike'], 'icon' => 'strike.png', 'key' => 'd', 'open' => '<del>', 'close' => '</del>', 'block' => false), array('type' => 'autohead', 'title' => $lang['qb_hequal'], 'icon' => 'hequal.png', 'key' => '8', 'text' => $lang['qb_h'], 'mod' => 0, 'block' => true), array('type' => 'autohead', 'title' => $lang['qb_hminus'], 'icon' => 'hminus.png', 'key' => '9', 'text' => $lang['qb_h'], 'mod' => 1, 'block' => true), array('type' => 'autohead', 'title' => $lang['qb_hplus'], 'icon' => 'hplus.png', 'key' => '0', 'text' => $lang['qb_h'], 'mod' => -1, 'block' => true), array('type' => 'picker', 'title' => $lang['qb_hs'], 'icon' => 'h.png', 'class' => 'pk_hl', 'list' => array(array('type' => 'format', 'title' => $lang['qb_h1'], 'icon' => 'h1.png', 'key' => '1', 'open' => '====== ', 'close' => ' ======\\n'), array('type' => 'format', 'title' => $lang['qb_h2'], 'icon' => 'h2.png', 'key' => '2', 'open' => '===== ', 'close' => ' =====\\n'), array('type' => 'format', 'title' => $lang['qb_h3'], 'icon' => 'h3.png', 'key' => '3', 'open' => '==== ', 'close' => ' ====\\n'), array('type' => 'format', 'title' => $lang['qb_h4'], 'icon' => 'h4.png', 'key' => '4', 'open' => '=== ', 'close' => ' ===\\n'), array('type' => 'format', 'title' => $lang['qb_h5'], 'icon' => 'h5.png', 'key' => '5', 'open' => '== ', 'close' => ' ==\\n')), 'block' => true), array('type' => 'linkwiz', 'title' => $lang['qb_link'], 'icon' => 'link.png', 'key' => 'l', 'open' => '[[', 'close' => ']]', 'block' => false), array('type' => 'format', 'title' => $lang['qb_extlink'], 'icon' => 'linkextern.png', 'open' => '[[', 'close' => ']]', 'sample' => 'http://example.com|' . $lang['qb_extlink'], 'block' => false), array('type' => 'formatln', 'title' => $lang['qb_ol'], 'icon' => 'ol.png', 'open' => ' - ', 'close' => '', 'key' => '-', 'block' => true), array('type' => 'formatln', 'title' => $lang['qb_ul'], 'icon' => 'ul.png', 'open' => ' * ', 'close' => '', 'key' => '.', 'block' => true), array('type' => 'insert', 'title' => $lang['qb_hr'], 'icon' => 'hr.png', 'insert' => '\\n----\\n', 'block' => true), array('type' => 'mediapopup', 'title' => $lang['qb_media'], 'icon' => 'image.png', 'url' => 'lib/exe/mediamanager.php?ns=', 'name' => 'mediaselect', 'options' => 'width=750,height=500,left=20,top=20,scrollbars=yes,resizable=yes', 'block' => false), array('type' => 'picker', 'title' => $lang['qb_smileys'], 'icon' => 'smiley.png', 'list' => getSmileys(), 'icobase' => 'smileys', 'block' => false), array('type' => 'picker', 'title' => $lang['qb_chars'], 'icon' => 'chars.png', 'list' => explode(' ', 'À à Á á  â à ã Ä ä Ǎ ǎ Ă ă Å å Ā ā Ą ą Æ æ Ć ć Ç ç Č č Ĉ ĉ Ċ ċ Ð đ ð Ď ď È è É é Ê ê Ë ë Ě ě Ē ē Ė ė Ę ę Ģ ģ Ĝ ĝ Ğ ğ Ġ ġ Ĥ ĥ Ì ì Í í Î î Ï ï Ǐ ǐ Ī ī İ ı Į į Ĵ ĵ Ķ ķ Ĺ ĺ Ļ ļ Ľ ľ Ł ł Ŀ ŀ Ń ń Ñ ñ Ņ ņ Ň ň Ò ò Ó ó Ô ô Õ õ Ö ö Ǒ ǒ Ō ō Ő ő Œ œ Ø ø Ŕ ŕ Ŗ ŗ Ř ř Ś ś Ş ş Š š Ŝ ŝ Ţ ţ Ť ť Ù ù Ú ú Û û Ü ü Ǔ ǔ Ŭ ŭ Ū ū Ů ů ǖ ǘ ǚ ǜ Ų ų Ű ű Ŵ ŵ Ý ý Ÿ ÿ Ŷ ŷ Ź ź Ž ž Ż ż Þ þ ß Ħ ħ ¿ ¡ ¢ £ ¤ ¥ € ¦ § ª ¬ ¯ ° ± ÷ ‰ ¼ ½ ¾ ¹ ² ³ µ ¶ † ‡ · • º ∀ ∂ ∃ Ə ə ∅ ∇ ∈ ∉ ∋ ∏ ∑ ‾ − ∗ √ ∝ ∞ ∠ ∧ ∨ ∩ ∪ ∫ ∴ ∼ ≅ ≈ ≠ ≡ ≤ ≥ ⊂ ⊃ ⊄ ⊆ ⊇ ⊕ ⊗ ⊥ ⋅ ◊ ℘ ℑ ℜ ℵ ♠ ♣ ♥ ♦ α β Γ γ Δ δ ε ζ η Θ θ ι κ Λ λ μ Ξ ξ Π π ρ Σ σ Τ τ υ Φ φ χ Ψ ψ Ω ω ★ ☆ ☎ ☚ ☛ ☜ ☝ ☞ ☟ ☹ ☺ ✔ ✘ × „ “ ” ‚ ‘ ’ « » ‹ › — – … ← ↑ → ↓ ↔ ⇐ ⇑ ⇒ ⇓ ⇔ © ™ ® ′ ″ [ ] { } ~ ( ) % § $ # | @'), 'block' => false), array('type' => 'signature', 'title' => $lang['qb_sig'], 'icon' => 'sig.png', 'key' => 'y', 'block' => false))); } // end event TOOLBAR_DEFINE default action $evt->advise_after(); unset($evt); // use JSON to build the JavaScript array $json = new JSON(); print "var {$varname} = " . $json->encode($menu) . ";\n"; }
/** * copied to core (available since Detritus) */ function white_toolsevent($toolsname, $items, $view = 'main') { $data = array('view' => $view, 'items' => $items); $hook = 'TEMPLATE_' . strtoupper($toolsname) . '_DISPLAY'; $evt = new Doku_Event($hook, $data); if ($evt->advise_before()) { $actions = array('export_pdf'); foreach ($evt->data['items'] as $k => $html) { if (in_array($k, $actions)) { $html = str_replace(' ' . $k, ' plugin_' . $k, $html); } echo $html; } } $evt->advise_after(); }
public function tplMetaDataForm(Doku_Event &$event) { if ($event->data != 'social_form') { return; } global $ID; echo '<div class="plugin_social">'; echo '<div class="form" id="pluginsocialform" >'; $form = new Doku_Form(array()); $form->addHidden('target', 'plugin_social'); $form->addHidden('id', $ID); $form->addHidden('do', 'social_save'); foreach (helper_plugin_social_meta::$metaEditableKeys as $type => $values) { $form->addElement('<div>'); $form->startFieldset($type); foreach ($values as $value) { $metadata = $this->helper->meta->getMetaData(); $name = $this->helper->meta->getMetaPropertyName($type, $value); $form->addElement(form_makeTextField($name, $metadata[$name], $name, null, 'block')); } $form->endFieldset(); $form->addElement('</div>'); } $form->addElement(form_makeButton('submit', null, $this->getLang('btnSave'))); html_form('', $form); echo '</div>'; echo '</div>'; $event->preventDefault(); }
/** * Reconfigure config for a given type * * @param Doku_Event $event event object by reference * @param mixed $param [the parameters passed as fifth argument to register_hook() when this * handler was registered] */ public function handle_ajax(Doku_Event $event, $param) { if ($event->data != 'plugin_struct_config') { return; } $event->preventDefault(); $event->stopPropagation(); global $INPUT; $conf = json_decode($INPUT->str('conf'), true); /** @var AbstractBaseType $type */ $class = 'dokuwiki\\plugin\\struct\\types\\' . $INPUT->str('type', 'Text'); $type = new $class($conf); header('Content-Type: text/plain'); // we need the encoded string, not decoded by jQuery echo json_encode($type->getConfig()); }