Allow triggers to call arbitrary functions

This commit is contained in:
Kijin Sung 2016-02-01 15:46:04 +09:00
parent 9f35a3c95b
commit 74ac1e5141
3 changed files with 46 additions and 2 deletions

View file

@ -60,6 +60,24 @@ class moduleController extends module
return $output;
}
/**
* @brief Add trigger callback function
*
* @param string $trigger_name
* @param string $called_position
* @param callable $callback_function
*/
function insertTriggerFunction($trigger_name, $called_position, $callback_function)
{
if(!isset($GLOBALS['__trigger_functions__']))
{
$GLOBALS['__trigger_functions__'] = array();
}
$GLOBALS['__trigger_functions__'][$trigger_name][$called_position][] = $callback_function;
return true;
}
/**
* @brief Add module trigger
* module trigger is to call a trigger to a target module