two more event hooks
darcs-hash:20061116212937-7ad00-2ac647a9040f75650bdbe1047e76370f9c900dff.gz
This commit is contained in:
parent
88e6a4f276
commit
c95706497c
3 changed files with 18 additions and 8 deletions
|
@ -14,6 +14,9 @@
|
|||
* Call the needed action handlers
|
||||
*
|
||||
* @author Andreas Gohr <andi@splitbrain.org>
|
||||
* @triggers ACTION_ACT_PREPROCESS
|
||||
* @triggers ACTION_REGISTER
|
||||
* @triggers ACTION_HEADERS_SEND
|
||||
*/
|
||||
function act_dispatch(){
|
||||
global $INFO;
|
||||
|
@ -48,7 +51,8 @@ function act_dispatch(){
|
|||
$ACT = act_permcheck($ACT);
|
||||
|
||||
//register
|
||||
if($ACT == 'register' && register()){
|
||||
$nil = array();
|
||||
if($ACT == 'register' && $_POST['save'] && trigger_event('ACTION_REGISTER', $nil, 'register')){
|
||||
$ACT = 'login';
|
||||
}
|
||||
|
||||
|
|
|
@ -62,7 +62,7 @@ class Doku_Event {
|
|||
function advise_after() {
|
||||
global $EVENT_HANDLER;
|
||||
|
||||
$this->_continue = true;
|
||||
$this->_continue = true;
|
||||
$EVENT_HANDLER->process_event($this,'AFTER');
|
||||
}
|
||||
|
||||
|
@ -71,7 +71,7 @@ class Doku_Event {
|
|||
*
|
||||
* - advise all registered (<event>_BEFORE) handlers that this event is about to take place
|
||||
* - carry out the default action using $this->data based on $enablePrevent and
|
||||
* $this->_default, all of which may have been modified by the event handlers.
|
||||
* $this->_default, all of which may have been modified by the event handlers.
|
||||
* - advise all registered (<event>_AFTER) handlers that the event has taken place
|
||||
*
|
||||
* @return $event->results
|
||||
|
@ -91,9 +91,9 @@ class Doku_Event {
|
|||
$this->result = $action($this->data);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
$this->advise_after();
|
||||
|
||||
|
||||
return $this->result;
|
||||
}
|
||||
|
||||
|
@ -103,7 +103,7 @@ class Doku_Event {
|
|||
* stop any further processing of the event by event handlers
|
||||
* this function does not prevent the default action taking place
|
||||
*/
|
||||
function stopPropagation() { $this->_continue = false; }
|
||||
function stopPropagation() { $this->_continue = false; }
|
||||
|
||||
/**
|
||||
* preventDefault
|
||||
|
@ -145,11 +145,11 @@ class Doku_Event_Handler {
|
|||
* register a hook for an event
|
||||
*
|
||||
* @PARAM $event (string) name used by the event, (incl '_before' or '_after' for triggers)
|
||||
* @PARAM $obj (obj) object in whose scope method is to be executed,
|
||||
* @PARAM $obj (obj) object in whose scope method is to be executed,
|
||||
* if NULL, method is assumed to be a globally available function
|
||||
* @PARAM $method (function) event handler function
|
||||
* @PARAM $param (mixed) data passed to the event handler
|
||||
*/
|
||||
*/
|
||||
function register_hook($event, $advise, &$obj, $method, $param=NULL) {
|
||||
$this->_hooks[$event.'_'.$advise][] = array(&$obj, $method, $param);
|
||||
}
|
||||
|
|
|
@ -909,6 +909,7 @@ function html_msgarea(){
|
|||
* Prints the registration form
|
||||
*
|
||||
* @author Andreas Gohr <andi@splitbrain.org>
|
||||
* @triggers HTML_REGISTERFORM_INJECTION
|
||||
*/
|
||||
function html_register(){
|
||||
global $lang;
|
||||
|
@ -952,6 +953,10 @@ function html_register(){
|
|||
<?php echo $lang['email']?>
|
||||
<input type="text" name="email" class="edit" size="50" value="<?php echo formText($_POST['email'])?>" />
|
||||
</label><br />
|
||||
<?php //bad and dirty event insert hook
|
||||
$evdata = array();
|
||||
trigger_event('HTML_REGISTERFORM_INJECTION', $evdata);
|
||||
?>
|
||||
<input type="submit" class="button" value="<?php echo $lang['register']?>" />
|
||||
</fieldset>
|
||||
</form>
|
||||
|
@ -1029,6 +1034,7 @@ function html_updateprofile(){
|
|||
*
|
||||
* @fixme this is a huge lump of code and should be modularized
|
||||
* @triggers HTML_PAGE_FROMTEMPLATE
|
||||
* @triggers HTML_EDITFORM_INJECTION
|
||||
* @author Andreas Gohr <andi@splitbrain.org>
|
||||
*/
|
||||
function html_edit($text=null,$include='edit'){ //FIXME: include needed?
|
||||
|
|
Loading…
Reference in a new issue