<?php
/* 
* Theme: PREMIUMPRESS CORE FRAMEWORK FILE
* Url: www.premiumpress.com
* Author: Mark Fail
*
* THIS FILE WILL BE UPDATED WITH EVERY UPDATE
* IF YOU WANT TO MODIFY THIS FILE, CREATE A CHILD THEME
*
* http://codex.wordpress.org/Child_Themes
*/
if (!defined('THEME_VERSION')) {	header('HTTP/1.0 403 Forbidden'); exit; }

global $CORE, $settings, $userdata;

if(isset($settings['pricing_data'])){

    $currentKey = 0;
 
    if($userdata->ID){
        $mymem 		= $CORE->USER("get_user_membership", $userdata->ID);
        if(isset($mymem['date_expires'])){			
            $memExpires = $CORE->date_timediff($mymem['date_expires'],'');			
            if(isset($mymem["key"])){
                $currentKey = $mymem["key"];
            }
        }
    }
 
$pricing_data = $settings['pricing_data'];
 
///////////////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////////
if(!empty($pricing_data)){
?>
<div class="<?php if(!isset($GLOBALS['flag-upgrade-memberships'])){ ?>show-mobile<?php } ?>">
<div>
 
<?php 
 $i=1; foreach($pricing_data as $pak){ ?>
 <div class="p-3 pb-1">
<div class="row">
 <div class="col-12 col-md-8">
 
 <p><strong><?php echo $pak['title']; ?></strong></p>
 
 <?php if(isset($pak['desc'])){ ?>
 <p class="mb-0"><?php echo $pak['desc']; ?></p>
 <?php } ?>
  
 </div>
 <div class="col-12 col-md-4 pt-2">
  <?php if($currentKey !=0 && $currentKey == $pak['id']){ ?>
  <a data-ppt-btn class=" btn-warning btn-block" href="#"><?php echo __("Current Plan","premiumpress"); ?></a>
  <?php }else{ ?>
  <a data-ppt-btn class=" btn-primary btn-block" <?php echo $pak['button']; ?>><?php echo __("Select","premiumpress"); ?></a>
  <?php } ?>
  
 
  <div class="text-center mt-2">
  <span class="<?php if(is_numeric($pak['price']) && $pak['price'] != "0"){ echo $CORE->GEO("price_formatting",array()); } ?>"><?php if($pak['price'] == 0){ echo $pak['price_text']; }else{  echo $pak['price']; } ?></span>
  </div>
   
  
 </div>

 <?php if(isset($pak['features']) && is_array($pak['features']) && !empty($pak['features']) ){ ?>
 <div class="scol-12 small my-3">
<?php foreach($pak['features'] as $f){ ?>
<div><i class="fa <?php if($f['value'] == "1"){?>fa-check<?php }else{ ?>fa-times<?php } ?> mx-2"></i> <?php echo $f['name']; ?></div>
<?php } ?>
</div>
<?php } ?>

<div class="col-12"><hr /></div> 
</div>
</div>
 <?php } ?> 
 </div> 
</div>
 

<?php
}

}
?>