base_client = $base_client; add_shortcode('darkify', array($this, 'darkify_shortcode_parser')); } public function darkify_shortcode_parser($atts, $content = null) { $options = get_option('darkify'); // Background $switch_background = isset($options['switch_background']) ? $options['switch_background'] : []; $switch_light_mode_bg = !empty($switch_background) ? $switch_background['switch_light_mode_bg'] : '#121116'; $switch_dark_mode_bg = !empty($switch_background) ? $switch_background['switch_dark_mode_bg'] : '#ffffff'; // Border $switch_border = isset($options['switch_border']) ? $options['switch_border'] : []; $switch_border_all = !empty($switch_border['all']) ? $switch_border['all'] : "0px"; $switch_border_light_color = !empty($switch_border['color']) ? $switch_border['color'] : "#ffffff"; $switch_border_dark_color = !empty($switch_border['color3']) ? $switch_border['color3'] : "#121116"; $switch_border_radius = !empty($switch_border['radius']) ? $switch_border['radius'] . 'px' : "7px"; // Color $switch_icon_color = isset($options['switch_icon_color']) ? $options['switch_icon_color'] : []; $switch_light_mode_color = !empty($switch_icon_color) ? $switch_icon_color['switch_light_mode_color'] : '#ffffff'; $switch_dark_mode_color = !empty($switch_icon_color) ? $switch_icon_color['switch_dark_mode_color'] : '#121116'; $atts = shortcode_atts(array( 'switch' => '1', 'switch_size' => '100', 'light_mode_bg' => $switch_light_mode_bg, 'dark_mode_bg' => $switch_dark_mode_bg, 'border' => $switch_border_all, 'border_light_color' => $switch_border_light_color, 'border_dark_color' => $switch_border_dark_color, 'border_radius' => $switch_border_radius, 'light_mode_color' => $switch_light_mode_color, 'dark_mode_color' => $switch_dark_mode_color, ), $atts); return $this->darkify_client_view_maker($atts); } public function darkify_client_view_maker($atts) { if (function_exists('wp_rand')) { $unique_id = wp_rand() . "_shortcode"; } $switch_styles = $this->base_client->utils->generateSwitchStylesForShortcode($atts); ob_start(); if (sizeof($switch_styles) > 0) { ?>