Skip to content

Commit 46451d7

Browse files
committed
wip
1 parent 0605325 commit 46451d7

File tree

3 files changed

+9
-4
lines changed

3 files changed

+9
-4
lines changed

src/Setting.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,9 @@ public static function get(string $key, $default = null): mixed
1515
return $value;
1616
}
1717

18-
public static function boolean(string $key): bool
18+
public static function boolean(string $key, bool $default = false): bool
1919
{
20-
return (bool)self::get($key, false);
20+
return (bool)self::get($key, $default);
2121
}
2222

2323
public static function array(string $key): array

src/Settings/Blocks/Fields/IpList.php

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,12 @@ class IpList extends Field
1616
public function getValueSanitizer(): callable
1717
{
1818
return function ($value) {
19-
$ips = explode("\n", $value);
19+
$ips = [];
20+
21+
if (! is_array($value)) {
22+
$ips = explode("\n", $value);
23+
}
24+
2025
$ips = array_map('trim', $ips);
2126
$ips = array_filter($ips, function ($ip) {
2227
return filter_var($ip, FILTER_VALIDATE_IP) !== false;

src/TrackingPolicy.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ class TrackingPolicy
66
{
77
public function shouldCollectAnalytics(): bool
88
{
9-
if (Setting::boolean(SettingName::ENABLED) === false) {
9+
if (Setting::boolean(SettingName::ENABLED, true) === false) {
1010
return false;
1111
}
1212

0 commit comments

Comments
 (0)