mirror of
https://github.com/slawkens/myaac.git
synced 2025-09-14 12:33:35 +02:00
Compare commits
6 Commits
Author | SHA1 | Date | |
---|---|---|---|
![]() |
d297e434b8 | ||
![]() |
c7966b7c55 | ||
![]() |
3e12f70861 | ||
![]() |
4aede4c626 | ||
![]() |
57643bb4aa | ||
![]() |
0139e4b446 |
@@ -99,4 +99,10 @@ $config['clients'] = [
|
|||||||
1291,
|
1291,
|
||||||
|
|
||||||
1300,
|
1300,
|
||||||
|
1310,
|
||||||
|
1311,
|
||||||
|
1312,
|
||||||
|
1316,
|
||||||
|
1320,
|
||||||
|
1321,
|
||||||
];
|
];
|
||||||
|
@@ -151,6 +151,10 @@ class Plugins {
|
|||||||
foreach(self::getAllPluginsJson() as $plugin) {
|
foreach(self::getAllPluginsJson() as $plugin) {
|
||||||
if (isset($plugin['hooks'])) {
|
if (isset($plugin['hooks'])) {
|
||||||
foreach ($plugin['hooks'] as $_name => $info) {
|
foreach ($plugin['hooks'] as $_name => $info) {
|
||||||
|
if (strpos($info['type'], 'HOOK_') !== false) {
|
||||||
|
$info['type'] = str_replace('HOOK_', '', $info['type']);
|
||||||
|
}
|
||||||
|
|
||||||
if (defined('HOOK_'. $info['type'])) {
|
if (defined('HOOK_'. $info['type'])) {
|
||||||
$hook = constant('HOOK_'. $info['type']);
|
$hook = constant('HOOK_'. $info['type']);
|
||||||
$hooks[] = ['name' => $_name, 'type' => $hook, 'file' => $info['file']];
|
$hooks[] = ['name' => $_name, 'type' => $hook, 'file' => $info['file']];
|
||||||
|
@@ -30,7 +30,7 @@ if($dev_mode) {
|
|||||||
}
|
}
|
||||||
unset($dev_mode);
|
unset($dev_mode);
|
||||||
|
|
||||||
$filter = new Twig_SimpleFilter('timeago', function ($datetime) {
|
$filter = new TwigFilter('timeago', function ($datetime) {
|
||||||
|
|
||||||
$time = time() - strtotime($datetime);
|
$time = time() - strtotime($datetime);
|
||||||
|
|
||||||
@@ -90,15 +90,16 @@ $function = new TwigFunction('truncate', function ($s, $n) {
|
|||||||
});
|
});
|
||||||
$twig->addFunction($function);
|
$twig->addFunction($function);
|
||||||
|
|
||||||
$function = new TwigFunction('hook', function ($hook, array $params = []) {
|
$function = new TwigFunction('hook', function ($context, $hook, array $params = []) {
|
||||||
global $hooks;
|
global $hooks;
|
||||||
|
|
||||||
if(is_string($hook)) {
|
if(is_string($hook)) {
|
||||||
$hook = constant($hook);
|
$hook = constant($hook);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$params['context'] = $context;
|
||||||
$hooks->trigger($hook, $params);
|
$hooks->trigger($hook, $params);
|
||||||
});
|
}, ['needs_context' => true]);
|
||||||
$twig->addFunction($function);
|
$twig->addFunction($function);
|
||||||
|
|
||||||
$function = new TwigFunction('config', function ($key) {
|
$function = new TwigFunction('config', function ($key) {
|
||||||
|
Reference in New Issue
Block a user