/**
  * Register/queue frontend scripts.
  */
 public static function load_scripts()
 {
     global $post;
     if (!did_action('before_woocommerce_init')) {
         return;
     }
     $suffix = defined('SCRIPT_DEBUG') && SCRIPT_DEBUG ? '' : '.min';
     $lightbox_en = 'yes' === get_option('woocommerce_enable_lightbox');
     $ajax_cart_en = 'yes' === get_option('woocommerce_enable_ajax_add_to_cart');
     $assets_path = str_replace(array('http:', 'https:'), '', WC()->plugin_url()) . '/assets/';
     $frontend_script_path = $assets_path . 'js/frontend/';
     // Register any scripts for later use, or used as dependencies
     self::register_script('select2', $assets_path . 'js/select2/select2' . $suffix . '.js', array('jquery'), '3.5.4');
     self::register_script('jquery-blockui', $assets_path . 'js/jquery-blockui/jquery.blockUI' . $suffix . '.js', array('jquery'), '2.70');
     self::register_script('jquery-payment', $assets_path . 'js/jquery-payment/jquery.payment' . $suffix . '.js', array('jquery'), '1.4.1');
     self::register_script('jquery-cookie', $assets_path . 'js/jquery-cookie/jquery.cookie' . $suffix . '.js', array('jquery'), '1.4.1');
     self::register_script('wc-credit-card-form', $frontend_script_path . 'credit-card-form' . $suffix . '.js', array('jquery', 'jquery-payment'));
     self::register_script('wc-add-to-cart-variation', $frontend_script_path . 'add-to-cart-variation' . $suffix . '.js', array('jquery', 'wp-util'));
     self::register_script('wc-single-product', $frontend_script_path . 'single-product' . $suffix . '.js', array('jquery'));
     self::register_script('wc-country-select', $frontend_script_path . 'country-select' . $suffix . '.js', array('jquery'));
     self::register_script('wc-address-i18n', $frontend_script_path . 'address-i18n' . $suffix . '.js', array('jquery'));
     self::register_script('wc-password-strength-meter', $frontend_script_path . 'password-strength-meter' . $suffix . '.js', array('jquery', 'password-strength-meter'));
     // Register frontend scripts conditionally
     if ($ajax_cart_en) {
         self::enqueue_script('wc-add-to-cart', $frontend_script_path . 'add-to-cart' . $suffix . '.js');
     }
     if (is_cart()) {
         self::enqueue_script('wc-cart', $frontend_script_path . 'cart' . $suffix . '.js', array('jquery', 'wc-country-select', 'wc-address-i18n'));
     }
     if (is_checkout() || is_account_page()) {
         self::enqueue_script('select2');
         self::enqueue_style('select2', $assets_path . 'css/select2.css');
         // Password strength meter.
         // Load in checkout, account login and edit account page.
         if ('no' === get_option('woocommerce_registration_generate_password') && !is_user_logged_in() || is_edit_account_page()) {
             self::enqueue_script('wc-password-strength-meter');
         }
     }
     if (is_checkout()) {
         self::enqueue_script('wc-checkout', $frontend_script_path . 'checkout' . $suffix . '.js', array('jquery', 'woocommerce', 'wc-country-select', 'wc-address-i18n'));
     }
     if (is_add_payment_method_page()) {
         self::enqueue_script('wc-add-payment-method', $frontend_script_path . 'add-payment-method' . $suffix . '.js', array('jquery', 'woocommerce'));
     }
     if (is_lost_password_page()) {
         self::enqueue_script('wc-lost-password', $frontend_script_path . 'lost-password' . $suffix . '.js', array('jquery', 'woocommerce'));
     }
     if ($lightbox_en && (is_product() || !empty($post->post_content) && strstr($post->post_content, '[product_page'))) {
         self::enqueue_script('prettyPhoto', $assets_path . 'js/prettyPhoto/jquery.prettyPhoto' . $suffix . '.js', array('jquery'), '3.1.6', true);
         self::enqueue_script('prettyPhoto-init', $assets_path . 'js/prettyPhoto/jquery.prettyPhoto.init' . $suffix . '.js', array('jquery', 'prettyPhoto'));
         self::enqueue_style('woocommerce_prettyPhoto_css', $assets_path . 'css/prettyPhoto.css');
     }
     if (is_product()) {
         self::enqueue_script('wc-single-product');
     }
     if ('geolocation_ajax' === get_option('woocommerce_default_customer_address')) {
         // Exclude common bots from geolocation by user agent.
         $ua = wc_get_user_agent();
         if (!strstr($ua, 'bot') && !strstr($ua, 'spider') && !strstr($ua, 'crawl')) {
             self::enqueue_script('wc-geolocation', $frontend_script_path . 'geolocation' . $suffix . '.js', array('jquery'));
         }
     }
     // Global frontend scripts
     self::enqueue_script('woocommerce', $frontend_script_path . 'woocommerce' . $suffix . '.js', array('jquery', 'jquery-blockui'));
     self::enqueue_script('wc-cart-fragments', $frontend_script_path . 'cart-fragments' . $suffix . '.js', array('jquery', 'jquery-cookie'));
     // CSS Styles
     if ($enqueue_styles = self::get_styles()) {
         foreach ($enqueue_styles as $handle => $args) {
             self::enqueue_style($handle, $args['src'], $args['deps'], $args['version'], $args['media']);
         }
     }
 }
 /**
  * Register/queue frontend scripts.
  */
 public static function load_scripts()
 {
     global $post;
     if (!did_action('before_woocommerce_init')) {
         return;
     }
     $suffix = defined('SCRIPT_DEBUG') && SCRIPT_DEBUG ? '' : '.min';
     $lightbox_en = 'yes' === get_option('woocommerce_enable_lightbox');
     $ajax_cart_en = 'yes' === get_option('woocommerce_enable_ajax_add_to_cart');
     $assets_path = str_replace(array('http:', 'https:'), '', WC()->plugin_url()) . '/assets/';
     $frontend_script_path = $assets_path . 'js/frontend/';
     // Chosen is @deprecated as of 2.3 in favour of 2.3. Here for backwards compatibility.
     self::register_script('chosen', $assets_path . 'js/chosen/chosen.jquery' . $suffix . '.js', array('jquery'), '1.0.0');
     self::register_script('select2', $assets_path . 'js/select2/select2' . $suffix . '.js', array('jquery'), '3.5.2');
     // Register any scripts for later use, or used as dependencies
     self::register_script('jquery-blockui', $assets_path . 'js/jquery-blockui/jquery.blockUI' . $suffix . '.js', array('jquery'), '2.70');
     self::register_script('jquery-payment', $assets_path . 'js/jquery-payment/jquery.payment' . $suffix . '.js', array('jquery'), '1.2.4');
     self::register_script('jquery-cookie', $assets_path . 'js/jquery-cookie/jquery.cookie' . $suffix . '.js', array('jquery'), '1.4.1');
     self::register_script('wc-credit-card-form', $frontend_script_path . 'credit-card-form' . $suffix . '.js', array('jquery', 'jquery-payment'));
     self::register_script('wc-add-to-cart-variation', $frontend_script_path . 'add-to-cart-variation' . $suffix . '.js');
     self::register_script('wc-single-product', $frontend_script_path . 'single-product' . $suffix . '.js');
     self::register_script('wc-country-select', $frontend_script_path . 'country-select' . $suffix . '.js');
     self::register_script('wc-address-i18n', $frontend_script_path . 'address-i18n' . $suffix . '.js');
     // Register frontend scripts conditionally
     if ($ajax_cart_en) {
         self::enqueue_script('wc-add-to-cart', $frontend_script_path . 'add-to-cart' . $suffix . '.js');
     }
     if (is_cart()) {
         self::enqueue_script('wc-cart', $frontend_script_path . 'cart' . $suffix . '.js', array('jquery', 'wc-country-select', 'wc-address-i18n'));
     }
     if (is_checkout() || is_page(get_option('woocommerce_myaccount_page_id'))) {
         self::enqueue_script('select2');
         wp_enqueue_style('select2', $assets_path . 'css/select2.css');
     }
     if (is_checkout()) {
         self::enqueue_script('wc-checkout', $frontend_script_path . 'checkout' . $suffix . '.js', array('jquery', 'woocommerce', 'wc-country-select', 'wc-address-i18n'));
     }
     if (is_add_payment_method_page()) {
         self::enqueue_script('wc-add-payment-method', $frontend_script_path . 'add-payment-method' . $suffix . '.js', array('jquery', 'woocommerce'));
     }
     if (is_lost_password_page()) {
         self::enqueue_script('wc-lost-password', $frontend_script_path . 'lost-password' . $suffix . '.js', array('jquery', 'woocommerce'));
     }
     if ($lightbox_en && (is_product() || !empty($post->post_content) && strstr($post->post_content, '[product_page'))) {
         self::enqueue_script('prettyPhoto', $assets_path . 'js/prettyPhoto/jquery.prettyPhoto' . $suffix . '.js', array('jquery'), '3.1.6', true);
         self::enqueue_script('prettyPhoto-init', $assets_path . 'js/prettyPhoto/jquery.prettyPhoto.init' . $suffix . '.js', array('jquery', 'prettyPhoto'));
         wp_enqueue_style('woocommerce_prettyPhoto_css', $assets_path . 'css/prettyPhoto.css');
     }
     if (is_product()) {
         self::enqueue_script('wc-single-product');
     }
     if ('geolocation_ajax' === get_option('woocommerce_default_customer_address')) {
         self::enqueue_script('wc-geolocation', $frontend_script_path . 'geolocation' . $suffix . '.js', array('jquery'));
     }
     // Global frontend scripts
     self::enqueue_script('woocommerce', $frontend_script_path . 'woocommerce' . $suffix . '.js', array('jquery', 'jquery-blockui'));
     self::enqueue_script('wc-cart-fragments', $frontend_script_path . 'cart-fragments' . $suffix . '.js', array('jquery', 'jquery-cookie'));
     // CSS Styles
     if ($enqueue_styles = self::get_styles()) {
         foreach ($enqueue_styles as $handle => $args) {
             wp_enqueue_style($handle, $args['src'], $args['deps'], $args['version'], $args['media']);
         }
     }
 }
 /**
  * Register/queue frontend scripts.
  */
 public static function load_scripts()
 {
     global $post;
     $suffix = defined('SCRIPT_DEBUG') && SCRIPT_DEBUG ? '' : '.min';
     $lightbox_en = 'yes' === get_option('woocommerce_enable_lightbox');
     $ajax_cart_en = 'yes' === get_option('woocommerce_enable_ajax_add_to_cart');
     $assets_path = str_replace(array('http:', 'https:'), '', WC()->plugin_url()) . '/assets/';
     $frontend_script_path = $assets_path . 'js/frontend/';
     // Chosen is @deprecated as of 2.3 in favour of 2.3. Here for backwards compatibility.
     self::register_script('chosen', $assets_path . 'js/chosen/chosen.jquery' . $suffix . '.js', array('jquery'), '1.0.0');
     self::register_script('select2', $assets_path . 'js/select2/select2' . $suffix . '.js', array('jquery'), '3.5.2');
     wp_localize_script('select2', 'wc_select_params', array('i18n_matches_1' => _x('One result is available, press enter to select it.', 'enhanced select', 'woocommerce'), 'i18n_matches_n' => _x('%qty% results are available, use up and down arrow keys to navigate.', 'enhanced select', 'woocommerce'), 'i18n_no_matches' => _x('No matches found', 'enhanced select', 'woocommerce'), 'i18n_ajax_error' => _x('Loading failed', 'enhanced select', 'woocommerce'), 'i18n_input_too_short_1' => _x('Please enter 1 or more characters', 'enhanced select', 'woocommerce'), 'i18n_input_too_short_n' => _x('Please enter %qty% or more characters', 'enhanced select', 'woocommerce'), 'i18n_input_too_long_1' => _x('Please delete 1 character', 'enhanced select', 'woocommerce'), 'i18n_input_too_long_n' => _x('Please delete %qty% characters', 'enhanced select', 'woocommerce'), 'i18n_selection_too_long_1' => _x('You can only select 1 item', 'enhanced select', 'woocommerce'), 'i18n_selection_too_long_n' => _x('You can only select %qty% items', 'enhanced select', 'woocommerce'), 'i18n_load_more' => _x('Loading more results…', 'enhanced select', 'woocommerce'), 'i18n_searching' => _x('Searching…', 'enhanced select', 'woocommerce')));
     // Register any scripts for later use, or used as dependencies
     self::register_script('jquery-blockui', $assets_path . 'js/jquery-blockui/jquery.blockUI' . $suffix . '.js', array('jquery'), '2.60');
     self::register_script('jquery-payment', $assets_path . 'js/jquery-payment/jquery.payment' . $suffix . '.js', array('jquery'), '1.2.1');
     self::register_script('jquery-cookie', $assets_path . 'js/jquery-cookie/jquery.cookie' . $suffix . '.js', array('jquery'), '1.4.1');
     self::register_script('wc-credit-card-form', $frontend_script_path . 'credit-card-form' . $suffix . '.js', array('jquery', 'jquery-payment'));
     self::register_script('wc-add-to-cart-variation', $frontend_script_path . 'add-to-cart-variation' . $suffix . '.js');
     self::register_script('wc-single-product', $frontend_script_path . 'single-product' . $suffix . '.js');
     self::register_script('wc-country-select', $frontend_script_path . 'country-select' . $suffix . '.js');
     self::register_script('wc-address-i18n', $frontend_script_path . 'address-i18n' . $suffix . '.js');
     // Register frontend scripts conditionally
     if ($ajax_cart_en) {
         self::enqueue_script('wc-add-to-cart', $frontend_script_path . 'add-to-cart' . $suffix . '.js');
     }
     if (is_cart()) {
         self::enqueue_script('wc-cart', $frontend_script_path . 'cart' . $suffix . '.js', array('jquery', 'wc-country-select'));
     }
     if (is_checkout() || is_page(get_option('woocommerce_myaccount_page_id'))) {
         self::enqueue_script('select2');
         wp_enqueue_style('select2', $assets_path . 'css/select2.css');
     }
     if (is_checkout()) {
         self::enqueue_script('wc-checkout', $frontend_script_path . 'checkout' . $suffix . '.js', array('jquery', 'woocommerce', 'wc-country-select', 'wc-address-i18n'));
     }
     if (is_add_payment_method_page()) {
         self::enqueue_script('wc-add-payment-method', $frontend_script_path . 'add-payment-method' . $suffix . '.js', array('jquery', 'woocommerce'));
     }
     if (is_lost_password_page()) {
         self::enqueue_script('wc-lost-password', $frontend_script_path . 'lost-password' . $suffix . '.js', array('jquery', 'woocommerce'));
     }
     if ($lightbox_en && (is_product() || !empty($post->post_content) && strstr($post->post_content, '[product_page'))) {
         self::enqueue_script('prettyPhoto', $assets_path . 'js/prettyPhoto/jquery.prettyPhoto' . $suffix . '.js', array('jquery'), '3.1.5', true);
         self::enqueue_script('prettyPhoto-init', $assets_path . 'js/prettyPhoto/jquery.prettyPhoto.init' . $suffix . '.js', array('jquery', 'prettyPhoto'));
         wp_enqueue_style('woocommerce_prettyPhoto_css', $assets_path . 'css/prettyPhoto.css');
     }
     if (is_product()) {
         self::enqueue_script('wc-single-product');
     }
     // Global frontend scripts
     self::enqueue_script('woocommerce', $frontend_script_path . 'woocommerce' . $suffix . '.js', array('jquery', 'jquery-blockui'));
     self::enqueue_script('wc-cart-fragments', $frontend_script_path . 'cart-fragments' . $suffix . '.js', array('jquery', 'jquery-cookie'));
     // CSS Styles
     if ($enqueue_styles = self::get_styles()) {
         foreach ($enqueue_styles as $handle => $args) {
             wp_enqueue_style($handle, $args['src'], $args['deps'], $args['version'], $args['media']);
         }
     }
 }
 /**
  * Register/queue frontend scripts.
  */
 public static function load_scripts()
 {
     global $post;
     if (!did_action('before_woocommerce_init')) {
         return;
     }
     $suffix = defined('SCRIPT_DEBUG') && SCRIPT_DEBUG ? '' : '.min';
     $ajax_cart_en = 'yes' === get_option('woocommerce_enable_ajax_add_to_cart');
     $assets_path = str_replace(array('http:', 'https:'), '', WC()->plugin_url()) . '/assets/';
     $frontend_script_path = $assets_path . 'js/frontend/';
     // Register any scripts for later use, or used as dependencies
     self::register_script('select2', $assets_path . 'js/select2/select2' . $suffix . '.js', array('jquery'), '3.5.4');
     self::register_script('jquery-blockui', $assets_path . 'js/jquery-blockui/jquery.blockUI' . $suffix . '.js', array('jquery'), '2.70');
     self::register_script('jquery-payment', $assets_path . 'js/jquery-payment/jquery.payment' . $suffix . '.js', array('jquery'), '1.4.1');
     self::register_script('js-cookie', $assets_path . 'js/js-cookie/js.cookie' . $suffix . '.js', array(), '2.1.3');
     self::register_script('wc-credit-card-form', $frontend_script_path . 'credit-card-form' . $suffix . '.js', array('jquery', 'jquery-payment'));
     self::register_script('wc-add-to-cart-variation', $frontend_script_path . 'add-to-cart-variation' . $suffix . '.js', array('jquery', 'wp-util'));
     self::register_script('wc-single-product', $frontend_script_path . 'single-product' . $suffix . '.js', array('jquery'));
     self::register_script('wc-country-select', $frontend_script_path . 'country-select' . $suffix . '.js', array('jquery'));
     self::register_script('wc-address-i18n', $frontend_script_path . 'address-i18n' . $suffix . '.js', array('jquery'));
     self::register_script('wc-password-strength-meter', $frontend_script_path . 'password-strength-meter' . $suffix . '.js', array('jquery', 'password-strength-meter'));
     // Register frontend scripts conditionally
     if ($ajax_cart_en) {
         self::enqueue_script('wc-add-to-cart', $frontend_script_path . 'add-to-cart' . $suffix . '.js');
     }
     if (is_cart()) {
         self::enqueue_script('wc-cart', $frontend_script_path . 'cart' . $suffix . '.js', array('jquery', 'wc-country-select', 'wc-address-i18n'));
     }
     if (is_checkout() || is_account_page()) {
         self::enqueue_script('select2');
         self::enqueue_style('select2', $assets_path . 'css/select2.css');
         // Password strength meter.
         // Load in checkout, account login and edit account page.
         if ('no' === get_option('woocommerce_registration_generate_password') && !is_user_logged_in() || is_edit_account_page() || is_lost_password_page()) {
             self::enqueue_script('wc-password-strength-meter');
         }
     }
     if (is_checkout()) {
         self::enqueue_script('wc-checkout', $frontend_script_path . 'checkout' . $suffix . '.js', array('jquery', 'woocommerce', 'wc-country-select', 'wc-address-i18n'));
     }
     if (is_add_payment_method_page()) {
         self::enqueue_script('wc-add-payment-method', $frontend_script_path . 'add-payment-method' . $suffix . '.js', array('jquery', 'woocommerce'));
     }
     if (is_lost_password_page()) {
         self::enqueue_script('wc-lost-password', $frontend_script_path . 'lost-password' . $suffix . '.js', array('jquery', 'woocommerce'));
     }
     if (is_product() || !empty($post->post_content) && strstr($post->post_content, '[product_page')) {
         self::enqueue_script('flexslider', $assets_path . 'js/flexslider/jquery.flexslider' . $suffix . '.js', array('jquery'), '2.7.0', true);
         self::enqueue_script('photoswipe', $assets_path . 'js/photoswipe/photoswipe' . $suffix . '.js', '4.1.1', true);
         self::enqueue_script('photoswipe-ui-default', $assets_path . 'js/photoswipe/photoswipe-ui-default' . $suffix . '.js', array('photoswipe'), '4.1.1', true);
         self::enqueue_style('photoswipe', $assets_path . 'css/photoswipe/photoswipe.css');
         self::enqueue_style('photoswipe-default-skin', $assets_path . 'css/photoswipe/default-skin/default-skin.css');
         self::enqueue_script('zoom', $assets_path . 'js/zoom/jquery.zoom' . $suffix . '.js', array('jquery'), '1.7.15', true);
         self::enqueue_script('wc-single-product');
         wp_localize_script('wc-single-product', 'flexslider_options', apply_filters('woocommerce_single_product_carousel_options', array('rtl' => is_rtl(), 'animation' => 'slide', 'smoothHeight' => true, 'directionNav' => false, 'controlNav' => 'thumbnails', 'slideshow' => false, 'animationSpeed' => 500)));
     }
     if ('geolocation_ajax' === get_option('woocommerce_default_customer_address')) {
         // Exclude common bots from geolocation by user agent.
         $ua = wc_get_user_agent();
         if (!strstr($ua, 'bot') && !strstr($ua, 'spider') && !strstr($ua, 'crawl')) {
             self::enqueue_script('wc-geolocation', $frontend_script_path . 'geolocation' . $suffix . '.js', array('jquery'));
         }
     }
     // Global frontend scripts
     self::enqueue_script('woocommerce', $frontend_script_path . 'woocommerce' . $suffix . '.js', array('jquery', 'jquery-blockui', 'js-cookie'));
     self::enqueue_script('wc-cart-fragments', $frontend_script_path . 'cart-fragments' . $suffix . '.js', array('jquery', 'js-cookie'));
     // CSS Styles
     if ($enqueue_styles = self::get_styles()) {
         foreach ($enqueue_styles as $handle => $args) {
             self::enqueue_style($handle, $args['src'], $args['deps'], $args['version'], $args['media']);
         }
     }
     // These are deprecated scripts only included for BW compatibility. @todo remove in future version.
     self::register_script('jquery-cookie', $assets_path . 'js/jquery-cookie/jquery.cookie' . $suffix . '.js', array('jquery'), '1.4.1');
     self::register_script('prettyPhoto', $assets_path . 'js/prettyPhoto/jquery.prettyPhoto' . $suffix . '.js', array('jquery'), '3.1.6', true);
     self::register_script('prettyPhoto-init', $assets_path . 'js/prettyPhoto/jquery.prettyPhoto.init' . $suffix . '.js', array('jquery', 'prettyPhoto'));
     self::register_style('woocommerce_prettyPhoto_css', $assets_path . 'css/prettyPhoto.css');
 }
Exemple #5
0
 public static function is_lost_password_page()
 {
     return self::exists() && is_lost_password_page();
 }
 /**
  * Register/queue frontend scripts.
  */
 public static function load_scripts()
 {
     global $post;
     if (!did_action('before_woocommerce_init')) {
         return;
     }
     self::register_scripts();
     self::register_styles();
     if ('yes' === get_option('woocommerce_enable_ajax_add_to_cart')) {
         self::enqueue_script('wc-add-to-cart');
     }
     if (is_cart()) {
         self::enqueue_script('wc-cart');
     }
     if (is_checkout() || is_account_page()) {
         self::enqueue_script('select2');
         self::enqueue_style('select2');
         // Password strength meter. Load in checkout, account login and edit account page.
         if ('no' === get_option('woocommerce_registration_generate_password') && !is_user_logged_in() || is_edit_account_page() || is_lost_password_page()) {
             self::enqueue_script('wc-password-strength-meter');
         }
     }
     if (is_checkout()) {
         self::enqueue_script('wc-checkout');
     }
     if (is_add_payment_method_page()) {
         self::enqueue_script('wc-add-payment-method');
     }
     if (is_lost_password_page()) {
         self::enqueue_script('wc-lost-password');
     }
     if (is_product() || !empty($post->post_content) && strstr($post->post_content, '[product_page')) {
         self::enqueue_script('flexslider');
         self::enqueue_script('photoswipe-ui-default');
         self::enqueue_style('photoswipe-default-skin');
         self::enqueue_script('zoom');
         self::enqueue_script('wc-single-product');
     }
     if ('geolocation_ajax' === get_option('woocommerce_default_customer_address')) {
         $ua = wc_get_user_agent();
         // Exclude common bots from geolocation by user agent.
         if (!strstr($ua, 'bot') && !strstr($ua, 'spider') && !strstr($ua, 'crawl')) {
             self::enqueue_script('wc-geolocation');
         }
     }
     // Global frontend scripts
     self::enqueue_script('woocommerce');
     self::enqueue_script('wc-cart-fragments');
     // CSS Styles
     if ($enqueue_styles = self::get_styles()) {
         foreach ($enqueue_styles as $handle => $args) {
             self::enqueue_style($handle, $args['src'], $args['deps'], $args['version'], $args['media']);
         }
     }
 }
        function widget($args, $instance)
        {
            extract($args);
            $show_logged_out = isset($instance['show_logged_out']) ? $instance['show_logged_out'] : 'yes';
            $show_logged_out_submenu = isset($instance['show_logged_out_submenu']) ? $instance['show_logged_out_submenu'] : 'yes';
            $title_logged_out = isset($instance['title_logged_out']) ? $instance['title_logged_out'] : '';
            $show_logged_in = isset($instance['show_logged_in']) ? $instance['show_logged_in'] : 'yes';
            $nav_menu = isset($instance['nav_menu']) ? wp_get_nav_menu_object($instance['nav_menu']) : '';
            $logged_in = false;
            if (is_user_logged_in() && $show_logged_in == 'yes') {
                $logged_in = true;
                global $current_user;
                get_currentuserinfo();
                $user_name = yit_get_welcome_user_name($current_user);
                ?>
                <!-- START LOGGED IN NAVIGATION -->
                <div id="welcome-menu" class="nav dropdown">
                    <ul>
                    <li class="menu-item dropdown"><a href="#"><span class="welcome_username"><?php 
                echo apply_filters('yit_welcome_login_label', __('Welcome, ', 'yit')) . apply_filters('yit_welcome_username', $user_name);
                ?>
</span> </a>
                    <?php 
                include_once YIT_THEME_ASSETS_PATH . '/lib/Walker_Nav_Menu_Div.php';
                $nav_args = array('menu' => $nav_menu, 'container' => 'div', 'container_class' => 'submenu', 'menu_class' => 'sub-menu clearfix', 'depth' => 1, 'walker' => new YIT_Walker_Nav_Menu_Div());
                wp_nav_menu($nav_args);
                ?>
</li>
                        </ul>

                </div>
                <!-- END LOGGED IN  NAVIGATION -->

            <?php 
            } elseif ($show_logged_out == 'yes') {
                $enabled_registration = get_option('woocommerce_enable_myaccount_registration');
                $enabled_registration_class = $enabled_registration === 'yes' ? 'with_registration' : '';
                $profile_link = is_shop_installed() ? get_permalink(wc_get_page_id('myaccount')) : wp_login_url();
                if (function_exists('icl_translate')) {
                    $title_logged_out = icl_translate('Widgets', 'widget_woocommerce_login_title_logged_out' . sanitize_title($title_logged_out), $title_logged_out);
                }
                ?>
                <div id="welcome-menu-login" class="nav">
                    <ul id="menu-welcome-login">
                        <li class="menu-item login-menu">
                            <a href="<?php 
                echo esc_url($profile_link);
                ?>
"><?php 
                echo $title_logged_out;
                ?>
<span class="sf-sub-indicator"> +</span></a>

                            <?php 
                if ($show_logged_out_submenu == 'yes') {
                    ?>

                            <div class="submenu clearfix" style="display: none;">
                                <div class="clearfix login-box <?php 
                    echo $enabled_registration_class;
                    ?>
">
                                    <div id="customer_login">
                                    <div class="customer-login-box customer-login-box1">
                                        <h4><?php 
                    _e('Login', 'yit');
                    ?>
</h4>
                                            <form method="post" class="login">
                                                <?php 
                    do_action('woocommerce_login_form_start');
                    ?>
                                                <div class="form-group">
                                                    <label for="username"><?php 
                    _e('Username or email address', 'yit');
                    ?>
 <span class="required">*</span></label>
                                                    <input type="text" class="form-control" name="username" id="username" value="<?php 
                    if (!empty($_POST['username'])) {
                        echo esc_attr($_POST['username']);
                    }
                    ?>
"/>
                                                </div>
                                                <div class="form-group">
                                                    <label for="password"><?php 
                    _e('Password', 'yit');
                    ?>
 <span class="required">*</span></label>
                                                    <input class="form-control" type="password" name="password" id="password" />
                                                </div>
                                                <?php 
                    do_action('woocommerce_login_form');
                    ?>
                                                <div class="form-group">
                                                    <?php 
                    wp_nonce_field('woocommerce-login');
                    ?>
                                                    <input type="submit" class="button button-login" name="login" value="<?php 
                    _e('Login', 'yit');
                    ?>
" />
                                                    <p class="lost_password">
                                                        <a href="<?php 
                    echo esc_url(wp_lostpassword_url());
                    ?>
"><?php 
                    _e('Lost password?', 'yit');
                    ?>
</a>
                                                    </p>
                                                   <!-- <label for="rememberme" class="inline">
                                                        <input name="rememberme" type="checkbox" id="rememberme" value="forever" /> <?php 
                    _e('Remember me', 'yit');
                    ?>
                                                    </label> -->
                                                </div>
                                                <div class="form-group">
                                                    <?php 
                    if (defined('NEW_FB_LOGIN') && NEW_FB_LOGIN == 1 && function_exists('new_fb_sign_button')) {
                        ?>
                                                        <div class="fb-connect">

                                                            <div class="btn-fb-login">
                                                                <a href="<?php 
                        echo new_fb_login_url();
                        ?>
&redirect=<?php 
                        echo site_url();
                        ?>
/" onclick="window.location = '<?php 
                        echo home_url();
                        ?>
/wp-login.php?loginFacebook=1&redirect=<?php 
                        echo site_url();
                        ?>
/'; return false;"><?php 
                        echo do_shortcode('[icon icon_size="16" color="inherit" icon_type="theme-icon" icon_theme="facebook"]');
                        ?>
Login  with  Facebook</a>
                                                            </div>
                                                        </div>
                                                    <?php 
                    }
                    ?>
                                                </div>

												<?php 
                    do_action('woocommerce_login_form_end');
                    ?>

                                            </form>
                                    </div>
                                        <?php 
                    if ($enabled_registration === 'yes') {
                        ?>


                                        <div class="customer-login-box customer-login-box2">

                                            <?php 
                        if (function_exists('wc_print_notices') && (!is_woocommerce() && !is_account_page() && !is_lost_password_page())) {
                            ?>
                                                <?php 
                            wc_print_notices();
                            ?>
                                            <?php 
                        }
                        ?>

                                            <h4><?php 
                        _e('First time here? Create your account', 'yit');
                        ?>
</h4>

                                            <form method="post" class="register" id="login-form">
                                                <?php 
                        do_action('woocommerce_register_form_start');
                        ?>
                                                <?php 
                        if (get_option('woocommerce_registration_generate_username') === 'no') {
                            ?>
                                                    <div class="form-group">
                                                        <label for="reg_username"><?php 
                            _e('Username', 'yit');
                            ?>
 <span class="required">*</span></label>
                                                        <input type="text" class="form-control" name="username" id="reg_username" value="<?php 
                            if (!empty($_POST['username'])) {
                                esc_attr($_POST['username']);
                            }
                            ?>
" />
                                                    </div>
                                                <?php 
                        }
                        ?>

                                                <div class="form-group">
                                                    <label for="reg_email"><?php 
                        _e('Email address', 'yit');
                        ?>
 <span class="required">*</span></label>
                                                    <input type="email" class="form-control" name="email" id="reg_email" value="<?php 
                        if (!empty($_POST['email'])) {
                            esc_attr($_POST['email']);
                        }
                        ?>
" />
                                                </div>

                                                <div class="form-group">
                                                    <?php 
                        if ('no' === get_option('woocommerce_registration_generate_password')) {
                            ?>

                                                        <p class="form-row form-row-wide">
                                                            <label for="reg_password"><?php 
                            _e('Password', 'yit');
                            ?>
 <span class="required">*</span></label>
                                                            <input type="password" class="form-control" name="password" id="reg_password"  />
                                                        </p>

                                                    <?php 
                        }
                        ?>


                                                </div>


                                                <!-- Spam Trap -->
                                                <div style="<?php 
                        echo is_rtl() ? 'right:-999em' : 'left:-999em';
                        ?>
; position:absolute;"><label for="trap"><?php 
                        _e('Anti-spam', 'yit');
                        ?>
</label><input type="text" name="email_2" id="trap" tabindex="-1" /></div>

                                                <?php 
                        class_exists('YITH_Vendors_Frontend_Premium') && remove_action('woocommerce_register_form', array(YITH_Vendors()->frontend, 'register_form'));
                        ?>
                                                <?php 
                        do_action('woocommerce_register_form');
                        ?>
                                                <?php 
                        do_action('register_form');
                        ?>
                                                <?php 
                        class_exists('YITH_Vendors_Frontend_Premium') && add_action('woocommerce_register_form', array(YITH_Vendors()->frontend, 'register_form'));
                        ?>

                                                <div class="form-group">
                                                    <?php 
                        wp_nonce_field('woocommerce-register');
                        ?>
                                                    <input type="submit" class="button button-register" name="register" value="<?php 
                        _e('Register &#xffeb;', 'yit');
                        ?>
" />
                                                </div>

                                                <?php 
                        do_action('woocommerce_register_form_end');
                        ?>

                                            </form>

                                        </div>

                                    </div>
                                <?php 
                    }
                    ?>
                                </div>

                            </div>

                            <?php 
                }
                ?>

                        </li>
                    </ul>
                </div>
            <?php 
            }
        }