mirror of
https://github.com/slawkens/myaac.git
synced 2025-05-09 23:49:20 +02:00
triggerFilter -> pass by reference (faster x5)
This commit is contained in:
parent
99997eb57d
commit
5b4b7b8a97
@ -575,7 +575,7 @@ function template_footer(): string
|
||||
$footer[] = base64_decode('UG93ZXJlZCBieSA8YSBocmVmPSJodHRwOi8vbXktYWFjLm9yZyIgdGFyZ2V0PSJfYmxhbmsiPk15QUFDLjwvYT4=');
|
||||
|
||||
global $hooks;
|
||||
$footer = $hooks->triggerFilter(HOOK_FILTER_THEME_FOOTER, $footer);
|
||||
$hooks->triggerFilter(HOOK_FILTER_THEME_FOOTER, $footer);
|
||||
|
||||
return implode('<br/>', $footer);
|
||||
}
|
||||
|
@ -37,7 +37,7 @@ class Hook
|
||||
return !isset($ret) || $ret == 1 || $ret;
|
||||
}
|
||||
|
||||
public function executeFilter(...$args) {
|
||||
public function executeFilter(&$args) {
|
||||
return include BASE . $this->_file;
|
||||
}
|
||||
|
||||
|
@ -30,7 +30,7 @@ class Hooks
|
||||
return $ret;
|
||||
}
|
||||
|
||||
public function triggerFilter($type, $args = [])
|
||||
public function triggerFilter($type, &...$args)
|
||||
{
|
||||
if(isset(self::$_hooks[$type])) {
|
||||
foreach(self::$_hooks[$type] as $hook) {
|
||||
@ -38,8 +38,6 @@ class Hooks
|
||||
$args = $hook->executeFilter(...$args);
|
||||
}
|
||||
}
|
||||
|
||||
return $args;
|
||||
}
|
||||
|
||||
public function exist($type): bool {
|
||||
|
@ -11,7 +11,7 @@ class EnvironmentBridge extends Environment
|
||||
global $hooks;
|
||||
|
||||
$context['viewName'] = $name;
|
||||
$context = $hooks->triggerFilter(HOOK_FILTER_TWIG_DISPLAY, $context);
|
||||
$hooks->triggerFilter(HOOK_FILTER_TWIG_DISPLAY, $context);
|
||||
|
||||
parent::display($name, $context);
|
||||
}
|
||||
@ -21,7 +21,7 @@ class EnvironmentBridge extends Environment
|
||||
global $hooks;
|
||||
|
||||
$context['viewName'] = $name;
|
||||
$context = $hooks->triggerFilter(HOOK_FILTER_TWIG_RENDER, $context);
|
||||
$hooks->triggerFilter(HOOK_FILTER_TWIG_RENDER, $context);
|
||||
|
||||
return parent::render($name, $context);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user