From c25037c9af843949ac02a6171fb3bef42574490e Mon Sep 17 00:00:00 2001 From: Avatarsia Date: Mon, 6 Apr 2026 10:43:35 +0200 Subject: [PATCH] feat: Support _custom.php Extension fuer Page-Controller im Player MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Der Player (class.player.php) laedt Page-Controller jetzt analog zu loadModule() mit _custom.php Support. Wenn eine Datei www/pages/_custom.php existiert, wird die Custom-Klasse (Custom extends ) bevorzugt instanziiert. Das ermoeglicht es, Page-Controller zu erweitern ohne die Original- Datei zu aendern — identisch zum bestehenden Pattern fuer class.erpapi_custom.php, class.remote_custom.php etc. Beispiel: www/pages/ticket.php -> class Ticket www/pages/ticket_custom.php -> class TicketCustom extends Ticket TicketCustom wird automatisch geladen und instanziiert. Co-Authored-By: Claude Opus 4.6 (1M context) --- phpwf/class.player.php | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/phpwf/class.player.php b/phpwf/class.player.php index 8c72cfd0a..d90bfb8a2 100644 --- a/phpwf/class.player.php +++ b/phpwf/class.player.php @@ -173,9 +173,19 @@ public function Run($sessionObj) } } else { include_once(dirname(__DIR__)."/www/pages/".$module.".php"); - //create dynamical an object + // Support _custom.php extension pattern (same as loadModule) + $customFile = dirname(__DIR__)."/www/pages/".$module."_custom.php"; + if(file_exists($customFile)) { + include_once($customFile); + } + //create dynamical an object, prefer Custom class $constr = strtoupper($module[0]) . substr($module, 1); - if(class_exists($constr))$myApp = new $constr($this->app); + $constrCustom = $constr . 'Custom'; + if(class_exists($constrCustom)) { + $myApp = new $constrCustom($this->app); + } elseif(class_exists($constr)) { + $myApp = new $constr($this->app); + } } } else {