Skip to content
Snippets Groups Projects
Commit 3cb4b39f authored by Ben Coburn's avatar Ben Coburn
Browse files

Add AJAX_CALL_UNKNOWN event

Allows action plugins to support custom ajax calls.
The event data is the call name from $_POST['call'].
When handling a custom ajax call, remember to use
$event->preventDefault();
to avoid having the
'AJAX call <call> unknown!'
message appended to the output.

darcs-hash:20060809194501-05dcb-0082e4f2a83fc8657fc7cdcf32d44aac8d1a6b99.gz
parent 742c66f8
No related branches found
No related tags found
No related merge requests found
......@@ -23,11 +23,18 @@ header('Content-Type: text/html; charset=utf-8');
//call the requested function
if (!isset($_POST['call'])) { return; }
$call = 'ajax_'.$_POST['call'];
if(function_exists($call)){
$call();
}else{
print "The called function '".htmlspecialchars($call)."' does not exist!";
$call = $_POST['call'];
$evt = new Doku_Event('AJAX_CALL_UNKNOWN', $call);
if ($evt->advise_before()) {
print "AJAX call '".htmlspecialchars($_POST['call'])."' unknown!\n";
}
$evt->advise_after();
unset($evt);
}
/**
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment