/** * Constructor * * @since 1.0.0 */ public function __construct() { $this->_yith_wcwl_install = YITH_WCWL_Install(); $this->_positions = apply_filters('yith_wcwl_positions', array('add-to-cart' => array('hook' => 'woocommerce_single_product_summary', 'priority' => 31), 'thumbnails' => array('hook' => 'woocommerce_product_thumbnails', 'priority' => 21), 'summary' => array('hook' => 'woocommerce_after_single_product_summary', 'priority' => 11))); $this->rules = apply_filters('yith_wcwl_colors_rules', array('add_to_wishlist' => '.woocommerce a.add_to_wishlist.button.alt', 'add_to_wishlist_hover' => '.woocommerce a.add_to_wishlist.button.alt:hover', 'add_to_cart' => '.woocommerce .wishlist_table a.add_to_cart.button.alt', 'add_to_cart_hover' => '.woocommerce .wishlist_table a.add_to_cart.button.alt:hover', 'button_style_1' => '.woocommerce a.button.ask-an-estimate-button, .woocommerce .hidden-title-form button, .yith-wcwl-wishlist-new .create-wishlist-button, .wishlist_manage_table tfoot button.submit-wishlist-changes, .yith-wcwl-wishlist-search-form button.wishlist-search-button', 'button_style_1_hover' => '.woocommerce a.button.ask-an-estimate-button:hover, .woocommerce .hidden-title-form button:hover, .yith-wcwl-wishlist-new .create-wishlist-button:hover, .wishlist_manage_table tfoot button.submit-wishlist-changes:hover, .yith-wcwl-wishlist-search-form button.wishlist-search-button:hover', 'button_style_2' => '.woocommerce .wishlist-title a.show-title-form, .woocommerce .hidden-title-form a.hide-title-form, .wishlist_manage_table tfoot a.create-new-wishlist', 'button_style_2_hover' => '.woocommerce .wishlist-title a.show-title-form:hover, .woocommerce .hidden-title-form a.hide-title-form:hover, .wishlist_manage_table tfoot a.create-new-wishlist:hover', 'wishlist_table' => '.woocommerce table.shop_table.wishlist_table', 'headers' => '.wishlist_table thead, .wishlist_table tfoot, .yith-wcwl-wishlist-new, .yith-wcwl-wishlist-search-form, .widget_yith-wcwl-lists ul.dropdown li.current a, .widget_yith-wcwl-lists ul.dropdown li a:hover, .selectBox-dropdown-menu.selectBox-options li.selectBox-selected a, .selectBox-dropdown-menu.selectBox-options li.selectBox-hover a')); $db_colors = get_option('yith_wcwl_frontend_css_colors'); $this->colors_options = wp_parse_args(maybe_unserialize($db_colors), apply_filters('yith_wcwl_colors_options', array('add_to_wishlist' => array('background' => '#333333', 'color' => '#FFFFFF', 'border_color' => '#333333'), 'add_to_wishlist_hover' => array('background' => '#4F4F4F', 'color' => '#FFFFFF', 'border_color' => '#4F4F4F'), 'add_to_cart' => array('background' => '#333333', 'color' => '#FFFFFF', 'border_color' => '#333333'), 'add_to_cart_hover' => array('background' => '#4F4F4F', 'color' => '#FFFFFF', 'border_color' => '#4F4F4F'), 'button_style_1' => array('background' => '#333333', 'color' => '#FFFFFF', 'border_color' => '#333333'), 'button_style_1_hover' => array('background' => '#4F4F4F', 'color' => '#FFFFFF', 'border_color' => '#4F4F4F'), 'button_style_2' => array('background' => '#FFFFFF', 'color' => '#858484', 'border_color' => '#c6c6c6'), 'button_style_2_hover' => array('background' => '#4F4F4F', 'color' => '#FFFFFF', 'border_color' => '#4F4F4F'), 'wishlist_table' => array('background' => '#FFFFFF', 'color' => '#6d6c6c', 'border_color' => '#FFFFFF'), 'headers' => array('background' => '#F4F4F4')))); if (empty($db_colors)) { update_option('yith_wcwl_frontend_css_colors', maybe_serialize($this->colors_options)); } if (get_option('yith_wcwl_enabled') == 'yes') { add_action('init', array($this, 'init'), 0); add_action('wp_head', array($this, 'detect_javascript'), 0); add_action('wp_head', array($this, 'add_button')); add_action('wp_enqueue_scripts', array($this, 'enqueue_styles_and_stuffs')); add_action('wp_enqueue_scripts', array($this, 'enqueue_scripts')); add_filter('body_class', array($this, 'add_body_class')); // add YITH WooCommerce Frequently Bought Together Premium shortcode add_action('yith_wcwl_after_wishlist_form', array($this, 'yith_wcfbt_shortcode'), 10, 1); // YITH WCWL Loaded do_action('yith_wcwl_loaded'); } }
/** * Run the installation * * @return void * @since 1.0.0 */ public function install() { $stored_db_version = get_option('yith_wcwl_db_version'); if ($stored_db_version == '1.0.0') { add_action('init', array(YITH_WCWL_Install(), 'update')); add_action('init', 'flush_rewrite_rules'); YITH_WCWL_Install()->default_options($this->options); // Plugin installed do_action('yith_wcwl_installed'); do_action('yith_wcwl_updated'); } elseif ($this->db_version != $stored_db_version || !YITH_WCWL_Install()->is_installed()) { add_action('init', array(YITH_WCWL_Install(), 'init')); YITH_WCWL_Install()->default_options($this->options); // Plugin installed do_action('yith_wcwl_installed'); } }