-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathConversion_Tracking_Settings.php
More file actions
83 lines (72 loc) · 1.63 KB
/
Copy pathConversion_Tracking_Settings.php
File metadata and controls
83 lines (72 loc) · 1.63 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
<?php
/**
* Class Google\Site_Kit\Core\Conversion_Tracking\Conversion_Tracking_Settings
*
* @package Google\Site_Kit\Core\Conversion_Tracking
* @copyright 2024 Google LLC
* @license https://www.apache.org/licenses/LICENSE-2.0 Apache License 2.0
* @link https://sitekit.withgoogle.com
*/
namespace Google\Site_Kit\Core\Conversion_Tracking;
use Google\Site_Kit\Core\Storage\Setting;
/**
* Class to store conversion tracking settings.
*
* @since 1.127.0
* @access private
* @ignore
*/
class Conversion_Tracking_Settings extends Setting {
/**
* The option name for this setting.
*/
const OPTION = 'googlesitekit_conversion_tracking';
/**
* Gets the expected value type.
*
* @since 1.127.0
*
* @return string The expected type of the setting option.
*/
protected function get_type() {
return 'object';
}
/**
* Gets the default value.
*
* @since 1.127.0
*
* @return array The default value.
*/
protected function get_default() {
return array(
'enabled' => false,
);
}
/**
* Gets the callback for sanitizing the setting's value before saving.
*
* @since 1.127.0
*
* @return callable Sanitize callback.
*/
protected function get_sanitize_callback() {
return function ( $value ) {
$new_value = $this->get();
if ( isset( $value['enabled'] ) ) {
$new_value['enabled'] = (bool) $value['enabled'];
}
return $new_value;
};
}
/**
* Accessor for the `enabled` setting.
*
* @since 1.127.0
*
* @return bool TRUE if conversion tracking is enabled, otherwise FALSE.
*/
public function is_conversion_tracking_enabled() {
return $this->get()['enabled'];
}
}