diff --git a/Application/Core/TinyMCE/Options/FilemanagerUrl.php b/Application/Core/TinyMCE/Options/FilemanagerUrl.php index 5816858..b43ca1f 100644 --- a/Application/Core/TinyMCE/Options/FilemanagerUrl.php +++ b/Application/Core/TinyMCE/Options/FilemanagerUrl.php @@ -24,8 +24,14 @@ declare(strict_types=1); namespace O3\TinyMCE\Application\Core\TinyMCE\Options; use O3\TinyMCE\Application\Core\TinyMCE\Loader; +use O3\TinyMCE\Application\Model\Constants; use OxidEsales\Eshop\Core\Registry; use OxidEsales\Eshop\Core\UtilsServer; +use OxidEsales\EshopCommunity\Internal\Container\ContainerFactory; +use OxidEsales\EshopCommunity\Internal\Framework\Module\Facade\ModuleSettingService; +use OxidEsales\EshopCommunity\Internal\Framework\Module\Facade\ModuleSettingServiceInterface; +use Psr\Container\ContainerExceptionInterface; +use Psr\Container\NotFoundExceptionInterface; class FilemanagerUrl extends AbstractOption { @@ -36,7 +42,7 @@ class FilemanagerUrl extends AbstractOption public function get(): string { /** @var string $sFilemanagerKey */ - $sFilemanagerKey = md5_file(Registry::getConfig()->getConfigParam("sShopDir")."/config.inc.php"); + $sFilemanagerKey = md5_file(rtrim(Registry::getConfig()->getConfigParam("sShopDir"), '/')."/config.inc.php"); Registry::get(UtilsServer::class)->setOxCookie("filemanagerkey", $sFilemanagerKey); return str_replace( @@ -56,6 +62,12 @@ class FilemanagerUrl extends AbstractOption */ public function requireRegistration(): bool { - return (bool) $this->loader->getShopConfig()->getConfigParam("blTinyMCE_filemanager"); + try { + /** @var ModuleSettingService $service */ + $service = ContainerFactory::getInstance()->getContainer()->get( ModuleSettingServiceInterface::class ); + return $service->getBoolean( "blTinyMCE_filemanager", Constants::OXID_MODULE_ID ); + } catch (ContainerExceptionInterface|NotFoundExceptionInterface) { + return false; + } } } diff --git a/Application/Core/TinyMCE/Options/Setup.php b/Application/Core/TinyMCE/Options/Setup.php index a0b5dab..ff977cb 100644 --- a/Application/Core/TinyMCE/Options/Setup.php +++ b/Application/Core/TinyMCE/Options/Setup.php @@ -24,6 +24,12 @@ declare(strict_types=1); namespace O3\TinyMCE\Application\Core\TinyMCE\Options; use O3\TinyMCE\Application\Core\TinyMCE\Utils; +use O3\TinyMCE\Application\Model\Constants; +use OxidEsales\EshopCommunity\Internal\Container\ContainerFactory; +use OxidEsales\EshopCommunity\Internal\Framework\Module\Facade\ModuleSettingService; +use OxidEsales\EshopCommunity\Internal\Framework\Module\Facade\ModuleSettingServiceInterface; +use Psr\Container\ContainerExceptionInterface; +use Psr\Container\NotFoundExceptionInterface; class Setup extends AbstractOption { @@ -45,6 +51,12 @@ class Setup extends AbstractOption */ public function requireRegistration(): bool { - return (bool) $this->loader->getShopConfig()->getConfigParam("blTinyMCE_filemanager"); + try { + /** @var ModuleSettingService $service */ + $service = ContainerFactory::getInstance()->getContainer()->get( ModuleSettingServiceInterface::class ); + return $service->getBoolean( "blTinyMCE_filemanager", Constants::OXID_MODULE_ID ); + } catch (ContainerExceptionInterface|NotFoundExceptionInterface) { + return false; + } } } diff --git a/Application/Core/TinyMCE/Plugins/Roxy.php b/Application/Core/TinyMCE/Plugins/Roxy.php index 0638104..44e3cbd 100644 --- a/Application/Core/TinyMCE/Plugins/Roxy.php +++ b/Application/Core/TinyMCE/Plugins/Roxy.php @@ -23,8 +23,14 @@ declare(strict_types=1); namespace O3\TinyMCE\Application\Core\TinyMCE\Plugins; +use O3\TinyMCE\Application\Model\Constants; use OxidEsales\Eshop\Core\Exception\FileException; use OxidEsales\Eshop\Core\Registry; +use OxidEsales\EshopCommunity\Internal\Container\ContainerFactory; +use OxidEsales\EshopCommunity\Internal\Framework\Module\Facade\ModuleSettingService; +use OxidEsales\EshopCommunity\Internal\Framework\Module\Facade\ModuleSettingServiceInterface; +use Psr\Container\ContainerExceptionInterface; +use Psr\Container\NotFoundExceptionInterface; class Roxy extends AbstractPlugin { @@ -52,6 +58,12 @@ class Roxy extends AbstractPlugin public function requireScript(): bool { - return (bool) Registry::getConfig()->getConfigParam("blTinyMCE_filemanager"); + try { + /** @var ModuleSettingService $service */ + $service = ContainerFactory::getInstance()->getContainer()->get( ModuleSettingServiceInterface::class ); + return $service->getBoolean( "blTinyMCE_filemanager", Constants::OXID_MODULE_ID ); + } catch (ContainerExceptionInterface|NotFoundExceptionInterface) { + return false; + } } }