mirror of
https://github.com/slawkens/myaac.git
synced 2025-10-30 15:36:24 +01:00
Compare commits
10 Commits
develop
...
feature/tw
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
11a2275115 | ||
|
|
50f73ba56c | ||
|
|
7dcdc4f743 | ||
|
|
8697809bbe | ||
|
|
9af676a59e | ||
|
|
3aaf71b9b5 | ||
|
|
28d61ee12f | ||
|
|
592bfaea70 | ||
|
|
b471b1567a | ||
|
|
44fe03c6ea |
@@ -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,16 +30,14 @@ class Hooks
|
||||
return $ret;
|
||||
}
|
||||
|
||||
public function triggerFilter($type, $args = [])
|
||||
public function triggerFilter($type, &$args): void
|
||||
{
|
||||
if(isset(self::$_hooks[$type])) {
|
||||
foreach(self::$_hooks[$type] as $hook) {
|
||||
/** @var Hook $hook */
|
||||
$args = $hook->executeFilter(...$args);
|
||||
$hook->executeFilter($args);
|
||||
}
|
||||
}
|
||||
|
||||
return $args;
|
||||
}
|
||||
|
||||
public function exist($type): bool {
|
||||
|
||||
@@ -198,6 +198,9 @@ class Plugins {
|
||||
}
|
||||
}
|
||||
|
||||
global $hooks;
|
||||
$hooks->triggerFilter(HOOK_FILTER_ROUTES, $routes);
|
||||
|
||||
usort($routes, function ($a, $b)
|
||||
{
|
||||
// key 3 is priority
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
@@ -98,6 +98,7 @@ define('HOOK_INSTALL_FINISH', ++$i);
|
||||
define('HOOK_INSTALL_FINISH_END', ++$i);
|
||||
|
||||
// hook filters
|
||||
define('HOOK_FILTER_ROUTES', ++$i);
|
||||
define('HOOK_FILTER_TWIG_DISPLAY', ++$i);
|
||||
define('HOOK_FILTER_TWIG_RENDER', ++$i);
|
||||
define('HOOK_FILTER_THEME_FOOTER', ++$i);
|
||||
|
||||
Reference in New Issue
Block a user