PluginProbe
Darkify – Dark Mode & Night Mode for Website & Admin (Dark Theme Included) / 1.3.2
Darkify – Dark Mode & Night Mode for Website & Admin (Dark Theme Included) v1.3.2
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 +212 -134 1.5.01.3.2 View file →
@@ -1,142 +1,213 @@
1 1 <?php
2 -use ThemeAtelier\Darkify\Includes\DarkifyUtils;
3 -// don't call the file directly.
4 -if (!defined('ABSPATH')) {
5 - exit;
6 -}
7 2
3 +use ThemeAtelier\Darkify\Helpers\DarkifyUtils;
4 +use ThemeAtelier\Darkify\Helpers\Helpers;
5 +
8 6 ob_start();
9 -$options = get_option('darkify');
10 -$enable_default_dark_mode = isset($options['enable_default_dark_mode']) ? $options['enable_default_dark_mode'] : '';
11 -$enable_os_aware = isset($options['enable_os_aware']) ? $options['enable_os_aware'] : true;
12 -$enable_keyboard_shortcut = isset($options['enable_keyboard_shortcut']) ? $options['enable_keyboard_shortcut'] : true;
7 +$options = get_option('darkify_pro');
8 +$enable_default_dark_mode = isset($options['enable_default_dark_mode']) ? $options['enable_default_dark_mode'] :'';
9 +$enable_scrollbar_dark = isset($options["enable_scrollbar_dark"]) ? $options["enable_scrollbar_dark"] :'';
10 +$enable_os_aware = isset($options['enable_os_aware']) ? $options['enable_os_aware'] : "";
11 +$enable_keyboard_shortcut = isset($options['enable_keyboard_shortcut']) ? $options['enable_keyboard_shortcut'] : "";
12 +$enable_switch_dragging = isset($options['enable_switch_dragging']) ? $options['enable_switch_dragging'] : "";
13 +$disallowed_elements = isset($options['disallowed_elements']) ? $options['disallowed_elements'] : "";
14 +$disallowed_elements_force_to_correct = isset($options['disallowed_elements_force_to_correct']) ? $options['disallowed_elements_force_to_correct'] : "";
15 +$allowed_elements_force_to_correct = isset($options['allowed_elements_force_to_correct']) ? $options['allowed_elements_force_to_correct'] : "";
16 +$allowed_elements = isset($options['allowed_elements']) ? $options['allowed_elements'] : "";
17 +$enable_invert_inline_svg = isset($options['enable_invert_inline_svg']) ? $options['enable_invert_inline_svg'] : "";
18 +$alternative_dark_mode_switcher = isset($options['alternative_dark_mode_switcher']) ? $options['alternative_dark_mode_switcher'] : "";
13 19 $enable_time = isset($options['enable_time']) ? $options['enable_time'] : "";
14 20 $enable_time_based_dark = isset($enable_time['enable_time_based_dark']) ? $enable_time['enable_time_based_dark'] : "";
15 -$enable_time_fields = isset($enable_time['enable_time_fields']) ? $enable_time['enable_time_fields'] : '';
16 -$time_based_dark_start = isset($enable_time_fields['time_based_dark_start']) ? $enable_time_fields['time_based_dark_start'] : "";
17 -$time_based_dark_stop = isset($enable_time_fields['time_based_dark_end']) ? $enable_time_fields['time_based_dark_end'] : "";
18 -
19 -// Extras
20 -$enable_scrollbar_dark = isset($options["enable_scrollbar_dark"]) ? $options["enable_scrollbar_dark"] : true;
21 -$alternative_dark_mode_switcher = isset($options['alternative_dark_mode_switcher']) ? $options['alternative_dark_mode_switcher'] : "";
22 -
23 -// Image Control
24 -$brightness = isset($options['brightness']) ? $options['brightness'] : "";
25 -$enable_low_image_brightness = isset($brightness['enable_low_image_brightness']) ? $brightness['enable_low_image_brightness'] : "1";
26 -$low_image_brightness_label = isset($brightness['low_image_brightness_label']) ? 100 - $brightness['low_image_brightness_label'] : 100 - "20";
27 -
21 +$time_based_dark_start = isset($enable_time['time_based_dark_start']['from']) ? $enable_time['time_based_dark_start']['from'] : "";
22 +$time_based_dark_stop = isset($enable_time['time_based_dark_start']['to']) ? $enable_time['time_based_dark_start']['to'] : "";
23 +$grayscale = isset($options['brightness']) ? $options['brightness'] : "";
24 +$enable_low_image_brightness = isset($grayscale['enable_low_image_brightness']) ? $grayscale['enable_low_image_brightness'] : "";
25 +$low_image_brightness_label = isset($grayscale['low_image_brightness_label']) ? $grayscale['low_image_brightness_label'] : "";
26 +$disallowed_low_brightness_images = isset($grayscale['disallowed_low_brightness_images']) ? $grayscale['disallowed_low_brightness_images'] : "[]";
28 27 $grayscale = isset($options['grayscale']) ? $options['grayscale'] : "";
29 28 $enable_image_grayscale = isset($grayscale['enable_image_grayscale']) ? $grayscale['enable_image_grayscale'] : "";
30 -$image_grayscale_label = isset($grayscale['image_grayscale_label']) ? $grayscale['image_grayscale_label'] : "80";
31 -
32 -$darken_background = isset($options['darken_background']) ? $options['darken_background'] : "";
33 -$enable_low_image_darken = isset($darken_background['enable_low_image_darken']) ? $darken_background['enable_low_image_darken'] : "1";
34 -$low_image_darken_label = isset($darken_background['low_image_darken_label']) ? $darken_background['low_image_darken_label'] : "60";
35 -
36 -$enable_invert_inline_svg = isset($options['enable_invert_inline_svg']) ? $options['enable_invert_inline_svg'] : "";
37 -
38 -// Video Control
29 +$image_grayscale_label = isset($grayscale['image_grayscale_label']) ? $grayscale['image_grayscale_label'] : "";
30 +$disallowed_low_grayscale_images = isset($grayscale['disallowed_low_grayscale_images']) ? $grayscale['disallowed_low_grayscale_images'] : "";
31 +$darken_background = isset($options['darken_background']);
32 +$enable_low_image_darken = isset($darken_background['enable_low_image_darken']) ? $darken_background['enable_low_image_darken'] : "";
33 +$low_image_darken_label = isset($darken_background['low_image_darken_label']) ? $darken_background['low_image_darken_label'] : "";
39 34 $video_brightness = isset($options['video_brightness']) ? $options['video_brightness'] : "";
40 -$enable_low_video_brightness = isset($video_brightness['enable_low_video_brightness']) ? $video_brightness['enable_low_video_brightness'] : true;
41 -$low_video_brightness_label = isset($video_brightness['low_video_brightness_label']) ? 100 - $video_brightness['low_video_brightness_label'] : 100 - "20";
35 +$enable_low_video_brightness = isset($video_brightness['enable_low_video_brightness']) ? $video_brightness['enable_low_video_brightness'] : "";
36 +$low_video_brightness_label = isset($video_brightness['low_video_brightness_label']) ? $video_brightness['low_video_brightness_label'] : "";
37 +$video_grayscale = isset($options['video_grayscale']);
38 +$enable_video_grayscale = isset($video_grayscale['enable_video_grayscale']) ? $video_grayscale['enable_video_grayscale'] : "";
39 +$video_grayscale_label = isset($video_grayscale['video_grayscale_label']) ? $video_grayscale['video_grayscale_label'] : "";
40 +$invert = isset($options['invert']) ? $options['invert'] : "";
41 +$enable_invert_images = isset($invert['enable_invert_images']) ? $invert['enable_invert_images'] : "";
42 +$invert_images_allowed_urls = isset($invert['invert_images_allowed_urls']) ? $invert['invert_images_allowed_urls'] : "[]";
43 +if ($invert_images_allowed_urls !== "") {
44 + $invert_images_allowed_urls_explode = explode(',', $invert_images_allowed_urls);
45 + $invert_images_allowed_urls_arr = json_encode($invert_images_allowed_urls_explode);
46 +}
42 47
43 -$video_grayscale = isset($options['video_grayscale']) ? $options['video_grayscale'] : '';
44 -$enable_video_grayscale = isset($video_grayscale['enable_video_grayscale']) ? $video_grayscale['enable_video_grayscale'] : "";
45 -$video_grayscale_label = isset($video_grayscale['video_grayscale_label']) ? $video_grayscale['video_grayscale_label'] : "80";
48 +$normal_image_replacements = isset($options["image_replacements"][0]["normal_image"]) ? $options["image_replacements"][0]["normal_image"] : [];
49 +$dark_image_replacements = isset($options["image_replacements"][0]["dark_image"]) ? $options["image_replacements"][0]["dark_image"] : [];
50 +if ($normal_image_replacements || $dark_image_replacements) {
51 + $image_replacements = json_encode($options["image_replacements"]);
52 +} else {
53 + $image_replacements = "[]";
54 +}
46 55
56 +$normal_video_replacements = isset($options["video_replacements"][0]["normal_video"]) ? $options["video_replacements"][0]["normal_video"] : [];
57 +$dark_video_replacements = isset($options["video_replacements"][0]["dark_video"]) ? $options["video_replacements"][0]["dark_video"] : [];
58 +if ($normal_video_replacements || $dark_video_replacements) {
59 + $video_replacements = json_encode($options["video_replacements"]);
60 +} else {
61 + $video_replacements = "[]";
62 +}
63 +?>
47 64
48 -if (!is_admin()) { ?>
65 +<?php if (!is_admin()) { ?>
49 66 <style type="text/css" class="darkify_inline_css">
50 67 :root {
51 68 <?php
52 - $dark_mode_color_palettes = [
53 - 'set1' => [
54 - 'bg' => isset($options["dark_mode_color_set1"]) ? $options["dark_mode_color_set1"]['background'] : '#0F0F0F',
55 - 'secondary_bg' => isset($options["dark_mode_color_set1"]) ? $options["dark_mode_color_set1"]['secondary_background'] : '#171717',
56 - 'text_color' => '#BEBEBE',
57 - 'link_color' => '#E7E7E7',
58 - 'link_hover_color' => '#BEBEBE',
59 - 'input_bg' => '#2D2D2D',
60 - 'input_text_color' => '#BEBEBE',
61 - 'input_placeholder_color' => '#BEBEBE',
62 - 'border_color' => '#4A4A4A',
63 - 'btn_text_color' => '#BEBEBE',
64 - 'btn_bg' => '#4A4A4A',
65 - 'btn_text_hover_color' => '#BEBEBE',
66 - 'btn_hover_bg' => '#2D2D2D',
67 - ],
68 - 'set3' => [
69 - 'bg' => isset($options["dark_mode_color_set3"]) ? $options["dark_mode_color_set3"]['background'] : '#211e3c',
70 - 'secondary_bg' => isset($options["dark_mode_color_set3"]) ? $options["dark_mode_color_set3"]['secondary_background'] : '#302C57',
71 - 'text_color' => '#B1BBD8',
72 - 'link_color' => '#8071fb',
73 - 'link_hover_color' => '#B1BBD8',
74 - 'input_bg' => '#2A264D',
75 - 'input_text_color' => '#B1BBD8',
76 - 'input_placeholder_color' => '#B1BBD8',
77 - 'border_color' => '#4E478D',
78 - 'btn_text_color' => '#B1BBD8',
79 - 'btn_bg' => '#4E478D',
80 - 'btn_text_hover_color' => '#B1BBD8',
81 - 'btn_hover_bg' => '#2A264D',
82 - ],
83 - 'set9' => [
84 - 'bg' => isset($options["dark_mode_color_set9"]) ? $options["dark_mode_color_set9"]['background'] : '#04261d',
85 - 'secondary_bg' => isset($options["dark_mode_color_set9"]) ? $options["dark_mode_color_set9"]['secondary_background'] : '#021e16',
86 - 'text_color' => '#C1D2BB',
87 - 'link_color' => '#00d29a',
88 - 'link_hover_color' => '#C1D2BB',
89 - 'input_bg' => '#073d2f',
90 - 'input_text_color' => '#C1D2BB',
91 - 'input_placeholder_color' => '#C1D2BB',
92 - 'border_color' => '#095541',
93 - 'btn_text_color' => '#C1D2BB',
94 - 'btn_bg' => '#095541',
95 - 'btn_text_hover_color' => '#C1D2BB',
96 - 'btn_hover_bg' => '#073d2f',
97 - ],
98 - 'set6' => [
99 - 'bg' => isset($options["dark_mode_color_set6"]) ? $options["dark_mode_color_set6"]['background'] : '#082032',
100 - 'secondary_bg' => isset($options["dark_mode_color_set6"]) ? $options["dark_mode_color_set6"]['secondary_background'] : '#061825',
101 - 'text_color' => '#B5D9F3',
102 - 'link_color' => '#61bbff',
103 - 'link_hover_color' => '#B5D9F3',
104 - 'input_bg' => '#0E3755',
105 - 'input_text_color' => '#B5D9F3',
106 - 'input_placeholder_color' => '#B5D9F3',
107 - 'border_color' => '#144E78',
108 - 'btn_text_color' => '#B5D9F3',
109 - 'btn_bg' => '#144E78',
110 - 'btn_text_hover_color' => '#B5D9F3',
111 - 'btn_hover_bg' => '#0E3755',
112 - ],
113 - 'set10' => [
114 - 'bg' => isset($options["dark_mode_color_set10"]) ? $options["dark_mode_color_set10"]['background'] : '#171004',
115 - 'secondary_bg' => isset($options["dark_mode_color_set10"]) ? $options["dark_mode_color_set10"]['secondary_background'] : '#211706',
116 - 'text_color' => '#E0D2BD',
117 - 'link_color' => '#e09525',
118 - 'link_hover_color' => '#E0D2BD',
119 - 'input_bg' => '#372911',
120 - 'input_text_color' => '#E0D2BD',
121 - 'input_placeholder_color' => '#E0D2BD',
122 - 'border_color' => '#5D4010',
123 - 'btn_text_color' => '#E0D2BD',
124 - 'btn_bg' => '#5D4010',
125 - 'btn_text_hover_color' => '#E0D2BD',
126 - 'btn_hover_bg' => '#372911',
127 - ],
128 - ];
69 + $darkify_color_pallets = isset($options["color_pallets"]) ? $options["color_pallets"] : 'set1';
129 70
71 + // Set 1
130 72
131 - $selected_set_key = isset($options['color_pallets']) ? $options['color_pallets'] : 'set1';
132 - $selected_set = $dark_mode_color_palettes[$selected_set_key] ?? $dark_mode_color_palettes['set1'];
73 + $dark_mode_color_set1_bg = isset($options["dark_mode_color_set1"]) ? $options["dark_mode_color_set1"]['background'] : '#0F0F0F';
74 + $dark_mode_color_set1_secondary_bg = isset($options["dark_mode_color_set1"]) ? $options["dark_mode_color_set1"]['secondary_background'] : '#171717';
75 + $dark_mode_set1_text_color = isset($options["dark_mode_link_color_set1"]) ? $options["dark_mode_link_color_set1"]['text'] : '#BEBEBE';
76 + $dark_mode_set1_link_color = isset($options["dark_mode_link_color_set1"]) ? $options["dark_mode_link_color_set1"]['color'] : '#FFFFFF';
77 + $dark_mode_set1_link_hover_color = isset($options["dark_mode_link_color_set1"]) ? $options["dark_mode_link_color_set1"]['hover'] : '#CCCCCC';
78 + $dark_mode_set1_input_bg = isset($options["dark_mode_input_color_set1"]) ? $options["dark_mode_input_color_set1"]['background'] : '#BEBEBE';
79 + $dark_mode_set1_input_text_color = isset($options["dark_mode_input_color_set1"]) ? $options["dark_mode_input_color_set1"]['color'] : '#2D2D2D';
80 + $dark_mode_set1_input_placeholder_color = isset($options["dark_mode_input_color_set1"]) ? $options["dark_mode_input_color_set1"]['placeholder'] : '#989898';
81 + $dark_mode_set1_border_color = isset($options["dark_mode_border_color_set1"]) ? $options["dark_mode_border_color_set1"] : '#4A4A4A';
82 + $dark_mode_set1_btn_text_color = isset($options["dark_mode_btn_color_set1"]) ? $options["dark_mode_btn_color_set1"]['color'] : '#2D2D2D';
83 + $dark_mode_set1_btn_bg = isset($options["dark_mode_btn_color_set1"]) ? $options["dark_mode_btn_color_set1"]['background'] : '#BEBEBE';
133 84
134 - // Output as CSS variables
135 - foreach ($selected_set as $key => $value) {
136 - echo '--darkify_dark_mode_' . esc_attr($key) . ': ' . esc_attr($value) . ';';
137 - }
138 - ?>
85 + // Set 2
86 +
87 + $dark_mode_color_set2_bg = isset($options["dark_mode_color_set2"]) ? $options["dark_mode_color_set2"]['background'] : '#092635';
88 + $dark_mode_color_set2_secondary_bg = isset($options["dark_mode_color_set2"]) ? $options["dark_mode_color_set2"]['secondary_background'] : '#1B4242';
89 + $dark_mode_set2_text_color = isset($options["dark_mode_link_color_set2"]) ? $options["dark_mode_link_color_set2"]['text'] : '#9EC8B9';
90 + $dark_mode_set2_link_color = isset($options["dark_mode_link_color_set2"]) ? $options["dark_mode_link_color_set2"]['color'] : '#FFFFFF';
91 + $dark_mode_set2_link_hover_color = isset($options["dark_mode_link_color_set2"]) ? $options["dark_mode_link_color_set2"]['hover'] : '#9EC8B9';
92 + $dark_mode_set2_input_bg = isset($options["dark_mode_input_color_set2"]) ? $options["dark_mode_input_color_set2"]['background'] : '#BEBEBE';
93 + $dark_mode_set2_input_text_color = isset($options["dark_mode_input_color_set2"]) ? $options["dark_mode_input_color_set2"]['color'] : '#092635';
94 + $dark_mode_set2_input_placeholder_color = isset($options["dark_mode_input_color_set2"]) ? $options["dark_mode_input_color_set2"]['placeholder'] : '#989898';
95 + $dark_mode_set2_border_color = isset($options["dark_mode_border_color_set2"]) ? $options["dark_mode_border_color_set2"] : '#4A4A4A';
96 + $dark_mode_set2_btn_text_color = isset($options["dark_mode_btn_color_set2"]) ? $options["dark_mode_btn_color_set2"]['color'] : '#2D2D2D';
97 + $dark_mode_set2_btn_bg = isset($options["dark_mode_btn_color_set2"]) ? $options["dark_mode_btn_color_set2"]['background'] : '#BEBEBE';
98 +
99 + // Set 4
100 +
101 + $dark_mode_color_set4_bg = isset($options["dark_mode_color_set4"]) ? $options["dark_mode_color_set4"]['background'] : '#363062';
102 + $dark_mode_color_set4_secondary_bg = isset($options["dark_mode_color_set4"]) ? $options["dark_mode_color_set4"]['secondary_background'] : '#435585';
103 + $dark_mode_set4_text_color = isset($options["dark_mode_link_color_set4"]) ? $options["dark_mode_link_color_set4"]['text'] : '#F5E8C7';
104 + $dark_mode_set4_link_color = isset($options["dark_mode_link_color_set4"]) ? $options["dark_mode_link_color_set4"]['color'] : '#FFFFFF';
105 + $dark_mode_set4_link_hover_color = isset($options["dark_mode_link_color_set4"]) ? $options["dark_mode_link_color_set4"]['hover'] : '#F5E8C7';
106 + $dark_mode_set4_input_bg = isset($options["dark_mode_input_color_set4"]) ? $options["dark_mode_input_color_set4"]['background'] : '#BEBEBE';
107 + $dark_mode_set4_input_text_color = isset($options["dark_mode_input_color_set4"]) ? $options["dark_mode_input_color_set4"]['color'] : '#363062';
108 + $dark_mode_set4_input_placeholder_color = isset($options["dark_mode_input_color_set4"]) ? $options["dark_mode_input_color_set4"]['placeholder'] : '#989898';
109 + $dark_mode_set4_border_color = isset($options["dark_mode_border_color_set4"]) ? $options["dark_mode_border_color_set4"] : '#818FB4';
110 + $dark_mode_set4_btn_text_color = isset($options["dark_mode_btn_color_set4"]) ? $options["dark_mode_btn_color_set4"]['color'] : '#435585';
111 + $dark_mode_set4_btn_bg = isset($options["dark_mode_btn_color_set4"]) ? $options["dark_mode_btn_color_set4"]['background'] : '#BEBEBE';
112 +
113 + if ('set1' == $darkify_color_pallets) : ?>
114 + --darkify_dark_mode_bg: <?php echo esc_attr($dark_mode_color_set1_bg); ?>;
115 + --darkify_dark_mode_secondary_bg: <?php echo esc_attr($dark_mode_color_set1_secondary_bg); ?>;
116 + --darkify_dark_mode_text_color: <?php echo esc_attr($dark_mode_set1_text_color); ?>;
117 + --darkify_dark_mode_link_color: <?php echo esc_attr($dark_mode_set1_link_color); ?>;
118 + --darkify_dark_mode_link_hover_color: <?php echo esc_attr($dark_mode_set1_link_hover_color); ?>;
119 + --darkify_dark_mode_input_bg: <?php echo esc_attr($dark_mode_set1_input_bg); ?>;
120 + --darkify_dark_mode_input_text_color: <?php echo esc_attr($dark_mode_set1_input_text_color); ?>;
121 + --darkify_dark_mode_input_placeholder_color: <?php echo esc_attr($dark_mode_set1_input_placeholder_color); ?>;
122 + --darkify_dark_mode_border_color: <?php echo esc_attr($dark_mode_set1_border_color); ?>;
123 + --darkify_dark_mode_btn_text_color: <?php echo esc_attr($dark_mode_set1_btn_text_color); ?>;
124 + --darkify_dark_mode_btn_bg: <?php echo esc_attr($dark_mode_set1_btn_bg); ?>;
125 + <?php elseif ('set2' == $darkify_color_pallets) : ?>
126 + --darkify_dark_mode_bg: <?php echo esc_attr($dark_mode_color_set2_bg); ?>;
127 + --darkify_dark_mode_secondary_bg: <?php echo esc_attr($dark_mode_color_set2_secondary_bg); ?>;
128 + --darkify_dark_mode_text_color: <?php echo esc_attr($dark_mode_set2_text_color); ?>;
129 + --darkify_dark_mode_link_color: <?php echo esc_attr($dark_mode_set2_link_color); ?>;
130 + --darkify_dark_mode_link_hover_color: <?php echo esc_attr($dark_mode_set2_link_hover_color); ?>;
131 + --darkify_dark_mode_input_bg: <?php echo esc_attr($dark_mode_set2_input_bg); ?>;
132 + --darkify_dark_mode_input_text_color: <?php echo esc_attr($dark_mode_set2_input_text_color); ?>;
133 + --darkify_dark_mode_input_placeholder_color: <?php echo esc_attr($dark_mode_set2_input_placeholder_color); ?>;
134 + --darkify_dark_mode_border_color: <?php echo esc_attr($dark_mode_set2_border_color); ?>;
135 + --darkify_dark_mode_btn_text_color: <?php echo esc_attr($dark_mode_set2_btn_text_color); ?>;
136 + --darkify_dark_mode_btn_bg: <?php echo esc_attr($dark_mode_set2_btn_bg); ?>;
137 + <?php elseif ('set4' == $darkify_color_pallets) : ?>
138 + --darkify_dark_mode_bg: <?php echo esc_attr($dark_mode_color_set4_bg); ?>;
139 + --darkify_dark_mode_secondary_bg: <?php echo esc_attr($dark_mode_color_set4_secondary_bg); ?>;
140 + --darkify_dark_mode_text_color: <?php echo esc_attr($dark_mode_set4_text_color); ?>;
141 + --darkify_dark_mode_link_color: <?php echo esc_attr($dark_mode_set4_link_color); ?>;
142 + --darkify_dark_mode_link_hover_color: <?php echo esc_attr($dark_mode_set4_link_hover_color); ?>;
143 + --darkify_dark_mode_input_bg: <?php echo esc_attr($dark_mode_set4_input_bg); ?>;
144 + --darkify_dark_mode_input_text_color: <?php echo esc_attr($dark_mode_set4_input_text_color); ?>;
145 + --darkify_dark_mode_input_placeholder_color: <?php echo esc_attr($dark_mode_set4_input_placeholder_color); ?>;
146 + --darkify_dark_mode_border_color: <?php echo esc_attr($dark_mode_set4_border_color); ?>;
147 + --darkify_dark_mode_btn_text_color: <?php echo esc_attr($dark_mode_set4_btn_text_color); ?>;
148 + --darkify_dark_mode_btn_bg: <?php echo esc_attr($dark_mode_set4_btn_bg); ?>;
149 + <?php elseif ('set5' == $darkify_color_pallets) : ?>
150 + --darkify_dark_mode_bg: <?php echo esc_attr($options["dark_mode_color_set5"]['background']); ?>;
151 + --darkify_dark_mode_secondary_bg: <?php echo esc_attr($options["dark_mode_color_set5"]['secondary_background']); ?>;
152 + --darkify_dark_mode_text_color: <?php echo esc_attr($options["dark_mode_link_color_set5"]['text']); ?>;
153 + --darkify_dark_mode_link_color: <?php echo esc_attr($options["dark_mode_link_color_set5"]['color']); ?>;
154 + --darkify_dark_mode_link_hover_color: <?php echo esc_attr($options["dark_mode_link_color_set5"]['hover']); ?>;
155 + --darkify_dark_mode_input_bg: <?php echo esc_attr($options["dark_mode_input_color_set5"]['background']); ?>;
156 + --darkify_dark_mode_input_text_color: <?php echo esc_attr($options["dark_mode_input_color_set5"]['color']); ?>;
157 + --darkify_dark_mode_input_placeholder_color: <?php echo esc_attr($options["dark_mode_input_color_set5"]['placeholder']); ?>;
158 + --darkify_dark_mode_border_color: <?php echo esc_attr($options["dark_mode_border_color_set5"]); ?>;
159 + --darkify_dark_mode_btn_text_color: <?php echo esc_attr($options["dark_mode_btn_color_set5"]['color']); ?>;
160 + --darkify_dark_mode_btn_bg: <?php echo esc_attr($options["dark_mode_btn_color_set5"]['background']); ?>;
161 + <?php elseif ('set6' == $darkify_color_pallets) : ?>
162 + --darkify_dark_mode_bg: <?php echo esc_attr($options["dark_mode_color_set6"]['background']); ?>;
163 + --darkify_dark_mode_secondary_bg: <?php echo esc_attr($options["dark_mode_color_set6"]['secondary_background']); ?>;
164 + --darkify_dark_mode_text_color: <?php echo esc_attr($options["dark_mode_link_color_set6"]['text']); ?>;
165 + --darkify_dark_mode_link_color: <?php echo esc_attr($options["dark_mode_link_color_set6"]['color']); ?>;
166 + --darkify_dark_mode_link_hover_color: <?php echo esc_attr($options["dark_mode_link_color_set6"]['hover']); ?>;
167 + --darkify_dark_mode_input_bg: <?php echo esc_attr($options["dark_mode_input_color_set6"]['background']); ?>;
168 + --darkify_dark_mode_input_text_color: <?php echo esc_attr($options["dark_mode_input_color_set6"]['color']); ?>;
169 + --darkify_dark_mode_input_placeholder_color: <?php echo esc_attr($options["dark_mode_input_color_set6"]['placeholder']); ?>;
170 + --darkify_dark_mode_border_color: <?php echo esc_attr($options["dark_mode_border_color_set6"]); ?>;
171 + --darkify_dark_mode_btn_text_color: <?php echo esc_attr($options["dark_mode_btn_color_set6"]['color']); ?>;
172 + --darkify_dark_mode_btn_bg: <?php echo esc_attr($options["dark_mode_btn_color_set6"]['background']); ?>;
173 + <?php elseif ('set9' == $darkify_color_pallets) : ?>
174 + --darkify_dark_mode_bg: <?php echo esc_attr($options["dark_mode_color_set9"]['background']); ?>;
175 + --darkify_dark_mode_secondary_bg: <?php echo esc_attr($options["dark_mode_color_set9"]['secondary_background']); ?>;
176 + --darkify_dark_mode_text_color: <?php echo esc_attr($options["dark_mode_link_color_set9"]['text']); ?>;
177 + --darkify_dark_mode_link_color: <?php echo esc_attr($options["dark_mode_link_color_set9"]['color']); ?>;
178 + --darkify_dark_mode_link_hover_color: <?php echo esc_attr($options["dark_mode_link_color_set9"]['hover']); ?>;
179 + --darkify_dark_mode_input_bg: <?php echo esc_attr($options["dark_mode_input_color_set9"]['background']); ?>;
180 + --darkify_dark_mode_input_text_color: <?php echo esc_attr($options["dark_mode_input_color_set9"]['color']); ?>;
181 + --darkify_dark_mode_input_placeholder_color: <?php echo esc_attr($options["dark_mode_input_color_set9"]['placeholder']); ?>;
182 + --darkify_dark_mode_border_color: <?php echo esc_attr($options["dark_mode_border_color_set9"]); ?>;
183 + --darkify_dark_mode_btn_text_color: <?php echo esc_attr($options["dark_mode_btn_color_set9"]['color']); ?>;
184 + --darkify_dark_mode_btn_bg: <?php echo esc_attr($options["dark_mode_btn_color_set9"]['background']); ?>;
185 + <?php elseif ('set10' == $darkify_color_pallets) : ?>
186 + --darkify_dark_mode_bg: <?php echo esc_attr($options["dark_mode_color_set10"]['background']); ?>;
187 + --darkify_dark_mode_secondary_bg: <?php echo esc_attr($options["dark_mode_color_set10"]['secondary_background']); ?>;
188 + --darkify_dark_mode_text_color: <?php echo esc_attr($options["dark_mode_link_color_set10"]['text']); ?>;
189 + --darkify_dark_mode_link_color: <?php echo esc_attr($options["dark_mode_link_color_set10"]['color']); ?>;
190 + --darkify_dark_mode_link_hover_color: <?php echo esc_attr($options["dark_mode_link_color_set10"]['hover']); ?>;
191 + --darkify_dark_mode_input_bg: <?php echo esc_attr($options["dark_mode_input_color_set10"]['background']); ?>;
192 + --darkify_dark_mode_input_text_color: <?php echo esc_attr($options["dark_mode_input_color_set10"]['color']); ?>;
193 + --darkify_dark_mode_input_placeholder_color: <?php echo esc_attr($options["dark_mode_input_color_set10"]['placeholder']); ?>;
194 + --darkify_dark_mode_border_color: <?php echo esc_attr($options["dark_mode_border_color_set10"]); ?>;
195 + --darkify_dark_mode_btn_text_color: <?php echo esc_attr($options["dark_mode_btn_color_set10"]['color']); ?>;
196 + --darkify_dark_mode_btn_bg: <?php echo esc_attr($options["dark_mode_btn_color_set10"]['background']); ?>;
197 + <?php elseif ('set11' == $darkify_color_pallets) : ?>
198 + --darkify_dark_mode_bg: <?php echo esc_attr($options["dark_mode_color_set11"]['background']); ?>;
199 + --darkify_dark_mode_secondary_bg: <?php echo esc_attr($options["dark_mode_color_set11"]['secondary_background']); ?>;
200 + --darkify_dark_mode_text_color: <?php echo esc_attr($options["dark_mode_link_color_set11"]['text']); ?>;
201 + --darkify_dark_mode_link_color: <?php echo esc_attr($options["dark_mode_link_color_set11"]['color']); ?>;
202 + --darkify_dark_mode_link_hover_color: <?php echo esc_attr($options["dark_mode_link_color_set11"]['hover']); ?>;
203 + --darkify_dark_mode_input_bg: <?php echo esc_attr($options["dark_mode_input_color_set11"]['background']); ?>;
204 + --darkify_dark_mode_input_text_color: <?php echo esc_attr($options["dark_mode_input_color_set11"]['color']); ?>;
205 + --darkify_dark_mode_input_placeholder_color: <?php echo esc_attr($options["dark_mode_input_color_set11"]['placeholder']); ?>;
206 + --darkify_dark_mode_border_color: <?php echo esc_attr($options["dark_mode_border_color_set11"]); ?>;
207 + --darkify_dark_mode_btn_text_color: <?php echo esc_attr($options["dark_mode_btn_color_set11"]['color']); ?>;
208 + --darkify_dark_mode_btn_bg: <?php echo esc_attr($options["dark_mode_btn_color_set11"]['background']); ?>;
209 + <?php endif; ?>
139 210 }
140 211 </style>
141 212 <?php } else { ?>
142 213 <style type="text/css" class="darkify_inline_css">
@@ -153,16 +224,13 @@
153 224 --darkify_dark_mode_btn_bg: #2D2D2D;
154 225 --darkify_dark_mode_btn_text_color: #BEBEBE;
155 226 }
156 227 </style>
157 -<?php }
228 +<?php } ?>
158 229
159 -if ($enable_scrollbar_dark) {
160 - $dark_mode_scrollbar_track_bg = '#29292a';
161 - $dark_mode_scrollbar_thumb_bg = '#52565a';
162 - include DarkifyUtils::darkify_locate_template('views/scrollbar.php');
163 -}
164 -?>
230 +<?php if ($enable_scrollbar_dark) { ?>
231 + <?php include_once Helpers::darkify_locate_template('views/scrollbar.php') ?>
232 +<?php } ?>
165 233
166 234 <script type="text/javascript" class="darkify_inline_js">
167 235 var darkify_switch_unique_id = "<?php echo esc_attr($this->unique_id); ?>";
168 236 var darkify_is_this_admin_panel = "<?php echo esc_attr(is_admin() ? "1" : "0"); ?>";
@@ -169,26 +237,35 @@
169 237 var darkify_enable_default_dark_mode = "<?php echo esc_attr($enable_default_dark_mode); ?>";
170 238 var darkify_enable_os_aware = "<?php echo esc_attr($enable_os_aware); ?>";
171 239 var darkify_enable_keyboard_shortcut = "<?php echo esc_attr($enable_keyboard_shortcut); ?>";
172 240 var darkify_enable_time_based_dark = "<?php echo esc_attr($enable_time_based_dark); ?>";
173 - var darkify_time_based_dark_start = "<?php echo esc_attr($time_based_dark_start ? $time_based_dark_start : ""); ?>";
174 - var darkify_time_based_dark_stop = "<?php echo esc_attr($time_based_dark_stop ? $time_based_dark_stop : ""); ?>";
241 + var darkify_time_based_dark_start = "<?php echo esc_attr($time_based_dark_start ? $time_based_dark_start : "19:00"); ?>";
242 + var darkify_time_based_dark_stop = "<?php echo esc_attr($time_based_dark_stop ? $time_based_dark_stop : "07:00"); ?>";
243 + var darkify_enable_switch_dragging = "<?php echo esc_attr($enable_switch_dragging); ?>";
175 244 var darkify_alternative_dark_mode_switch = "<?php echo esc_attr($alternative_dark_mode_switcher); ?>";
176 245 var darkify_enable_low_image_brightness = "<?php echo esc_attr($enable_low_image_brightness); ?>";
177 246 var darkify_image_brightness_to = "<?php echo esc_attr($low_image_brightness_label); ?>";
247 + var darkify_disallowed_low_brightness_images = "<?php echo esc_attr($disallowed_low_brightness_images); ?>";
178 248 var darkify_enable_image_grayscale = "<?php echo esc_attr($enable_image_grayscale); ?>";
179 249 var darkify_image_grayscale_to = "<?php echo esc_attr($image_grayscale_label); ?>";
250 + var darkify_disallowed_grayscale_images = "<?php echo esc_attr($disallowed_low_grayscale_images); ?>";
180 251 var darkify_enable_bg_image_darken = "<?php echo esc_attr($enable_low_image_darken); ?>";
181 252 var darkify_bg_image_darken_to = "<?php echo esc_attr($low_image_darken_label); ?>";
182 253 var darkify_enable_invert_inline_svg = "<?php echo esc_attr($enable_invert_inline_svg); ?>";
254 + var darkify_enable_invert_images = "<?php echo esc_attr($enable_invert_images); ?>";
255 + var darkify_invert_images_allowed_urls = "<?php echo esc_attr($invert_images_allowed_urls ? $invert_images_allowed_urls_arr : "[]"); ?>";
256 + var darkify_image_replacements = "<?php echo esc_attr($image_replacements) ?>";
183 257 var darkify_enable_low_video_brightness = "<?php echo esc_attr($enable_low_video_brightness); ?>";
184 258 var darkify_video_brightness_to = "<?php echo esc_attr($low_video_brightness_label); ?>";
185 259 var darkify_enable_video_grayscale = "<?php echo esc_attr($enable_video_grayscale); ?>";
186 260 var darkify_video_grayscale_to = "<?php echo esc_attr($video_grayscale_label); ?>";
187 -
188 - var darkify_disallowed_elements = "<?php echo esc_attr($this->utils->generateDisallowedElementsStr($options, $this->external_support)); ?>";
189 - var darkify_allowed_btn_class = <?php echo json_encode($this->utils->addButtonClassByDarkify($options)); ?>;
190 -
261 + var darkify_video_replacements = "<?PHP echo esc_attr($video_replacements); ?>";
262 + var darkify_allowed_elements = "<?php echo esc_attr(DarkifyUtils::generateAllowedElementsStr($options)); ?>";
263 + var darkify_allowed_elements_raw = "<?php echo esc_attr($allowed_elements); ?>";
264 + var darkify_allowed_elements_force_to_correct = "<?php echo esc_attr($allowed_elements_force_to_correct); ?>";
265 + var darkify_disallowed_elements = "<?php echo esc_attr(DarkifyUtils::generateDisallowedElementsStr($options, $this->external_support)); ?>";
266 + var darkify_disallowed_elements_raw = "<?php echo esc_attr($disallowed_elements); ?>";
267 + var darkify_disallowed_elements_force_to_correct = "<?php echo esc_attr($disallowed_elements_force_to_correct); ?>";
191 268 </script>
192 269 <?php
193 270 $output = ob_get_clean();
194 271 $tags_allowed_in_output = array(
@@ -195,4 +272,5 @@
195 272 'style' => array('type' => array(), 'class' => array()),
196 273 'script' => array('type' => array(), 'class' => array())
197 274 );
198 275 echo wp_kses($this->utils->minify_string($output), $tags_allowed_in_output);
276 +?>