From 928133893576f8074de2bcd77860257bae1249b9 Mon Sep 17 00:00:00 2001 From: Arcturus Date: Thu, 19 Sep 2024 20:47:46 +0900 Subject: [PATCH] update lib/common.lib.php --- AvocadoEdition_Light/lib/common.lib.php | 44 +++++++++++++++++++++++++ 1 file changed, 44 insertions(+) diff --git a/AvocadoEdition_Light/lib/common.lib.php b/AvocadoEdition_Light/lib/common.lib.php index 19604db..1d13c0f 100644 --- a/AvocadoEdition_Light/lib/common.lib.php +++ b/AvocadoEdition_Light/lib/common.lib.php @@ -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; +}