<?php
   /*
   Theme Designed By: S O R O U S H M A R K E T
   Email: info@soroushmarket.ir
   Demo Website: soroushmarket.ir
   Author Website: soroushmarket.ir
   */
   if( !current_user_can('administrator') ) {
   global $data;
    if ($data['show_under_page'] == 1) {
         get_template_part('under-page'); 
         die();
   }
   }
?>
<!doctype html>
<?php
global $data;
   $color = basename($data['custom_color']);
   $css_color = str_replace("png","css",$color);
   $theme_color = str_replace(".png","",$color); ?>
<html <?php language_attributes(); ?>>
   <head>
      <meta http-equiv="Content-Type" content="text/html; charset=<?php bloginfo( 'charset' ); ?>">
      <meta http-equiv="X-UA-Compatible" content="IE=edge">
      <meta name="viewport" content="width=device-width,initial-scale=1">
      <meta name="theme-color" content="<?php echo '#'.$theme_color; ?>" />
      <link rel="shortcut icon" href="<?php echo $data['site_favicon']; ?>" type="image/x-icon" />
      <?php if ( is_singular() ) wp_enqueue_script( 'comment-reply' ); ?>
      <link rel="alternate" type="appliction/rss+xml" href="<?php bloginfo('rss2_url'); ?>" title="<?php printf(__( 'آخرین مطالب %s', 'mytheme' ), esc_html( get_bloginfo('name'), 1 ) ); ?>" />
      <link rel="alternate" type="appliction/rss+xml" href="<?php bloginfo('comments_rss2_url'); ?>" title="<?php printf(__( 'آخرین نظرات %s', 'mytheme' ), esc_html( get_bloginfo('name'), 1 ) ); ?>" />
      <link rel="pingback" href="<?php bloginfo('pingback_url'); ?>" />
      <?php if($data['custom_css']!=''){ ?>
      <style type="text/css">
         <?php echo $data['custom_css']."\n"; ?>
      </style>
      <?php } ?>
      <?php echo $data['header_codes']."\n"; ?>
      <?php wp_head(); ?>
   </head>
   <body id="top" <?php body_class(); ?>>
      <div class="container-fluid head">
      <div class="row s-bar">
         <div class="container">
            <?php if ($data['show_contact'] == 1) { ?>
            <div class="col-lg-6 col-md-6 hidden-xs tel">
               <div class="top-tel">
                  <span class="fa fa-phone" aria-hidden="true"></span> <span class="top-val" id="site-tel"><?php echo $data['site_tel']; ?></span>
               </div>
               <div class="top-tel">
                  <span class="fa fa-at" aria-hidden="true"></span> <span class="top-val" id="site-email"><?php echo $data['site_email']; ?></span>
               </div>
            </div>
            <?php } else { ?>
            <div class="col-lg-6 col-md-6 hidden-xs"> <span class="date"><?php echo parsidate ('امروز: l، j F Y ') ; ?></span> </div>
            <?php } ?>
            <?php if ($data['show_user_btn'] == 1 && $data['show_mo_btn'] == 1 ) {
                  if (is_user_logged_in()) {
                     $user = wp_get_current_user();?>
               <div class="visible-xs mobtn">
                  <div class="dropdown">
                     <button class="btn btn-info dropdown-toggle user-btns btn-sm" type="button" data-toggle="dropdown">
                     <span class="fa fa-user"></span>
                     <span class="caret"></span>
                     </button>
                     <ul class="dropdown-menu user-menu mu-menu">
                        <li><a href="<?php echo esc_url( home_url() ); ?>/edit-profile"><span class="fa fa-user"></span>حساب کاربری</a></li>
                        <li><a href="<?php echo edd_get_checkout_uri(); ?>"><span class="fa fa-shopping-basket"></span>سبد خرید</a></li>
                        <li><a href="<?php echo esc_url( home_url() ); ?>/checkout/purchase-history/"><span class="fa fa-history"></span>تاریخچه سفارشات</a></li>
                        <li><a href="<?php echo wp_logout_url(home_url()); ?>"><span class="fa fa-sign-out"></span>خروج</a></li>
                     </ul>
                  </div>
                  </div>
                  <?php   } else { ?>
                  <div class="visible-xs user-btns mobtn"> 
                     <button class="btn btn-success btn-sm" data-toggle="modal" data-target="#login">
                     <span class="fa fa-user user-icon"></span>
                     <span class="hidden-sm hidden-xs">ورود</span>
                     </button>
                     <a href="<?php echo esc_url( home_url() ); ?>/register" title="جهت استفاده از تمامی امکانات سایت ثبت نام کنید" class="btn btn-info btn-sm">
                     <span class="fa fa-user-plus reg-icon"></span>
                     <span class="hidden-sm hidden-xs">ثبت نام</span>
                     </a>
                     </div>
                     <?php }  } ?>
                  <?php if ($data['show_user_btn'] == 1 && $data['show_mo_btn'] == 1) {
                     echo '<div class="col-xs-6 pull-left">';
                  }else{
                     echo '<div class="col-sm-6 col-xs-12 pull-left">';
                   }?>
               <ul class="list-inline mmenu">
                  <li class="li_one"><a href="<?php echo $data['mhead_one_link']; ?>" target="_self"><span class="fa <?php echo $data['mhead_one_icon']; ?> mhead_one" aria-hidden="true" data-toggle="tooltip" data-placement="bottom" title="<?php echo $data['mhead_one_text']; ?>"></span></a></li>
                  <li class="li_two"><a href="<?php echo $data['mhead_two_link']; ?>" target="_self"><span class="fa <?php echo $data['mhead_two_icon']; ?> mhead_two" aria-hidden="true" data-toggle="tooltip" data-placement="bottom" title="<?php echo $data['mhead_two_text']; ?>"></span></a></li>
                  <li class="li_three"><a href="<?php echo $data['mhead_three_link']; ?>" target="_self"><span class="fa <?php echo $data['mhead_three_icon']; ?> mhead_three" aria-hidden="true" data-toggle="tooltip" data-placement="bottom" title="<?php echo $data['mhead_three_text']; ?>"></span></a></li>
                  <li class="li_four"><a href="<?php echo $data['mhead_four_link']; ?>" target="_self"><span class="fa <?php echo $data['mhead_four_icon']; ?> mhead_four" aria-hidden="true" data-toggle="tooltip" data-placement="bottom" title="<?php echo $data['mhead_four_text']; ?>"></span></a></li>
               </ul>
            </div>
         </div>
      </div>
      <div class="row header">
         <div class="container">
            <div role="banner" class="col-lg-3 col-md-3 col-sm-3 col-xs-12 logo">
               <h1> <a href="<?php echo esc_url( home_url() ); ?>" title="<?php bloginfo( 'name' );?> | <?php bloginfo('description'); ?>" rel="home"> <img src="<?php global $data; echo $data['site_logo']; ?>" alt="<?php bloginfo( 'name' );?> | <?php bloginfo('description'); ?>" title="<?php bloginfo( 'name' );?> | <?php bloginfo('description'); ?>" class="img-logo"/><strong>
                  <?php bloginfo( 'name' );?>
                  |
                  <?php bloginfo( 'description' );?>
                  </strong></a>
               </h1>
            </div>
            <div class="col-lg-5 col-md-5 col-sm-5 col-xs-12 pull-left s-form">
               <form role="search" method="get" id="searchformh" action="<?php echo esc_url( home_url() ); ?>">
                  <div class="input-group">
                     <input type="text" value="" name="s" id="sh" class="form-control" placeholder="جستجوی فایل ها ...">
                     <span class="input-group-btn">
                     <input type="submit" id="searchsubmith" value="&nbsp;&nbsp;جستجو" class="btn btn-success btn-search btn-lg">
                     </span> 
                  </div>
                  <input type="hidden" name="post_type" value="download">
               </form>
            </div>
         </div>
      </div>
      <div class="row nav" id="nav-row">
         <div class="container">
            <nav class="navbar navbar-default">
               <div class="navbar-header">
                  <button class="navbar-toggle collapsed" data-toggle="collapse" data-target=".navbar-ex1-collapse" aria-expanded="false"> <span class="fa fa-bars"></span> </button>
                  <span class="navbar-brand"><a href="<?php echo esc_url( home_url() ); ?>"><span class="fa fa-home" aria-hidden="true"></span></a></span> 
               </div>
               <div style="float:right;">
                  <?php
                     wp_nav_menu( array(
                     'menu'                    => 'primary',
                     'theme_location'        => 'primary',
                     'depth'                  => 3,
                     'container'              => 'div',
                     'container_class'   => 'collapse navbar-collapse navbar-ex1-collapse',
                     'menu_class'            => 'nav navbar-nav',
                     'fallback_cb'      => 'wp_bootstrap_navwalker::fallback',
                     'walker'            => new wp_bootstrap_navwalker()
                     ));
                     ?>
               </div>
               <?php if ($data['show_user_btn'] == 1) {
                  if (is_user_logged_in()) {
                     $user = wp_get_current_user();?>
               <div class="hidden-xs" style="direction: rtl;margin-top:10px;float:left">
                  <div class="dropdown">
                     <button class="btn btn-info dropdown-toggle user-btn" type="button" data-toggle="dropdown">
                     <span class="fa fa-user"></span>
                     <span class="hidden-sm"><?php echo $user->display_name;?></span>
                     <span class="caret"></span>
                     </button>
                     <ul class="dropdown-menu user-menu u-menu">
                        <li><a href="<?php echo esc_url( home_url() ); ?>/edit-profile"><span class="fa fa-user"></span>حساب کاربری</a></li>
                        <li><a href="<?php echo edd_get_checkout_uri(); ?>"><span class="fa fa-shopping-basket"></span>سبد خرید</a></li>
                        <li><a href="<?php echo esc_url( home_url() ); ?>/checkout/purchase-history/"><span class="fa fa-history"></span>تاریخچه سفارشات</a></li>
                        <li><a href="<?php echo wp_logout_url(home_url()); ?>"><span class="fa fa-sign-out"></span>خروج</a></li>
                     </ul>
                  </div>
                  <?php   } else { ?>
                  <div class="hidden-xs user-btns"> 
                     <button class="btn btn-success" data-toggle="modal" data-target="#login">
                     <span class="fa fa-user user-icon"></span>
                     <span class="hidden-sm">ورود</span>
                     </button>
                     <a href="<?php echo esc_url( home_url() ); ?>/register" title="جهت استفاده از تمامی امکانات سایت ثبت نام کنید" class="btn btn-info">
                     <span class="fa fa-user-plus reg-icon"></span>
                     <span class="hidden-sm">ثبت نام</span>
                     </a>
                     <?php } ?>
                  </div>
                  <?php } ?>
            </nav>
            </div>
         </div>
      </div>
      <div class="container">
      <div class="row main">
      <?php if ($data['show_msg'] == 1) { ?>
      <div class="col-lg-12">
         <div class="alert <?php echo $data['msg_color'] ?><?php if ($data['user_close'] == 1) { ?> alert-dismissible<?php } ?> msg" role="alert"><span class="fa <?php echo $data['msg_icon']; ?>" aria-hidden="true"></span>&nbsp;&nbsp;<?php echo $data['site_msg']; ?>
            <?php if ($data['user_close'] == 1) { ?>
            <button type="button" class="close" data-dismiss="alert" aria-label="Close"><span aria-hidden="true">&times;</span></button>
         </div>
         <?php } ?>
      </div>
      <?php } ?>
      <?php if ($data['show_bread'] == 1 && !is_front_page()) { ?>
      <div class="col-lg-12">
         <?php echo breadcrumb(); ?>
      </div>
      <?php } ?>
      <?php if( is_front_page() && $wp_query->get( 'paged' ) < 2 ) :
         if ($data['show_slider'] == 1) { ?>
      <div class="col-lg-12 slide-con <?php if ($data['show_slider_mobile'] == 0) { echo 'hidden-xs'; } ?>">
         <?php
         $slides = $data['main_slider'];
          if(!empty($slides[1][url])){ ?>
         <div class="slider_container">
            <ul class="rslides" id="slider">
               <?php 
                    foreach ($slides as $slide) {
                     if(!empty($slide[url])){
                  echo '<li>
                          <a href="'.$slide['link'].'" title="'.$slide['title'].'"><img src="'.$slide['url'].'" alt="'.$slide['title'].'"></a>';
                          if ($slide['title'] != '') {
                          echo '<div class="caption hidden-xs">'.$slide['title'].'
                            <div class="desc">'.$slide['description'].'</div>
                          </div>';}
                        echo '</li>';
                  }}
                    ?>
            </ul>
         </div>
         <?php } else {echo 'لطفا ابتدا اسلایدی
          را از طریق بخش تنظیمات پوسته اضافه نمایید.';} ?>
      </div>
      <?php }
         endif; ?>