PluginProbe
Metricool – Social media and site statistics / trunk
Metricool – Social media and site statistics vtrunk
2.1.0 2.0.2 2.0.1 2.0.0 1.27 trunk
← All changes | app/Services/TrackingScriptService.php +7 -4 2.0.2trunk View file →
@@ -5,14 +5,17 @@
5 5 namespace Metricool\Services;
6 6
7 7 class TrackingScriptService
8 8 {
9 + public const OPTION_TRACKING_HASH = 'metricool_tracking_script_hash';
10 + public const OPTION_TRACKING_ACTIVE = 'metricool_tracking_script_active';
11 +
9 12 /**
10 13 * Stores the tracking hash in the database
11 14 */
12 15 public function storeTrackingHash(string $hash): self
13 16 {
14 - update_option('metricool_tracking_script_hash', $hash);
17 + update_option(self::OPTION_TRACKING_HASH, $hash, true);
15 18
16 19 return $this;
17 20 }
18 21
@@ -17,9 +20,9 @@
17 20 }
18 21
19 22 public function activateTrackingWidget(): self
20 23 {
21 - update_option('metricool_tracking_script_active', true);
24 + update_option(self::OPTION_TRACKING_ACTIVE, true, true);
22 25
23 26 return $this;
24 27 }
25 28
@@ -27,9 +30,9 @@
27 30 * Returns if the user has enabled the widget in the settings
28 31 */
29 32 public function isTrackingWidgetActive(): bool
30 33 {
31 - return (bool) get_option('metricool_tracking_script_active', false);
34 + return (bool) get_option(self::OPTION_TRACKING_ACTIVE, false);
32 35 }
33 36
34 37 /**
35 38 * Returns the hash from settings
@@ -35,7 +38,7 @@
35 38 * Returns the hash from settings
36 39 */
37 40 public function getTrackingHash(): string
38 41 {
39 - return (string) get_option('metricool_tracking_script_hash', '');
42 + return (string) get_option(self::OPTION_TRACKING_HASH, '');
40 43 }
41 44 }