[Changed] Usercentrics-Class constants and adjust glob-code to it

This commit is contained in:
MaxBUhe 2024-05-31 15:18:26 +02:00
parent bbd7b5ec95
commit 1dd353ce58
3 changed files with 29 additions and 27 deletions

View File

@ -7,8 +7,19 @@ namespace D3\GoogleAnalytics4\Application\Model\CMP;
use D3\GoogleAnalytics4\Application\Model\ManagerTypes; 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 class Usercentrics extends ConsentManagementPlatformBaseModel
{ {
const sCMPName = ManagerTypes::USERCENTRICS_MANUALLY; const sExternalIncludationPublicName = "( Externe Einbindung ) Usercentrics";
const sAlternatename = ManagerTypes::USERCENTRICS_MODULE; const sExternalIncludationInternalName = "usercentrics";
const sModuleIncludationPublicName = "( Modul ) Usercentrics";
const sModuleIncludationInternalName = "oxps_usercentrics";
} }

View File

@ -2,6 +2,8 @@
namespace D3\GoogleAnalytics4\Application\Model; namespace D3\GoogleAnalytics4\Application\Model;
use D3\GoogleAnalytics4\Application\Model\CMP\Usercentrics;
class ManagerTypes class ManagerTypes
{ {
#ToDo: make own classes for each of the manager #ToDo: make own classes for each of the manager
@ -14,23 +16,9 @@ class ManagerTypes
* Further information's: * Further information's:
* https://github.com/aggrosoft/oxid-cookie-compliance * https://github.com/aggrosoft/oxid-cookie-compliance
*/ */
const AGCOOKIECOMPLIANCE = "agcookiecompliance"; const AGCOOKIECOMPLIANCE = "Aggrosoft Cookie Compliance";
/** const CONSENTMANAGER = "Consentmanager";
* 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, "externalService" => self::EXTERNAL_SERVICE,
"agcookiecompliance" => self::AGCOOKIECOMPLIANCE, "agcookiecompliance" => self::AGCOOKIECOMPLIANCE,
"net_cookie_manager" => self::NET_COOKIE_MANAGER, "net_cookie_manager" => self::NET_COOKIE_MANAGER,
"oxps_usercentrics" => self::USERCENTRICS_MODULE, Usercentrics::sModuleIncludationInternalName => Usercentrics::sModuleIncludationPublicName,
"usercentrics" => self::USERCENTRICS_MANUALLY, Usercentrics::sExternalIncludationInternalName => Usercentrics::sExternalIncludationPublicName,
"consentmanager" => self::CONSENTMANAGER, "cmconsentmanager" => self::CONSENTMANAGER,
"cookiefirst" => self::COOKIEFIRST, "cookiefirst" => self::COOKIEFIRST,
"cookiebot" => self::COOKIEBOT, "cookiebot" => self::COOKIEBOT,
]; ];

View File

@ -104,8 +104,8 @@ class ViewConfig extends ViewConfig_parent
// UserCentrics or consentmanager // UserCentrics or consentmanager
if ( if (
$this->sCookieManagerType === ManagerTypes::USERCENTRICS_MODULE $this->sCookieManagerType === Usercentrics::sModuleIncludationInternalName
or $this->sCookieManagerType === ManagerTypes::USERCENTRICS_MANUALLY or $this->sCookieManagerType === Usercentrics::sExternalIncludationInternalName
or $this->sCookieManagerType === ManagerTypes::CONSENTMANAGER or $this->sCookieManagerType === ManagerTypes::CONSENTMANAGER
or $this->sCookieManagerType === ManagerTypes::COOKIEFIRST or $this->sCookieManagerType === ManagerTypes::COOKIEFIRST
or $this->sCookieManagerType === ManagerTypes::COOKIEBOT or $this->sCookieManagerType === ManagerTypes::COOKIEBOT
@ -134,8 +134,8 @@ class ViewConfig extends ViewConfig_parent
} }
if ( if (
$this->sCookieManagerType === ManagerTypes::USERCENTRICS_MODULE $this->sCookieManagerType === Usercentrics::sModuleIncludationInternalName
or $this->sCookieManagerType === ManagerTypes::USERCENTRICS_MANUALLY or $this->sCookieManagerType === Usercentrics::sExternalIncludationInternalName
) )
{ {
return 'data-usercentrics="' . $sControlParameter . '" type="text/plain" async=""'; return 'data-usercentrics="' . $sControlParameter . '" type="text/plain" async=""';
@ -252,7 +252,10 @@ class ViewConfig extends ViewConfig_parent
*/ */
public function d3IsUsercentricsCMPChosen() :bool public function d3IsUsercentricsCMPChosen() :bool
{ {
return (bool) ($this->d3GetModuleConfigParam('_HAS_STD_MANAGER') === Usercentrics::sCMPName $sCMPPubName = $this->d3GetModuleConfigParam('_HAS_STD_MANAGER');
or $this->d3GetModuleConfigParam('_HAS_STD_MANAGER') === Usercentrics::sAlternatename); $aPossibleCMP = (oxNew(ManagerTypes::class))->getManagerList();
return (bool) ($sCMPPubName === Usercentrics::sExternalIncludationInternalName
or $sCMPPubName === Usercentrics::sModuleIncludationInternalName);
} }
} }