public function wpmenucart_menu_item() {
$item_data = $this->shop->menu_item();
// Check empty cart settings
if ($item_data['cart_contents_count'] == 0 && ( !isset($this->options['always_display']) ) ) {
$empty_menu_item = '<a class="wpmenucart-contents empty-wpmenucart" style="display:none"> </a>';
return $empty_menu_item;
}
if ( isset($this->options['wpml_string_translation']) && function_exists( 'icl_t' ) ) {
//use WPML
$viewing_cart = icl_t('WP Menu Cart', 'hover text', 'View your shopping cart');
$start_shopping = icl_t('WP Menu Cart', 'empty hover text', 'Start shopping');
$cart_contents = $item_data['cart_contents_count'] .' '. ( $item_data['cart_contents_count'] == 1 ? icl_t('WP Menu Cart', 'item text', 'item') : icl_t('WP Menu Cart', 'items text', 'items') );
} else {
//use regular WP i18n
$viewing_cart = __('View your shopping cart', 'wp-menu-cart');
$start_shopping = __('Start shopping', 'wp-menu-cart');
$cart_contents = sprintf(_n('%d item', '%d items', $item_data['cart_contents_count'], 'wp-menu-cart'), $item_data['cart_contents_count']);
}
$this->menu_items['menu']['cart_contents'] = $cart_contents;
if ($item_data['cart_contents_count'] == 0) {
$menu_item_href = apply_filters ('wpmenucart_emptyurl', $item_data['shop_page_url'] );
$menu_item_title = apply_filters ('wpmenucart_emptytitle', $start_shopping );
$menu_item_classes = 'wpmenucart-contents empty-wpmenucart-visible';
} else {
$menu_item_href = apply_filters ('wpmenucart_fullurl', $item_data['cart_url'] );
$menu_item_title = apply_filters ('wpmenucart_fulltitle', $viewing_cart );
$menu_item_classes = 'wpmenucart-contents';
}
$this->menu_items['menu']['menu_item_href'] = $menu_item_href;
$this->menu_items['menu']['menu_item_title'] = $menu_item_title;
if(defined('UBERMENU_VERSION') && (version_compare(UBERMENU_VERSION, '3.0.0') >= 0)){
$menu_item_classes .= ' ubermenu-target';
}
$menu_item = '<a class="'.$menu_item_classes.'" href="'.$menu_item_href.'" title="'.$menu_item_title.'">';
$menu_item_a_content = '';
if (isset($this->options['icon_display'])) {
$icon = isset($this->options['cart_icon']) ? $this->options['cart_icon'] : '0';
$menu_item_icon = '<i class="wpmenucart-icon-shopping-cart-'.$icon.'"></i>';
$menu_item_a_content .= $menu_item_icon;
} else {
$menu_item_icon = '';
}
switch ($this->options['items_display']) {
case 1: //items only
$menu_item_a_content .= '<span class="cartcontents">'.$cart_contents.'</span>';
break;
case 2: //price only
$menu_item_a_content .= '<span class="amount">'.$item_data['cart_total'].'</span>';
break;
case 3: //items & price
$menu_item_a_content .= '<span class="cartcontents">'.$cart_contents.'</span><span class="amount">'.$item_data['cart_total'].'</span>';
break;
}
$menu_item_a_content = apply_filters ('wpmenucart_menu_item_a_content', $menu_item_a_content, $menu_item_icon, $cart_contents, $item_data );
$this->menu_items['menu']['menu_item_a_content'] = $menu_item_a_content;
$menu_item .= $menu_item_a_content . '</a>';
$menu_item = apply_filters ('wpmenucart_menu_item_a', $menu_item, $item_data, $this->options, $menu_item_a_content, $viewing_cart, $start_shopping, $cart_contents);
if( !empty( $menu_item ) ) return $menu_item;
}