From 2a335328d234c3bc4936a1a7684bf9700b494896 Mon Sep 17 00:00:00 2001 From: slawkens Date: Sat, 24 May 2025 15:51:37 +0200 Subject: [PATCH] feat: new hook: HOOK_FILTER_POT, possibility to replace POT classes --- system/libs/pot/OTS.php | 13 ++++++++++--- system/src/global.php | 1 + 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/system/libs/pot/OTS.php b/system/libs/pot/OTS.php index fb93afea..a90c6cfd 100644 --- a/system/libs/pot/OTS.php +++ b/system/libs/pot/OTS.php @@ -311,9 +311,16 @@ class POT */ public function loadClass($class) { - if( preg_match('/^(I|E_)?OTS_/', $class) > 0) - { - include_once($this->path . $class . '.php'); + if( preg_match('/^(I|E_)?OTS_/', $class) > 0) { + global $hooks; + + $include = $this->path . $class . '.php'; + + $args = ['include' => $include, 'class' => $class]; + $hooks->triggerFilter(HOOK_FILTER_POT, $args); + + $include = $args['include']; + include_once($include); } } diff --git a/system/src/global.php b/system/src/global.php index 62366c1c..e4dfec58 100644 --- a/system/src/global.php +++ b/system/src/global.php @@ -102,6 +102,7 @@ define('HOOK_FILTER_ROUTES', ++$i); define('HOOK_FILTER_TWIG_DISPLAY', ++$i); define('HOOK_FILTER_TWIG_RENDER', ++$i); define('HOOK_FILTER_THEME_FOOTER', ++$i); +define('HOOK_FILTER_POT', ++$i); const HOOK_FIRST = HOOK_INIT; define('HOOK_LAST', $i);