update lib/common.lib.php

This commit is contained in:
Amberstone 2024-09-19 20:47:46 +09:00
parent 82f776b035
commit 9281338935
Signed by: amber
GPG key ID: 094B0E55F98D8BF1

View file

@ -3313,3 +3313,47 @@ function is_include_path_check($path = '')
}
return true;
}
include_once dirname(__FILE__) . '/Hook/hook.class.php';
include_once dirname(__FILE__) . '/Hook/hook.extends.class.php';
function run_event($tag, $arg = '')
{
if ($hook = get_hook_class()) {
$args = array();
if (
is_array($arg)
&&
isset($arg[0])
&&
is_object($arg[0])
&&
1 == count($arg)
) {
$args[] =& $arg[0];
} else {
$args[] = $arg;
}
$numArgs = func_num_args();
for ($a = 2; $a < $numArgs; $a++) {
$args[] = func_get_arg($a);
}
$hook->doAction($tag, $args, false);
}
}
function get_hook_class()
{
if (class_exists('GML_Hook')) {
return GML_Hook::getInstance();
}
return null;
}