<?php
if (rad_is_unknown_page()) {
    echo "</div>";
}

$go_up             = rad_get_option("go-up");
$type              = rad_get_option("footer-type");
$footer_logo       = rad_get_option("footer-logo");
$footer_logo_style = rad_get_option("footer-logo-style");
$description       = rad_get_option("footer-description");
$copyright         = rad_get_option("footer-copyright");
$socials           = rad_get_option("footer-socials");
$social_type       = rad_get_option("footer-socials-type");
$payment           = rad_get_option("footer-payment");
$newsletter        = rad_get_option("footer-newsletter");
$style             = (rad_get_option("footer-style") == "0" ? "light" : "dark");

$main_logo = $second_logo = "";
rad_get_logo($main_logo, $second_logo);

if ($footer_logo == 1) {
    $footer_logo_style = ($footer_logo_style == 1) ? $main_logo : $second_logo;
    $footer_logo_style = "<img src=\"" . esc_url($footer_logo_style) . "\" class=\"logo\" alt=\"" . esc_attr(get_bloginfo("name")) . "\"/>";
} else {
    $footer_logo_style = "";
}

$payment = ($payment != "") ? "<img src=\"" . esc_url(rad_get_image_url($payment, "full")) . "\" class=\"payment\" alt=\"" . esc_attr__("payment", "aventa") . "\"/>" : "";

$social_type = ($social_type == 1) ? "icon" : "text";?>

            <footer id="rad-footer" class="<?php echo esc_attr($style); ?> type-<?php echo esc_attr($type); ?>">
                <div class="footer-wrapper container">
                <?php

                $style = ($style == "dark") ? "light" : "dark";

                if ($type == 1) {
                    echo "<div class=\"row\">";
                    echo "<div class=\"span6\">";
                    echo wp_kses($footer_logo_style, array("img" => array("src" => array(), "class" => array(), "alt" => array())));
                    if($description != "")
                    {
                        echo "<div class=\"description\">" . nl2br(esc_html($description)) . "</div>";
                    }

                    if ($socials) {
                        echo rad_social_icons("footer-socials", null, array("social-icons", $style . "-style"), $social_type);
                    }

                    wp_nav_menu(array(
                        "container"      => "",
                        "menu_class"     => "simple-menu first-menu",
                        "before"         => "",
                        "theme_location" => "footer-nav1",
                        "walker"         => new rad_Simple_Nav_Walker(),
                        "fallback_cb"    => false,
                        "after"          => "",
                    ));

                    wp_nav_menu(array(
                        "container"      => "",
                        "menu_class"     => "simple-menu second-menu",
                        "before"         => "",
                        "theme_location" => "footer-nav2",
                        "walker"         => new rad_Simple_Nav_Walker(),
                        "fallback_cb"    => false,
                        "after"          => "",
                    ));

                    echo "<div class=\"footer-newsletter\">" . do_shortcode($newsletter) . "</div>";

                    echo "</div>";

                    echo "<div class=\"span2 footer-widget-area\">";
                    if (is_active_sidebar("footer-widget-1")) {
                        dynamic_sidebar("footer-widget-1");
                    }
                    echo "</div>";

                    echo "<div class=\"span2 footer-widget-area\">";
                    if (is_active_sidebar("footer-widget-2")) {
                        dynamic_sidebar("footer-widget-2");
                    }
                    echo "</div>";

                    echo "<div class=\"span2 footer-widget-area\">";
                    if (is_active_sidebar("footer-widget-3")) {
                        dynamic_sidebar("footer-widget-3");
                    }
                    echo "</div>";

                    echo "</div>";
                    echo "<div class=\"row\">";
                    echo "<div class=\"span6\">";
                    echo "<div class=\"copyright\">" . esc_html($copyright) . "</div>";
                    echo "</div>";
                    echo "<div class=\"span6\">";
                    echo wp_kses($payment, array("img" => array("src" => array(), "class" => array(), "alt" => array())));
                    echo "</div>";
                    echo "</div>";
                } elseif ($type == 2) {
                    echo "<div class=\"row\">";
                    echo "<div class=\"span5\">";
                    echo wp_kses($footer_logo_style, array("img" => array("src" => array(), "class" => array(), "alt" => array())));

                    wp_nav_menu(array(
                        "container"      => "",
                        "menu_class"     => "simple-menu first-menu",
                        "before"         => "",
                        "theme_location" => "footer-nav1",
                        "walker"         => new rad_Simple_Nav_Walker(),
                        "fallback_cb"    => false,
                        "after"          => "",
                    ));
                    wp_nav_menu(array(
                        "container"      => "",
                        "menu_class"     => "simple-menu second-menu",
                        "before"         => "",
                        "theme_location" => "footer-nav2",
                        "walker"         => new rad_Simple_Nav_Walker(),
                        "fallback_cb"    => false,
                        "after"          => "",
                    ));

                    echo "<div class=\"footer-newsletter\">" . do_shortcode($newsletter) . "</div>";

                    echo "</div>";
                    echo "<div class=\"span2 footer-widget-area\">";
                    if (is_active_sidebar("footer-widget-1")) {
                        dynamic_sidebar("footer-widget-1");
                    }
                    echo "</div>";
                    echo "<div class=\"span2 footer-widget-area\">";
                    if (is_active_sidebar("footer-widget-2")) {
                        dynamic_sidebar("footer-widget-2");
                    }
                    echo "</div>";
                    echo "<div class=\"span3\">";
                    if($description != "")
                    {
                        echo "<div class=\"description\">" . nl2br(esc_html($description)) . "</div>";
                    }

                    if ($socials) {
                        echo rad_social_icons("footer-socials", null, array("social-icons", $style . "-style"), $social_type);
                    }

                    echo "<div class=\"copyright\">" . esc_html($copyright) . "</div>";
                    echo wp_kses($payment, array("img" => array("src" => array(), "class" => array(), "alt" => array())));
                    echo "</div>";

                    echo "</div>";
                } elseif ($type == 3) {
                    echo "<div class=\"row\">";
                    echo "<div class=\"span12\">";
                    if (is_active_sidebar("footer-widget-1")) {
                        dynamic_sidebar("footer-widget-1");
                    }

                    echo wp_kses($footer_logo_style, array("img" => array("src" => array(), "class" => array(), "alt" => array())));
                    echo "<div class=\"footer-newsletter\">" . do_shortcode($newsletter) . "</div>";
                    wp_nav_menu(array(
                        "container"      => "",
                        "menu_class"     => "simple-menu first-menu",
                        "before"         => "",
                        "theme_location" => "footer-nav1",
                        "walker"         => new rad_Simple_Nav_Walker(),
                        "fallback_cb"    => false,
                        "after"          => "",
                    ));
                    wp_nav_menu(array(
                        "container"      => "",
                        "menu_class"     => "simple-menu second-menu",
                        "before"         => "",
                        "theme_location" => "footer-nav2",
                        "walker"         => new rad_Simple_Nav_Walker(),
                        "fallback_cb"    => false,
                        "after"          => "",
                    ));
                    if($description != "")
                    {
                        echo "<div class=\"description\">" . nl2br(esc_html($description)) . "</div>";
                    }
                    echo wp_kses($payment, array("img" => array("src" => array(), "class" => array(), "alt" => array())));
                    echo "<div>";
                    echo "<div class=\"copyright\">" . esc_html($copyright) . "</div>";
                    if ($socials) {
                        echo rad_social_icons("footer-socials", null, array("social-icons", $style . "-style"), $social_type);
                    }
                    echo "</div>";
                    echo "</div>";
                    echo "</div>";
                } elseif ($type == 4) {
                    echo "<div class=\"row\">";
                    echo "<div class=\"span4\">";
                    if ($socials) {
                        echo rad_social_icons("footer-socials", null, array("social-icons", $style . "-style"), $social_type);
                    }
                    echo "</div>";
                    echo "<div class=\"span4\">";
                    echo wp_kses($footer_logo_style, array("img" => array("src" => array(), "class" => array(), "alt" => array())));
                    echo "</div>";
                    echo "<div class=\"span4\">";
                    echo wp_kses($payment, array("img" => array("src" => array(), "class" => array(), "alt" => array())));
                    echo "</div>";
                    echo "</div>";
                    echo "<div class=\"row\">";
                    echo "<div class=\"span12\">";
                    if (is_active_sidebar("footer-widget-1")) {
                        dynamic_sidebar("footer-widget-1");
                    }

                    wp_nav_menu(array(
                        "container"      => "",
                        "menu_class"     => "simple-menu first-menu",
                        "before"         => "",
                        "theme_location" => "footer-nav1",
                        "walker"         => new rad_Simple_Nav_Walker(),
                        "fallback_cb"    => false,
                        "after"          => "",
                    ));
                    wp_nav_menu(array(
                        "container"      => "",
                        "menu_class"     => "simple-menu second-menu",
                        "before"         => "",
                        "theme_location" => "footer-nav2",
                        "walker"         => new rad_Simple_Nav_Walker(),
                        "fallback_cb"    => false,
                        "after"          => "",
                    ));
                    if($description != "")
                    {
                        echo "<div class=\"description\">" . nl2br(esc_html($description)) . "</div>";
                    }
                    echo "<div class=\"copyright\">" . esc_html($copyright) . "</div>";
                    echo "</div>";
                    echo "</div>";
                }
                elseif ($type == 5) {
                    echo "<div class=\"row\">";
                    echo "<div class=\"span6\">";
                    echo wp_kses($footer_logo_style, array("img" => array("src" => array(), "class" => array(), "alt" => array())));
                    
                    if($description != "")
                    {
                        echo "<div class=\"description\">" . nl2br(esc_html($description)) . "</div>";
                    }

                    wp_nav_menu(array(
                        "container"      => "",
                        "menu_class"     => "simple-menu first-menu",
                        "before"         => "",
                        "theme_location" => "footer-nav1",
                        "walker"         => new rad_Simple_Nav_Walker(),
                        "fallback_cb"    => false,
                        "after"          => "",
                    ));
                    wp_nav_menu(array(
                        "container"      => "",
                        "menu_class"     => "simple-menu second-menu",
                        "before"         => "",
                        "theme_location" => "footer-nav2",
                        "walker"         => new rad_Simple_Nav_Walker(),
                        "fallback_cb"    => false,
                        "after"          => "",
                    ));

                    echo "<div class=\"footer-newsletter\">" . do_shortcode($newsletter) . "</div>";

                    if ($socials) {
                        echo rad_social_icons("footer-socials", null, array("social-icons", $style . "-style"), $social_type);
                    }

                    echo "<div class=\"copyright\">" . esc_html($copyright) . "</div>";
                    echo wp_kses($payment, array("img" => array("src" => array(), "class" => array(), "alt" => array())));

                    echo "</div>";
                    echo "<div class=\"span3 footer-widget-area\">";
                    if (is_active_sidebar("footer-widget-1")) {
                        dynamic_sidebar("footer-widget-1");
                    }
                    echo "</div>";
                    echo "<div class=\"span3 footer-widget-area\">";
                    if (is_active_sidebar("footer-widget-2")) {
                        dynamic_sidebar("footer-widget-2");
                    }
                    echo "</div>";

                    echo "</div>";
                }
                ?>
                </div>
            </footer>
        </div>
        <?php
        if($go_up) { ?>
        <a href="#top" class="go-up visible-desktop" rel="nofollow"></a>
        <?php
        }
        wp_footer();?>
    </body>
</html>