-
Notifications
You must be signed in to change notification settings - Fork 16
Expand file tree
/
Copy pathBlogThemeUtil.php
More file actions
46 lines (40 loc) · 1.19 KB
/
Copy pathBlogThemeUtil.php
File metadata and controls
46 lines (40 loc) · 1.19 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
<?php
namespace Module\Blog\Util;
use Module\Blog\Type\BlogDarkModeType;
class BlogThemeUtil
{
public static function isDarkAuto()
{
if (!modstart_config('Blog_DarkModeEnable', false)) {
return false;
}
$type = modstart_config('Blog_DarkModeType', BlogDarkModeType::AUTO);
return BlogDarkModeType::AUTO == $type;
}
public static function isDarkTime()
{
if (!modstart_config('Blog_DarkModeEnable', false)) {
return false;
}
$type = modstart_config('Blog_DarkModeType', BlogDarkModeType::AUTO);
if (BlogDarkModeType::TIME == $type) {
$start = modstart_config('Blog_DarkModeStart');
$end = modstart_config('Blog_DarkModeEnd');
if (!$start || !$end) {
return false;
}
$time = date('H:i:s');
if ($end > $start) {
if ($time > $start && $time < $end) {
return true;
}
} else {
if ($time < $end || $time > $start) {
return true;
}
}
return false;
}
return false;
}
}