示例#1
0
 function sf_aux_links($position, $alt_version = false, $header_version = "")
 {
     // VARIABLES
     $login_url = wp_login_url();
     $logout_url = wp_logout_url(home_url());
     $my_account_link = get_admin_url();
     $myaccount_page_id = get_option('woocommerce_myaccount_page_id');
     if ($myaccount_page_id) {
         $my_account_link = get_permalink($myaccount_page_id);
         $logout_url = wp_logout_url(get_permalink($myaccount_page_id));
         $login_url = get_permalink($myaccount_page_id);
         if (get_option('woocommerce_force_ssl_checkout') == 'yes') {
             $logout_url = str_replace('http:', 'https:', $logout_url);
             $login_url = str_replace('http:', 'https:', $login_url);
         }
     }
     $login_url = apply_filters('sf_header_login_url', $login_url);
     $my_account_link = apply_filters('sf_header_myaccount_url', $my_account_link);
     global $sf_options;
     $show_sub = $sf_options['show_sub'];
     $show_translation = $sf_options['show_translation'];
     $sub_code = __($sf_options['sub_code'], 'swiftframework');
     $show_account = $sf_options['show_account'];
     $show_cart = $show_wishlist = false;
     if (isset($sf_options['show_cart'])) {
         $show_cart = $sf_options['show_cart'];
     }
     if (isset($sf_options['show_wishlist'])) {
         $show_wishlist = $sf_options['show_wishlist'];
     }
     $ss_enable = $sf_options['ss_enable'];
     $aux_links_output = $ss_enable = "";
     // LINKS + SEARCH OUTPUT
     $aux_links_output .= '<nav class="std-menu ' . $position . '">' . "\n";
     $aux_links_output .= '<ul class="menu">' . "\n";
     if ($show_account) {
         if (is_user_logged_in()) {
             $aux_links_output .= '<li><a href="' . $logout_url . '">' . __("Sign Out", "swiftframework") . '</a></li>' . "\n";
             $aux_links_output .= '<li><a href="' . $my_account_link . '" class="admin-link">' . __("My Account", "swiftframework") . '</a></li>' . "\n";
         } else {
             $aux_links_output .= '<li><a href="' . $login_url . '">' . __("Login", "swiftframework") . '</a></li>' . "\n";
         }
     }
     if ($show_sub) {
         $aux_links_output .= '<li class="parent"><a href="#">' . __("Subscribe", "swiftframework") . '</a>' . "\n";
         $aux_links_output .= '<ul class="sub-menu">' . "\n";
         $aux_links_output .= '<li><div class="header-subscribe clearfix">' . "\n";
         $aux_links_output .= do_shortcode($sub_code) . "\n";
         $aux_links_output .= '</div></li>' . "\n";
         $aux_links_output .= '</ul>' . "\n";
         $aux_links_output .= '</li>' . "\n";
     }
     if ($show_translation) {
         $aux_links_output .= '<li class="parent aux-languages"><a href="#">' . __("Language", "swiftframework") . '</a>' . "\n";
         $aux_links_output .= '<ul class="header-languages sub-menu">' . "\n";
         if (function_exists('sf_language_flags')) {
             $aux_links_output .= sf_language_flags();
         }
         $aux_links_output .= '</ul>' . "\n";
         $aux_links_output .= '</li>' . "\n";
     }
     if ($header_version != "header-1") {
         if ($show_cart) {
             $aux_links_output .= sf_get_cart();
         }
         if (class_exists('YITH_WCWL_UI') && $show_wishlist) {
             $aux_links_output .= sf_get_wishlist();
         }
     }
     $aux_links_output .= '</ul>' . "\n";
     $aux_links_output .= '</nav>' . "\n";
     // RETURN
     return $aux_links_output;
 }
 function sf_mobile_menu()
 {
     global $post, $woocommerce, $sf_options;
     $mobile_header_layout = $sf_options['mobile_header_layout'];
     $mobile_show_translation = $sf_options['mobile_show_translation'];
     $mobile_show_search = $sf_options['mobile_show_search'];
     $mobile_menu_type = "slideout";
     $fs_close_icon = apply_filters('sf_fullscreen_close_icon', '<i class="ss-delete"></i>');
     if (isset($sf_options['mobile_menu_type'])) {
         $mobile_menu_type = $sf_options['mobile_menu_type'];
     }
     $page_menu = "";
     if ($post && !is_search()) {
         $page_menu = sf_get_post_meta($post->ID, 'sf_page_menu', true);
     }
     $mobile_show_cart = $sf_options['mobile_show_cart'];
     $mobile_show_account = $sf_options['mobile_show_account'];
     $login_url = wp_login_url();
     $logout_url = wp_logout_url(home_url());
     $my_account_link = get_admin_url();
     $myaccount_page_id = get_option('woocommerce_myaccount_page_id');
     if ($myaccount_page_id) {
         $my_account_link = get_permalink($myaccount_page_id);
         $logout_url = wp_logout_url(get_permalink($myaccount_page_id));
         $login_url = get_permalink($myaccount_page_id);
         if (get_option('woocommerce_force_ssl_checkout') == 'yes') {
             $logout_url = str_replace('http:', 'https:', $logout_url);
             $login_url = str_replace('http:', 'https:', $login_url);
         }
     }
     $login_url = apply_filters('sf_header_login_url', $login_url);
     $register_url = apply_filters('sf_header_register_url', wp_registration_url());
     $my_account_link = apply_filters('sf_header_myaccount_url', $my_account_link);
     if (get_option('woocommerce_enable_myaccount_registration') && $myaccount_page_id) {
         $register_url = apply_filters('sf_header_register_url', $my_account_link);
     }
     $mobile_menu_args = array('echo' => false, 'theme_location' => 'mobile_menu', 'walker' => new sf_alt_menu_walker(), 'fallback_cb' => '', 'menu' => $page_menu);
     $mobile_menu_output = "";
     if ($mobile_header_layout == "left-logo" || $mobile_header_layout == "center-logo-alt") {
         $mobile_menu_output .= '<div id="mobile-menu-wrap" class="menu-is-right">' . "\n";
     } else {
         $mobile_menu_output .= '<div id="mobile-menu-wrap" class="menu-is-left">' . "\n";
     }
     if ($mobile_menu_type == "overlay") {
         $mobile_menu_output .= '<a href="#" class="mobile-overlay-close">' . $fs_close_icon . '</a>';
     }
     if ($mobile_show_translation && (function_exists('pll_the_languages') || function_exists('icl_get_languages'))) {
         $mobile_menu_output .= '<ul class="mobile-language-select">' . sf_language_flags() . '</ul>' . "\n";
     }
     if ($mobile_show_search) {
         $mobile_menu_output .= '<form method="get" class="mobile-search-form" action="' . home_url() . '/">' . "\n";
         $mobile_menu_output .= '<i class="sf-icon-search"></i>' . "\n";
         $mobile_menu_output .= '<input type="text" placeholder="' . __("Search", "swiftframework") . '" name="s" autocomplete="off" />' . "\n";
         $mobile_menu_output .= '</form>' . "\n";
     }
     $mobile_menu_output .= '<nav id="mobile-menu" class="clearfix">' . "\n";
     if (function_exists('wp_nav_menu')) {
         $mobile_menu_output .= wp_nav_menu($mobile_menu_args);
     }
     $mobile_menu_output .= '<ul class="alt-mobile-menu">' . "\n";
     if (sf_woocommerce_activated()) {
         if ($mobile_show_cart) {
             $mobile_menu_output .= sf_get_cart();
         }
         $mobile_menu_output .= sf_get_wishlist();
         if ($mobile_show_account) {
             if (is_user_logged_in()) {
                 $mobile_menu_output .= '<li><a href="' . $my_account_link . '" class="admin-link">' . __("My Account", "swiftframework") . '</a></li>' . "\n";
                 $mobile_menu_output .= '<li><a href="' . $logout_url . '">' . __("Logout", "swiftframework") . '</a></li>' . "\n";
             } else {
                 $mobile_menu_output .= '<li><a href="' . $login_url . '">' . __("Login", "swiftframework") . '</a></li>' . "\n";
                 $mobile_menu_output .= '<li><a href="' . $register_url . '">' . __("Sign Up", "swiftframework") . '</a></li>' . "\n";
             }
         }
     }
     $mobile_menu_output .= '</ul>' . "\n";
     $mobile_menu_output .= '</nav>' . "\n";
     $mobile_menu_output .= '</div>' . "\n";
     echo $mobile_menu_output;
 }
示例#3
0
 function sf_aux_links($position, $alt_version = FALSE, $header_version = "")
 {
     // VARIABLES
     $login_url = wp_login_url();
     $logout_url = wp_logout_url(home_url());
     $myaccount_page_id = get_option('woocommerce_myaccount_page_id');
     if ($myaccount_page_id) {
         $logout_url = wp_logout_url(get_permalink($myaccount_page_id));
         $login_url = get_permalink($myaccount_page_id);
         if (get_option('woocommerce_force_ssl_checkout') == 'yes') {
             $logout_url = str_replace('http:', 'https:', $logout_url);
             $login_url = str_replace('http:', 'https:', $login_url);
         }
     }
     $options = get_option('sf_dante_options');
     $show_sub = $options['show_sub'];
     $show_translation = $options['show_translation'];
     $sub_code = $options['sub_code'];
     $show_account = $options['show_account'];
     $show_cart = $options['show_cart'];
     $show_wishlist = $options['show_wishlist'];
     $tb_search_text = $options['tb_search_text'];
     $aux_links_output = $ss_enable = "";
     if (isset($options['ss_enable'])) {
         $ss_enable = $options['ss_enable'];
     } else {
         $ss_enable = true;
     }
     // LINKS + SEARCH OUTPUT
     $aux_links_output .= '<nav class="std-menu ' . $position . '">' . "\n";
     $aux_links_output .= '<ul class="menu">' . "\n";
     if ($show_account) {
         if (is_user_logged_in()) {
             $aux_links_output .= '<li><a class="get_started_link" href="/profile/details">Get Started</a>' . "\n";
             $aux_links_output .= '<li><a href="' . wp_logout_url(home_url()) . '">' . __("Logout", "swiftframework") . '</a></li>' . "\n";
             // $aux_links_output .= '<li><a href="'.home_url()."/dashboard"'">'. "Profile & Order" .'</a></li>'. "\n";
             $aux_links_output .= '<li><a href="' . home_url() . '/dashboard">Profile & Order</a></li>' . "\n";
             if ($myaccount_page_id) {
                 // $aux_links_output .= '<li><a href="'.get_permalink( $myaccount_page_id ).'" class="admin-link">'. __("My Account", "swiftframework") .'</a></li>'. "\n";
             } else {
                 // $aux_links_output .= '<li><a href="'.get_admin_url().'" class="admin-link">'. __("My Account", "swiftframework") .'</a></li>'. "\n";
             }
         } else {
             // $aux_links_output .= '<li><a href="'.$login_url.'">'. __("Login", "swiftframework") .'</a></li>'. "\n";
             $aux_links_output .= '<li><a class="get_started_link" href="/profile">Get Started</a>' . "\n";
             $aux_links_output .= '<li><a href="/login">' . __("Login", "swiftframework") . '</a></li>' . "\n";
         }
     }
     if ($show_sub) {
         $aux_links_output .= '<li class="parent"><a href="#">' . __("Subscribe", "swiftframework") . '</a>' . "\n";
         $aux_links_output .= '<ul class="sub-menu">' . "\n";
         $aux_links_output .= '<li><div id="header-subscribe" class="clearfix">' . "\n";
         $aux_links_output .= do_shortcode($sub_code) . "\n";
         $aux_links_output .= '</div></li>' . "\n";
         $aux_links_output .= '</ul>' . "\n";
         $aux_links_output .= '</li>' . "\n";
     }
     if ($show_translation) {
         $aux_links_output .= '<li class="parent aux-languages"><a href="#">' . __("Language", "swiftframework") . '</a>' . "\n";
         $aux_links_output .= '<ul id="header-languages" class="sub-menu">' . "\n";
         if (function_exists('sf_language_flags')) {
             $aux_links_output .= sf_language_flags();
         }
         $aux_links_output .= '</ul>' . "\n";
         $aux_links_output .= '</li>' . "\n";
     }
     if ($header_version != "header-1") {
         if ($show_cart) {
             $aux_links_output .= sf_get_cart();
         }
         if (class_exists('YITH_WCWL_UI') && $show_wishlist) {
             $aux_links_output .= sf_get_wishlist();
         }
     }
     if ($position == "header-menu" && !$alt_version && $ss_enable) {
         $aux_links_output .= '<li><a class="swift-search-link" href="#"><i class="ss-zoomin"></i><span>' . do_shortcode($tb_search_text) . '</span></a></li>' . "\n";
     }
     $aux_links_output .= '</ul>' . "\n";
     $aux_links_output .= '</nav>' . "\n";
     // RETURN
     return $aux_links_output;
 }