diff --git a/Application/Model/CMP/Usercentrics.php b/Application/Model/CMP/Usercentrics.php index 2c4cba4..9e13404 100644 --- a/Application/Model/CMP/Usercentrics.php +++ b/Application/Model/CMP/Usercentrics.php @@ -7,8 +7,19 @@ namespace D3\GoogleAnalytics4\Application\Model\CMP; use D3\GoogleAnalytics4\Application\Model\ManagerTypes; +/** + * Used the OXID Module. + * + * Further information's: + * https://docs.oxid-esales.com/modules/usercentrics/de/latest/einfuehrung.html + * + * Usercentrics homepage: + * https://usercentrics.com + */ class Usercentrics extends ConsentManagementPlatformBaseModel { - const sCMPName = ManagerTypes::USERCENTRICS_MANUALLY; - const sAlternatename = ManagerTypes::USERCENTRICS_MODULE; + const sExternalIncludationPublicName = "( Externe Einbindung ) Usercentrics"; + const sExternalIncludationInternalName = "usercentrics"; + const sModuleIncludationPublicName = "( Modul ) Usercentrics"; + const sModuleIncludationInternalName = "oxps_usercentrics"; } \ No newline at end of file diff --git a/Application/Model/ManagerTypes.php b/Application/Model/ManagerTypes.php index f12af76..191c9c5 100644 --- a/Application/Model/ManagerTypes.php +++ b/Application/Model/ManagerTypes.php @@ -2,6 +2,8 @@ namespace D3\GoogleAnalytics4\Application\Model; +use D3\GoogleAnalytics4\Application\Model\CMP\Usercentrics; + class ManagerTypes { #ToDo: make own classes for each of the manager @@ -14,23 +16,9 @@ class ManagerTypes * Further information's: * https://github.com/aggrosoft/oxid-cookie-compliance */ - const AGCOOKIECOMPLIANCE = "agcookiecompliance"; + const AGCOOKIECOMPLIANCE = "Aggrosoft Cookie Compliance"; - /** - * Used the OXID Module. - * - * Further information's: - * https://docs.oxid-esales.com/modules/usercentrics/de/latest/einfuehrung.html - * - * Usercentrics homepage: - * https://usercentrics.com - */ - const USERCENTRICS_MODULE = "oxps_usercentrics"; - - /** - * manually included usercentrics script - */ - const USERCENTRICS_MANUALLY = "USERCENTRICS"; + const CONSENTMANAGER = "Consentmanager"; const CONSENTMANAGER = "CONSENTMANAGER"; @@ -47,9 +35,9 @@ class ManagerTypes "externalService" => self::EXTERNAL_SERVICE, "agcookiecompliance" => self::AGCOOKIECOMPLIANCE, "net_cookie_manager" => self::NET_COOKIE_MANAGER, - "oxps_usercentrics" => self::USERCENTRICS_MODULE, - "usercentrics" => self::USERCENTRICS_MANUALLY, - "consentmanager" => self::CONSENTMANAGER, + Usercentrics::sModuleIncludationInternalName => Usercentrics::sModuleIncludationPublicName, + Usercentrics::sExternalIncludationInternalName => Usercentrics::sExternalIncludationPublicName, + "cmconsentmanager" => self::CONSENTMANAGER, "cookiefirst" => self::COOKIEFIRST, "cookiebot" => self::COOKIEBOT, ]; diff --git a/Modules/Core/ViewConfig.php b/Modules/Core/ViewConfig.php index d5f294c..3ff33db 100644 --- a/Modules/Core/ViewConfig.php +++ b/Modules/Core/ViewConfig.php @@ -104,8 +104,8 @@ class ViewConfig extends ViewConfig_parent // UserCentrics or consentmanager if ( - $this->sCookieManagerType === ManagerTypes::USERCENTRICS_MODULE - or $this->sCookieManagerType === ManagerTypes::USERCENTRICS_MANUALLY + $this->sCookieManagerType === Usercentrics::sModuleIncludationInternalName + or $this->sCookieManagerType === Usercentrics::sExternalIncludationInternalName or $this->sCookieManagerType === ManagerTypes::CONSENTMANAGER or $this->sCookieManagerType === ManagerTypes::COOKIEFIRST or $this->sCookieManagerType === ManagerTypes::COOKIEBOT @@ -134,8 +134,8 @@ class ViewConfig extends ViewConfig_parent } if ( - $this->sCookieManagerType === ManagerTypes::USERCENTRICS_MODULE - or $this->sCookieManagerType === ManagerTypes::USERCENTRICS_MANUALLY + $this->sCookieManagerType === Usercentrics::sModuleIncludationInternalName + or $this->sCookieManagerType === Usercentrics::sExternalIncludationInternalName ) { return 'data-usercentrics="' . $sControlParameter . '" type="text/plain" async=""'; @@ -252,7 +252,10 @@ class ViewConfig extends ViewConfig_parent */ public function d3IsUsercentricsCMPChosen() :bool { - return (bool) ($this->d3GetModuleConfigParam('_HAS_STD_MANAGER') === Usercentrics::sCMPName - or $this->d3GetModuleConfigParam('_HAS_STD_MANAGER') === Usercentrics::sAlternatename); + $sCMPPubName = $this->d3GetModuleConfigParam('_HAS_STD_MANAGER'); + $aPossibleCMP = (oxNew(ManagerTypes::class))->getManagerList(); + + return (bool) ($sCMPPubName === Usercentrics::sExternalIncludationInternalName + or $sCMPPubName === Usercentrics::sModuleIncludationInternalName); } } \ No newline at end of file