function wd_tini_account() { global $wd_data; $woo_header = isset($wd_data['wd_woo_header']) && $wd_data['wd_woo_header']; $has_woocommerce = true; $_actived = apply_filters('active_plugins', get_option('active_plugins')); if (!in_array("woocommerce/woocommerce.php", $_actived)) { $has_woocommerce = false; } ob_start(); if ($woo_header && $has_woocommerce) { global $woocommerce; $myaccount_page_id = get_option('woocommerce_myaccount_page_id'); if ($myaccount_page_id) { $myaccount_page_url = get_permalink($myaccount_page_id); } else { $myaccount_page_url = ''; } $_user_logged = is_user_logged_in(); ?> <?php do_action('wd_before_tini_account'); ?> <div class="wd_tini_account_wrapper"> <div class="wd_tini_account_control"> <a href="<?php echo esc_url($myaccount_page_url); ?> " title="<?php _e('My Account', 'wpdance'); ?> "> <?php if (is_user_logged_in()) { ?> <span><?php _e('My Account', 'wpdance'); ?> </span> <?php } else { ?> <span><?php _e('Login / Register', 'wpdance'); ?> </span> <?php } ?> <i class="fa fa-user"></i> </a> </div> <div class="form_drop_down drop_down_container <?php echo $_user_logged ? "hidden" : ""; ?> "> <?php if (!$_user_logged) { ?> <div class="form_wrapper"> <div class="form_wrapper_body"> <form method="post" class="login" id="loginform-custom" action="<?php echo esc_url(wp_login_url()); ?> " > <?php do_action('woocommerce_login_form_start'); ?> <p class="login-username"> <label for="log"><?php _e('User or Email', 'wpdance'); ?> <span class="required">*</span></label> <input type="text" size="20" value="" class="input" id="log" name="log"> </p> <p class="login-password"> <label for="pwd"><?php _e('Password', 'wpdance'); ?> <span class="required">*</span></label> <input type="password" size="20" value="" class="input" id="pwd" name="pwd"> </p> <div class="clear"></div> <?php do_action('woocommerce_login_form'); ?> <p class="login-submit"> <input type="submit" class="button-body button big" name="login" value="<?php _e('Login', 'wpdance'); ?> " /> </p> <?php do_action('woocommerce_login_form_end'); ?> </form> </div> <div class="form_wrapper_footer"> <p><strong><a class="forgot-password bold" href="<?php echo esc_url(wp_lostpassword_url()); ?> "><?php _e('Forgot password?', 'wpdance'); ?> </a></strong></p> <p><strong><a class="register-button bold" href="<?php echo esc_url($myaccount_page_url); ?> "><?php _e('Register new account', 'wpdance'); ?> </a></strong></p> </div> </div> <?php } else { ?> <span class="my_account_wrapper"><a href="<?php echo admin_url('profile.php', 'https'); ?> " title="<?php _e('My Account', 'wpdance'); ?> "><?php _e('My Account', 'wpdance'); ?> </a></span> <span class="logout_wrapper"><a href="<?php echo wp_logout_url(get_permalink()); ?> " title="<?php _e('Logout', 'wpdance'); ?> "><?php _e('Logout', 'wpdance'); ?> </a></span> <?php } ?> </div> </div> <?php do_action('wd_after_tini_account'); ?> <?php } else { if (!class_exists('ec_accountpage')) { return ''; } $accountpage_id = get_option('ec_option_accountpage'); if (function_exists('icl_object_id')) { $accountpage_id = icl_object_id($accountpage_id, 'page', true, ICL_LANGUAGE_CODE); } $accountpage_url = get_permalink($accountpage_id); if (class_exists("WordPressHTTPS") && isset($_SERVER['HTTPS'])) { $https_class = new WordPressHTTPS(); $accountpage_url = $https_class->makeUrlHttps($accountpage_url); } $_user_logged = isset($_SESSION['ec_password']) && $_SESSION['ec_password'] != "guest"; if (substr_count($accountpage_url, '?')) { $permalink_divider = "&"; } else { $permalink_divider = "?"; } $forgot_password_url = $accountpage_url . $permalink_divider . 'ec_page=forgot_password'; $register_url = $accountpage_url . $permalink_divider . 'ec_page=register'; $logout_url = $accountpage_url . $permalink_divider . 'ec_page=logout'; $profile_url = $accountpage_url . $permalink_divider . 'ec_page=dashboard'; ?> <?php do_action('wd_before_tini_account'); ?> <div class="wd_tini_account_wrapper"> <div class="wd_tini_account_control"> <a href="<?php echo esc_url($accountpage_url); ?> " title="<?php _e('My Account', 'wpdance'); ?> "> <?php if ($_user_logged) { ?> <span><?php _e('My Account', 'wpdance'); ?> </span> <?php } else { ?> <span><?php _e('Login / Register', 'wpdance'); ?> </span> <?php } ?> <i class="fa fa-user"></i> </a> </div> <div class="form_drop_down drop_down_container <?php echo $_user_logged ? "hidden" : ""; ?> "> <?php if (!$_user_logged) { ?> <div class="form_wrapper"> <div class="form_wrapper_body"> <form method="post" class="login" id="loginform-custom" action="<?php echo esc_url($accountpage_url); ?> " > <p class="login-username"> <label><?php _e('Email address', 'wpdance'); ?> <span class="required">*</span></label> <input type="text" size="20" value="" class="input" name="ec_account_login_email"> </p> <p class="login-password"> <label><?php _e('Password', 'wpdance'); ?> <span class="required">*</span></label> <input type="password" size="20" value="" class="input" name="ec_account_login_password"> </p> <div class="clear"></div> <p class="login-submit"> <input type="submit" class="button-body button big" name="login" value="<?php _e('Login', 'wpdance'); ?> " /> <input type="hidden" name="ec_account_form_action" value="login"> </p> </form> </div> <div class="form_wrapper_footer"> <p><strong><a class="forgot-password bold" href="<?php echo esc_url($forgot_password_url); ?> "><?php _e('Forgot password?', 'wpdance'); ?> </a></strong></p> <p><strong><a class="register-button bold" href="<?php echo esc_url($register_url); ?> "><?php _e('Register new account', 'wpdance'); ?> </a></strong></p> </div> </div> <?php } else { ?> <span class="my_account_wrapper"><a href="<?php echo esc_url($profile_url); ?> " title="<?php _e('My Account', 'wpdance'); ?> "><?php _e('My Account', 'wpdance'); ?> </a></span> <span class="logout_wrapper"><a href="<?php echo esc_url($logout_url); ?> " title="<?php _e('Logout', 'wpdance'); ?> "><?php _e('Logout', 'wpdance'); ?> </a></span> <?php } ?> </div> </div> <?php do_action('wd_after_tini_account'); ?> <?php } $tini_account = ob_get_clean(); return $tini_account; }
function wd_tini_cart() { global $wd_data; $woo_header = isset($wd_data['wd_woo_header']) && $wd_data['wd_woo_header']; if (isset($_POST['is_ec_page'])) { $woo_header = !$_POST['is_ec_page']; } $has_woocommerce = true; $_actived = apply_filters('active_plugins', get_option('active_plugins')); if (!in_array("woocommerce/woocommerce.php", $_actived)) { $has_woocommerce = false; } if ($woo_header && $has_woocommerce) { $_cart_empty = sizeof(WC()->cart->get_cart()) > 0 ? false : true; ob_start(); ?> <?php do_action('wd_before_tini_cart'); ?> <div class="wd_tini_cart_wrapper"> <div class="wd_tini_cart_control heading"> <div class="cart_size"> <a href="<?php echo WC()->cart->get_cart_url(); ?> " title="<?php _e('View your shopping bag', 'wpdance'); ?> "> <span class="label"><?php _e('shopping cart', 'wpdance'); ?> </span> <span class="number"><?php echo WC()->cart->cart_contents_count; ?> </span> </a> <span class="cart_size_value_head"> <span class="wd_cart_total"><?php echo WC()->cart->get_cart_subtotal(); ?> </span> <i class="fa fa-align-justify"></i> </span> </div> </div> <div class="cart_dropdown drop_down_container"> <div class="cart_dropdown_wrapper"> <?php if (!$_cart_empty) { ?> <div class="dropdown_body woocommerce "> <ul class="cart_list product_list_widget"> <?php $_cart_array = WC()->cart->get_cart(); $_index = 0; ?> <?php foreach ($_cart_array as $cart_item_key => $cart_item) { $_product = $cart_item['data']; // Only display if allowed if (!apply_filters('woocommerce_widget_cart_item_visible', true, $cart_item, $cart_item_key) || !$_product->exists() || $cart_item['quantity'] == 0) { continue; } // Get price $product_price = get_option('woocommerce_tax_display_cart') == 'excl' ? $_product->get_price_excluding_tax() : $_product->get_price_including_tax(); $product_price = apply_filters('woocommerce_cart_item_price_html', wc_price($product_price), $cart_item, $cart_item_key); ?> <li class="<?php echo $_index == 0 ? "first" : ($_index == count($_cart_array) - 1 ? "last" : ""); ?> "> <a class="product-thumbnail"> <?php echo $_product->get_image('shop_thumbnail'); ?> </a> <div class="product-meta"> <a href="<?php echo get_permalink($cart_item['product_id']); ?> "> <?php echo esc_html($_product->get_title()); ?> </a> <?php echo apply_filters('woocommerce_widget_cart_item_quantity', '<span class="quantity">' . sprintf('%s × %s', $product_price, $cart_item['quantity']) . '</span>', $cart_item, $cart_item_key); ?> <?php echo apply_filters('woocommerce_cart_item_remove_link', sprintf('<a href="%s" class="remove" title="%s">×</a>', esc_url(WC()->cart->get_remove_url($cart_item_key)), __('Remove this item', 'wpdance')), $cart_item_key); ?> </div> </li> <?php $_index++; ?> <?php } ?> </ul><!-- end product list --> </div> <?php } else { ?> <div class="size_empty"> <?php _e('You have no items in your shopping cart.', 'wpdance'); ?> </div> <?php } ?> <?php if (!$_cart_empty) { ?> <div class="dropdown_footer"> <p class="total"><span class="bold font-second"><?php _e('Subtotal', 'wpdance'); ?> </span> <?php echo WC()->cart->get_cart_subtotal(); ?> </p> <?php do_action('woocommerce_widget_shopping_cart_before_buttons'); ?> <p class="buttons"> <a class="checkout big" href="<?php echo WC()->cart->get_checkout_url(); ?> " class="button checkout"><?php _e('checkout', 'wpdance'); ?> </a> <a class="cart button-body big" href="<?php echo WC()->cart->get_cart_url(); ?> "><?php _e('go to cart', 'wpdance'); ?> </a> </p> </div> <?php } ?> </div> </div> </div> <?php do_action('wd_after_tini_cart'); ?> <?php $tini_cart = ob_get_clean(); return $tini_cart; } else { if (!isset($_SESSION['ec_cart_id']) || !class_exists('ec_cart')) { return; } $cart = new ec_cart($_SESSION['ec_cart_id']); $ec_cartpage = new ec_cartpage(); $cart_url = $ec_cartpage->cart_page; $checkout_url = $ec_cartpage->cart_page . $ec_cartpage->permalink_divider . 'ec_page=checkout_info'; if (class_exists("WordPressHTTPS") && isset($_SERVER['HTTPS'])) { $https_class = new WordPressHTTPS(); $cart_url = $https_class->makeUrlHttps($cart_url); $checkout_url = $https_class->makeUrlHttps($checkout_url); } ?> <div class="wd_tini_cart_wrapper"> <div class="wd_tini_cart_control heading"> <div class="cart_size"> <a href="<?php echo esc_url($cart_url); ?> " title="<?php _e('View your shopping bag', 'wpdance'); ?> "> <span class="label"><?php _e('shopping cart', 'wpdance'); ?> </span> <span class="number"><?php echo esc_html($cart->get_total_items()); ?> </span> </a> <span class="cart_size_value_head"> <span class="wd_cart_total"><span class="amount"><?php echo esc_html($GLOBALS['currency']->get_currency_display($cart->subtotal)); ?> </span></span> <i class="fa fa-align-justify"></i> </span> </div> </div> <div class="cart_dropdown drop_down_container"> <div class="cart_dropdown_wrapper"> <?php if (count($cart->cart) > 0) { ?> <div class="dropdown_body woocommerce "> <ul class="cart_list product_list_widget"> <?php $_index = 0; ?> <?php foreach ($cart->cart as $cart_item_key => $cart_item) { ?> <li class="<?php echo $_index == 0 ? "first" : ($_index == count($cart->cart) - 1 ? "last" : ""); ?> "> <a href="<?php echo esc_url($cart_item->get_product_url()); ?> " class="product-thumbnail"> <img src="<?php echo esc_url($cart_item->get_image_url()); ?> " alt="" /> </a> <div class="product-meta"> <?php $cart_item->display_title_link(); ?> <span class="quantity"><?php echo esc_html($cart_item->display_unit_price(0, 0)); ?> × <?php echo esc_html($cart_item->quantity); ?> </span> <a href="javascript: void(0)" class="remove ec_remove_item" title="Remove items" data-cartitem_id="<?php echo esc_attr($cart_item->cartitem_id); ?> " data-model_number="<?php echo esc_attr($cart_item->model_number); ?> ">×</a> </div> </li> <?php $_index++; ?> <?php } ?> </ul><!-- end product list --> </div> <?php } else { ?> <div class="size_empty"> <?php _e('You have no items in your shopping cart.', 'wpdance'); ?> </div> <?php } ?> <?php if (count($cart->cart) > 0) { ?> <div class="dropdown_footer"> <p class="total"><span class="bold font-second"><?php _e('Subtotal', 'wpdance'); ?> </span><span class="amount"><?php echo esc_html($GLOBALS['currency']->get_currency_display($cart->subtotal)); ?> </span></p> <p class="buttons"> <a class="checkout big" href="<?php echo esc_url($checkout_url); ?> " class="button checkout"><?php _e('checkout', 'wpdance'); ?> </a> <a class="cart button-body big" href="<?php echo esc_url($cart_url); ?> "><?php _e('go to cart', 'wpdance'); ?> </a> </p> </div> <?php } ?> </div> </div> </div> <?php } }