mirror of
https://github.com/Piwigo/Piwigo.git
synced 2025-04-27 19:59:56 +03:00
small optim on events trigger when several handlers are registered (no more array_slice inside the loop)
git-svn-id: http://piwigo.org/svn/trunk@27335 68402e56-0260-453c-a942-63ccdbb3a9ee
This commit is contained in:
parent
d736f6b09a
commit
78621a3487
1 changed files with 5 additions and 3 deletions
|
@ -279,19 +279,20 @@ function trigger_event($event, $data=null)
|
|||
return $data;
|
||||
}
|
||||
$args = func_get_args();
|
||||
array_shift($args);
|
||||
|
||||
foreach ($pwg_event_handlers[$event] as $priority => $handlers)
|
||||
{
|
||||
foreach ($handlers as $handler)
|
||||
{
|
||||
$args[1] = $data;
|
||||
$args[0] = $data;
|
||||
|
||||
if (!empty($handler['include_path']))
|
||||
{
|
||||
include_once($handler['include_path']);
|
||||
}
|
||||
|
||||
$data = call_user_func_array($handler['function'], array_slice($args, 1));
|
||||
$data = call_user_func_array($handler['function'], $args);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -341,6 +342,7 @@ function trigger_action($event)
|
|||
return;
|
||||
}
|
||||
$args = func_get_args();
|
||||
array_shift($args);
|
||||
|
||||
foreach ($pwg_event_handlers[$event] as $priority => $handlers)
|
||||
{
|
||||
|
@ -351,7 +353,7 @@ function trigger_action($event)
|
|||
include_once($handler['include_path']);
|
||||
}
|
||||
|
||||
call_user_func_array($handler['function'], array_slice($args,1));
|
||||
call_user_func_array($handler['function'], $args);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue