mirror of
https://github.com/Lastorder-DC/rhymix.git
synced 2026-04-02 01:52:10 +09:00
Allow triggers to call arbitrary functions
This commit is contained in:
parent
9f35a3c95b
commit
74ac1e5141
3 changed files with 46 additions and 2 deletions
|
|
@ -1207,9 +1207,9 @@ class ModuleHandler extends Handler
|
|||
|
||||
$oModuleModel = getModel('module');
|
||||
$triggers = $oModuleModel->getTriggers($trigger_name, $called_position);
|
||||
if(!$triggers || count($triggers) < 1)
|
||||
if(!$triggers)
|
||||
{
|
||||
return new Object();
|
||||
$triggers = array();
|
||||
}
|
||||
|
||||
//store before trigger call time
|
||||
|
|
@ -1252,6 +1252,17 @@ class ModuleHandler extends Handler
|
|||
unset($oModule);
|
||||
}
|
||||
|
||||
$trigger_functions = $oModuleModel->getTriggerFunctions($trigger_name, $called_position);
|
||||
foreach($trigger_functions as $item)
|
||||
{
|
||||
$item($obj);
|
||||
|
||||
if(is_object($output) && method_exists($output, 'toBool') && !$output->toBool())
|
||||
{
|
||||
return $output;
|
||||
}
|
||||
}
|
||||
|
||||
return new Object();
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue