update lib/common.lib.php
This commit is contained in:
parent
82f776b035
commit
9281338935
1 changed files with 44 additions and 0 deletions
|
|
@ -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;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue