| 1 |
<?php |
| 2 |
if (!defined('ABSPATH')) { |
| 3 |
die; |
| 4 |
} // Cannot access directly. |
| 5 |
$options = get_option('darkify'); |
| 6 |
$hide_on_desktop = $options["hide_on_desktop"]; |
| 7 |
$hide_on_mobile = $options["hide_on_mobile"]; |
| 8 |
$hide_dark_mode_on_mobile = isset($hide_on_mobile["hide_dark_mode_on_mobile"]) ? $hide_on_mobile["hide_dark_mode_on_mobile"] : 0; |
| 9 |
$type_of_hide_by = isset($hide_on_mobile["type_of_hide_by"]) ? $hide_on_mobile["type_of_hide_by"] : 0; |
| 10 |
?> |
| 11 |
<?php if (!is_admin()) { ?> |
| 12 |
<?php if ($options["enable_dark_mode_switch"]) { ?> |
| 13 |
<?php if (!$this->utils->is_hidden_by_user_agent($hide_on_desktop, $hide_dark_mode_on_mobile, $type_of_hide_by)) { ?> |
| 14 |
<?php include DRK_LITE_PATH . "public/templates/views/switch.php"; ?> |
| 15 |
<?php } ?> |
| 16 |
<?php } ?> |
| 17 |
<?php } ?> |
| 18 |
|
| 19 |
<?php if (is_admin()) { ?> |
| 20 |
<?php /* Check if block editor is on, then add the dark mode button there */ ?> |
| 21 |
<?php if ($options["enable_admin_panel_dark_mode"]) { |
| 22 |
if (class_exists('WP_Block_Type_Registry')) { |
| 23 |
$current_screen = get_current_screen(); |
| 24 |
if ($current_screen && 'post' === $current_screen->base && ('post' === $current_screen->post_type || 'page' === $current_screen->post_type)) { |
| 25 |
// Enqueue the script |
| 26 |
wp_enqueue_script( 'darkify-editor-script', plugin_dir_url( __FILE__ ) . 'darkify-editor-script.js', array( 'wp-dom-ready', 'wp-edit-post' ), null, true ); |
| 27 |
} |
| 28 |
} |
| 29 |
} ?> |
| 30 |
<?php } ?> |