<?php

namespace core_next;

global $core_next_set;
$footer_data['date'] = date('Y');
$footer_data['site_name'] = get_bloginfo('name');
$footer_data['icp'] = $core_next_set['icp'];
$footer_data['icp_police'] = $core_next_set['icp_police'];
$footer_data['icp_icon_url'] = Config::$img_url . "/icon/icp.svg";
$footer_data['icp_police_icon_url'] = Config::$img_url . "/icon/police.svg";
$footer_data['footer_widget_right'] = WordPress::getSideBarHtml('footer_widget_right');
$footer_data['footer_widget_left'] = WordPress::getSideBarHtml('footer_widget');
if ($core_next_set['close_copyright']) {
    $footer_data['hide_copyright'] = 'true';
}
if ($core_next_set['icp'] == '') {
    $footer_data['hide_icp'] = 'true';
}
if ($core_next_set['icp_police'] == '') {
    $footer_data['hide_icp_police'] = 'true';
}
if ($core_next_set['footer_wave']) {
    echo Template::getTemplateHtml('footer-wave', []);
}

if (WordPress::hasMenu('footer_menu')) {
    $footer_data['footer_menu'] = WordPress::menuArrayToHtml('footer_menu');
} else {
    $footer_data['footer_menu_hide'] = 'true';
    $footer_data['footer_menu'] = '';
}

$html = Template::getTemplateHtmlByDOMDocument('footer', $footer_data);
print_r($html);

if ($core_next_set['phone_nav_open']) {
    $show_phone_nav = false;
    if (is_home() && $core_next_set['phone_nav_show_home']) {
        $show_phone_nav = true;
    }

    if (is_single() && $core_next_set['phone_nav_show_single']) {
        $show_phone_nav = true;
    }

    if (is_page() && $core_next_set['phone_nav_show_page']) {
        $show_phone_nav = true;
    }

    if (is_category() && $core_next_set['phone_nav_show_cate']) {
        $show_phone_nav = true;
    }

    if ($show_phone_nav) {
        get_template_part('template/module/phone-nav');
    }
}

