| 1 |
<?php |
| 2 |
if (!defined('ABSPATH')) { |
| 3 |
die; |
| 4 |
} // Cannot access directly. |
| 5 |
|
| 6 |
$hide_on_mobile = isset($options["hide_on_mobile"]) ? $options["hide_on_mobile"] : ''; |
| 7 |
$hide_dark_mode_on_mobile = isset($hide_on_mobile['hide_dark_mode_on_mobile']) ? $hide_on_mobile['hide_dark_mode_on_mobile'] : ''; |
| 8 |
$tooltip_on_floating_switch = isset($options["tooltip_on_floating_switch"]) ? $options["tooltip_on_floating_switch"] : ''; |
| 9 |
$tooltip_color = isset($tooltip_on_floating_switch['tooltip_color']) ? $tooltip_on_floating_switch['tooltip_color'] : ''; |
| 10 |
|
| 11 |
$switcher_button_position = isset($options["switcher_button_position"]) ? $options["switcher_button_position"] : ''; |
| 12 |
|
| 13 |
$dark_mode_switch_position = isset($switcher_button_position["dark_mode_switch_position"]) ? $switcher_button_position["dark_mode_switch_position"] : ""; |
| 14 |
$switch_position_top_right = isset($switcher_button_position["switch_position_top_right"]) ? $switcher_button_position["switch_position_top_right"] : ""; |
| 15 |
$switch_position_top_right_top = isset($switch_position_top_right["top"]) ? $switch_position_top_right["top"] : "40"; |
| 16 |
$switch_position_top_right_right = isset($switch_position_top_right["right"]) ? $switch_position_top_right["right"] : "40"; |
| 17 |
$switch_position_top_left = isset($switcher_button_position["switch_position_top_left"]) ? $switcher_button_position["switch_position_top_left"] : ""; |
| 18 |
$switch_position_top_left_top = isset($switch_position_top_left["top"]) ? $switch_position_top_left["top"] : "40"; |
| 19 |
$switch_position_top_left_left = isset($switch_position_top_left["left"]) ? $switch_position_top_left["left"] : "40"; |
| 20 |
$switch_position_bottom_right = isset($switcher_button_position["switch_position_bottom_right"]) ? $switcher_button_position["switch_position_bottom_right"] : ""; |
| 21 |
$switch_position_bottom_right_bottom = isset($switch_position_bottom_right["bottom"]) ? $switch_position_bottom_right["bottom"] : "40"; |
| 22 |
$switch_position_bottom_right_right = isset($switch_position_bottom_right["right"]) ? $switch_position_bottom_right["right"] : "40"; |
| 23 |
$switch_position_bottom_left = isset($switcher_button_position["switch_position_bottom_left"]) ? $switcher_button_position["switch_position_bottom_left"] : ""; |
| 24 |
$switch_position_bottom_left_bottom = isset($switch_position_bottom_left["bottom"]) ? $switch_position_bottom_left["bottom"] : "40"; |
| 25 |
$switch_position_bottom_left_left = isset($switch_position_bottom_left["left"]) ? $switch_position_bottom_left["left"] : "40"; |
| 26 |
$different_switch_in_mobile = isset($options["different_switch_in_mobile"]) ? $options["different_switch_in_mobile"] : ''; |
| 27 |
$switch_position_different_in_mobile = isset($different_switch_in_mobile["switch_position_different_in_mobile"]) ? $different_switch_in_mobile["switch_position_different_in_mobile"] : ""; |
| 28 |
$switch_position_top_right_in_mobile = isset($different_switch_in_mobile["switch_position_top_right_in_mobile"]) ? $different_switch_in_mobile["switch_position_top_right_in_mobile"] : ""; |
| 29 |
$switch_position_top_right_top_in_mobile = isset($switch_position_top_right_in_mobile["top"]) ? $switch_position_top_right_in_mobile["top"] : "40"; |
| 30 |
$switch_position_top_right_right_in_mobile = isset($switch_position_top_right_in_mobile["right"]) ? $switch_position_top_right_in_mobile["right"] : "40"; |
| 31 |
$switch_position_top_left_in_mobile = isset($different_switch_in_mobile["switch_position_top_left_in_mobile"]) ? $different_switch_in_mobile["switch_position_top_left_in_mobile"] : ""; |
| 32 |
$switch_position_top_left_top_in_mobile = isset($switch_position_top_left_in_mobile["top"]) ? $switch_position_top_left_in_mobile["top"] : "40"; |
| 33 |
$switch_position_top_left_left_in_mobile = isset($switch_position_top_left_in_mobile["left"]) ? $switch_position_top_left_in_mobile["left"] : "40"; |
| 34 |
$switch_position_bottom_right_in_mobile = isset($different_switch_in_mobile["switch_position_bottom_right_in_mobile"]) ? $different_switch_in_mobile["switch_position_bottom_right_in_mobile"] : ""; |
| 35 |
$switch_position_bottom_right_bottom_in_mobile = isset($switch_position_bottom_right_in_mobile["bottom"]) ? $switch_position_bottom_right_in_mobile["bottom"] : "40"; |
| 36 |
$switch_position_bottom_right_right_in_mobile = isset($switch_position_bottom_right_in_mobile["right"]) ? $switch_position_bottom_right_in_mobile["right"] : "40"; |
| 37 |
$switch_position_bottom_left_in_mobile = isset($different_switch_in_mobile["switch_position_bottom_left_in_mobile"]) ? $different_switch_in_mobile["switch_position_bottom_left_in_mobile"] : ""; |
| 38 |
$switch_position_bottom_left_bottom_in_mobile = isset($switch_position_bottom_left_in_mobile["bottom"]) ? $switch_position_bottom_left_in_mobile["bottom"] : "40"; |
| 39 |
$switch_position_bottom_left_left_in_mobile = isset($switch_position_bottom_left_in_mobile["left"]) ? $switch_position_bottom_left_in_mobile["left"] : "40"; |
| 40 |
$floating_switch_width = isset($tooltip_on_floating_switch["floating_switch_width"]) ? $tooltip_on_floating_switch["floating_switch_width"] : ""; |
| 41 |
?> |
| 42 |
<style type="text/css" class="darkify_inline_css"> |
| 43 |
#darkify_switch_<?php echo esc_attr($this->unique_id); ?> { |
| 44 |
<?php foreach ($this->utils->generateSwitchStyles($options) as $key => $value) { ?><?php echo esc_attr($key); ?>: <?php echo esc_attr($value); ?>; |
| 45 |
<?php } ?> |
| 46 |
} |
| 47 |
|
| 48 |
#darkify_switch_<?php echo esc_attr($this->unique_id); ?> { |
| 49 |
--darkify_switch_position_from_top_right_top: <?php echo esc_attr($switch_position_top_right_top); ?>px; |
| 50 |
--darkify_switch_position_from_top_right_right: <?php echo esc_attr($switch_position_top_right_right); ?>px; |
| 51 |
--darkify_switch_position_from_bottom_right_bottom: <?php echo esc_attr($switch_position_bottom_right_bottom); ?>px; |
| 52 |
--darkify_switch_position_from_bottom_right_right: <?php echo esc_attr($switch_position_bottom_right_right); ?>px; |
| 53 |
--darkify_switch_position_from_top_left_top: <?php echo esc_attr($switch_position_top_left_top); ?>px; |
| 54 |
--darkify_switch_position_from_top_left_left: <?php echo esc_attr($switch_position_top_left_left); ?>px; |
| 55 |
--darkify_switch_position_from_bottom_left_bottom: <?php echo esc_attr($switch_position_bottom_left_bottom); ?>px; |
| 56 |
--darkify_switch_position_from_bottom_left_left: <?php echo esc_attr($switch_position_bottom_left_left); ?>px; |
| 57 |
<?php if ($switch_position_different_in_mobile) { ?> |
| 58 |
--darkify_switch_position_from_top_right_top_in_mobile: <?php echo esc_attr($switch_position_top_right_right_in_mobile); ?>px; |
| 59 |
--darkify_switch_position_from_top_right_right_in_mobile: <?php echo esc_attr($switch_position_top_right_right_in_mobile); ?>px; |
| 60 |
--darkify_switch_position_from_bottom_right_bottom_in_mobile: <?php echo esc_attr($switch_position_bottom_right_bottom_in_mobile); ?>px; |
| 61 |
--darkify_switch_position_from_bottom_right_right_in_mobile: <?php echo esc_attr($switch_position_bottom_right_right_in_mobile); ?>px; |
| 62 |
--darkify_switch_position_from_top_left_top_in_mobile: <?php echo esc_attr($switch_position_top_left_top_in_mobile); ?>px; |
| 63 |
--darkify_switch_position_from_top_left_left_in_mobile: <?php echo esc_attr($switch_position_top_left_top_in_mobile); ?>px; |
| 64 |
--darkify_switch_position_from_bottom_left_bottom_in_mobile: <?php echo esc_attr($switch_position_bottom_left_bottom_in_mobile); ?>px; |
| 65 |
--darkify_switch_position_from_bottom_left_left_in_mobile: <?php echo esc_attr($switch_position_bottom_left_left_in_mobile); ?>px; |
| 66 |
<?php } if ($floating_switch_width) { ?>--darkify_switch_tooltip_bg_color: <?php echo esc_attr($tooltip_color["tooltip_background_color"]); ?>; |
| 67 |
--darkify_switch_tooltip_text_color: <?php echo esc_attr($tooltip_color["tooltip_text_color"]); ?>; |
| 68 |
<?php } ?> |
| 69 |
} |
| 70 |
</style> |
| 71 |
|
| 72 |
<?php |
| 73 |
$hide_dark_mode_on_mobile_screen = ""; |
| 74 |
|
| 75 |
if ($hide_dark_mode_on_mobile) { |
| 76 |
if ($hide_on_mobile["type_of_hide_by"] == "screen_size" || $hide_on_mobile["type_of_hide_by"] == "both") { |
| 77 |
$hide_dark_mode_on_mobile_screen = "darkify_hide_on_mobile"; |
| 78 |
} |
| 79 |
} |
| 80 |
|
| 81 |
if ($dark_mode_switch_position == "") { |
| 82 |
$floating_switch_position = "darkify_bottom_right"; |
| 83 |
} else { |
| 84 |
$floating_switch_position = "darkify_" . $dark_mode_switch_position; |
| 85 |
} |
| 86 |
if ($switch_position_different_in_mobile) { |
| 87 |
$floating_switch_position .= " darkify_" . $different_switch_in_mobile["switch_position_in_mobile"] . "_in_mobile"; |
| 88 |
} |
| 89 |
|
| 90 |
$tooltip_classes = ""; |
| 91 |
if ($floating_switch_width) { |
| 92 |
$tooltip_classes = "darkify_tooltip darkify_tooltip_" . $tooltip_on_floating_switch["tooltip_position"]; |
| 93 |
} |
| 94 |
|
| 95 |
$darkify_absolute_position = isset($options["enable_absolute_position"]) ? $options["enable_absolute_position"] : ''; |
| 96 |
$position_class = ''; |
| 97 |
if ($darkify_absolute_position) { |
| 98 |
$position_class = ' darkify_absolute_position'; |
| 99 |
} |
| 100 |
$dark_mode_switcher = isset($options["enable_dark_switcher"]) ? $options["enable_dark_switcher"] : 'classic'; |
| 101 |
|
| 102 |
if ("classic" === $dark_mode_switcher) { ?> |
| 103 |
<div id="darkify_switch_<?php echo esc_attr($this->unique_id); ?>" onclick="darkify_switch_trigger()" class="darkify_switch darkify_switch_style <?php echo esc_attr($floating_switch_position); ?> <?php echo esc_attr($position_class); ?> <?php echo esc_attr($tooltip_classes); ?> <?php echo esc_attr($hide_dark_mode_on_mobile_screen); ?>"> |
| 104 |
<div class="theme-toggle"> |
| 105 |
<svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" width="50px" height="50px" fill="currentColor" stroke-linecap="round" class="theme-toggle__classic" viewBox="0 0 32 32"> |
| 106 |
<clipPath id="theme-toggle__classic__cutout"> |
| 107 |
<path d="M0-5h30a1 1 0 0 0 9 13v24H0Z" /> |
| 108 |
</clipPath> |
| 109 |
<g clip-path="url(#theme-toggle__classic__cutout)"> |
| 110 |
<circle cx="16" cy="16" r="9.34" /> |
| 111 |
<g stroke="currentColor" stroke-width="1.5"> |
| 112 |
<path d="M16 5.5v-4" /> |
| 113 |
<path d="M16 30.5v-4" /> |
| 114 |
<path d="M1.5 16h4" /> |
| 115 |
<path d="M26.5 16h4" /> |
| 116 |
<path d="m23.4 8.6 2.8-2.8" /> |
| 117 |
<path d="m5.7 26.3 2.9-2.9" /> |
| 118 |
<path d="m5.8 5.8 2.8 2.8" /> |
| 119 |
<path d="m23.4 23.4 2.9 2.9" /> |
| 120 |
</g> |
| 121 |
</g> |
| 122 |
</svg> |
| 123 |
</div> |
| 124 |
<?php if ($floating_switch_width) { ?> <span class="darkify_tooltiptext"><?php echo esc_attr($tooltip_on_floating_switch["tooltip_text"]); ?></span> <?php } ?> |
| 125 |
</div> |
| 126 |
<?php } ?> |
| 127 |
<?php if ("inner-moon" === $dark_mode_switcher) { ?> |
| 128 |
<div id="darkify_switch_<?php echo esc_attr($this->unique_id); ?>" onclick="darkify_switch_trigger()" class="darkify_switch darkify_switch_style <?php echo esc_attr($floating_switch_position); ?> <?php echo esc_attr($options["enable_absolute_position"] ? "darkify_absolute_position" : ""); ?> <?php echo esc_attr($tooltip_classes); ?> <?php echo esc_attr($hide_dark_mode_on_mobile_screen); ?>"> |
| 129 |
<div class="theme-toggle"> |
| 130 |
<svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" width="50px" height="50px" fill="currentColor" class="theme-toggle__inner-moon" viewBox="0 0 32 32"> |
| 131 |
<path d="M27.5 11.5v-7h-7L16 0l-4.5 4.5h-7v7L0 16l4.5 4.5v7h7L16 32l4.5-4.5h7v-7L32 16l-4.5-4.5zM16 25.4a9.39 9.39 0 1 1 0-18.8 9.39 9.39 0 1 1 0 18.8z" /> |
| 132 |
<circle cx="16" cy="16" r="8.1" /> |
| 133 |
</svg> |
| 134 |
</div> |
| 135 |
<?php if ($floating_switch_width) { ?> <span class="darkify_tooltiptext"><?php echo esc_attr($tooltip_on_floating_switch["tooltip_text"]); ?></span> <?php } ?> |
| 136 |
</div> |
| 137 |
<?php } ?> |
| 138 |
<?php if ("expand" === $dark_mode_switcher) { ?> |
| 139 |
<div id="darkify_switch_<?php echo esc_attr($this->unique_id); ?>" onclick="darkify_switch_trigger()" class="darkify_switch darkify_switch_style <?php echo esc_attr($floating_switch_position); ?> <?php echo esc_attr($options["enable_absolute_position"] ? "darkify_absolute_position" : ""); ?> <?php echo esc_attr($tooltip_classes); ?> <?php echo esc_attr($hide_dark_mode_on_mobile_screen); ?>"> |
| 140 |
<div class="theme-toggle"> |
| 141 |
<svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" width="50px" height="50px" fill="currentColor" class="theme-toggle__expand" viewBox="0 0 32 32"> |
| 142 |
<clipPath id="theme-toggle__expand__cutout"> |
| 143 |
<path d="M0-11h25a1 1 0 0017 13v30H0Z" /> |
| 144 |
</clipPath> |
| 145 |
<g clip-path="url(#theme-toggle__expand__cutout)"> |
| 146 |
<circle cx="16" cy="16" r="8.4" /> |
| 147 |
<path d="M18.3 3.2c0 1.3-1 2.3-2.3 2.3s-2.3-1-2.3-2.3S14.7.9 16 .9s2.3 1 2.3 2.3zm-4.6 25.6c0-1.3 1-2.3 2.3-2.3s2.3 1 2.3 2.3-1 2.3-2.3 2.3-2.3-1-2.3-2.3zm15.1-10.5c-1.3 0-2.3-1-2.3-2.3s1-2.3 2.3-2.3 2.3 1 2.3 2.3-1 2.3-2.3 2.3zM3.2 13.7c1.3 0 2.3 1 2.3 2.3s-1 2.3-2.3 2.3S.9 17.3.9 16s1-2.3 2.3-2.3zm5.8-7C9 7.9 7.9 9 6.7 9S4.4 8 4.4 6.7s1-2.3 2.3-2.3S9 5.4 9 6.7zm16.3 21c-1.3 0-2.3-1-2.3-2.3s1-2.3 2.3-2.3 2.3 1 2.3 2.3-1 2.3-2.3 2.3zm2.4-21c0 1.3-1 2.3-2.3 2.3S23 7.9 23 6.7s1-2.3 2.3-2.3 2.4 1 2.4 2.3zM6.7 23C8 23 9 24 9 25.3s-1 2.3-2.3 2.3-2.3-1-2.3-2.3 1-2.3 2.3-2.3z" /> |
| 148 |
</g> |
| 149 |
</svg> |
| 150 |
</div> |
| 151 |
<?php if ($floating_switch_width) { ?> <span class="darkify_tooltiptext"><?php echo esc_attr($tooltip_on_floating_switch["tooltip_text"]); ?></span> <?php } ?> |
| 152 |
</div> |
| 153 |
<?php } ?> |
| 154 |
<?php if ("within" === $dark_mode_switcher) { ?> |
| 155 |
<div id="darkify_switch_<?php echo esc_attr($this->unique_id); ?>" onclick="darkify_switch_trigger()" class="darkify_switch darkify_switch_style <?php echo esc_attr($floating_switch_position); ?> <?php echo esc_attr($options["enable_absolute_position"] ? "darkify_absolute_position" : ""); ?> <?php echo esc_attr($tooltip_classes); ?> <?php echo esc_attr($hide_dark_mode_on_mobile_screen); ?>"> |
| 156 |
<div class="theme-toggle"> |
| 157 |
<svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" class="theme-toggle__within" height="1em" width="1em" viewBox="0 0 32 32" fill="currentColor"> |
| 158 |
<clipPath id="theme-toggle__within__clip"> |
| 159 |
<path d="M0 0h32v32h-32ZM6 16A1 1 0 0026 16 1 1 0 006 16" /> |
| 160 |
</clipPath> |
| 161 |
<g clip-path="url(#theme-toggle__within__clip)"> |
| 162 |
<path d="M30.7 21.3 27.1 16l3.7-5.3c.4-.5.1-1.3-.6-1.4l-6.3-1.1-1.1-6.3c-.1-.6-.8-.9-1.4-.6L16 5l-5.4-3.7c-.5-.4-1.3-.1-1.4.6l-1 6.3-6.4 1.1c-.6.1-.9.9-.6 1.3L4.9 16l-3.7 5.3c-.4.5-.1 1.3.6 1.4l6.3 1.1 1.1 6.3c.1.6.8.9 1.4.6l5.3-3.7 5.3 3.7c.5.4 1.3.1 1.4-.6l1.1-6.3 6.3-1.1c.8-.1 1.1-.8.7-1.4zM16 25.1c-5.1 0-9.1-4.1-9.1-9.1 0-5.1 4.1-9.1 9.1-9.1s9.1 4.1 9.1 9.1c0 5.1-4 9.1-9.1 9.1z" /> |
| 163 |
</g> |
| 164 |
<path class="theme-toggle__within__circle" d="M16 7.7c-4.6 0-8.2 3.7-8.2 8.2s3.6 8.4 8.2 8.4 8.2-3.7 8.2-8.2-3.6-8.4-8.2-8.4zm0 14.4c-3.4 0-6.1-2.9-6.1-6.2s2.7-6.1 6.1-6.1c3.4 0 6.1 2.9 6.1 6.2s-2.7 6.1-6.1 6.1z" /> |
| 165 |
<path class="theme-toggle__within__inner" d="M16 9.5c-3.6 0-6.4 2.9-6.4 6.4s2.8 6.5 6.4 6.5 6.4-2.9 6.4-6.4-2.8-6.5-6.4-6.5z" /> |
| 166 |
</svg> |
| 167 |
</div> |
| 168 |
<?php if ($floating_switch_width) { ?> <span class="darkify_tooltiptext"><?php echo esc_attr($tooltip_on_floating_switch["tooltip_text"]); ?></span> <?php } ?> |
| 169 |
</div> |
| 170 |
<?php } ?> |