/**
  * Constructor.
  * 
  * @param array $details
  * @return \YITH_WCWL
  * @since 1.0.0
  */
 public function __construct($details)
 {
     $this->details = $details;
     $this->wcwl_init = YITH_WCWL_Init();
     if (is_admin()) {
         $this->wcwl_admin_init = YITH_WCWL_Admin_Init();
     }
     add_action('after_setup_theme', array($this, 'plugin_fw_loader'), 1);
     // add rewrite rule
     add_action('init', array($this, 'add_rewrite_rules'), 0);
     add_filter('query_vars', array($this, 'add_public_query_var'));
     add_action('init', array($this, 'add_to_wishlist'));
     add_action('wp_ajax_add_to_wishlist', array($this, 'add_to_wishlist_ajax'));
     add_action('wp_ajax_nopriv_add_to_wishlist', array($this, 'add_to_wishlist_ajax'));
     add_action('init', array($this, 'remove_from_wishlist'));
     add_action('wp_ajax_remove_from_wishlist', array($this, 'remove_from_wishlist_ajax'));
     add_action('wp_ajax_nopriv_remove_from_wishlist', array($this, 'remove_from_wishlist_ajax'));
     add_action('wp_ajax_reload_wishlist_and_adding_elem', array($this, 'reload_wishlist_and_adding_elem_ajax'));
     add_action('wp_ajax_nopriv_reload_wishlist_and_adding_elem', array($this, 'reload_wishlist_and_adding_elem_ajax'));
     add_action('woocommerce_add_to_cart', array($this, 'remove_from_wishlist_after_add_to_cart'));
     add_filter('woocommerce_product_add_to_cart_url', array($this, 'redirect_to_cart'), 10, 2);
     add_action('yith_wcwl_before_wishlist_title', array($this, 'print_notices'));
     add_filter('woocommerce_add_to_cart_redirect', array($this, 'yith_wfbt_redirect_after_add_to_cart'), 10, 1);
     // add filter for font-awesome compatibility
     add_filter('option_yith_wcwl_add_to_wishlist_icon', array($this, 'update_font_awesome_classes'));
     add_filter('option_yith_wcwl_add_to_cart_icon', array($this, 'update_font_awesome_classes'));
 }
        /**
         * Add colors options to the panel.
         *
         * @return void
         * @access private
         * @since 1.0.0
         */
        private function _styles_options()
        {
            $colors = maybe_unserialize(get_option('yith_wcwl_frontend_css_colors'));
            foreach (YITH_WCWL_Init()->colors_options as $color => $attrs) {
                if (!isset($colors[$color])) {
                    $colors[$color] = $attrs;
                }
            }
            ?>
			<div class="color-panel">
				<div class="clear"></div>
				<h4><?php 
            _e('"Add to wishlist" button', 'yit');
            ?>
</h4>
				<?php 
            yith_frontend_css_color_picker(__('Background', 'yit'), 'yith_wcwl_color_add_to_wishlist_background', $colors['add_to_wishlist']['background']);
            yith_frontend_css_color_picker(__('Text', 'yit'), 'yith_wcwl_color_add_to_wishlist_color', $colors['add_to_wishlist']['color']);
            yith_frontend_css_color_picker(__('Border', 'yit'), 'yith_wcwl_color_add_to_wishlist_border_color', $colors['add_to_wishlist']['border_color']);
            ?>
				<div class="clear" style="height:10px;"></div>
				<?php 
            // hover
            yith_frontend_css_color_picker(__('Background (hover)', 'yit'), 'yith_wcwl_color_add_to_wishlist_hover_background', $colors['add_to_wishlist_hover']['background']);
            yith_frontend_css_color_picker(__('Text (hover)', 'yit'), 'yith_wcwl_color_add_to_wishlist_hover_color', $colors['add_to_wishlist_hover']['color']);
            yith_frontend_css_color_picker(__('Border (hover)', 'yit'), 'yith_wcwl_color_add_to_wishlist_hover_border_color', $colors['add_to_wishlist_hover']['border_color']);
            ?>
				<div class="clear" style="height:30px;"></div>
				<h4><?php 
            _e('"Add to Cart" button', 'yit');
            ?>
</h4>
				<?php 
            yith_frontend_css_color_picker(__('Background', 'yit'), 'yith_wcwl_color_add_to_cart_background', $colors['add_to_cart']['background']);
            yith_frontend_css_color_picker(__('Text', 'yit'), 'yith_wcwl_color_add_to_cart_color', $colors['add_to_cart']['color']);
            yith_frontend_css_color_picker(__('Border', 'yit'), 'yith_wcwl_color_add_to_cart_border_color', $colors['add_to_cart']['border_color']);
            ?>
				<div class="clear" style="height:10px;"></div>
				<?php 
            // hover
            yith_frontend_css_color_picker(__('Background (hover)', 'yit'), 'yith_wcwl_color_add_to_cart_hover_background', $colors['add_to_cart_hover']['background']);
            yith_frontend_css_color_picker(__('Text (hover)', 'yit'), 'yith_wcwl_color_add_to_cart_hover_color', $colors['add_to_cart_hover']['color']);
            yith_frontend_css_color_picker(__('Border (hover)', 'yit'), 'yith_wcwl_color_add_to_cart_hover_border_color', $colors['add_to_cart_hover']['border_color']);
            ?>
				<div class="clear" style="height:30px;"></div>
				<h4><?php 
            _e('"Style 1" button', 'yit');
            ?>
</h4>
				<?php 
            yith_frontend_css_color_picker(__('Background', 'yit'), 'yith_wcwl_color_button_style_1_background', $colors['button_style_1']['background']);
            yith_frontend_css_color_picker(__('Text', 'yit'), 'yith_wcwl_color_button_style_1_color', $colors['button_style_1']['color']);
            yith_frontend_css_color_picker(__('Border', 'yit'), 'yith_wcwl_color_button_style_1_border_color', $colors['button_style_1']['border_color']);
            ?>
				<div class="clear" style="height:10px;"></div>
				<?php 
            // hover
            yith_frontend_css_color_picker(__('Background (hover)', 'yit'), 'yith_wcwl_color_button_style_1_hover_background', $colors['button_style_1_hover']['background']);
            yith_frontend_css_color_picker(__('Text (hover)', 'yit'), 'yith_wcwl_color_button_style_1_hover_color', $colors['button_style_1_hover']['color']);
            yith_frontend_css_color_picker(__('Border (hover)', 'yit'), 'yith_wcwl_color_button_style_1_hover_border_color', $colors['button_style_1_hover']['border_color']);
            ?>
				<div class="clear" style="height:30px;"></div>
				<h4><?php 
            _e('"Style 2" button', 'yit');
            ?>
</h4>
				<?php 
            yith_frontend_css_color_picker(__('Background', 'yit'), 'yith_wcwl_color_button_style_2_background', $colors['button_style_2']['background']);
            yith_frontend_css_color_picker(__('Text', 'yit'), 'yith_wcwl_color_button_style_2_color', $colors['button_style_2']['color']);
            yith_frontend_css_color_picker(__('Border', 'yit'), 'yith_wcwl_color_button_style_2_border_color', $colors['button_style_2']['border_color']);
            ?>
				<div class="clear" style="height:10px;"></div>
				<?php 
            // hover
            yith_frontend_css_color_picker(__('Background (hover)', 'yit'), 'yith_wcwl_color_button_style_2_hover_background', $colors['button_style_2_hover']['background']);
            yith_frontend_css_color_picker(__('Text (hover)', 'yit'), 'yith_wcwl_color_button_style_2_hover_color', $colors['button_style_2_hover']['color']);
            yith_frontend_css_color_picker(__('Border (hover)', 'yit'), 'yith_wcwl_color_button_style_2_hover_border_color', $colors['button_style_2_hover']['border_color']);
            ?>
				<div class="clear" style="height:30px;"></div>
				<h4><?php 
            _e('Wishlist table', 'yit');
            ?>
</h4>
				<?php 
            yith_frontend_css_color_picker(__('Background', 'yit'), 'yith_wcwl_color_wishlist_table_background', $colors['wishlist_table']['background']);
            yith_frontend_css_color_picker(__('Text', 'yit'), 'yith_wcwl_color_wishlist_table_color', $colors['wishlist_table']['color']);
            yith_frontend_css_color_picker(__('Border', 'yit'), 'yith_wcwl_color_wishlist_table_border_color', $colors['wishlist_table']['border_color']);
            ?>
				<div class="clear" style="height:30px;"></div>
				<h4><?php 
            _e('Headers', 'yit');
            ?>
</h4>
				<?php 
            yith_frontend_css_color_picker(__('Background color', 'yit'), 'yith_wcwl_color_headers_background', $colors['headers']['background']);
            do_action('yith_wcwl_admin_color_pickers');
            ?>
				<div class="clear"></div>
			</div>
			<div class="clear" style="height:30px;"></div>
		<?php 
        }
        /**
         * Add colors options to the panel.
         *
         * @return void
         * @access private
         * @since 1.0.0
         */
        private function _styles_options()
        {
            $colors = maybe_unserialize(get_option('yith_wcwl_frontend_css_colors'));
            foreach (YITH_WCWL_Init()->colors_options as $color => $attrs) {
                if (!isset($colors[$color])) {
                    $colors[$color] = $attrs;
                }
            }
            ?>
            <div class="color-panel">
            <div class="clear"></div>
            <h4><?php 
            _e('"Add to wishlist" button', 'yit');
            ?>
</h4>
            <?php 
            yith_frontend_css_color_picker(__('Background', 'yit'), 'yith_wcwl_color_add_to_wishlist_background', $colors['add_to_wishlist']['background']);
            yith_frontend_css_color_picker(__('Text', 'yit'), 'yith_wcwl_color_add_to_wishlist_color', $colors['add_to_wishlist']['color']);
            yith_frontend_css_color_picker(__('Border', 'yit'), 'yith_wcwl_color_add_to_wishlist_border_color', $colors['add_to_wishlist']['border_color']);
            ?>
            <div class="clear" style="height:10px;"></div>
            <?php 
            // hover
            yith_frontend_css_color_picker(__('Background (hover)', 'yit'), 'yith_wcwl_color_add_to_wishlist_hover_background', $colors['add_to_wishlist_hover']['background']);
            yith_frontend_css_color_picker(__('Text (hover)', 'yit'), 'yith_wcwl_color_add_to_wishlist_hover_color', $colors['add_to_wishlist_hover']['color']);
            yith_frontend_css_color_picker(__('Border (hover)', 'yit'), 'yith_wcwl_color_add_to_wishlist_hover_border_color', $colors['add_to_wishlist_hover']['border_color']);
            ?>
            <div class="clear" style="height:30px;"></div>
            <h4><?php 
            _e('"Add to Cart" button', 'yit');
            ?>
</h4>
            <?php 
            yith_frontend_css_color_picker(__('Background', 'yit'), 'yith_wcwl_color_add_to_cart_background', $colors['add_to_cart']['background']);
            yith_frontend_css_color_picker(__('Text', 'yit'), 'yith_wcwl_color_add_to_cart_color', $colors['add_to_cart']['color']);
            yith_frontend_css_color_picker(__('Border', 'yit'), 'yith_wcwl_color_add_to_cart_border_color', $colors['add_to_cart']['border_color']);
            ?>
            <div class="clear" style="height:10px;"></div>
            <?php 
            // hover
            yith_frontend_css_color_picker(__('Background (hover)', 'yit'), 'yith_wcwl_color_add_to_cart_hover_background', $colors['add_to_cart_hover']['background']);
            yith_frontend_css_color_picker(__('Text (hover)', 'yit'), 'yith_wcwl_color_add_to_cart_hover_color', $colors['add_to_cart_hover']['color']);
            yith_frontend_css_color_picker(__('Border (hover)', 'yit'), 'yith_wcwl_color_add_to_cart_hover_border_color', $colors['add_to_cart_hover']['border_color']);
            ?>
            <div class="clear" style="height:30px;"></div>
            <h4><?php 
            _e('"Style 1" button', 'yit');
            ?>
</h4>
            <?php 
            yith_frontend_css_color_picker(__('Background', 'yit'), 'yith_wcwl_color_button_style_1_background', $colors['button_style_1']['background']);
            yith_frontend_css_color_picker(__('Text', 'yit'), 'yith_wcwl_color_button_style_1_color', $colors['button_style_1']['color']);
            yith_frontend_css_color_picker(__('Border', 'yit'), 'yith_wcwl_color_button_style_1_border_color', $colors['button_style_1']['border_color']);
            ?>
            <div class="clear" style="height:10px;"></div>
            <?php 
            // hover
            yith_frontend_css_color_picker(__('Background (hover)', 'yit'), 'yith_wcwl_color_button_style_1_hover_background', $colors['button_style_1_hover']['background']);
            yith_frontend_css_color_picker(__('Text (hover)', 'yit'), 'yith_wcwl_color_button_style_1_hover_color', $colors['button_style_1_hover']['color']);
            yith_frontend_css_color_picker(__('Border (hover)', 'yit'), 'yith_wcwl_color_button_style_1_hover_border_color', $colors['button_style_1_hover']['border_color']);
            ?>
            <div class="clear" style="height:30px;"></div>
            <h4><?php 
            _e('"Style 2" button', 'yit');
            ?>
</h4>
            <?php 
            yith_frontend_css_color_picker(__('Background', 'yit'), 'yith_wcwl_color_button_style_2_background', $colors['button_style_2']['background']);
            yith_frontend_css_color_picker(__('Text', 'yit'), 'yith_wcwl_color_button_style_2_color', $colors['button_style_2']['color']);
            yith_frontend_css_color_picker(__('Border', 'yit'), 'yith_wcwl_color_button_style_2_border_color', $colors['button_style_2']['border_color']);
            ?>
            <div class="clear" style="height:10px;"></div>
            <?php 
            // hover
            yith_frontend_css_color_picker(__('Background (hover)', 'yit'), 'yith_wcwl_color_button_style_2_hover_background', $colors['button_style_2_hover']['background']);
            yith_frontend_css_color_picker(__('Text (hover)', 'yit'), 'yith_wcwl_color_button_style_2_hover_color', $colors['button_style_2_hover']['color']);
            yith_frontend_css_color_picker(__('Border (hover)', 'yit'), 'yith_wcwl_color_button_style_2_hover_border_color', $colors['button_style_2_hover']['border_color']);
            ?>
            <div class="clear" style="height:30px;"></div>
            <h4><?php 
            _e('Wishlist table', 'yit');
            ?>
</h4>
            <?php 
            yith_frontend_css_color_picker(__('Background', 'yit'), 'yith_wcwl_color_wishlist_table_background', $colors['wishlist_table']['background']);
            yith_frontend_css_color_picker(__('Text', 'yit'), 'yith_wcwl_color_wishlist_table_color', $colors['wishlist_table']['color']);
            yith_frontend_css_color_picker(__('Border', 'yit'), 'yith_wcwl_color_wishlist_table_border_color', $colors['wishlist_table']['border_color']);
            ?>
            <div class="clear" style="height:30px;"></div>
            <h4><?php 
            _e('Headers', 'yit');
            ?>
</h4>
            <?php 
            yith_frontend_css_color_picker(__('Background color', 'yit'), 'yith_wcwl_color_headers_background', $colors['headers']['background']);
            do_action('yith_wcwl_admin_color_pickers');
            ?>
            <div class="clear"></div>
            </div>
            <div class="clear" style="height:30px;"></div>

            <script type="text/javascript">
                jQuery('input#yith_wcwl_frontend_css').on('change',function () {
                    if (jQuery(this).is(':checked')) {
                        jQuery('#yith_wcwl_styles_colors').hide();
                        jQuery('#yith_wcwl_rounded_corners').parents('tr').hide();
                        jQuery('#yith_wcwl_add_to_wishlist_icon').parents('tr').hide();
                        jQuery('#yith_wcwl_add_to_cart_icon').parents('tr').hide();
                    } else {
                        jQuery('#yith_wcwl_styles_colors').show();
                        if (jQuery('#yith_wcwl_use_button').is(':checked')) {
                            jQuery('#yith_wcwl_rounded_corners').parents('tr').show();
                            jQuery('#yith_wcwl_add_to_wishlist_icon').parents('tr').show();
                            jQuery('#yith_wcwl_add_to_cart_icon').parents('tr').show();
                        }
                    }
                }).change();

                jQuery('input#yith_wcwl_use_button').on('change',function () {
                    if (jQuery(this).is(':checked') && !jQuery('#yith_wcwl_frontend_css').is(':checked')) {
                        jQuery('#yith_wcwl_rounded_corners').parents('tr').show();
                        jQuery('#yith_wcwl_add_to_wishlist_icon').parents('tr').show();
                        jQuery('#yith_wcwl_add_to_cart_icon').parents('tr').show();
                    } else {
                        jQuery('#yith_wcwl_rounded_corners').parents('tr').hide();
                        jQuery('#yith_wcwl_add_to_wishlist_icon').parents('tr').hide();
                        jQuery('#yith_wcwl_add_to_cart_icon').parents('tr').hide();
                    }
                }).change();

                jQuery('#yith_wcwl_multi_wishlist_enable').on('change', function () {
                    if (jQuery(this).is(':checked')) {
                        jQuery('#yith_wcwl_wishlist_create_title').parents('tr').show();
                        jQuery('#yith_wcwl_wishlist_manage_title').parents('tr').show();
                    }
                    else{
                        jQuery('#yith_wcwl_wishlist_create_title').parents('tr').hide();
                        jQuery('#yith_wcwl_wishlist_manage_title').parents('tr').hide();
                    }
                }).change();
            </script>
        <?php 
        }