<?php
/*
Theme Designed By: Meysam Hosseinkhani
Email: Meysam98@Gmail.com
Author Website: Hosseinkhani.ir
*/
   // Exit if accessed directly
   if (!defined('ABSPATH')) {
    exit;
}
?>

<?php global $az_data; ?>

<footer class="sfooter">
    <!-- start main page -->
    <?php
if ($az_data['show_main_page'] && is_front_page()) { ?>
    <div class="container-fluid main-sec">
        <div class="container">
            <div class="main-title">
                <h3>
                    <?php echo $az_data['main_title']; ?>
                </h3>
            </div>
            <div class="main-page">
                <?php echo $az_data['main_text']; ?>
            </div>
        </div>
    </div>
    <?php } ?>
    <!-- end main page -->

    
    <?php if(az_woo()) { 
    if ( $az_data['show_archive_desc'] && is_archive() && !is_shop() && !empty(get_the_archive_description()) ) { ?>
    <!-- start category description -->
    <div class="container-fluid main-sec">
        <div class="container">
            <div class="main-title">
                <h1>
                    <?php single_cat_title(); ?>
                </h1>
            </div>
            <div class="main-page">
                <?php the_archive_description(); ?>
            </div>
        </div>
    </div>
    <!-- end category description -->
    <?php }
    } else {
        if ( $az_data['show_archive_desc'] && is_archive() && !empty(get_the_archive_description()) ) { ?>
            <!-- start category description -->
            <div class="container-fluid main-sec">
                <div class="container">
                    <div class="main-title">
                        <h1>
                            <?php single_cat_title(); ?>
                        </h1>
                    </div>
                    <div class="main-page">
                        <?php the_archive_description(); ?>
                    </div>
                </div>
            </div>
            <!-- end category description -->
            <?php }
    } ?>

    <?php
if ($az_data['info_bar']) { ?>
    <div class="container-fluid info-bar">
        <div class="container">
            <div class="row">

                <?php if($az_data['info_bar_prods']) { ?>
                <div class="prod-count col">
                    <?php
                    if (az_woo()) {
                        $count_prods = wp_count_posts('product');
                    } else {
                        $count_prods = wp_count_posts('download');
                    }
                    $published_prods = $count_prods->publish; ?>
                    <i class="fas fa-shopping-bag"></i>
                    <span class="count-num">
                        <?php echo $published_prods; ?>+</span>
                    <span class="count-text">تعداد محصولات</span>
                </div>
                <?php } ?>
                
                <?php if($az_data['info_bar_sales']) { ?>
                <div class="prod-count col">
                    <i class="fas fa-credit-card"></i>
                    <span class="count-num">
                    <?php
                        if (az_woo()) {
                            echo az_woo_get_total_sales();
                        } else {
                            echo edd_get_total_sales();
                        }
                    ?>+</span>
                    <span class="count-text">خرید موفق</span>
                </div>
                <?php } ?>

                <?php if($az_data['info_bar_users']) { ?>
                <div class="prod-count col">
                    <?php $usercount = count_users();
                    $result = $usercount['total_users']; ?>
                    <i class="fas fa-user"></i>
                    <span class="count-num">
                        <?php echo $result; ?>+</span>
                    <span class="count-text">تعداد کاربران</span>
                </div>
                <?php } ?>

                <?php if($az_data['info_bar_posts']) { ?>
                <div class="prod-count col">
                    <?php $count_posts = wp_count_posts('post');
                    $published_posts = $count_posts->publish; ?>
                    <i class="fas fa-file-alt"></i>
                    <span class="count-num">
                        <?php echo $published_posts; ?>+</span>
                    <span class="count-text">تعداد نوشته ها</span>
                </div>
                <?php } ?>

            </div>
        </div>
    </div>
    <?php } ?>
    <div class="container-fluid footer">
        <?php if ( is_active_sidebar( 'footer-1' ) || is_active_sidebar( 'footer-2' ) || is_active_sidebar( 'footer-3' ) ) : ?>
        <aside class="container fwcontainer">
            <div class="row">
                <div class="col-md-4 col-12 f-widget">
                    <?php if ( is_active_sidebar( 'footer-1' ) ) :
                    dynamic_sidebar('footer-1'); 
                    endif;?>
                </div>
                <div class="col-md-4 col-12 f-widget">
                    <?php if ( is_active_sidebar( 'footer-2' ) ) :
                    dynamic_sidebar('footer-2'); 
                    endif;?>
                </div>
                <div class="col-md-4 col-12 f-widget">
                    <?php if ( is_active_sidebar( 'footer-3' ) ) :
                    dynamic_sidebar('footer-3');
                    endif;?>
                </div>
            </div>
        </aside>
        <?php endif; ?>
    </div>
    <div role="contentinfo" class="container-fluid copyright">
        <?php if($az_data['show_addr']) { ?>
        <div class="container addr-con">
            <div class="row">
                <div class="col-lg-9 col-12 addr-text-con">

                    <?php if(($az_data['addr_text']!='') && ($az_data['show_faddr'])) { ?>
                    <div class="addr-text col-md-7 col-12"><i class="fas fa-map-marker" aria-hidden="true"></i>
                        <?php echo $az_data['addr_text']; ?>
                    </div>
                    <?php } ?>
                    
                    <div class="ftel col-md-5 col-12">

                        <?php if(($az_data['site_tel']!='') && ($az_data['show_ftel'])) { ?>
                        <span class="foot-tel">
                            <span class="fas fa-phone-square" aria-hidden="true"></span>
                            <span class="top-val" id="site-tel">
                            <?php echo $az_data['site_tel']; ?>
                            </span>
                        </span>
                        <?php } ?>

                        <?php if(($az_data['site_email']!='') && ($az_data['show_fmail'])) { ?>
                        <span class="foot-tel">
                            <span class="fas fa-envelope" aria-hidden="true"></span>
                            <span class="top-val" id="site-email">
                            <?php echo $az_data['site_email']; ?>
                            </span>
                        </span>
                        <?php } ?>

                    </div>
                </div>

                <?php if($az_data['show_apps']) { ?>
                <div class="col-lg-3 col-12 apps-icon">
                    <?php if($az_data['and_link'] != '') { ?>
                    <a href="<?php echo $az_data['and_link']; ?>" rel="nofollow" class="btn btn-outline-success and-btn"><i class="fab fa-android" aria-hidden="true"></i> نسخه آندروید</a>
                    <?php } ?>
                    <?php if($az_data['ios_link'] != '') { ?>
                    <a href="<?php echo $az_data['ios_link']; ?>" rel="nofollow" class="btn btn-outline-light ios-btn"><i class="fab fa-apple" aria-hidden="true"></i> نسخه ios</a>
                    <?php } ?>
                </div>
                <?php } ?>
            </div>
        </div>
        <?php } ?>

        <div class="container footer-con">
            <div class="row">
                <div class="col-lg-6 col-12">
                    <div class="footer-text">
                        <?php echo $az_data['footer_text']; ?>
                    </div>
                </div>
                <div class="col-lg-6 col-12">
                    <?php if($az_data['footer_nav']) { ?>
                    <nav class="footer-nav" <?php if($az_data['site_schema']) {?>itemscope itemtype="https://schema.org/SiteNavigationElement"
                        <?php } ?>>
                        <?php
                            wp_nav_menu( array(
                                'menu'              => 'footer',
                                'theme_location'    => 'footer',
                                'depth'             => 1,
                                'container'         => 'div'
                                )
                            );
                        ?>
                    </nav>
                    <?php } else { ?>
                    <ul class="social footer-social">
                        <?php if ($az_data['so_facebook']) { ?>
                        <li data-toggle="tooltip" data-placement="top" title="فیسبوک">
                            <a <?php if($az_data['site_schema']) {?>itemprop="sameAs" <?php } ?> aria-label="فیسبوک" href="<?php echo $az_data['so_facebook_link']; ?>" target="_blank">
                            <i class="fab fa-facebook"></i>
                            </a>
                        </li>
                        <?php } ?>

                        <?php if ($az_data['so_google']) { ?>
                        <li data-toggle="tooltip" data-placement="top" title="گوگل پلاس">
                            <a <?php if($az_data['site_schema']) {?>itemprop="sameAs"<?php } ?> aria-label="گوگل پلاس" href="<?php echo $az_data['so_google_link']; ?>" target="_blank">
                            <i class="fab fa-google-plus"></i>
                            </a>
                        </li>
                        <?php } ?>

                        <?php if ($az_data['so_twitter']) { ?>
                        <li data-toggle="tooltip" data-placement="top" title="توئیتر">
                            <a <?php if($az_data['site_schema']) {?>itemprop="sameAs"<?php } ?> aria-label="توئیتر" href="<?php echo $az_data['so_twitter_link']; ?>" target="_blank">
                            <i class="fab fa-twitter"></i>
                            </a>
                        </li>
                        <?php } ?>

                        <?php if ($az_data['so_youtube']) { ?>
                        <li data-toggle="tooltip" data-placement="top" title="یوتیوب">
                            <a <?php if($az_data['site_schema']) {?>itemprop="sameAs"<?php } ?> aria-label="یوتیوب" href="<?php echo $az_data['so_youtube_link']; ?>" target="_blank">
                            <i class="fab fa-youtube"></i>
                            </a>
                        </li>
                        <?php } ?>

                        <?php if ($az_data['so_dribble']) { ?>
                        <li data-toggle="tooltip" data-placement="top" title="دریبل">
                            <a <?php if($az_data['site_schema']) {?>itemprop="sameAs"<?php } ?> aria-label="دریبل" href="<?php echo $az_data['so_dribble_link']; ?>" target="_blank">
                            <i class="fab fa-dribbble"></i>
                            </a>
                        </li>
                        <?php } ?>

                        <?php if ($az_data['so_linkedin']) { ?>
                        <li data-toggle="tooltip" data-placement="top" title="لینکداین">
                            <a <?php if($az_data['site_schema']) {?>itemprop="sameAs"<?php } ?> aria-label="لینکداین" href="<?php echo $az_data['so_linkedin_link']; ?>" target="_blank">
                            <i class="fab fa-linkedin"></i>
                            </a>
                        </li>
                        <?php } ?>

                        <?php if ($az_data['so_instagram']) { ?>
                        <li data-toggle="tooltip" data-placement="top" title="اینستاگرام">
                            <a <?php if($az_data['site_schema']) {?>itemprop="sameAs"<?php } ?> aria-label="اینستاگرام" href="<?php echo $az_data['so_instagram_link']; ?>" target="_blank">
                            <i class="fab fa-instagram"></i>
                            </a>
                        </li>
                        <?php } ?>

                        <?php if ($az_data['so_cloob']) { ?>
                        <li data-toggle="tooltip" data-placement="top" title="کلوپ">
                            <a <?php if($az_data['site_schema']) {?>itemprop="sameAs"<?php } ?> aria-label="کلوپ" href="<?php echo $az_data['so_cloob_link']; ?>" target="_blank">
                            <i class="ico-cloob"></i>
                            </a>
                        </li>
                        <?php } ?>

                        <?php if ($az_data['so_telegram']) { ?>
                        <li data-toggle="tooltip" data-placement="top" title="تلگرام">
                        <a <?php if($az_data['site_schema']) {?>itemprop="sameAs"<?php } ?> aria-label="تلگرام" href="<?php echo $az_data['so_telegram_link']; ?>" target="_blank" >                            <i class="ico-telegram"></i>
                        </a>
                        </li>
                        <?php } ?>

                        <?php if ($az_data['so_aparat']) { ?>
                        <li data-toggle="tooltip" data-placement="top" title="آپارات">
                            <a <?php if($az_data['site_schema']) {?>itemprop="sameAs"<?php } ?> aria-label="آپارات" href="<?php echo $az_data['so_aparat_link']; ?>" target="_blank">
                            <i class="ico-aparat"></i>
                            </a>
                        </li>
                        <?php } ?>

                        <?php if ($az_data['so_gap']) { ?>
                        <li data-toggle="tooltip" data-placement="top" title="گپ">
                            <a <?php if($az_data['site_schema']) {?>itemprop="sameAs"<?php } ?> aria-label="گپ" href="<?php echo $az_data['so_gap_link']; ?>" target="_blank">
                            <i class="ico-Gap"></i>
                            </a>
                        </li>
                        <?php } ?>

                        <?php if ($az_data['so_eitaa']) { ?>
                        <li data-toggle="tooltip" data-placement="top" title="ایتا">
                            <a <?php if($az_data['site_schema']) {?>itemprop="sameAs"<?php } ?> aria-label="ایتا" href="<?php echo $az_data['so_eitaa_link']; ?>" target="_blank">
                            <i class="ico-Eitaa"></i>
                            </a>
                        </li>
                        <?php } ?>

                        <?php if ($az_data['so_bisphone']) { ?>
                        <li data-toggle="tooltip" data-placement="top" title="بیسفون">
                            <a <?php if($az_data['site_schema']) {?>itemprop="sameAs"<?php } ?> aria-label="بیسفون" href="<?php echo $az_data['so_bisphone_link']; ?>" target="_blank">
                            <i class="ico-Bisphone"></i>
                            </a>
                        </li>
                        <?php } ?>

                        <?php if ($az_data['so_bale']) { ?>
                        <li data-toggle="tooltip" data-placement="top" title="بله">
                            <a <?php if($az_data['site_schema']) {?>itemprop="sameAs"<?php } ?> aria-label="بله" href="<?php echo $az_data['so_bale_link']; ?>" target="_blank">
                            <i class="ico-Bale"></i>
                            </a>
                        </li>
                        <?php } ?>

                        <?php if ($az_data['so_soroush']) { ?>
                        <li data-toggle="tooltip" data-placement="top" title="سروش">
                            <a <?php if($az_data['site_schema']) {?>itemprop="sameAs"<?php } ?> aria-label="سروش" href="<?php echo $az_data['so_soroush_link']; ?>" target="_blank">
                            <i class="ico-Soroush"></i>
                            </a>
                        </li>
                        <?php } ?>

                        <?php if ($az_data['so_igap']) { ?>
                        <li data-toggle="tooltip" data-placement="top" title="آی گپ">
                            <a <?php if($az_data['site_schema']) {?>itemprop="sameAs"<?php } ?> aria-label="آی گپ" href="<?php echo $az_data['so_igap_link']; ?>" target="_blank">
                            <i class="ico-iGap"></i>
                            </a>
                        </li>
                        <?php } ?>

                        <?php if ($az_data['so_pinterest']) { ?>
                        <li data-toggle="tooltip" data-placement="top" title="پینترست">
                            <a <?php if($az_data['site_schema']) {?>itemprop="sameAs"<?php } ?> aria-label="پینترست" href="<?php echo $az_data['so_pinterest_link']; ?>" target="_blank">
                            <i class="fab fa-pinterest"></i>
                            </a>
                        </li>
                        <?php } ?>
                    </ul>
                    <?php } ?>
                </div>
            </div>
        </div>
    </div>
</footer>

<?php if (!$az_data['ch_login_link']) { 
if(!is_user_logged_in()){
?>
<!-- Modal -->
<div class="modal fade" id="login" tabindex="-1" role="dialog" aria-labelledby="ورود به سایت">
    <div class="modal-dialog modal-sm" role="document">
        <div class="modal-content">
            <form name="login_form" id="login_form" action="" method="post">
                <div class="modal-header">
                    <button type="button" class="close" data-dismiss="modal" aria-label="Close"><i class="fas fa-times" aria-hidden="true"></i></button>
                    <span class="login-icon">
                        <i class="fas fa-user" aria-hidden="true"></i>
                    </span>
                </div>
                <div class="modal-body">
                    <span class="status"></span>
                    <div class="form-group">
                        <div class="input-group">
                            <span class="input-group-prepend">
                                <span class="input-group-text">
                                    <span class="fas fa-user"></span>
                                </span>
                            </span>
                            <input name="username" type="text" class="form-control" id="username" placeholder="نام کاربری" required="required" />
                        </div>
                    </div>
                    <div class="form-group">
                        <div class="input-group">
                            <span class="input-group-prepend">
                                <span class="input-group-text">
                                    <span class="fas fa-key"></span>
                                </span>
                            </span>
                            <input name="password" type="password" class="form-control" id="password" placeholder="کلمه عبور" required="required" />
                        </div>
                    </div>
                    <span class="lost-password">
                        <a href="<?php echo wp_lostpassword_url(); ?>" title="فراموشی رمزعبور">
                        فراموشی کلمه عبور؟ 
                        </a>
                    </span>
                    <?php if($az_data['recapcha_login']) { ?>
                    <div class="g-recaptcha" data-sitekey="<?php echo $az_data['site_key'];  ?>"></div>
                    <?php } ?>
                    <?php wp_nonce_field( 'ajax-login-nonce', 'security' ); ?>
                </div>
                <div class="modal-footer">
                    <button class="btn btn-blue plogin-btn" id="loginSubmit">
                        <span class="fas fa-user"></span>&nbsp;&nbsp;ورود به سایت
                    </button>
                </div>
            </form>
        </div>
    </div>
</div>
<!-- END Modal -->
<?php }} ?>

<?php if ($az_data['show_return_top']) { ?>
<div id="back-top" class="hidden-sm hidden-xs">
    <a href="#top"><span class="fas fa-chevron-up"></span></a>
</div>
<?php } ?>

<?php if ($az_data['show_cart_btn']) { ?>
    <?php if (az_woo()) {
        $cart_url = wc_get_cart_url(); ?>
        <div id="cart-btn" style="display: block;">
            <a href="<?php echo $cart_url; ?>">
                <span class="fas fa-shopping-cart shop-icon" data-toggle="tooltip" data-placement="right" title="سبد خرید"></span>
                <span class="header-cart edd-cart-quantity badge">
                <?php echo WC()->cart->get_cart_contents_count(); ?>
                </span>
            </a>
        </div>
    <?php } else {  ?>
        <div id="cart-btn" style="display: block;">
            <a href="<?php echo edd_get_checkout_uri(); ?>">
                <span class="fas fa-shopping-cart shop-icon" data-toggle="tooltip" data-placement="right" title="سبد خرید"></span>
                <span class="header-cart edd-cart-quantity badge">
                <?php echo edd_get_cart_quantity(); ?>
                </span>
            </a>
        </div>
    <?php } ?>
<?php } ?>
<?php 
global $az_data;
if(!empty($az_data['footer_codes'])){
    echo $az_data['footer_codes']."\n";
}?>
<?php wp_footer(); ?>
</body>
</html>