<?php
/* Prohibit direct script loading */
defined('ABSPATH') || die('No direct script access allowed!');
?>
<li>
    <div class="collapsible-header"><?php esc_html_e('Source: menus', 'wpmsPro') ?></div>
    <div class="collapsible-body"><span>
<?php
$ids_menu   = array(0);
$check_menu = array();
$terms      = get_terms(array('taxonomy' => 'nav_menu', 'hide_empty' => true));
foreach ($terms as $value) {
    $list_submenu_id = get_objects_in_term($value->term_id, 'nav_menu');
    $ids_menu        = array_merge($ids_menu, $list_submenu_id);
}

if (empty($this->settings_sitemap['wpms_check_firstsave'])) {
    $this->settings_sitemap['wpms_sitemap_menus'] = $ids_menu;
}

if (!empty($this->settings_sitemap['wpms_sitemap_menus'])) {
    if (!empty($terms)) {
        foreach ($terms as $value) {
            if (!in_array('sitemap_menus_' . $value->term_id, $check_menu)) {
                $check_menu[] = 'sitemap_menus_' . $value->term_id;
                echo '<div id="' . esc_attr('sitemap_menus_' . $value->term_id) . '" class="wpms_sitemap_menus">';
                $viewmenu = $this->viewMenusFrontend($value, $ids_menu);
                // phpcs:ignore WordPress.Security.EscapeOutput -- Content escaped in the method WpmsProSitemap::viewMenusFrontend
                echo $viewmenu;

                echo '</div>';
                echo '<div class="' . esc_attr('holder holder_sitemaps_menus_' . $value->term_id) . '"></div>';
            }
        }
    }
}
?>
</span></div>
</li>