本文整理汇总了PHP中Doku_Event::stopPropagation方法的典型用法代码示例。如果您正苦于以下问题:PHP Doku_Event::stopPropagation方法的具体用法?PHP Doku_Event::stopPropagation怎么用?PHP Doku_Event::stopPropagation使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Doku_Event
的用法示例。
在下文中一共展示了Doku_Event::stopPropagation方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: handle_ajax
/**
* 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);
}
示例2: isset
/**
* @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']);
}
示例3: ajax
/**
* @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);
}
示例4: onAjaxCallUnknown
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);
}
示例5: info
/**
* 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);
}
示例6: handle_auth_user_change
/**
* [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);
}
}
示例7: handle_ajax
/**
* 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));
}
}
示例8: handle_schema
/**
* 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;
}
示例9: handle_ajax_call_unknown
/**
* @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 ']}';
}
示例10: handle_do_action
/**
* 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;
}
示例11: handle_action_act_preprocess
/**
* [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_action_act_preprocess(Doku_Event &$event, $param)
{
if ($event->data != 'pageproperties') {
return;
}
$event->preventDefault();
$event->stopPropagation();
return true;
}
示例12: handle_register_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_register_action(Doku_Event &$event, $param)
{
if ($event->data !== 'register') {
return;
}
//no other action handlers needed
$event->stopPropagation();
$event->preventDefault();
$this->override_html_register();
}
示例13: handle_ajax_call_unknown
/**
* @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);
}
示例14: JSON
/**
* 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);
}
示例15: handle_ajax_call
/**
*
* @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);
}