PluginProbe ʕ •ᴥ•ʔ
Matomo Analytics – Powerful, Privacy-First Insights for WordPress / trunk
Matomo Analytics – Powerful, Privacy-First Insights for WordPress vtrunk
5.11.1 5.11.0 5.10.2 5.10.1 trunk 1.0.2 1.0.3 1.0.4 1.0.5 1.0.6 1.1.0 1.1.1 1.1.2 1.1.3 1.2.0 1.3.0 1.3.1 1.3.2 4.0.0 4.0.1 4.0.2 4.0.3 4.0.4 4.1.0 4.1.1 4.1.2 4.1.3 4.10.0 4.11.0 4.12.0 4.13.0 4.13.2 4.13.3 4.13.4 4.13.5 4.14.0 4.14.1 4.14.2 4.15.0 4.15.1 4.15.2 4.15.3 4.2.0 4.3.0 4.3.1 4.4.1 4.4.2 4.5.0 4.6.0 5.0.1 5.0.2 5.0.3 5.0.4 5.0.5 5.0.6 5.0.7 5.0.8 5.1.0 5.1.1 5.1.2 5.1.3 5.1.4 5.1.5 5.1.6 5.1.7 5.10.0 5.2.0 5.2.1 5.2.2 5.3.0 5.3.1 5.3.2 5.3.3 5.6.0 5.6.1 5.7.0 5.7.1 5.8.0 5.8.1 5.8.2
matomo / app / core / Tracker / Config / ThirdPartyCookies.php
matomo / app / core / Tracker / Config Last commit date
ThirdPartyCookies.php 4 months ago
ThirdPartyCookies.php
92 lines
1 <?php
2
3 namespace Piwik\Tracker\Config;
4
5 use Piwik\Piwik;
6 use Piwik\Settings\Interfaces\ConfigSettingInterface;
7 use Piwik\Settings\Interfaces\PolicyComparisonInterface;
8 use Piwik\Settings\Interfaces\SettingValueInterface;
9 use Piwik\Settings\Interfaces\Traits\PolicyComparisonTrait;
10 use Piwik\Settings\Interfaces\Traits\Getters\ConfigGetterTrait;
11 use Piwik\Policy\CnilPolicy;
12 /**
13 * @implements ConfigSettingInterface<bool|null>
14 * @implements PolicyComparisonInterface<bool|null>
15 * @implements SettingValueInterface<bool|null>
16 */
17 class ThirdPartyCookies implements ConfigSettingInterface, PolicyComparisonInterface, SettingValueInterface
18 {
19 /**
20 * @use ConfigGetterTrait<bool|null>
21 */
22 use ConfigGetterTrait;
23 /**
24 * @use PolicyComparisonTrait<bool|null>
25 */
26 use PolicyComparisonTrait;
27 /**
28 * @var bool|null
29 */
30 private $value;
31 private function __construct(?bool $value)
32 {
33 $this->value = $value;
34 }
35 protected static function getConfigSection() : string
36 {
37 return 'Tracker';
38 }
39 protected static function getConfigSettingName() : string
40 {
41 return 'use_third_party_id_cookie';
42 }
43 public static function getPolicyRequirements() : array
44 {
45 return [CnilPolicy::class => \false];
46 }
47 public static function isCompliant(string $policy, ?int $idSite = null) : bool
48 {
49 $policyValues = self::getPolicyRequirements();
50 if (!array_key_exists($policy, $policyValues)) {
51 return \true;
52 }
53 $currentValue = self::getInstance($idSite)->getValue();
54 return $currentValue === $policyValues[$policy];
55 }
56 public static function getComplianceRequirementNote(?int $idSite = null) : string
57 {
58 return Piwik::translate('General_ThirdPartyCookieSettingNote');
59 }
60 protected static function compareStrictness($value1, $value2) : bool
61 {
62 if ($value1 === \true && $value2 === \true) {
63 return \true;
64 }
65 return \false;
66 }
67 public static function getTitle() : string
68 {
69 return Piwik::translate('General_ThirdPartyCookieSettingTitle');
70 }
71 public static function getInstance(?int $idSite = null) : self
72 {
73 $values = self::getPolicyRequiredValues($idSite);
74 $configValue = self::getConfigValue($idSite);
75 if ($configValue === null) {
76 // Without site ID
77 $configValue = self::getConfigValue();
78 }
79 $values['config'] = $configValue;
80 $strictest = self::getStrictestValueFromArray($values);
81 return new self($strictest);
82 }
83 public function getValue()
84 {
85 return $this->value;
86 }
87 public static function getInlineHelp() : string
88 {
89 return '';
90 }
91 }
92