PluginProbe
Darkify – Dark Mode & Night Mode for Website & Admin (Dark Theme Included) / 1.4.6
Darkify – Dark Mode & Night Mode for Website & Admin (Dark Theme Included) v1.4.6
2.1.3 2.1.2 2.1.1 2.1.0 2.0.4 2.0.3 2.0.2 2.0.1 2.0.0 1.5.5 1.5.4 1.5.3 1.5.2 1.5.1 1.5.0 trunk 1.0.1 1.1.0 1.2.0 1.2.1 1.2.2 1.2.3 1.2.4 1.2.5 1.3.0 All 57 releases
← All changes | src/Frontend/Templates/header_script.php +73 -273 2.0.01.4.6 View file →
@@ -1,77 +1,37 @@
1 1 <?php
2 2
3 -use ThemeAtelier\Darkify\Includes\DarkifyUtils;
3 +use ThemeAtelier\Darkify\Helpers\DarkifyUtils;
4 4
5 -// don't call the file directly.
6 -if (!defined('ABSPATH')) {
7 - exit;
8 -}
9 -
10 5 ob_start();
11 6 $options = get_option('darkify');
12 -// Controls
13 7 $enable_default_dark_mode = isset($options['enable_default_dark_mode']) ? $options['enable_default_dark_mode'] : '';
14 8 $enable_os_aware = isset($options['enable_os_aware']) ? $options['enable_os_aware'] : true;
15 9 $enable_keyboard_shortcut = isset($options['enable_keyboard_shortcut']) ? $options['enable_keyboard_shortcut'] : true;
16 -$keyboard_shortcut_keys = isset($options['keyboard_shortcut_keys']) && $options['keyboard_shortcut_keys'] ? $options['keyboard_shortcut_keys'] : 'ctrl+alt+d';
17 10 $enable_time = isset($options['enable_time']) ? $options['enable_time'] : "";
18 11 $enable_time_based_dark = isset($enable_time['enable_time_based_dark']) ? $enable_time['enable_time_based_dark'] : "";
19 -$enable_time_fields = isset($enable_time['enable_time_fields']) ? $enable_time['enable_time_fields'] : '';
20 -$time_based_dark_start = isset($enable_time_fields['time_based_dark_start']) ? $enable_time_fields['time_based_dark_start'] : "";
21 -$time_based_dark_stop = isset($enable_time_fields['time_based_dark_end']) ? $enable_time_fields['time_based_dark_end'] : "";
12 +$time_based_dark_start = isset($enable_time['time_based_dark_start']['from']) ? $enable_time['time_based_dark_start']['from'] : "";
13 +$time_based_dark_stop = isset($enable_time['time_based_dark_start']['to']) ? $enable_time['time_based_dark_start']['to'] : "";
22 14
23 15 // Extras
24 -$enable_scrollbar_dark = isset($options["enable_scrollbar_dark"]) ? $options["enable_scrollbar_dark"] : false;
25 -$enable_frontend_iframe_dark_mode = isset($options['enable_frontend_iframe_dark_mode']) ? $options['enable_frontend_iframe_dark_mode'] : true;
26 -$enable_switch_dragging = isset($options['enable_switch_dragging']) ? $options['enable_switch_dragging'] : "";
27 -$enable_switch_attention = isset($options['enable_switch_attention']) ? $options['enable_switch_attention'] : '';
28 -$switch_attention_effect = isset($options['switch_attention_effect']) ? $options['switch_attention_effect'] : 'pulse';
29 -$disallowed_elements = isset($options['disallowed_elements']) ? DarkifyUtils::normalize_restriction_class($options['disallowed_elements']) : "";
30 -
31 -$disallowed_elements_force_to_correct = isset($options['disallowed_elements_force_to_correct']) ? $options['disallowed_elements_force_to_correct'] : true;
32 -$allowed_elements_force_to_correct = isset($options['allowed_elements_force_to_correct']) ? $options['allowed_elements_force_to_correct'] : true;
33 -$allowed_elements = isset($options['allowed_elements']) ? DarkifyUtils::normalize_restriction_class($options['allowed_elements']) : "";
34 -
16 +$enable_scrollbar_dark = isset($options["enable_scrollbar_dark"]) ? $options["enable_scrollbar_dark"] : true;
35 17 $alternative_dark_mode_switcher = isset($options['alternative_dark_mode_switcher']) ? $options['alternative_dark_mode_switcher'] : "";
36 18
37 -
38 19 // Image Control
39 20 $brightness = isset($options['brightness']) ? $options['brightness'] : "";
40 -$enable_low_image_brightness = isset($brightness['enable_low_image_brightness']) ? $brightness['enable_low_image_brightness'] : '1';
21 +$enable_low_image_brightness = isset($brightness['enable_low_image_brightness']) ? $brightness['enable_low_image_brightness'] : "1";
41 22 $low_image_brightness_label = isset($brightness['low_image_brightness_label']) ? 100 - $brightness['low_image_brightness_label'] : 100 - "20";
42 -$disallowed_low_brightness_images = isset($brightness['disallowed_low_brightness_images']) ? DarkifyUtils::normalize_image_urls($brightness['disallowed_low_brightness_images']) : "";
43 23
44 24 $grayscale = isset($options['grayscale']) ? $options['grayscale'] : "";
45 25 $enable_image_grayscale = isset($grayscale['enable_image_grayscale']) ? $grayscale['enable_image_grayscale'] : "";
46 26 $image_grayscale_label = isset($grayscale['image_grayscale_label']) ? $grayscale['image_grayscale_label'] : "80";
47 -$disallowed_low_grayscale_images = isset($grayscale['disallowed_low_grayscale_images']) ? DarkifyUtils::normalize_image_urls($grayscale['disallowed_low_grayscale_images']) : "";
48 27
49 28 $darken_background = isset($options['darken_background']) ? $options['darken_background'] : "";
50 29 $enable_low_image_darken = isset($darken_background['enable_low_image_darken']) ? $darken_background['enable_low_image_darken'] : "1";
51 -$low_image_darken_label = isset($darken_background['low_image_darken_label']) ? $darken_background['low_image_darken_label'] : '60';
30 +$low_image_darken_label = isset($darken_background['low_image_darken_label']) ? $darken_background['low_image_darken_label'] : "60";
52 31
53 32 $enable_invert_inline_svg = isset($options['enable_invert_inline_svg']) ? $options['enable_invert_inline_svg'] : "";
54 33
55 -$invert = isset($options['invert']) ? $options['invert'] : "";
56 -$enable_invert_images = isset($invert['enable_invert_images']) ? $invert['enable_invert_images'] : "";
57 -$invert_images_allowed_urls = !empty($invert['invert_images_allowed_urls']) ? DarkifyUtils::normalize_image_urls($invert['invert_images_allowed_urls']) : "";
58 -
59 -if ($invert_images_allowed_urls !== "") {
60 - $invert_images_allowed_urls_explode = explode(',', $invert_images_allowed_urls);
61 - $invert_images_allowed_urls_arr = json_encode($invert_images_allowed_urls_explode);
62 -} else {
63 - $invert_images_allowed_urls_arr = "[]";
64 -}
65 -
66 -$normal_image_replacements = isset($options["image_replacements"][0]['normal_image']) ? $options["image_replacements"][0]['normal_image'] : '';
67 -$dark_image_replacements = isset($options["image_replacements"][0]['dark_image']) ? $options["image_replacements"][0]['dark_image'] : '';
68 -if ($normal_image_replacements || $dark_image_replacements) {
69 - $image_replacements = json_encode($options["image_replacements"]);
70 -} else {
71 - $image_replacements = "";
72 -}
73 -
74 34 // Video Control
75 35 $video_brightness = isset($options['video_brightness']) ? $options['video_brightness'] : "";
76 36 $enable_low_video_brightness = isset($video_brightness['enable_low_video_brightness']) ? $video_brightness['enable_low_video_brightness'] : true;
77 37 $low_video_brightness_label = isset($video_brightness['low_video_brightness_label']) ? 100 - $video_brightness['low_video_brightness_label'] : 100 - "20";
@@ -79,17 +39,10 @@
79 39 $video_grayscale = isset($options['video_grayscale']) ? $options['video_grayscale'] : '';
80 40 $enable_video_grayscale = isset($video_grayscale['enable_video_grayscale']) ? $video_grayscale['enable_video_grayscale'] : "";
81 41 $video_grayscale_label = isset($video_grayscale['video_grayscale_label']) ? $video_grayscale['video_grayscale_label'] : "80";
82 42
83 -$normal_video_replacements = isset($options["video_replacements"][0]["normal_video"]) ? $options["video_replacements"][0]["normal_video"] : '';
84 -$dark_video_replacements = isset($options["video_replacements"][0]["dark_video"]) ? $options["video_replacements"][0]["dark_video"] : '';
85 -if ($normal_video_replacements || $dark_video_replacements) {
86 - $video_replacements = json_encode($options["video_replacements"]);
87 -} else {
88 - $video_replacements = "[]";
89 -}
43 +
90 44 if (!is_admin()) { ?>
91 - <script type="text/javascript" class="darkify_inline_js">(function(){var s=localStorage.darkify_last_state,t=localStorage.darkify_selected_theme||'set1';if(s==='1'){var h=document.documentElement;h.classList.add('darkify_dark_mode_enabled');h.classList.add('darkify-'+t);}}());</script>
92 45 <style type="text/css" class="darkify_inline_css">
93 46 :root {
94 47 <?php
95 48 $dark_mode_color_palettes = [
@@ -95,172 +48,83 @@
95 48 $dark_mode_color_palettes = [
96 49 'set1' => [
97 50 'bg' => isset($options["dark_mode_color_set1"]) ? $options["dark_mode_color_set1"]['background'] : '#0F0F0F',
98 51 'secondary_bg' => isset($options["dark_mode_color_set1"]) ? $options["dark_mode_color_set1"]['secondary_background'] : '#171717',
99 - 'text_color' => isset($options["dark_mode_link_color_set1"]) ? $options["dark_mode_link_color_set1"]['text'] : '#BEBEBE',
100 - 'link_color' => isset($options["dark_mode_link_color_set1"]) ? $options["dark_mode_link_color_set1"]['color'] : '#E7E7E7',
101 - 'link_hover_color' => isset($options["dark_mode_link_color_set1"]) ? $options["dark_mode_link_color_set1"]['hover'] : '#BEBEBE',
102 - 'input_bg' => isset($options["dark_mode_input_color_set1"]) ? $options["dark_mode_input_color_set1"]['background'] : '#2D2D2D',
103 - 'input_text_color' => isset($options["dark_mode_input_color_set1"]) ? $options["dark_mode_input_color_set1"]['color'] : '#BEBEBE',
104 - 'input_placeholder_color' => isset($options["dark_mode_input_color_set1"]) ? $options["dark_mode_input_color_set1"]['placeholder'] : '#BEBEBE',
105 - 'border_color' => isset($options["dark_mode_border_color_set1"]) ? $options["dark_mode_border_color_set1"] : '#4A4A4A',
106 - 'btn_text_color' => isset($options["dark_mode_btn_color_set1"]) ? $options["dark_mode_btn_color_set1"]['color'] : '#BEBEBE',
107 - 'btn_bg' => isset($options["dark_mode_btn_color_set1"]) ? $options["dark_mode_btn_color_set1"]['background'] : '#4A4A4A',
108 - 'btn_text_hover_color' => isset($options["dark_mode_btn_color_set1"]) ? $options["dark_mode_btn_color_set1"]['hover_color'] : '#BEBEBE',
109 - 'btn_hover_bg' => isset($options["dark_mode_btn_color_set1"]) ? $options["dark_mode_btn_color_set1"]['hover_background'] : '#2D2D2D',
52 + 'text_color' => '#BEBEBE',
53 + 'link_color' => '#E7E7E7',
54 + 'link_hover_color' => '#BEBEBE',
55 + 'input_bg' => '#2D2D2D',
56 + 'input_text_color' => '#BEBEBE',
57 + 'input_placeholder_color' => '#BEBEBE',
58 + 'border_color' => '#4A4A4A',
59 + 'btn_text_color' => '#BEBEBE',
60 + 'btn_bg' => '#4A4A4A',
61 + 'btn_text_hover_color' => '#BEBEBE',
62 + 'btn_hover_bg' => '#2D2D2D',
110 63 ],
111 - 'set2' => [
112 - 'bg' => isset($options["dark_mode_color_set2"]) ? $options["dark_mode_color_set2"]['background'] : '#092635',
113 - 'secondary_bg' => isset($options["dark_mode_color_set2"]) ? $options["dark_mode_color_set2"]['secondary_background'] : '#081E29',
114 - 'text_color' => isset($options["dark_mode_link_color_set2"]) ? $options["dark_mode_link_color_set2"]['text'] : '#BEE0F1',
115 - 'link_color' => isset($options["dark_mode_link_color_set2"]) ? $options["dark_mode_link_color_set2"]['color'] : '#2B97CD',
116 - 'link_hover_color' => isset($options["dark_mode_link_color_set2"]) ? $options["dark_mode_link_color_set2"]['hover'] : '#BEE0F1',
117 - 'input_bg' => isset($options["dark_mode_input_color_set2"]) ? $options["dark_mode_input_color_set2"]['background'] : '#2D2D2D',
118 - 'input_text_color' => isset($options["dark_mode_input_color_set2"]) ? $options["dark_mode_input_color_set2"]['color'] : '#BEE0F1',
119 - 'input_placeholder_color' => isset($options["dark_mode_input_color_set2"]) ? $options["dark_mode_input_color_set2"]['placeholder'] : '#BEE0F1',
120 - 'border_color' => isset($options["dark_mode_border_color_set2"]) ? $options["dark_mode_border_color_set2"] : '#195979',
121 - 'btn_text_color' => isset($options["dark_mode_btn_color_set2"]) ? $options["dark_mode_btn_color_set2"]['color'] : '#BEE0F1',
122 - 'btn_bg' => isset($options["dark_mode_btn_color_set2"]) ? $options["dark_mode_btn_color_set2"]['background'] : '#195979',
123 - 'btn_text_hover_color' => isset($options["dark_mode_btn_color_set2"]) ? $options["dark_mode_btn_color_set2"]['hover_color'] : '#BEE0F1',
124 - 'btn_hover_bg' => isset($options["dark_mode_btn_color_set2"]) ? $options["dark_mode_btn_color_set2"]['hover_background'] : '#2D2D2D',
125 - ],
126 64 'set3' => [
127 65 'bg' => isset($options["dark_mode_color_set3"]) ? $options["dark_mode_color_set3"]['background'] : '#211e3c',
128 66 'secondary_bg' => isset($options["dark_mode_color_set3"]) ? $options["dark_mode_color_set3"]['secondary_background'] : '#302C57',
129 - 'text_color' => isset($options["dark_mode_link_color_set3"]) ? $options["dark_mode_link_color_set3"]['text'] : '#B1BBD8',
130 - 'link_color' => isset($options["dark_mode_link_color_set3"]) ? $options["dark_mode_link_color_set3"]['color'] : '#8071fb',
131 - 'link_hover_color' => isset($options["dark_mode_link_color_set3"]) ? $options["dark_mode_link_color_set3"]['hover'] : '#B1BBD8',
132 - 'input_bg' => isset($options["dark_mode_input_color_set3"]) ? $options["dark_mode_input_color_set3"]['background'] : '#2A264D',
133 - 'input_text_color' => isset($options["dark_mode_input_color_set3"]) ? $options["dark_mode_input_color_set3"]['color'] : '#B1BBD8',
134 - 'input_placeholder_color' => isset($options["dark_mode_input_color_set3"]) ? $options["dark_mode_input_color_set3"]['placeholder'] : '#B1BBD8',
135 - 'border_color' => isset($options["dark_mode_border_color_set3"]) ? $options["dark_mode_border_color_set3"] : '#4E478D',
136 - 'btn_text_color' => isset($options["dark_mode_btn_color_set3"]) ? $options["dark_mode_btn_color_set3"]['color'] : '#B1BBD8',
137 - 'btn_bg' => isset($options["dark_mode_btn_color_set3"]) ? $options["dark_mode_btn_color_set3"]['background'] : '#4E478D',
138 - 'btn_text_hover_color' => isset($options["dark_mode_btn_color_set3"]) ? $options["dark_mode_btn_color_set3"]['hover_color'] : '#B1BBD8',
139 - 'btn_hover_bg' => isset($options["dark_mode_btn_color_set3"]) ? $options["dark_mode_btn_color_set3"]['hover_background'] : '#2A264D',
67 + 'text_color' => '#B1BBD8',
68 + 'link_color' => '#8071fb',
69 + 'link_hover_color' => '#B1BBD8',
70 + 'input_bg' => '#2A264D',
71 + 'input_text_color' => '#B1BBD8',
72 + 'input_placeholder_color' => '#B1BBD8',
73 + 'border_color' => '#4E478D',
74 + 'btn_text_color' => '#B1BBD8',
75 + 'btn_bg' => '#4E478D',
76 + 'btn_text_hover_color' => '#B1BBD8',
77 + 'btn_hover_bg' => '#2A264D',
140 78 ],
141 - 'set4' => [
142 - 'bg' => isset($options["dark_mode_color_set4"]) ? $options["dark_mode_color_set4"]['background'] : '#1d253a',
143 - 'secondary_bg' => isset($options["dark_mode_color_set4"]) ? $options["dark_mode_color_set4"]['secondary_background'] : '#2B3655',
144 - 'text_color' => isset($options["dark_mode_link_color_set4"]) ? $options["dark_mode_link_color_set4"]['text'] : '#B1BBD8',
145 - 'link_color' => isset($options["dark_mode_link_color_set4"]) ? $options["dark_mode_link_color_set4"]['color'] : '#638eff',
146 - 'link_hover_color' => isset($options["dark_mode_link_color_set4"]) ? $options["dark_mode_link_color_set4"]['hover'] : '#B1BBD8',
147 - 'input_bg' => isset($options["dark_mode_input_color_set4"]) ? $options["dark_mode_input_color_set4"]['background'] : '#242F4C',
148 - 'input_text_color' => isset($options["dark_mode_input_color_set4"]) ? $options["dark_mode_input_color_set4"]['color'] : '#B1BBD8',
149 - 'input_placeholder_color' => isset($options["dark_mode_input_color_set4"]) ? $options["dark_mode_input_color_set4"]['placeholder'] : '#B1BBD8',
150 - 'border_color' => isset($options["dark_mode_border_color_set4"]) ? $options["dark_mode_border_color_set4"] : '#46598C',
151 - 'btn_text_color' => isset($options["dark_mode_btn_color_set4"]) ? $options["dark_mode_btn_color_set4"]['color'] : '#B1BBD8',
152 - 'btn_bg' => isset($options["dark_mode_btn_color_set4"]) ? $options["dark_mode_btn_color_set4"]['background'] : '#46598C',
153 - 'btn_text_hover_color' => isset($options["dark_mode_btn_color_set4"]) ? $options["dark_mode_btn_color_set4"]['hover_color'] : '#B1BBD8',
154 - 'btn_hover_bg' => isset($options["dark_mode_btn_color_set4"]) ? $options["dark_mode_btn_color_set4"]['hover_background'] : '#303D60',
79 + 'set9' => [
80 + 'bg' => isset($options["dark_mode_color_set9"]) ? $options["dark_mode_color_set9"]['background'] : '#04261d',
81 + 'secondary_bg' => isset($options["dark_mode_color_set9"]) ? $options["dark_mode_color_set9"]['secondary_background'] : '#021e16',
82 + 'text_color' => '#C1D2BB',
83 + 'link_color' => '#00d29a',
84 + 'link_hover_color' => '#C1D2BB',
85 + 'input_bg' => '#073d2f',
86 + 'input_text_color' => '#C1D2BB',
87 + 'input_placeholder_color' => '#C1D2BB',
88 + 'border_color' => '#095541',
89 + 'btn_text_color' => '#C1D2BB',
90 + 'btn_bg' => '#095541',
91 + 'btn_text_hover_color' => '#C1D2BB',
92 + 'btn_hover_bg' => '#073d2f',
155 93 ],
156 - 'set5' => [
157 - 'bg' => isset($options["dark_mode_color_set5"]) ? $options["dark_mode_color_set5"]['background'] : '#1b1823',
158 - 'secondary_bg' => isset($options["dark_mode_color_set5"]) ? $options["dark_mode_color_set5"]['secondary_background'] : '#352f44',
159 - 'text_color' => isset($options["dark_mode_link_color_set5"]) ? $options["dark_mode_link_color_set5"]['text'] : '#C6C1D5',
160 - 'link_color' => isset($options["dark_mode_link_color_set5"]) ? $options["dark_mode_link_color_set5"]['color'] : '#b094ff',
161 - 'link_hover_color' => isset($options["dark_mode_link_color_set5"]) ? $options["dark_mode_link_color_set5"]['hover'] : '#C6C1D5',
162 - 'input_bg' => isset($options["dark_mode_input_color_set5"]) ? $options["dark_mode_input_color_set5"]['background'] : '#403953',
163 - 'input_text_color' => isset($options["dark_mode_input_color_set5"]) ? $options["dark_mode_input_color_set5"]['color'] : '#C6C1D5',
164 - 'input_placeholder_color' => isset($options["dark_mode_input_color_set5"]) ? $options["dark_mode_input_color_set5"]['placeholder'] : '#C6C1D5',
165 - 'border_color' => isset($options["dark_mode_border_color_set5"]) ? $options["dark_mode_border_color_set5"] : '#54496f',
166 - 'btn_text_color' => isset($options["dark_mode_btn_color_set5"]) ? $options["dark_mode_btn_color_set5"]['color'] : '#C6C1D5',
167 - 'btn_bg' => isset($options["dark_mode_btn_color_set5"]) ? $options["dark_mode_btn_color_set5"]['background'] : '#54496f',
168 - 'btn_text_hover_color' => isset($options["dark_mode_btn_color_set5"]) ? $options["dark_mode_btn_color_set5"]['hover_color'] : '#C6C1D5',
169 - 'btn_hover_bg' => isset($options["dark_mode_btn_color_set5"]) ? $options["dark_mode_btn_color_set5"]['hover_background'] : '#403953',
170 - ],
171 94 'set6' => [
172 95 'bg' => isset($options["dark_mode_color_set6"]) ? $options["dark_mode_color_set6"]['background'] : '#082032',
173 96 'secondary_bg' => isset($options["dark_mode_color_set6"]) ? $options["dark_mode_color_set6"]['secondary_background'] : '#061825',
174 - 'text_color' => isset($options["dark_mode_link_color_set6"]) ? $options["dark_mode_link_color_set6"]['text'] : '#B5D9F3',
175 - 'link_color' => isset($options["dark_mode_link_color_set6"]) ? $options["dark_mode_link_color_set6"]['color'] : '#61bbff',
176 - 'link_hover_color' => isset($options["dark_mode_link_color_set6"]) ? $options["dark_mode_link_color_set6"]['hover'] : '#B5D9F3',
177 - 'input_bg' => isset($options["dark_mode_input_color_set6"]) ? $options["dark_mode_input_color_set6"]['background'] : '#0E3755',
178 - 'input_text_color' => isset($options["dark_mode_input_color_set6"]) ? $options["dark_mode_input_color_set6"]['color'] : '#B5D9F3',
179 - 'input_placeholder_color' => isset($options["dark_mode_input_color_set6"]) ? $options["dark_mode_input_color_set6"]['placeholder'] : '#B5D9F3',
180 - 'border_color' => isset($options["dark_mode_border_color_set6"]) ? $options["dark_mode_border_color_set6"] : '#144E78',
181 - 'btn_text_color' => isset($options["dark_mode_btn_color_set6"]) ? $options["dark_mode_btn_color_set6"]['color'] : '#B5D9F3',
182 - 'btn_bg' => isset($options["dark_mode_btn_color_set6"]) ? $options["dark_mode_btn_color_set6"]['background'] : '#144E78',
183 - 'btn_text_hover_color' => isset($options["dark_mode_btn_color_set6"]) ? $options["dark_mode_btn_color_set6"]['hover_color'] : '#B5D9F3',
184 - 'btn_hover_bg' => isset($options["dark_mode_btn_color_set6"]) ? $options["dark_mode_btn_color_set6"]['hover_background'] : '#0E3755',
97 + 'text_color' => '#B5D9F3',
98 + 'link_color' => '#61bbff',
99 + 'link_hover_color' => '#B5D9F3',
100 + 'input_bg' => '#0E3755',
101 + 'input_text_color' => '#B5D9F3',
102 + 'input_placeholder_color' => '#B5D9F3',
103 + 'border_color' => '#144E78',
104 + 'btn_text_color' => '#B5D9F3',
105 + 'btn_bg' => '#144E78',
106 + 'btn_text_hover_color' => '#B5D9F3',
107 + 'btn_hover_bg' => '#0E3755',
185 108 ],
186 - 'set7' => [
187 - 'bg' => isset($options["dark_mode_color_set7"]) ? $options["dark_mode_color_set7"]['background'] : '#07161b',
188 - 'secondary_bg' => isset($options["dark_mode_color_set7"]) ? $options["dark_mode_color_set7"]['secondary_background'] : '#0d242e',
189 - 'text_color' => isset($options["dark_mode_link_color_set7"]) ? $options["dark_mode_link_color_set7"]['text'] : '#C5E6F0',
190 - 'link_color' => isset($options["dark_mode_link_color_set7"]) ? $options["dark_mode_link_color_set7"]['color'] : '#33c0ec',
191 - 'link_hover_color' => isset($options["dark_mode_link_color_set7"]) ? $options["dark_mode_link_color_set7"]['hover'] : '#C5E6F0',
192 - 'input_bg' => isset($options["dark_mode_input_color_set7"]) ? $options["dark_mode_input_color_set7"]['background'] : '#19495A',
193 - 'input_text_color' => isset($options["dark_mode_input_color_set7"]) ? $options["dark_mode_input_color_set7"]['color'] : '#C5E6F0',
194 - 'input_placeholder_color' => isset($options["dark_mode_input_color_set7"]) ? $options["dark_mode_input_color_set7"]['placeholder'] : '#C5E6F0',
195 - 'border_color' => isset($options["dark_mode_border_color_set7"]) ? $options["dark_mode_border_color_set7"] : '#286F8D',
196 - 'btn_text_color' => isset($options["dark_mode_btn_color_set7"]) ? $options["dark_mode_btn_color_set7"]['color'] : '#C5E6F0',
197 - 'btn_bg' => isset($options["dark_mode_btn_color_set7"]) ? $options["dark_mode_btn_color_set7"]['background'] : '#286F8D',
198 - 'btn_text_hover_color' => isset($options["dark_mode_btn_color_set7"]) ? $options["dark_mode_btn_color_set7"]['hover_color'] : '#C5E6F0',
199 - 'btn_hover_bg' => isset($options["dark_mode_btn_color_set7"]) ? $options["dark_mode_btn_color_set7"]['hover_background'] : '#19495A',
200 - ],
201 - 'set8' => [
202 - 'bg' => isset($options["dark_mode_color_set8"]) ? $options["dark_mode_color_set8"]['background'] : '#15274C',
203 - 'secondary_bg' => isset($options["dark_mode_color_set8"]) ? $options["dark_mode_color_set8"]['secondary_background'] : '#112244',
204 - 'text_color' => isset($options["dark_mode_link_color_set8"]) ? $options["dark_mode_link_color_set8"]['text'] : '#ACC1EA',
205 - 'link_color' => isset($options["dark_mode_link_color_set8"]) ? $options["dark_mode_link_color_set8"]['color'] : '#6197ff',
206 - 'link_hover_color' => isset($options["dark_mode_link_color_set8"]) ? $options["dark_mode_link_color_set8"]['hover'] : '#ACC1EA',
207 - 'input_bg' => isset($options["dark_mode_input_color_set8"]) ? $options["dark_mode_input_color_set8"]['background'] : '#1a2f5c',
208 - 'input_text_color' => isset($options["dark_mode_input_color_set8"]) ? $options["dark_mode_input_color_set8"]['color'] : '#ACC1EA',
209 - 'input_placeholder_color' => isset($options["dark_mode_input_color_set8"]) ? $options["dark_mode_input_color_set8"]['placeholder'] : '#ACC1EA',
210 - 'border_color' => isset($options["dark_mode_border_color_set8"]) ? $options["dark_mode_border_color_set8"] : '#244892',
211 - 'btn_text_color' => isset($options["dark_mode_btn_color_set8"]) ? $options["dark_mode_btn_color_set8"]['color'] : '#ACC1EA',
212 - 'btn_bg' => isset($options["dark_mode_btn_color_set8"]) ? $options["dark_mode_btn_color_set8"]['background'] : '#244892',
213 - 'btn_text_hover_color' => isset($options["dark_mode_btn_color_set8"]) ? $options["dark_mode_btn_color_set8"]['hover_color'] : '#ACC1EA',
214 - 'btn_hover_bg' => isset($options["dark_mode_btn_color_set8"]) ? $options["dark_mode_btn_color_set8"]['hover_background'] : '#1a2f5c',
215 - ],
216 - 'set9' => [
217 - 'bg' => isset($options["dark_mode_color_set9"]) ? $options["dark_mode_color_set9"]['background'] : '#04261d',
218 - 'secondary_bg' => isset($options["dark_mode_color_set9"]) ? $options["dark_mode_color_set9"]['secondary_background'] : '#021e16',
219 - 'text_color' => isset($options["dark_mode_link_color_set9"]) ? $options["dark_mode_link_color_set9"]['text'] : '#C1D2BB',
220 - 'link_color' => isset($options["dark_mode_link_color_set9"]) ? $options["dark_mode_link_color_set9"]['color'] : '#00d29a',
221 - 'link_hover_color' => isset($options["dark_mode_link_color_set9"]) ? $options["dark_mode_link_color_set9"]['hover'] : '#C1D2BB',
222 - 'input_bg' => isset($options["dark_mode_input_color_set9"]) ? $options["dark_mode_input_color_set9"]['background'] : '#073d2f',
223 - 'input_text_color' => isset($options["dark_mode_input_color_set9"]) ? $options["dark_mode_input_color_set9"]['color'] : '#C1D2BB',
224 - 'input_placeholder_color' => isset($options["dark_mode_input_color_set9"]) ? $options["dark_mode_input_color_set9"]['placeholder'] : '#C1D2BB',
225 - 'border_color' => isset($options["dark_mode_border_color_set9"]) ? $options["dark_mode_border_color_set9"] : '#095541',
226 - 'btn_text_color' => isset($options["dark_mode_btn_color_set9"]) ? $options["dark_mode_btn_color_set9"]['color'] : '#C1D2BB',
227 - 'btn_bg' => isset($options["dark_mode_btn_color_set9"]) ? $options["dark_mode_btn_color_set9"]['background'] : '#095541',
228 - 'btn_text_hover_color' => isset($options["dark_mode_btn_color_set9"]) ? $options["dark_mode_btn_color_set9"]['hover_color'] : '#C1D2BB',
229 - 'btn_hover_bg' => isset($options["dark_mode_btn_color_set9"]) ? $options["dark_mode_btn_color_set9"]['hover_background'] : '#073d2f',
230 - ],
231 109 'set10' => [
232 110 'bg' => isset($options["dark_mode_color_set10"]) ? $options["dark_mode_color_set10"]['background'] : '#171004',
233 111 'secondary_bg' => isset($options["dark_mode_color_set10"]) ? $options["dark_mode_color_set10"]['secondary_background'] : '#211706',
234 - 'text_color' => isset($options["dark_mode_link_color_set10"]) ? $options["dark_mode_link_color_set10"]['text'] : '#E0D2BD',
235 - 'link_color' => isset($options["dark_mode_link_color_set10"]) ? $options["dark_mode_link_color_set10"]['color'] : '#e09525',
236 - 'link_hover_color' => isset($options["dark_mode_link_color_set10"]) ? $options["dark_mode_link_color_set10"]['hover'] : '#E0D2BD',
237 - 'input_bg' => isset($options["dark_mode_input_color_set10"]) ? $options["dark_mode_input_color_set10"]['background'] : '#372911',
238 - 'input_text_color' => isset($options["dark_mode_input_color_set10"]) ? $options["dark_mode_input_color_set10"]['color'] : '#E0D2BD',
239 - 'input_placeholder_color' => isset($options["dark_mode_input_color_set10"]) ? $options["dark_mode_input_color_set10"]['placeholder'] : '#E0D2BD',
240 - 'border_color' => isset($options["dark_mode_border_color_set10"]) ? $options["dark_mode_border_color_set10"] : '#5D4010',
241 - 'btn_text_color' => isset($options["dark_mode_btn_color_set10"]) ? $options["dark_mode_btn_color_set10"]['color'] : '#E0D2BD',
242 - 'btn_bg' => isset($options["dark_mode_btn_color_set10"]) ? $options["dark_mode_btn_color_set10"]['background'] : '#5D4010',
243 - 'btn_text_hover_color' => isset($options["dark_mode_btn_color_set10"]) ? $options["dark_mode_btn_color_set10"]['hover_color'] : '#E0D2BD',
244 - 'btn_hover_bg' => isset($options["dark_mode_btn_color_set10"]) ? $options["dark_mode_btn_color_set10"]['hover_background'] : '#372911',
112 + 'text_color' => '#E0D2BD',
113 + 'link_color' => '#e09525',
114 + 'link_hover_color' => '#E0D2BD',
115 + 'input_bg' => '#372911',
116 + 'input_text_color' => '#E0D2BD',
117 + 'input_placeholder_color' => '#E0D2BD',
118 + 'border_color' => '#5D4010',
119 + 'btn_text_color' => '#E0D2BD',
120 + 'btn_bg' => '#5D4010',
121 + 'btn_text_hover_color' => '#E0D2BD',
122 + 'btn_hover_bg' => '#372911',
245 123 ],
246 - 'set11' => [
247 - 'bg' => isset($options["dark_mode_color_set11"]) ? $options["dark_mode_color_set11"]['background'] : '#19081b',
248 - 'secondary_bg' => isset($options["dark_mode_color_set11"]) ? $options["dark_mode_color_set11"]['secondary_background'] : '#210a24',
249 - 'text_color' => isset($options["dark_mode_link_color_set11"]) ? $options["dark_mode_link_color_set11"]['text'] : '#c09dc2',
250 - 'link_color' => isset($options["dark_mode_link_color_set11"]) ? $options["dark_mode_link_color_set11"]['color'] : '#c832d4',
251 - 'link_hover_color' => isset($options["dark_mode_link_color_set11"]) ? $options["dark_mode_link_color_set11"]['hover'] : '#c09dc2',
252 - 'input_bg' => isset($options["dark_mode_input_color_set11"]) ? $options["dark_mode_input_color_set11"]['background'] : '#2c082f',
253 - 'input_text_color' => isset($options["dark_mode_input_color_set11"]) ? $options["dark_mode_input_color_set11"]['color'] : '#c09dc2',
254 - 'input_placeholder_color' => isset($options["dark_mode_input_color_set11"]) ? $options["dark_mode_input_color_set11"]['placeholder'] : '#c09dc2',
255 - 'border_color' => isset($options["dark_mode_border_color_set11"]) ? $options["dark_mode_border_color_set11"] : '#440649',
256 - 'btn_text_color' => isset($options["dark_mode_btn_color_set11"]) ? $options["dark_mode_btn_color_set11"]['color'] : '#c09dc2',
257 - 'btn_bg' => isset($options["dark_mode_btn_color_set11"]) ? $options["dark_mode_btn_color_set11"]['background'] : '#440649',
258 - 'btn_text_hover_color' => isset($options["dark_mode_btn_color_set11"]) ? $options["dark_mode_btn_color_set11"]['hover_color'] : '#c09dc2',
259 - 'btn_hover_bg' => isset($options["dark_mode_btn_color_set11"]) ? $options["dark_mode_btn_color_set11"]['hover_background'] : '#2c082f',
260 - ],
261 124 ];
262 125
126 +
263 127 $selected_set_key = isset($options['color_pallets']) ? $options['color_pallets'] : 'set1';
264 128 $selected_set = $dark_mode_color_palettes[$selected_set_key] ?? $dark_mode_color_palettes['set1'];
265 129
266 130 // Output as CSS variables
@@ -269,55 +133,9 @@
269 133 }
270 134 ?>
271 135 }
272 136 </style>
273 -<?php } else {
274 - /*
275 - * `dark` on <html> is the de-facto convention a React admin themes itself
276 - * off — Tailwind's class strategy, shadcn/ui, and Darkify's own React admin
277 - * (`@custom-variant dark (&:is(.dark *))`) all key on exactly this class.
278 - *
279 - * It used to be added only on Darkify's own SPA pages, which is why a
280 - * React-based admin screen from ANOTHER plugin stayed stubbornly light while
281 - * the rest of wp-admin went dark: such an app doesn't take its colours from
282 - * the cascade at all, it reads design tokens that only switch when `dark` is
283 - * present, and that class never arrived. Mirroring Admin Panel Dark Mode
284 - * onto it here — on every admin screen, not just ours — lets any app
285 - * following the convention inherit the theme with no plugin-specific
286 - * handling on either side.
287 - *
288 - * Setting it in <head> means the very first paint is already dark; the
289 - * runtime half of the mirror lives in client_main.js so the admin-bar switch
290 - * re-themes those screens live too. The `h.classList.add('dark')` call is
291 - * emitted as a static literal in the snippet below.
292 - */
293 - /*
294 - * `d` gates this FOUC snippet on Admin Panel Dark Mode actually being ON.
295 - * It used to be implicit: with the option off this template was never
296 - * included on an admin screen. Darkify's own SPA screens now always
297 - * include it (so the admin-bar icon can toggle without a reload), so
298 - * without this check a stale `darkify_admin_panel_last_state = "1"` would
299 - * darken the screen even though the option is off.
300 - *
301 - * Nested ifs, NOT `s==='1'&&d==='1'`: this whole template is printed
302 - * through wp_kses() (see the bottom of the file), whose entity
303 - * normalization rewrites a bare `&` to `&amp;` — script content is raw
304 - * text, so `&&` would reach the browser as `&amp;&amp;` and kill the
305 - * snippet with a SyntaxError. Keep this snippet free of `&` (and `<`).
306 - */
307 - /*
308 - * Effective admin darkening for THIS screen. Block Editor Dark Mode is
309 - * independent of Admin Panel Dark Mode: the block editor darkens when Block
310 - * Editor Dark Mode is on even if Admin Panel Dark Mode is off. Reused for the
311 - * runtime gate (darkify_admin_panel_dark_enabled) below.
312 - */
313 - $darkify_screen = \function_exists('get_current_screen') ? \get_current_screen() : null;
314 - $darkify_is_block_editor = $darkify_screen && \method_exists($darkify_screen, 'is_block_editor') && $darkify_screen->is_block_editor();
315 - $darkify_block_editor_dark = !empty($options['block_editor_dark_mode']);
316 - $darkify_effective_admin_dark = (!empty($options['enable_admin_panel_dark_mode']) || ($darkify_is_block_editor && $darkify_block_editor_dark)) ? '1' : '0';
317 - $darkify_admin_dark_on = $darkify_effective_admin_dark;
318 - ?>
319 - <script type="text/javascript" class="darkify_inline_js">(function(){var s=localStorage.darkify_admin_panel_last_state,t=localStorage.darkify_selected_theme||'set1',d='<?php echo esc_attr($darkify_admin_dark_on); ?>';if(s==='1'){if(d==='1'){var h=document.documentElement;h.classList.add('darkify_dark_mode_enabled');h.classList.add('darkify-'+t);h.classList.add('dark');}}}());</script>
137 +<?php } else { ?>
320 138 <style type="text/css" class="darkify_inline_css">
321 139 :root {
322 140 --darkify_dark_mode_bg: #181a1b;
323 141 --darkify_dark_mode_secondary_bg: #202324;
@@ -329,16 +147,15 @@
329 147 --darkify_dark_mode_input_placeholder_color: #989898;
330 148 --darkify_dark_mode_border_color: #4A4A4A;
331 149 --darkify_dark_mode_btn_bg: #2D2D2D;
332 150 --darkify_dark_mode_btn_text_color: #BEBEBE;
333 - --darkify_dark_mode_btn_hover_bg: #BEBEBE;
334 - --darkify_dark_mode_btn_text_hover_color: #2D2D2D;
335 151 }
336 152 </style>
337 153 <?php }
154 +
338 155 if ($enable_scrollbar_dark) {
339 - $dark_mode_scrollbar_track_bg = !empty($options["scrollbar_color"]) ? $options["scrollbar_color"]['dark_mode_scrollbar_track_bg'] : '';
340 - $dark_mode_scrollbar_thumb_bg = !empty($options["scrollbar_color"]) ? $options["scrollbar_color"]['dark_mode_scrollbar_thumb_bg'] : '';
156 + $dark_mode_scrollbar_track_bg = '#29292a';
157 + $dark_mode_scrollbar_thumb_bg = '#52565a';
341 158 include DarkifyUtils::darkify_locate_template('views/scrollbar.php');
342 159 }
343 160 ?>
344 161
@@ -347,44 +164,27 @@
347 164 var darkify_is_this_admin_panel = "<?php echo esc_attr(is_admin() ? "1" : "0"); ?>";
348 165 var darkify_enable_default_dark_mode = "<?php echo esc_attr($enable_default_dark_mode); ?>";
349 166 var darkify_enable_os_aware = "<?php echo esc_attr($enable_os_aware); ?>";
350 167 var darkify_enable_keyboard_shortcut = "<?php echo esc_attr($enable_keyboard_shortcut); ?>";
351 - var darkify_keyboard_shortcut_keys = "<?php echo esc_attr($keyboard_shortcut_keys); ?>";
352 168 var darkify_enable_time_based_dark = "<?php echo esc_attr($enable_time_based_dark); ?>";
353 - var darkify_time_based_dark_start = "<?php echo esc_attr($time_based_dark_start ? $time_based_dark_start : "19:00"); ?>";
354 - var darkify_time_based_dark_stop = "<?php echo esc_attr($time_based_dark_stop ? $time_based_dark_stop : "07:00"); ?>";
355 - var darkify_enable_switch_dragging = "<?php echo esc_attr($enable_switch_dragging); ?>";
356 - var darkify_enable_switch_attention = "<?php echo esc_attr($enable_switch_attention); ?>";
357 - var darkify_switch_attention_effect = "<?php echo esc_attr($switch_attention_effect); ?>";
358 -
169 + var darkify_time_based_dark_start = "<?php echo esc_attr($time_based_dark_start ? $time_based_dark_start : ""); ?>";
170 + var darkify_time_based_dark_stop = "<?php echo esc_attr($time_based_dark_stop ? $time_based_dark_stop : ""); ?>";
359 171 var darkify_alternative_dark_mode_switch = "<?php echo esc_attr($alternative_dark_mode_switcher); ?>";
360 - var darkify_enable_frontend_iframe_dark_mode = "<?php echo esc_attr($enable_frontend_iframe_dark_mode); ?>";
361 172 var darkify_enable_low_image_brightness = "<?php echo esc_attr($enable_low_image_brightness); ?>";
362 173 var darkify_image_brightness_to = "<?php echo esc_attr($low_image_brightness_label); ?>";
363 - var darkify_disallowed_low_brightness_images = "<?php echo esc_attr($disallowed_low_brightness_images); ?>";
364 174 var darkify_enable_image_grayscale = "<?php echo esc_attr($enable_image_grayscale); ?>";
365 175 var darkify_image_grayscale_to = "<?php echo esc_attr($image_grayscale_label); ?>";
366 - var darkify_disallowed_grayscale_images = "<?php echo esc_attr($disallowed_low_grayscale_images); ?>";
367 176 var darkify_enable_bg_image_darken = "<?php echo esc_attr($enable_low_image_darken); ?>";
368 177 var darkify_bg_image_darken_to = "<?php echo esc_attr($low_image_darken_label); ?>";
369 178 var darkify_enable_invert_inline_svg = "<?php echo esc_attr($enable_invert_inline_svg); ?>";
370 - var darkify_enable_invert_images = "<?php echo esc_attr($enable_invert_images); ?>";
371 - var darkify_invert_images_allowed_urls = "<?php echo esc_attr($invert_images_allowed_urls_arr); ?>";
372 - var darkify_image_replacements = "<?php echo esc_attr($image_replacements) ?>";
373 179 var darkify_enable_low_video_brightness = "<?php echo esc_attr($enable_low_video_brightness); ?>";
374 180 var darkify_video_brightness_to = "<?php echo esc_attr($low_video_brightness_label); ?>";
375 181 var darkify_enable_video_grayscale = "<?php echo esc_attr($enable_video_grayscale); ?>";
376 182 var darkify_video_grayscale_to = "<?php echo esc_attr($video_grayscale_label); ?>";
377 - var darkify_video_replacements = "<?PHP echo esc_attr($video_replacements); ?>";
378 - var darkify_allowed_elements = "<?php echo esc_attr($this->utils->generateAllowedElementsStr($options)); ?>";
379 - var darkify_allowed_elements_raw = "<?php echo esc_attr($allowed_elements); ?>";
380 - var darkify_allowed_elements_force_to_correct = "<?php echo esc_attr($allowed_elements_force_to_correct); ?>";
381 183
382 184 var darkify_disallowed_elements = "<?php echo esc_attr($this->utils->generateDisallowedElementsStr($options, $this->external_support)); ?>";
383 - var darkify_disallowed_elements_raw = "<?php echo esc_attr($disallowed_elements); ?>";
384 - var darkify_disallowed_elements_force_to_correct = "<?php echo esc_attr($disallowed_elements_force_to_correct); ?>";
385 -
386 185 var darkify_allowed_btn_class = <?php echo json_encode($this->utils->addButtonClassByDarkify($options)); ?>;
186 +
387 187 </script>
388 188 <?php
389 189 $output = ob_get_clean();
390 190 $tags_allowed_in_output = array(