<?php 


/**
 * Use for the show the testimonials at home page and in testimonial page with shortcode
 * @param int $pageId default is null the id of a post
 * @param boolean $isCustomizer default is false if set to true it mean the output is set for the home page
 * @param int $i default null
 * @param boolean $showStaticVals default is false
 * @return string
 * @author Luzuk <support@luzuk.com>
 * */





/*services*/
function serviceShortCode($pageId = null, $isCustomizer = false, $i = null) {

  ob_start();

  $args = array('post_type' => 'our-service');
  if (!empty($pageId)) {
    $args['page_id'] = absint($pageId);
  }
  $args['posts_per_page'] = -1;
  $colCls = '';
    // if($isCustomizer == true){
  $cols = get_theme_mod('rg_service_npp_count',3);  
  //$services_page_icon1 = get_theme_mod('services_page_icon1'.$i);
  ++$cols;
  switch ($cols) {
   case 1:
   $colCls = 'col-md-12 col-sm-12';
   break;
   case 2: 
   $colCls = 'col-md-6 col-sm-6';
   break;
   case 3:
   case 5:
   case 6:
   case 9:
   $colCls = 'col-md-4 col-sm-6';
   break;
   case 4:
   case 7:
   case 8:
   case 10:
   case 11:
   case 12:
   $colCls = 'col-md-3 col-sm-6';
   break;
   default: 
   $colCls = 'col-md-3 col-sm-6';
   break;
 }
    // }
 $text = '';
 $query = new WP_Query($args);
 if ($query->have_posts()):
  $postN = 0;

  while ($query->have_posts()) : $query->the_post();
    $luzuk_image = wp_get_attachment_image_src(get_post_thumbnail_id(), 'total-service-thumb');
    $post = get_post();

    ?>

    <div class="<?php echo $colCls;?> pd-5 single-service">
      <div class="section-element section-element-blog">
        <div class="post uk-grid-margin bg-hovered uk-width-1-3@m uk-scrollspy-inview uk-animation-slide-bottom-small" style="">
          <?php
          if (has_post_thumbnail()) {
            $image_url = $luzuk_image[0];
          } else {
            $image_url = get_template_directory_uri() . '/images/about-right.jpg';
          }
          ?>   
          <div class="thumb_backound pr4 pl4 uk-transition-toggle uk-light uk-flex-bottom">
            <?php
                  if (has_post_thumbnail()) {
                      $image_url = $luzuk_image[0];
                  } else {
                      $image_url = get_template_directory_uri() . '/images/services.jpg';
                  }
              ?>                                                        
                  <img class="img-responsive" src="<?php echo esc_url($image_url); ?>" alt="<?php the_title(); ?>" />

            <div class="entry-hover"></div>
            <div class="uk-flex uk-flex-column">
              <h3 class="animeblogtitle">
                <a href="">
                 <?php the_title(); ?>
               </a>
             </h3>
             <p class="animeblogtext">
              <?php 
              if(has_excerpt()){
                echo get_the_excerpt();
              }else{
                echo lz_fitness_excerpt( get_the_content() , 75 );
              }
              ?>
            </p>

            <?php
            $servicesbutn_text = get_theme_mod('servicesbutn_text', 'Read more');
            ?>

            <?php if( get_theme_mod('services_button_display','show' ) == 'show') :
              ?>
              <a class="main-btn btn-1" href="<?php the_permalink(); ?>"> <?php echo $servicesbutn_text; ?> <i class="fa fa-long-arrow-right"></i></a>
            <?php endif ?>

          </div>
        </div>
      </div>
    </div><!-- end .section-element/blog -->
  </div>


  <?php
endwhile;
$text = ob_get_contents();
ob_clean();
endif;
wp_reset_postdata();
return $text;
}

/**
 * Use for the show the testimonials at home page and in testimonial page with shortcode
 * @param int $pageId default is null the id of a post
 * @param boolean $isCustomizer default is false if set to true it mean the output is set for the home page
 * @param int $i default null
 * @param boolean $showStaticVals default is false
 * @return string
 * @author Luzuk <support@luzuk.com>
 * */






    /**
     * Use for the show the testimonials at home page and in testimonial page with shortcode
     * @param int $pageId default is null the id of a post
     * @param boolean $isCustomizer default is false if set to true it mean the output is set for the home page
     * @param int $i default null
     * @param boolean $showStaticVals default is false
     * @return void
     * @author Luzuk <support@luzuk.com>
     * */
    

//testimonial new
    function testimonialShortCode($pageId = null, $isCustomizer = false, $i = null) {

      ob_start();

      $args = array('post_type' => 'our-testimonials');
      if (!empty($pageId)) {
        $args['page_id'] = absint($pageId);
      }
      $colCls = '';
    // if($isCustomizer == true){
      $cols = get_theme_mod('testimonials_npp_count', 2);
      $cols++;
      switch($cols){

      }
      $icons = array(1=>'heart', 2=>'star', 3=>'flash', 4=>'bell',5=>'heart', 6=>'star', 7=>'flash', 8=>'bell');     
    // }
      $text = '';
      $query = new WP_Query($args);
      if ($query->have_posts()):
        $postN = 0;

        while ($query->have_posts()) : $query->the_post();
          $lz_fitness_image = wp_get_attachment_image_src(get_post_thumbnail_id(), 'total-team-thumb');
          if ($isCustomizer === true) {
            $lz_fitness_test_designation = get_theme_mod('lz_fitness_test_designation' . $i);
          }
          $post = get_post();
            //designation
          $designation = get_post_meta($post->ID, 'designation', false);
          $lz_fitness_test_designation = !empty($designation[0]) ? $designation[0] : '';

          if (($postN % 3) == 0 && $isCustomizer == false) {
            ?>
            <!-- <div class="clearfix paddingBot20"></div> -->
     <!--  </div>
      <div class="row"> -->
        <?php
      }
      ++$postN;
      ?>
      <div class="item testimonial-inner">
        <div class="client-image">
          <i class="fa fa-quote-left"></i>
          <img src="<?php echo (!empty($lz_fitness_image[0])) ? $lz_fitness_image[0] : get_template_directory_uri() . '/images/team-thumb.png' ?>" class="img-responsive" alt="<?php the_title(); ?>" />
          <div class="clearfix"></div>
        </div> 
        <div class="testimonial-inner-content">
          <p>
           <?php
           if (has_excerpt()) {
            echo get_the_excerpt();
          } else {
            echo get_the_content();
          }
          ?>
        </p>
        <h6 class="client-name"><?php the_title(); ?></h6>
      </div> 
    </div>

    <?php
  endwhile;
  $text = ob_get_contents();
  ob_clean();
endif;
wp_reset_postdata();
return $text;
}

//pricing
function pricingShortcode() {
  ob_start();
  $cols = get_theme_mod('pricing_npp_count', 2);
  $cols++;
  switch ($cols) {
    case 1:
    $colCls = 'col-md-12 col-sm-12';
    break;
    case 2:
    case 4:
    $colCls = 'col-md-6 col-sm-6';
    break;
    case 3:
    case 5:
    case 6:
    $colCls = 'col-md-4 col-sm-6';
    break;
    default:
    $colCls = 'col-md-4 col-sm-6';
    break;
  }
  echo '<div id="price">';
  $showStatic = true;
  for ($i = 1; $i <= $cols; $i++) {

    if( get_theme_mod('Pricing_PlanNameColor'.$i,true) ) {
      $Pricing_PlanNameColor = 'color:'.esc_attr(get_theme_mod('Pricing_PlanNameColor'.$i)).';';
    }

    if( get_theme_mod('Pricing_ContetColor'.$i,true) ) {
      $Pricing_ContetColor = 'color:'.esc_attr(get_theme_mod('Pricing_ContetColor'.$i)).';';
    }

    if( get_theme_mod('Pricing_ListIconColor'.$i,true) ) {
      $Pricing_ListIconColor = 'color:'.esc_attr(get_theme_mod('Pricing_ListIconColor'.$i)).';';
    }

    if( get_theme_mod('Pricing_PriceNdPlanTypeTextColor'.$i,true) ) {
      $Pricing_PriceNdPlanTypeTextColor = 'color:'.esc_attr(get_theme_mod('Pricing_PriceNdPlanTypeTextColor'.$i)).';';
    }

    if( get_theme_mod('Pricing_PlanTBgssColor'.$i,true) ) {
      $Pricing_PlanTBgssColor = 'background-color:'.esc_attr(get_theme_mod('Pricing_PlanTBgssColor'.$i)).';';
    }

    if( get_theme_mod('Pricing_PriceBoxBgssColor'.$i,true) ) {
      $Pricing_PriceBoxBgssColor = 'background-color:'.esc_attr(get_theme_mod('Pricing_PriceBoxBgssColor'.$i)).';';
    }


    if( get_theme_mod('Pricing_Bubble1Color'.$i,true) ) {
      $Pricing_Bubble1Color = 'background-color:'.esc_attr(get_theme_mod('Pricing_Bubble1Color'.$i)).';';
    }
    if( get_theme_mod('Pricing_Bubble2Color'.$i,true) ) {
      $Pricing_Bubble2Color = 'background-color:'.esc_attr(get_theme_mod('Pricing_Bubble2Color'.$i)).';';
    }

    if( get_theme_mod('Pricing_Bubble3Color'.$i,true) ) {
      $Pricing_Bubble3Color = 'background-color:'.esc_attr(get_theme_mod('Pricing_Bubble3Color'.$i)).';';
    }
    if( get_theme_mod('Pricing_Bubble4Color'.$i,true) ) {
      $Pricing_Bubble4Color = 'background-color:'.esc_attr(get_theme_mod('Pricing_Bubble4Color'.$i)).';';
    }

    $PlanPageId = get_theme_mod('pricing_plan_page_' . $i);
    $planTitle  = get_theme_mod('pricing_plan_name_' . $i, 'Basic');
    $planstart  = get_theme_mod('pricing_plan_start_' . $i, 'Month');
    $planunit  = get_theme_mod('pricing_plan_unit_' . $i,'$');
    $planPrice  = get_theme_mod('pricing_plan_price_' . $i,'3.99');
    $planContent= get_theme_mod('pricing_plan_content_' . $i, '<ul><li><i class="fa fa-check"></i>Aenean tempus ac urna</li><li><i class="fa fa-check"></i>Iaculis molestie scelerisque</li><li><i class="fa fa-check"></i>Tristique magna et</li><li><i class="fa fa-check"></i>Consectetur adipiscing elit</li>  <li><i class="fa fa-times"></i>Lorem ipsum dolor sit amet</li><li><i class="fa fa-times"></i>Morbi non ante sagittis</li></ul>');

    $link = get_theme_mod('pricing_plan_url'.$i);
    $url = get_theme_mod('pricing_plan_url_'.$i, '');

    if ($PlanPageId || $planTitle || $planstart || $planunit || $planPrice || $planContent || $url) {
      $showStatic = false;
      ?>
      <div class="<?php echo $colCls; ?> single-pricing-bx">
        <?php if ($planunit || $planPrice || $planstart ) { ?>

         <div class="package-amount" style="<?php echo esc_attr($Pricing_PriceNdPlanTypeTextColor); ?> <?php echo esc_attr($Pricing_PlanTBgssColor); ?>">
          <?php echo ($planunit); ?> <?php echo ($planPrice); ?> / <?php echo ($planstart); ?>
        </div>
      <?php }?>
      <div class="single-price-table" style="<?php echo esc_attr($Pricing_PriceBoxBgssColor); ?>">
        <div class="price-design-elemnts one" style="<?php echo esc_attr($Pricing_Bubble1Color); ?>"></div><!-- ./elemnts one -->
        <div class="price-design-elemnts two" style="<?php echo esc_attr($Pricing_Bubble2Color); ?>"></div><!-- ./elemnts two -->
        <div class="price-design-elemnts three" style="<?php echo esc_attr($Pricing_Bubble3Color); ?>"></div><!-- ./elemnts three -->
        <div class="price-design-elemnts four" style="<?php echo esc_attr($Pricing_Bubble4Color); ?>"></div><!-- ./elemnts four -->

        <div class="price-header">
          <span class="package-title" style="<?php echo esc_attr($Pricing_PlanNameColor); ?>">
            <?php echo ($planTitle); ?>

          </span>
        </div><!-- ./ price header -->

        <div class="price-body" style="<?php echo esc_attr($Pricing_ContetColor); ?>">
          <ul>
           <?php echo nl2br($planContent); ?>
         </ul>
       </div><!-- ./ price body -->

       <div class="price-footer">
        <?php
        $pricing_page_id = get_theme_mod('pricing_page');
        $pricing_page_button_title = get_theme_mod('pricing_page_button_title_'.$i, 'Shop Now');
        ?>
        <?php if($pricing_page_button_title){ ?>
          <div class="ht-princing-link">

            <a class="main-btn btn-1" href="<?php echo esc_url(!empty($url)?$url:'');?>"> <?php echo $pricing_page_button_title ?> <i class="fa fa-long-arrow-right"></i></a>

          </div>
        <?php } ?>
      </div><!-- ./price footer -->
    </div>
  </div>
  <?php
}
}
if ($showStatic === true) {
  for ($i = 1; $i <= $cols; $i++) {
    $link = get_theme_mod('pricing_plan_url'.$i);
    $url = get_theme_mod('pricing_plan_url_'.$i, '#');

    ?>
    <div class="<?php echo $colCls; ?> single-pricing-bx">
      <div class="package-amount">$3.99/ Month</div>
      <div class="single-price-table">
       <div class="price-design-elemnts one"></div><!-- ./elemnts one -->
       <div class="price-design-elemnts two"></div><!-- ./elemnts two -->
       <div class="price-design-elemnts three"></div><!-- ./elemnts three -->
       <div class="price-design-elemnts four"></div><!-- ./elemnts four -->
       <div class="price-header">
        <span class="package-title">Basic</span>
      </div><!-- ./ price header -->
      <div class="price-body">
        <ul><li><i class="fa fa-check"></i>Aenean tempus ac urna</li><li><i class="fa fa-check"></i>Iaculis molestie scelerisque</li><li><i class="fa fa-check"></i>Tristique magna et</li><li><i class="fa fa-check"></i>Consectetur adipiscing elit</li>  <li><i class="fa fa-times"></i>Lorem ipsum dolor sit amet</li><li><i class="fa fa-times"></i>Morbi non ante sagittis</li></ul>
      </div><!-- ./ price body -->
      <div class="price-footer">
        <div class="ht-princing-link">
          <a class="pribtn pricingbtn" href="<?php echo esc_url(!empty($url)?$url:'#');?>"><?php echo $pricing_page_button_title; ?>
        </a>
      </div>
    </div><!-- ./price footer -->

  </div>


</div>
<?php
}
echo '<div class="clearfix"></div>';
echo '</div>';
}

$pricingHtml = ob_get_contents();
        // echo $pricingHtml;
ob_flush();
ob_clean();
}

