feat: new hook: HOOK_FILTER_POT, possibility to replace POT classes

This commit is contained in:
slawkens 2025-05-24 15:51:37 +02:00
parent 7d435ff643
commit 2a335328d2
2 changed files with 11 additions and 3 deletions

View File

@ -311,9 +311,16 @@ class POT
*/ */
public function loadClass($class) public function loadClass($class)
{ {
if( preg_match('/^(I|E_)?OTS_/', $class) > 0) if( preg_match('/^(I|E_)?OTS_/', $class) > 0) {
{ global $hooks;
include_once($this->path . $class . '.php');
$include = $this->path . $class . '.php';
$args = ['include' => $include, 'class' => $class];
$hooks->triggerFilter(HOOK_FILTER_POT, $args);
$include = $args['include'];
include_once($include);
} }
} }

View File

@ -102,6 +102,7 @@ define('HOOK_FILTER_ROUTES', ++$i);
define('HOOK_FILTER_TWIG_DISPLAY', ++$i); define('HOOK_FILTER_TWIG_DISPLAY', ++$i);
define('HOOK_FILTER_TWIG_RENDER', ++$i); define('HOOK_FILTER_TWIG_RENDER', ++$i);
define('HOOK_FILTER_THEME_FOOTER', ++$i); define('HOOK_FILTER_THEME_FOOTER', ++$i);
define('HOOK_FILTER_POT', ++$i);
const HOOK_FIRST = HOOK_INIT; const HOOK_FIRST = HOOK_INIT;
define('HOOK_LAST', $i); define('HOOK_LAST', $i);