| @@ -1,143 +1,213 @@ | ||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | -use ThemeAtelier\Darkify\Includes\DarkifyUtils; | |
| 4 | -// don't call the file directly. | |
| 5 | -if (!defined('ABSPATH')) { | |
| 6 | - exit; | |
| 7 | -} | |
| 3 | +use ThemeAtelier\Darkify\Helpers\DarkifyUtils; | |
| 4 | +use ThemeAtelier\Darkify\Helpers\Helpers; | |
| 8 | 5 | |
| 9 | 6 | ob_start(); |
| 10 | -$options = get_option('darkify'); | |
| 11 | -$enable_default_dark_mode = isset($options['enable_default_dark_mode']) ? $options['enable_default_dark_mode'] : ''; | |
| 12 | -$enable_os_aware = isset($options['enable_os_aware']) ? $options['enable_os_aware'] : true; | |
| 13 | -$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'] : ""; | |
| 14 | 19 | $enable_time = isset($options['enable_time']) ? $options['enable_time'] : ""; |
| 15 | 20 | $enable_time_based_dark = isset($enable_time['enable_time_based_dark']) ? $enable_time['enable_time_based_dark'] : ""; |
| 16 | -$enable_time_fields = isset($enable_time['enable_time_fields']) ? $enable_time['enable_time_fields'] : ''; | |
| 17 | -$time_based_dark_start = isset($enable_time_fields['time_based_dark_start']) ? $enable_time_fields['time_based_dark_start'] : ""; | |
| 18 | -$time_based_dark_stop = isset($enable_time_fields['time_based_dark_end']) ? $enable_time_fields['time_based_dark_end'] : ""; | |
| 19 | - | |
| 20 | -// Extras | |
| 21 | -$enable_scrollbar_dark = isset($options["enable_scrollbar_dark"]) ? $options["enable_scrollbar_dark"] : true; | |
| 22 | -$alternative_dark_mode_switcher = isset($options['alternative_dark_mode_switcher']) ? $options['alternative_dark_mode_switcher'] : ""; | |
| 23 | - | |
| 24 | -// Image Control | |
| 25 | -$brightness = isset($options['brightness']) ? $options['brightness'] : ""; | |
| 26 | -$enable_low_image_brightness = isset($brightness['enable_low_image_brightness']) ? $brightness['enable_low_image_brightness'] : "1"; | |
| 27 | -$low_image_brightness_label = isset($brightness['low_image_brightness_label']) ? 100 - $brightness['low_image_brightness_label'] : 100 - "20"; | |
| 28 | - | |
| 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'] : "[]"; | |
| 29 | 27 | $grayscale = isset($options['grayscale']) ? $options['grayscale'] : ""; |
| 30 | 28 | $enable_image_grayscale = isset($grayscale['enable_image_grayscale']) ? $grayscale['enable_image_grayscale'] : ""; |
| 31 | -$image_grayscale_label = isset($grayscale['image_grayscale_label']) ? $grayscale['image_grayscale_label'] : "80"; | |
| 32 | - | |
| 33 | -$darken_background = isset($options['darken_background']) ? $options['darken_background'] : ""; | |
| 34 | -$enable_low_image_darken = isset($darken_background['enable_low_image_darken']) ? $darken_background['enable_low_image_darken'] : "1"; | |
| 35 | -$low_image_darken_label = isset($darken_background['low_image_darken_label']) ? $darken_background['low_image_darken_label'] : "60"; | |
| 36 | - | |
| 37 | -$enable_invert_inline_svg = isset($options['enable_invert_inline_svg']) ? $options['enable_invert_inline_svg'] : ""; | |
| 38 | - | |
| 39 | -// 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'] : ""; | |
| 40 | 34 | $video_brightness = isset($options['video_brightness']) ? $options['video_brightness'] : ""; |
| 41 | -$enable_low_video_brightness = isset($video_brightness['enable_low_video_brightness']) ? $video_brightness['enable_low_video_brightness'] : true; | |
| 42 | -$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 | +} | |
| 43 | 47 | |
| 44 | -$video_grayscale = isset($options['video_grayscale']) ? $options['video_grayscale'] : ''; | |
| 45 | -$enable_video_grayscale = isset($video_grayscale['enable_video_grayscale']) ? $video_grayscale['enable_video_grayscale'] : ""; | |
| 46 | -$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 | +} | |
| 47 | 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 | +?> | |
| 48 | 64 | |
| 49 | -if (!is_admin()) { ?> | |
| 65 | +<?php if (!is_admin()) { ?> | |
| 50 | 66 | <style type="text/css" class="darkify_inline_css"> |
| 51 | 67 | :root { |
| 52 | 68 | <?php |
| 53 | - $dark_mode_color_palettes = [ | |
| 54 | - 'set1' => [ | |
| 55 | - 'bg' => isset($options["dark_mode_color_set1"]) ? $options["dark_mode_color_set1"]['background'] : '#0F0F0F', | |
| 56 | - 'secondary_bg' => isset($options["dark_mode_color_set1"]) ? $options["dark_mode_color_set1"]['secondary_background'] : '#171717', | |
| 57 | - 'text_color' => '#BEBEBE', | |
| 58 | - 'link_color' => '#E7E7E7', | |
| 59 | - 'link_hover_color' => '#BEBEBE', | |
| 60 | - 'input_bg' => '#2D2D2D', | |
| 61 | - 'input_text_color' => '#BEBEBE', | |
| 62 | - 'input_placeholder_color' => '#BEBEBE', | |
| 63 | - 'border_color' => '#4A4A4A', | |
| 64 | - 'btn_text_color' => '#BEBEBE', | |
| 65 | - 'btn_bg' => '#4A4A4A', | |
| 66 | - 'btn_text_hover_color' => '#BEBEBE', | |
| 67 | - 'btn_hover_bg' => '#2D2D2D', | |
| 68 | - ], | |
| 69 | - 'set3' => [ | |
| 70 | - 'bg' => isset($options["dark_mode_color_set3"]) ? $options["dark_mode_color_set3"]['background'] : '#211e3c', | |
| 71 | - 'secondary_bg' => isset($options["dark_mode_color_set3"]) ? $options["dark_mode_color_set3"]['secondary_background'] : '#302C57', | |
| 72 | - 'text_color' => '#B1BBD8', | |
| 73 | - 'link_color' => '#8071fb', | |
| 74 | - 'link_hover_color' => '#B1BBD8', | |
| 75 | - 'input_bg' => '#2A264D', | |
| 76 | - 'input_text_color' => '#B1BBD8', | |
| 77 | - 'input_placeholder_color' => '#B1BBD8', | |
| 78 | - 'border_color' => '#4E478D', | |
| 79 | - 'btn_text_color' => '#B1BBD8', | |
| 80 | - 'btn_bg' => '#4E478D', | |
| 81 | - 'btn_text_hover_color' => '#B1BBD8', | |
| 82 | - 'btn_hover_bg' => '#2A264D', | |
| 83 | - ], | |
| 84 | - 'set9' => [ | |
| 85 | - 'bg' => isset($options["dark_mode_color_set9"]) ? $options["dark_mode_color_set9"]['background'] : '#04261d', | |
| 86 | - 'secondary_bg' => isset($options["dark_mode_color_set9"]) ? $options["dark_mode_color_set9"]['secondary_background'] : '#021e16', | |
| 87 | - 'text_color' => '#C1D2BB', | |
| 88 | - 'link_color' => '#00d29a', | |
| 89 | - 'link_hover_color' => '#C1D2BB', | |
| 90 | - 'input_bg' => '#073d2f', | |
| 91 | - 'input_text_color' => '#C1D2BB', | |
| 92 | - 'input_placeholder_color' => '#C1D2BB', | |
| 93 | - 'border_color' => '#095541', | |
| 94 | - 'btn_text_color' => '#C1D2BB', | |
| 95 | - 'btn_bg' => '#095541', | |
| 96 | - 'btn_text_hover_color' => '#C1D2BB', | |
| 97 | - 'btn_hover_bg' => '#073d2f', | |
| 98 | - ], | |
| 99 | - 'set6' => [ | |
| 100 | - 'bg' => isset($options["dark_mode_color_set6"]) ? $options["dark_mode_color_set6"]['background'] : '#082032', | |
| 101 | - 'secondary_bg' => isset($options["dark_mode_color_set6"]) ? $options["dark_mode_color_set6"]['secondary_background'] : '#061825', | |
| 102 | - 'text_color' => '#B5D9F3', | |
| 103 | - 'link_color' => '#61bbff', | |
| 104 | - 'link_hover_color' => '#B5D9F3', | |
| 105 | - 'input_bg' => '#0E3755', | |
| 106 | - 'input_text_color' => '#B5D9F3', | |
| 107 | - 'input_placeholder_color' => '#B5D9F3', | |
| 108 | - 'border_color' => '#144E78', | |
| 109 | - 'btn_text_color' => '#B5D9F3', | |
| 110 | - 'btn_bg' => '#144E78', | |
| 111 | - 'btn_text_hover_color' => '#B5D9F3', | |
| 112 | - 'btn_hover_bg' => '#0E3755', | |
| 113 | - ], | |
| 114 | - 'set10' => [ | |
| 115 | - 'bg' => isset($options["dark_mode_color_set10"]) ? $options["dark_mode_color_set10"]['background'] : '#171004', | |
| 116 | - 'secondary_bg' => isset($options["dark_mode_color_set10"]) ? $options["dark_mode_color_set10"]['secondary_background'] : '#211706', | |
| 117 | - 'text_color' => '#E0D2BD', | |
| 118 | - 'link_color' => '#e09525', | |
| 119 | - 'link_hover_color' => '#E0D2BD', | |
| 120 | - 'input_bg' => '#372911', | |
| 121 | - 'input_text_color' => '#E0D2BD', | |
| 122 | - 'input_placeholder_color' => '#E0D2BD', | |
| 123 | - 'border_color' => '#5D4010', | |
| 124 | - 'btn_text_color' => '#E0D2BD', | |
| 125 | - 'btn_bg' => '#5D4010', | |
| 126 | - 'btn_text_hover_color' => '#E0D2BD', | |
| 127 | - 'btn_hover_bg' => '#372911', | |
| 128 | - ], | |
| 129 | - ]; | |
| 69 | + $darkify_color_pallets = isset($options["color_pallets"]) ? $options["color_pallets"] : 'set1'; | |
| 130 | 70 | |
| 71 | + // Set 1 | |
| 131 | 72 | |
| 132 | - $selected_set_key = isset($options['color_pallets']) ? $options['color_pallets'] : 'set1'; | |
| 133 | - $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'; | |
| 134 | 84 | |
| 135 | - // Output as CSS variables | |
| 136 | - foreach ($selected_set as $key => $value) { | |
| 137 | - echo '--darkify_dark_mode_' . esc_attr($key) . ': ' . esc_attr($value) . ';'; | |
| 138 | - } | |
| 139 | - ?> | |
| 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; ?> | |
| 140 | 210 | } |
| 141 | 211 | </style> |
| 142 | 212 | <?php } else { ?> |
| 143 | 213 | <style type="text/css" class="darkify_inline_css"> |
| @@ -152,20 +222,15 @@ | ||
| 152 | 222 | --darkify_dark_mode_input_placeholder_color: #989898; |
| 153 | 223 | --darkify_dark_mode_border_color: #4A4A4A; |
| 154 | 224 | --darkify_dark_mode_btn_bg: #2D2D2D; |
| 155 | 225 | --darkify_dark_mode_btn_text_color: #BEBEBE; |
| 156 | - --darkify_dark_mode_btn_hover_bg: #BEBEBE; | |
| 157 | - --darkify_dark_mode_btn_text_hover_color: #2D2D2D; | |
| 158 | 226 | } |
| 159 | 227 | </style> |
| 160 | -<?php } | |
| 228 | +<?php } ?> | |
| 161 | 229 | |
| 162 | -if ($enable_scrollbar_dark) { | |
| 163 | - $dark_mode_scrollbar_track_bg = '#29292a'; | |
| 164 | - $dark_mode_scrollbar_thumb_bg = '#52565a'; | |
| 165 | - include DarkifyUtils::darkify_locate_template('views/scrollbar.php'); | |
| 166 | -} | |
| 167 | -?> | |
| 230 | +<?php if ($enable_scrollbar_dark) { ?> | |
| 231 | + <?php include_once Helpers::darkify_locate_template('views/scrollbar.php') ?> | |
| 232 | +<?php } ?> | |
| 168 | 233 | |
| 169 | 234 | <script type="text/javascript" class="darkify_inline_js"> |
| 170 | 235 | var darkify_switch_unique_id = "<?php echo esc_attr($this->unique_id); ?>"; |
| 171 | 236 | var darkify_is_this_admin_panel = "<?php echo esc_attr(is_admin() ? "1" : "0"); ?>"; |
| @@ -172,25 +237,35 @@ | ||
| 172 | 237 | var darkify_enable_default_dark_mode = "<?php echo esc_attr($enable_default_dark_mode); ?>"; |
| 173 | 238 | var darkify_enable_os_aware = "<?php echo esc_attr($enable_os_aware); ?>"; |
| 174 | 239 | var darkify_enable_keyboard_shortcut = "<?php echo esc_attr($enable_keyboard_shortcut); ?>"; |
| 175 | 240 | var darkify_enable_time_based_dark = "<?php echo esc_attr($enable_time_based_dark); ?>"; |
| 176 | - var darkify_time_based_dark_start = "<?php echo esc_attr($time_based_dark_start ? $time_based_dark_start : ""); ?>"; | |
| 177 | - 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); ?>"; | |
| 178 | 244 | var darkify_alternative_dark_mode_switch = "<?php echo esc_attr($alternative_dark_mode_switcher); ?>"; |
| 179 | 245 | var darkify_enable_low_image_brightness = "<?php echo esc_attr($enable_low_image_brightness); ?>"; |
| 180 | 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); ?>"; | |
| 181 | 248 | var darkify_enable_image_grayscale = "<?php echo esc_attr($enable_image_grayscale); ?>"; |
| 182 | 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); ?>"; | |
| 183 | 251 | var darkify_enable_bg_image_darken = "<?php echo esc_attr($enable_low_image_darken); ?>"; |
| 184 | 252 | var darkify_bg_image_darken_to = "<?php echo esc_attr($low_image_darken_label); ?>"; |
| 185 | 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) ?>"; | |
| 186 | 257 | var darkify_enable_low_video_brightness = "<?php echo esc_attr($enable_low_video_brightness); ?>"; |
| 187 | 258 | var darkify_video_brightness_to = "<?php echo esc_attr($low_video_brightness_label); ?>"; |
| 188 | 259 | var darkify_enable_video_grayscale = "<?php echo esc_attr($enable_video_grayscale); ?>"; |
| 189 | 260 | var darkify_video_grayscale_to = "<?php echo esc_attr($video_grayscale_label); ?>"; |
| 190 | - | |
| 191 | - var darkify_disallowed_elements = "<?php echo esc_attr($this->utils->generateDisallowedElementsStr($options, $this->external_support)); ?>"; | |
| 192 | - var darkify_allowed_btn_class = <?php echo json_encode($this->utils->addButtonClassByDarkify($options)); ?>; | |
| 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); ?>"; | |
| 193 | 268 | </script> |
| 194 | 269 | <?php |
| 195 | 270 | $output = ob_get_clean(); |
| 196 | 271 | $tags_allowed_in_output = array( |
| @@ -197,4 +272,5 @@ | ||
| 197 | 272 | 'style' => array('type' => array(), 'class' => array()), |
| 198 | 273 | 'script' => array('type' => array(), 'class' => array()) |
| 199 | 274 | ); |
| 200 | 275 | echo wp_kses($this->utils->minify_string($output), $tags_allowed_in_output); |
| 276 | +?> | |