taskman_bhl/bhl_macro.inc.php

34 lines
805 B
PHP
Raw Permalink Normal View History

2023-05-26 12:00:22 +03:00
<?php
/**
* @global
*/
function macro_BHL_REF($proc, $module, $func, $signature_json = '')
2023-05-26 12:00:22 +03:00
{
//let's try the .local override first
$module_file = \taskman\bhl_map_module_to_file($module.".local");
if($module_file)
{
$module .= '.local';
$func .= '_Local';
}
else
{
$module_file = \taskman\bhl_map_module_to_file($module);
if(!$module_file)
throw new Exception("Module not found '{$module}'");
}
2023-05-26 12:00:22 +03:00
//validate signature only if it's explicitely passed
if($signature_json)
{
$signature = json_decode($signature_json, false);
if(!is_array($signature))
throw new Exception("Signature is invalid '$module'");
\taskman\bhl_validate_func_ref($module_file, $func, $signature);
2023-05-26 12:00:22 +03:00
}
return array('module' => ltrim($module, '/'), 'fn' => $func);
2023-05-26 12:00:22 +03:00
}