From 2ee30692ff07472eb961a70c6a0c8418a8432e62 Mon Sep 17 00:00:00 2001 From: Eric Espie Date: Thu, 22 May 2025 15:02:29 +0200 Subject: [PATCH] Change deprecated calls --- sources/Application/TwigBase/Controller/Controller.php | 2 +- sources/Application/WebPage/WebPage.php | 7 ++++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/sources/Application/TwigBase/Controller/Controller.php b/sources/Application/TwigBase/Controller/Controller.php index 43d85f270..0f1a6a1e1 100644 --- a/sources/Application/TwigBase/Controller/Controller.php +++ b/sources/Application/TwigBase/Controller/Controller.php @@ -773,7 +773,7 @@ abstract class Controller extends AbstractController { // iTop 3.1 and older compatibility, if not an URI we don't know if its relative to app root or module root if (strpos($sLinkedScript, "://") === false) { - $this->m_oPage->add_linked_script($sLinkedScript); + $this->m_oPage->LinkScriptFromAppRoot(utils::LocalPath($sLinkedScript, APPROOT)); return; } diff --git a/sources/Application/WebPage/WebPage.php b/sources/Application/WebPage/WebPage.php index ae1e42ee5..1e2096a72 100644 --- a/sources/Application/WebPage/WebPage.php +++ b/sources/Application/WebPage/WebPage.php @@ -1280,18 +1280,19 @@ JS; protected function AddCompatibilityFiles(string $sFileType, string $sMode): void { $sConstantName = 'COMPATIBILITY_'.strtoupper($sMode).'_LINKED_'. ($sFileType === static::ENUM_COMPATIBILITY_FILE_TYPE_CSS ? 'STYLESHEETS' : 'SCRIPTS') .'_REL_PATH'; - $sMethodName = 'add_linked_'.($sFileType === static::ENUM_COMPATIBILITY_FILE_TYPE_CSS ? 'stylesheet' : 'script'); + $sMethodName = 'Link'.($sFileType === static::ENUM_COMPATIBILITY_FILE_TYPE_CSS ? 'Resource' : 'Script').'FromAppRoot'; + // Add ancestors files foreach (array_reverse(class_parents(static::class)) as $sParentClass) { foreach (constant($sParentClass.'::'.$sConstantName) as $sFile) { - $this->$sMethodName(utils::GetAbsoluteUrlAppRoot().$sFile); + $this->$sMethodName($sFile); } } // Add current class files foreach (constant('static::'.$sConstantName) as $sFile) { - $this->$sMethodName(utils::GetAbsoluteUrlAppRoot().$sFile); + $this->$sMethodName($sFile); } }