<?php defined('ABSPATH') or die("No script kiddies please!"); ?>
<div class="wpfm-menu-wrapper wpfm-<?php echo $template; ?>" template-type="<?php echo $template; ?>" menu-id="<?php echo $menu_data->id; ?>" data-scroll-call="<?php echo isset($menu_design_detail['menu_design']['show_menu_on_scroll']) && $menu_design_detail['menu_design']['show_menu_on_scroll'] == 1 ? 1 : 0; ?>" data-scroll-value="<?php echo isset($menu_design_detail['menu_design']['show_menu_scroll_event_value']) && !empty($menu_design_detail['menu_design']['show_menu_scroll_event_value']) ? esc_attr($menu_design_detail['menu_design']['show_menu_scroll_event_value']) : '100'; ?>" data-pos-offset-var="<?php echo isset($options['menu_enable_offset_to_position']) && $options['menu_enable_offset_to_position'] == 1 ? 1 : 0; ?>" 
     <?php echo isset($menu_design_detail['menu_design']['show_menu_on_scroll']) && $menu_design_detail['menu_design']['show_menu_on_scroll'] == 1 ? 'style="display:none;"' : ''; ?>>
    <nav id="wpfm-floating-menu-nav" class="wpfm-menu-nav wpfm wpfm-position-<?php echo $menu_position; ?>">
        <?php
        if (isset($template) && $template == 'template-17') {
            $expand_icon = 'fa fa-share-alt';
            ?>
            <a class="wpfm-nav-hover-trigger" href="javascript:void(0)" id="<?php echo $menu_position; ?>">
                <span aria-hidden="true"><i class="<?php echo $expand_icon; ?>"></i></span>
            </a>
        <?php } ?>
        <ul class="wpfm-nav wpfm-nav-show-hide">
            <?php
            foreach ($menu_structure_detail as $key => $val) {
                if (isset($val['wpfm_field_enable_modal_pp']) && $val['wpfm_field_enable_modal_pp'] == '1') {
                    $wpfm_href_address = '#modal-popup-' . $menu_data->id . '-' . $key;
                } else {
                    if (!empty($val["wpfm_target_link_address"])) {
                        $wpfm_href_address = stripslashes_deep(esc_url($val["wpfm_target_link_address"]));
                    } else {
                        $wpfm_href_address = '';
                    }
                }
                if (isset($val["wpfm_field_link_target"]) && $val["wpfm_field_link_target"] != '') {
                    $wpfm_link_target = 'target="_blank"';
                } else {
                    $wpfm_link_target = '';
                }
                if (isset($val["wpfm_tooltip_show"]) && $val["wpfm_tooltip_show"] == '1' && !empty($val["wpfm_menu_tooltip_title"])) {
                    $tooltip_title = stripslashes_deep($val["wpfm_menu_tooltip_title"]);
                }
                if (isset($val["icon_color_type"]) && $val["icon_color_type"] == 'custom' && isset($val["menu_icon_color"])) {
                    $icon_color = 'style="color:' . esc_attr($val["menu_icon_color"]) . '"';
                } else if (isset($val["icon_color_type"]) && $val["icon_color_type"] == 'default') {
                    $icon_color = '';
                }
                if ((isset($val["check_user_log"]) && $val["check_user_log"] == 'logged-in' && is_user_logged_in()) || ((isset($val["check_user_log"]) && $val["check_user_log"] == 'all')) || (!isset($val["check_user_log"]))) {
                    $wpfm_userrole_admin_array = array();
                    if (isset($val["wpfm_userrole"]) && !empty($val["wpfm_userrole"])) {
                        foreach ($val["wpfm_userrole"] as $wfkey => $wfval) {
                            array_push($wpfm_userrole_admin_array, $wfval);
                        }
                    }
                    if ((isset($val["check_user_log"]) && $val["check_user_log"] == 'logged-in' && is_user_logged_in()) && in_array($this->wpfm_get_user_role(), $wpfm_userrole_admin_array) || ((isset($val["check_user_log"]) && $val["check_user_log"] == 'all')) || (!isset($val["check_user_log"]))) {
                        ?>
                        <li class="<?php
                        if (!(isset($val["wpfm_title_show"])) || $val["wpfm_title_show"] == '') {
                            echo 'wpfm-title-hidden';
                        }
                        ?> <?php
                        if ((isset($val["wpfm_custom_class"])) && $val["wpfm_custom_class"] != '') {
                            echo $val['wpfm_custom_class'];
                        }
                        ?> <?php
                        if (isset($val['wpfm_field_enable_modal_pp']) && $val['wpfm_field_enable_modal_pp'] == '1') {
                            echo 'wpfm-modal-popup-link';
                        }
                        ?>"  data-li-key="<?php echo $key; ?>">
                            <a title="<?php
                            if (!empty($val['wpfm_menu_item_title_attribute'])) {
                                echo $val['wpfm_menu_item_title_attribute'];
                            }
                            ?>" class="wpfm-menu-link" href="<?php echo $wpfm_href_address; ?>" <?php echo $wpfm_link_target; ?> rel="<?php
                               if (isset($wpfm_settings['menu_link_add_nofollow']) && $wpfm_settings['menu_link_add_nofollow'] == 1) {
                                   echo 'nofollow';
                               }
                               ?> <?php echo isset($val['wpfm_xfn_relationship']) && !empty($val['wpfm_xfn_relationship']) ? esc_attr($val['wpfm_xfn_relationship']) : ''; ?>">
                                <?php if (isset($template) && ($template == 'template-7' || $template == 'template-11' || $template == 'template-12' || $template == 'template-13')) { ?><span class="wpfm-icon-menu-name-wrapper"><?php } ?>
                                    <span class='wpfm-icon-block <?php
                                    if ((isset($val['icon_icon_type']) && $val['icon_icon_type'] == 'image-icon')) {
                                        echo "wpfm-image-icon-block";
                                    }
                                    ?>'>
                                              <?php
                                              if (((isset($val['icon_icon_type']) && $val['icon_icon_type'] == 'default') && (isset($val['icon_picker_settings']) && $val['icon_picker_settings'] != '')) || !isset($val['icon_icon_type']) && (isset($val['icon_picker_settings']) && $val['icon_picker_settings'] != '')) {
                                                  $v = explode('|', esc_attr($val['icon_picker_settings']));
                                                  ?>
                                            <i <?php
                                            if (isset($icon_color)) {
                                                echo $icon_color;
                                            }
                                            ?> class="<?php echo $v[0] == 'eleganticons' ? esc_attr($v[0]) . ' ' . ltrim($v[1], '-') : esc_attr($v[0]) . ' ' . esc_attr($v[1]); ?>" aria-hidden="true"></i>
                                            <?php } else if ((isset($val['icon_icon_type']) && $val['icon_icon_type'] == 'custom') && (isset($val['icon_picker_custom']) && $val['icon_picker_custom'] != '')) { ?> 
                                            <i <?php
                                            if (isset($icon_color)) {
                                                echo $icon_color;
                                            }
                                            ?>class="<?php echo $val['icon_picker_custom']; ?>" aria-hidden="true"></i>
                                            <?php } else if ((isset($val['icon_icon_type']) && $val['icon_icon_type'] == 'image-icon')) { ?>
                                            <img class="wpfm-image-icon" src="<?php echo!empty($val['icon_picker_image_custom']) ? $val['icon_picker_image_custom'] : ''; ?>" >
                                        <?php } ?>
                                    </span>
                                    <span class='wpfm-menu-name-tooltip-wrap'>
                                        <span class='name wpfm-menu-name'>
                                            <?php if (isset($val['wpfm_menu_item_title']) && !empty($val['wpfm_menu_item_title']) && (isset($val["wpfm_title_show"]) && $val["wpfm_title_show"] == '1')) {
                                                ?>
                                                <?php echo stripslashes_deep($val["wpfm_menu_item_title"]); ?>
                                            <?php }
                                            ?>
                                            <?php
                                            if (isset($template) && in_array($template, array('template-14', 'template-15', 'template-17', 'template-18'))) {
                                                if (isset($val["wpfm_tooltip_show"]) && $val["wpfm_tooltip_show"] == '1' && !empty($val["wpfm_menu_tooltip_title"])) {
                                                    ?>
                                                    <span class='tooltip wpfm-tootltip-title'>
                                                        <?php
                                                        if (isset($val['wpfm_menu_tooltip_title']) && !empty($val['wpfm_menu_tooltip_title'])) {
                                                            echo stripslashes_deep($val["wpfm_menu_tooltip_title"]);
                                                        }
                                                        ?>
                                                    </span>
                                                    <?php
                                                }
                                            }
                                            ?>
                                        </span>
                                    </span>
                                    <?php if (isset($template) && ($template == 'template-7' || $template == 'template-11' || $template == 'template-12' || $template == 'template-13')) { ?></span><?php } ?>          
                            </a>    
                            <?php
                            if (isset($template) && !in_array($template, array('template-14', 'template-15', 'template-17', 'template-18'))) {
                                if (isset($val["wpfm_tooltip_show"]) && $val["wpfm_tooltip_show"] == '1' && !empty($val["wpfm_menu_tooltip_title"])) {
                                    ?>
                                    <span class='tooltip wpfm-tootltip-title'>
                                        <?php
                                        if (isset($val['wpfm_menu_tooltip_title']) && !empty($val['wpfm_menu_tooltip_title'])) {
                                            echo stripslashes_deep($val["wpfm_menu_tooltip_title"]);
                                        }
                                        ?>
                                    </span>
                                    <?php
                                }
                            }
                            ?>                             
                        </li>
                        <?php
                    }
                }
            }
            ?>  
        </ul>             
    </nav>
    <div class="wpfm-menu-additional-content-wrap">
        <?php
        foreach ($menu_structure_detail as $key => $val) {
            if (isset($val['wpfm_field_enable_modal_pp']) && $val['wpfm_field_enable_modal_pp'] == '1') {
                if (isset($val['wpfm_custom_mod_popup_content']) && !empty($val['wpfm_custom_mod_popup_content'])) {
                    ?>
                    <div class="wpfm-menu-additional-content-inner" id="wpfm-id-<?php echo $menu_data->id; ?>-key-<?php echo $key; ?>-content" style="display:none;">
                        <span class="wpfm-menu-additional-content-close">X</span>
                        <div class="wpfm-menu-popup-content">
                            <?php
                            echo do_shortcode( stripslashes_deep(nl2br($val['wpfm_custom_mod_popup_content'])));
                            ?>
                        </div>
                    </div>
                    <?php
                }
            }
        }
        ?>
    </div>
    <div class="wpfm-menu-additional-content-overlay" id="wpfm-menu-additional-content-overlay-<?php echo $menu_data->id; ?>"></div>
</div>
