<?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 $settings, $CORE;

///////////////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////////

 $settings = array(
  
  "title" => __("Search Filters","premiumpress"), 
  "desc" => __("Setup your website search filters.","premiumpress"),
 
  "doclink" => "https://www.premiumpress.com/doc/maps/",
  
  "video" => "",
  );
   _ppt_template('framework/admin/_form-wrap-top' ); 

///////////////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////////


$search_toggle = _ppt(array('design', 'search_toggle'));  



 ///////////////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////////

?>

<style>
#overview-box, #a-box, #d-box,  #ip-box, #h-box {
	display:none;
}
</style>

  

<div class="card" >

<div class="card-body">

 
<label><?php echo __("Search Filters","premiumpress"); ?></label>
<div class="opacity-5 fs-sm mb-2"><?php echo __("Choose the filters you want to be displayed on the search page.","premiumpress"); ?></div>
 
<div class="row no-gutters px-0 mt-2 bg-light rounded p-3 pt-4">
 
<?php
 
foreach(ppt_theme_main_filters() as $k => $f ){ 

$filter = $f['key'];

if( in_array($search_toggle,array("inline")) && substr( $f['key'] ,0,3) != "tax" ){
  continue;
}

switch(strtolower(THEME_KEY)){
  case "es":{

    if( $filter == "tax_store"){

      $f['name'] = __("Agencies","premiumpress"); 
    }

  } break;
}
 
?>


<div class="col-md-3">

<label class="custom-control custom-checkbox">
        
        <input type="checkbox" class="custom-control-input" <?php if( in_array(_ppt(array("searchfilter",$filter)),array("","1"))){ ?>checked=checked<?php } ?> onchange="updateSearchCheck('filter_<?php echo $filter; ?>');"  value="" />
           
        <span class="custom-control-label"> <?php echo $f['name']; ?>
        
        
<?php if(isset($f['info'])){ ?>
        <div class="badge_tooltip text-center float-right mr-3" data-direction="top">
    <div class="badge_tooltip__initiator"> 
   <i class="fal fa fa-info-circle" style="color:#000000"></i></div>
    <div class="badge_tooltip__item"><?php echo $f['info']; ?> </div>
  </div>
  <?php } ?>
        
        
        </span>
</label>

</div>

<input type="hidden" class="stopclean" id="filter_<?php echo $filter; ?>" name="admin_values[searchfilter][<?php echo $filter; ?>]" value="<?php echo _ppt(array("searchfilter",$filter)); ?>">

<script>
<?php if( _ppt(array("searchfilter",$filter)) != 1){ ?>
jQuery(document).ready(function(){ 
jQuery(".orderby-<?php echo $filter; ?>").hide();
});
<?php } ?>
</script>

<?php } ?>

 
 
</div>

 
<script>
 

function updateSearchCheck(div){
 
var hiddenField = jQuery('#'+div), val = hiddenField.val();

hiddenField.val(val === "1" ? "0" : "1");

}

</script>

<?php
 
 
 
///////////////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////////
  
$search_order = _ppt('search_order');
 
 
?>
 
<label class="mt-3 opacity-5"><?php echo __("Display Order","premiumpress"); ?></label>
<div class="search_order mt-2 p-2 bg-light position-relative" style="border:1px dashed #efefef;">
<ol class="row no-gutters px-0 pb-0">
 
<?php
foreach(ppt_theme_main_filters() as $k => $f ){ 
 
 
	$filter = $f['key'];
	$title = $f['name'];

 

  if( in_array($search_toggle,array("inline")) && substr( $f['key'] ,0,3) != "tax" ){
    continue;
  }
	
	if( in_array(_ppt(array("searchfilter",$filter)),array("","1"))){ 
	
	}else{
	continue;
	}
		
?>
<span class="btn btn-system btn-sm mr-2 mt-2 drag orderby-<?php echo $filter; ?>" data-wid="<?php echo $filter; ?>">
<span class="grab"><i class="fa fa-expand-arrows-alt opacity-5 tiny"></i> <?php echo $title; ?></span>

<input type="hidden" class="stopclean"  name="admin_values[search_order][<?php echo $filter; ?>]" value="<?php echo _ppt(array("search_order",$filter)); ?>">


</span>
<?php } ?> 
</ol> 
</div>
<script>
jQuery(document).ready(function(){ 

 	jQuery('.search_order ol').sortable({
			connectWith: ".drag",
			handle: ".grab",
			placeholder: "panel-placeholder",
			
			stop: function( ) { 
				
				searchOrder();
			
			},start: function(event, ui){
			
			var classes = ui.item.attr('class').split(/\s+/);
			for(var x=0; x<classes.length;x++){   
				if (classes[x].indexOf("col")>-1){
				ui.placeholder.addClass(classes[x]);
			  }
			}
			  
			 ui.placeholder.css({      
			  width: ui.item.innerWidth() - 30 + 1,
			  height: ui.item.innerHeight() - 15 + 1,     
			  padding: ui.item.css("padding"),
			  marginTop: 0
			});       
		  }
		}); 
		
		
		jQuery(".search_order .btn").show();
		
});	
function searchOrder(){ 
	 
	var orderdata = "";
	jQuery('.search_order .btn[data-wid]').each(function(i, obj) {
	  
		orderdata = orderdata +  jQuery(this).data('wid')+',';
	
	});
	  	 
	jQuery.ajax({
			type: "POST",
			url: ajax_site_url,			
			data: {
				admin_action: "ajax_search_filter_order",		  
				data: orderdata, 
						 
			},
			success: function(response) {						 
				
			},	 
	});
	 
}
 

</script>
<style>
.panel-placeholder { background:#fff; border: 1px dotted black; padding:15px; height: 50px; margin: 15px; background:#fefefe;   }

</style>
<?php 
 

///////////////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////////
 /*
?>
<hr />
<label><?php echo __("Sort By","premiumpress"); ?></label>

<div class="row no-gutters px-0 mt-2">
<?php  

 
foreach(ppt_theme_orderby_filters() as $k => $f ){ ?>
        <div class="col-md-3">
        <label class="custom-control custom-checkbox"> 
        
        <input type="checkbox" 
        value="1" 
        class="custom-control-input" 
        id="searchorderby_<?php echo $k; ?>check" 
        onchange="CheckBoxSel('#searchorderby_<?php echo $k; ?>');"
         
		<?php if( in_array(_ppt(array('searchorderby', $k)), array("","1")) ){ ?>checked=checked<?php } ?>> 
        
          <input type="hidden" name="admin_values[searchorderby][<?php echo $k; ?>]" id="searchorderby_<?php echo $k; ?>add" value="<?php if( in_array(_ppt(array('searchorderby', $k)), array("","1")) ){ echo 1; }else{ echo 0; } ?>"> 
       
      	<span class="custom-control-label"><?php echo $f['name']; ?></span>
        </label>
        </div>
<?php  } ?>

</div>

<?php
*/

///////////////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////////

$showonly = ppt_theme_checkbox_filters();

if(in_array($search_toggle,array("inline"))){
  $showonly = array();
}

if(!empty($showonly)){
?>
<hr />
<label><?php echo __("Toggle Filters","premiumpress"); ?></label>
<div class="opacity-5 fs-sm mb-4"><?php echo __("Choose which toggle boxes to display.","premiumpress"); ?></div>

<div class="row no-gutters px-0 mt-2">
<?php foreach($showonly as $k => $f ){ ?>
        <div class="col-md-3">
        <label class="custom-control custom-checkbox"> 
        
        <input type="checkbox" 
        value="1" 
        class="custom-control-input" 
        id="searchcheckbox_<?php echo $k; ?>check" 
        onchange="CheckBoxSel('#searchcheckbox_<?php echo $k; ?>');"
         
		<?php if( $k == "hideall" && in_array(_ppt(array('searchcheckbox', $k)), array("")) ){ }elseif( in_array(_ppt(array('searchcheckbox', $k)), array("","1")) ){ ?>checked=checked<?php } ?>> 
        
          <input type="hidden" name="admin_values[searchcheckbox][<?php echo $k; ?>]" id="searchcheckbox_<?php echo $k; ?>add" value="<?php if( in_array(_ppt(array('searchcheckbox', $k)), array("","1")) ){ echo 1; }else{ echo 0; } ?>"> 
       
      	<span class="custom-control-label"><?php echo $f['name']; ?></span>
        </label>
        </div>
<?php  } ?>

</div>

<hr />
 
<div class="row no-guttersx px-0 mt-2">   
<?php 


$filters = array(

	1 => array("key" => "hidetogglebar", "name" =>  __("Hide Entire Togglebar","premiumpress") ),
   
	
);

foreach($filters as $k => $f ){ ?>
        <div class="col-md-6">
        <label class="custom-control custom-checkbox"> 
        
        <input type="checkbox" 
        value="1" 
        class="custom-control-input" 
        id="searchcustom_<?php echo $f['key']; ?>check" 
        onchange="CheckBoxSel('#searchcustom_<?php echo $f['key']; ?>');"
         
		<?php if( _ppt(array('search', $f['key'])) == 1){ ?>checked=checked<?php } ?>> 
        
          <input type="hidden" name="admin_values[search][<?php echo $f['key']; ?>]" id="searchcustom_<?php echo $f['key']; ?>add" value="<?php if( _ppt(array('search', $f['key'])) == 1){ echo 1; }else{ echo 0; } ?>"> 
       
      	<span class="custom-control-label"><?php echo $f['name']; ?></span>
        </label>
        </div>
<?php  } ?>
</div>
<?php  } ?>



<?php /*

$lay = _ppt(array('design', 'search_filters')); 

if(in_array(_ppt(array('design', 'search_layout')),array("sidebar"))){
  
  $vk = array(
    3 => __("Sidebar","premiumpress"),
    4 => __("Above Results","premiumpress"), 
  ); 


}else{  

  $vk = array(
    0 => __("Hide","premiumpress"),
    1 => __("Big","premiumpress"),
    2 => __("Toggle Button","premiumpress"), 
  ); 

}
    
    ?>
<hr>

<label><?php echo __("Filter Display","premiumpress"); ?></label>

<div class="opacity-5 fs-sm mb-2"><?php echo __("Choose the design for your filter boxes.","premiumpress"); ?></div>

<div class="small">
<?php foreach($vk  as $k => $l){ ?>

<span class="mr-2" style="font-weight: 600 !important;"><input <?php if($k == $lay){ ?> checked=checked <?php } ?> type="radio" name="admin_values[design][search_filters]" value="<?php echo $k; ?>" class="mr-2"><?php echo $l; ?></span>
  
<?php } ?>
</div>
 

 
<?php */ /************************** */ ?>


<?php if( in_array(THEME_KEY, array("cp")) ){ ?>

 <input type="hidden" name="admin_values[searchcustom][with_images]" value="0" />
 
<?php }else{ ?>  
<hr />
<label><?php echo __("Hidden Filters","premiumpress"); ?></label>
<div class="row no-guttersx px-0 mt-2">
    
<?php 


$filters = array(

	1 => array("key" => "with_images", "name" => str_replace("%s", strtolower(__($CORE->LAYOUT("captions","2"),"premiumpress")), __("Only show %s with images","premiumpress")) ),
	2 => array("key" => "login_filters", "name" =>  __("Only members can use search filters.","premiumpress") ),
 
	
);

if( in_array(THEME_KEY, array("vt")) ){
  unset($filters[1]);
}

foreach($filters as $k => $f ){ ?>
        <div class="col-md-6">
        <label class="custom-control custom-checkbox"> 
        
        <input type="checkbox" 
        value="1" 
        class="custom-control-input" 
        id="searchcustom_<?php echo $f['key']; ?>check" 
        onchange="CheckBoxSel('#searchcustom_<?php echo $f['key']; ?>');"
         
		<?php if( _ppt(array('searchcustom', $f['key'])) == 1){ ?>checked=checked<?php } ?>> 
        
          <input type="hidden" name="admin_values[searchcustom][<?php echo $f['key']; ?>]" id="searchcustom_<?php echo $f['key']; ?>add" value="<?php if( (_ppt(array('searchcustom', $f['key'])) == "" && $k < 4 ) || _ppt(array('searchcustom', $f['key'])) == 1){ echo 1; }else{ echo 0; } ?>"> 
       
      	<span class="custom-control-label"><?php echo $f['name']; ?></span>
        </label>
        </div>
<?php  } ?>
</div>

<?php } ?>


</div>

   <div class="card-footer text-center py-4">
      <button type="submit" data-ppt-btn class="btn-primary"><?php echo __("Save Settings","premiumpress"); ?></button>
    </div>


</div>
<?php _ppt_template('framework/admin/_form-wrap-bottom' ); ?>


<?php

///////////////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////////

if(in_array(_ppt(array('design', 'search_layout')),array("sidebar"))  ){
 
  $settings = array(
  
  "title" => __("Sidebar Widgets","premiumpress"), 
  "desc" => __("Widgets are displayed in the sidebar.","premiumpress"), 

  
  );
  
_ppt_template('framework/admin/_form-wrap-top' ); ?>
   
<div class="card ">

<div class="p-3">



    
<?php 





$spages = array(

  "search" => array(

    "title" => __("Search Page Widgets","premiumpress"),
    "desc" => __("Choose which widgets to display on the main search page.","premiumpress"),

  ),

  "store" => array(

    "title" => __("Store Page Widgets","premiumpress"),
    "desc" => __("Choose which widgets to display on this page.","premiumpress"),

  ), 

);

if(defined('THEME_KEY') && in_array(THEME_KEY, array("es"))){ 
  $spages['store']['title'] = __("Agency Page Widgets","premiumpress"); 
}


if( !in_array(THEME_KEY, array("jb","es","cp","so","cb","cm")) ){
  unset($spages['store']);
}


foreach($spages as $pageKey => $page){
?>

<label><?php echo $page['title']; ?></label>
<div class="opacity-5 fs-sm mb-4"><?php echo $page['desc']; ?></div>

<div class="row no-guttersx px-0 mt-2">
 

<?php 

$widgets = ppt_theme_main_widgets($pageKey); 

$search_order = _ppt('searchwidgets_'.$pageKey.'_order');

 
if(!is_array($search_order) ){

  // SETUP SOME DEFAULTS?? 
   
  
 
}elseif(is_array($search_order) && !empty($search_order)){
	
	$newFilters = array();
	foreach($widgets as $k => $f){
		$newFilters[$k] = $f;
		$newFilters[$k]['order'] = 100;
	}
	
	$i=1;
	foreach($search_order as $kg => $gg){
		if(isset($newFilters[$kg])){
			$newFilters[$kg]['order'] = $i;
			$i++;
		}
	}  

  $order = array_column($newFilters, 'order'); 
	array_multisort( $order, SORT_ASC, $newFilters); 
	
  $widgets = $newFilters;

}

foreach($widgets as $k => $f ){ ?>
        <div class="col-md-4">
        <label class="custom-control custom-checkbox"> 
        
        <input type="checkbox" 
        value="1" 
        class="custom-control-input" 
        id="searchwidgets_<?php echo $pageKey; ?>_<?php echo $f['key']; ?>check" 
        onchange="CheckBoxSel('#searchwidgets_<?php echo $pageKey; ?>_<?php echo $f['key']; ?>');"
         
		<?php if( _ppt(array('searchwidgets', $pageKey."_".$f['key'])) == 1){ ?>checked=checked<?php } ?>> 
        
          <input type="hidden" name="admin_values[searchwidgets][<?php echo $pageKey."_".$f['key']; ?>]" id="searchwidgets_<?php echo $pageKey."_".$f['key']; ?>add" value="<?php if( (_ppt(array('searchwidgets', $pageKey."_".$f['key'])) == "" && $k < 4 ) || _ppt(array('searchwidgets', $pageKey."_".$f['key'])) == 1){ echo 1; }else{ echo 0; } ?>"> 
       
      	<span class="custom-control-label"><?php echo $f['name']; ?></span>
        </label>
        </div>
<?php  } ?>
</div>

 
<label class="mt-3 opacity-5"><?php echo __("Display Order","premiumpress"); ?></label>
<div class="search_order mt-2 p-2 bg-light position-relative" style="border:1px dashed #efefef;">
<ol class="row no-gutters px-0 pb-0">
 
<?php





foreach($widgets as $k => $f ){ 
 
	$filter = $k;
	$title = $f['name'];
  
  if( _ppt(array('searchwidgets', $pageKey."_".$k)) != 1){
      continue;
  }

		
?>
<span class="btn btn-system btn-sm mr-2 mt-2 drag orderby-<?php echo $filter; ?>" data-wid="<?php echo $filter; ?>">
<span class="grab"><i class="fa fa-expand-arrows-alt opacity-5 tiny"></i> <?php echo $title; ?></span>

<input type="hidden" class="stopclean"  name="admin_values[searchwidgets_<?php echo $pageKey; ?>_order][<?php echo $filter; ?>]" value="<?php echo _ppt(array("searchwidgets_".$pageKey."_order", $filter)); ?>">


</span>
<?php } ?> 
</ol> 
</div>
 
<hr>

<?php } // next page ?>

</div>

   <div class="card-footer text-center py-4">
      <button type="submit" data-ppt-btn class="btn-primary"><?php echo __("Save Settings","premiumpress"); ?></button>
    </div>


</div>
<?php _ppt_template('framework/admin/_form-wrap-bottom' ); ?>


<?php

}

///////////////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////////


 
  $settings = array(
  
  "title" => __("Page Layout","premiumpress"), 
  "desc" => "", 

  
  );
  
_ppt_template('framework/admin/_form-wrap-top' ); ?>
   
<div class="card"><div class="p-3"><div class="row">



<?php /************************** */ $lay = _ppt(array('design', 'search_layout')); ?>

<div class="col-md-12"><label><?php echo __("Default Layout","premiumpress"); ?></label></div>
<div class="col-md-6">
<div class="opacity-5 fs-sm mb-2"><?php echo __("Full Page","premiumpress"); ?></div>
<img src="https://premiumpress1063.b-cdn.net/_demoimagesv10/demo/blocks/search_layout1.jpg" class="img-fluid <?php if(in_array($lay,array("","full"))){ echo "active-blue"; } ?>">
<div class="text-center"><input type="radio" name="admin_values[design][search_layout]" value="full" <?php if(in_array($lay,array("","full"))){ echo "checked"; } ?>></div>
</div>

<div class="col-md-6">
<div class="opacity-5 fs-sm mb-2"><?php echo __("Sidebar","premiumpress"); ?></div>
<img src="https://premiumpress1063.b-cdn.net/_demoimagesv10/demo/blocks/search_layout2.jpg" class="img-fluid <?php if(in_array($lay,array("sidebar"))){ echo "active-blue"; } ?>">
<div class="text-center"><input type="radio" name="admin_values[design][search_layout]" value="sidebar" <?php if(in_array($lay,array("sidebar"))){ echo "checked"; } ?>></div>
</div>

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

<?php /************************** */  ?>
<?php if(!in_array(THEME_KEY,array("cp","jb")) && !in_array(_ppt(array('design', 'search_layout')),array("sidebar"))){ $lay = $search_toggle;  ?>

   

<div class="col-md-12"><label><?php echo __("Filters Layout","premiumpress"); ?></label></div>
<div class="col-md-6">
<div class="opacity-5 fs-sm mb-2"><?php echo __("Boxed","premiumpress"); ?></div>
<img src="https://premiumpress1063.b-cdn.net/_demoimagesv10/demo/blocks/tg1.jpg" class="img-fluid <?php if(in_array($lay,array("","boxed"))){ echo "active-blue"; } ?>">
<div class="text-center"><input type="radio" name="admin_values[design][search_toggle]" value="boxed" <?php if(in_array($lay,array("","boxed"))){ echo "checked"; } ?>></div>
</div>

<div class="col-md-6">
<div class="opacity-5 fs-sm mb-2"><?php echo __("Inline","premiumpress"); ?></div>
<img src="https://premiumpress1063.b-cdn.net/_demoimagesv10/demo/blocks/tg2.jpg" class="img-fluid <?php if(in_array($lay,array("inline"))){ echo "active-blue"; } ?>">
<div class="text-center"><input type="radio" name="admin_values[design][search_toggle]" value="inline" <?php if(in_array($lay,array("inline"))){ echo "checked"; } ?>></div>
</div>

<div class="col-md-12"><hr /> </div>
<?php /************************** */ }else{ ?>
  <input type="hidden" name="admin_values[design][search_toggle]" value="boxed">
  
<?php } ?>


<?php if(in_array(_ppt(array('design', 'search_layout')),array("sidebar"))){  $lay = _ppt(array('searchliststyle', 'cardlayout')); ?>


  <div class="col-md-12"><label><?php echo __("Filter box design","premiumpress"); ?></label></div>
<div class="col-md-6">
<div class="opacity-5 fs-sm mb-2"><?php echo __("Single Box","premiumpress"); ?></div>
<img src="https://premiumpress1063.b-cdn.net/_demoimagesv10/demo/blocks/filters1.jpg" class="img-fluid <?php if(in_array($lay,array("","1"))){ echo "active-blue"; } ?>">
<div class="text-center"><input type="radio" name="admin_values[searchliststyle][cardlayout]" value="1" <?php if(in_array($lay,array("","1"))){ echo "checked"; } ?>></div>
</div>

<div class="col-md-6">
<div class="opacity-5 fs-sm mb-2"><?php echo __("Separated Box","premiumpress"); ?></div>
<img src="https://premiumpress1063.b-cdn.net/_demoimagesv10/demo/blocks/filters2.jpg" class="img-fluid <?php if(in_array($lay,array("2"))){ echo "active-blue"; } ?>">
<div class="text-center"><input type="radio" name="admin_values[searchliststyle][cardlayout]" value="2" <?php if(in_array($lay,array("2"))){ echo "checked"; } ?>></div>
</div>
 

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


<?php if(in_array(_ppt(array('design', 'search_layout')),array("sidebar"))){  $lay = _ppt(array('design', 'searchcolumns')); ?>


<div class="col-md-12"><label><?php echo __("Sidebar Layout Size","premiumpress"); ?></label></div>
<div class="col-md-6">
<div class="opacity-5 fs-sm mb-2"><?php echo __("Two Columns","premiumpress"); ?></div>
<img src="https://premiumpress1063.b-cdn.net/_demoimagesv10/demo/blocks/filters1.jpg" class="img-fluid <?php if(in_array($lay,array("","1"))){ echo "active-blue"; } ?>">
<div class="text-center"><input type="radio" name="admin_values[design][searchcolumns]" value="1" <?php if(in_array($lay,array("","1"))){ echo "checked"; } ?>></div>
</div>

<div class="col-md-6">
<div class="opacity-5 fs-sm mb-2"><?php echo __("Three Columns","premiumpress"); ?></div>
<img src="https://premiumpress1063.b-cdn.net/_demoimagesv10/demo/blocks/search_sidebar1.jpg" class="img-fluid <?php if(in_array($lay,array("3"))){ echo "active-blue"; } ?>">
<div class="text-center"><input type="radio" name="admin_values[design][searchcolumns]" value="3" <?php if(in_array($lay,array("3"))){ echo "checked"; } ?>></div>
</div>



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


<?php if(!in_array(THEME_KEY,array("cp"))){  $lay = _ppt(array('design', 'search_sponsored')); ?>


<div class="col-md-12"><label><?php echo __("Sponsored Bar","premiumpress"); ?></label></div>
<div class="col-md-6">
<div class="opacity-5 fs-sm mb-2"><?php echo __("Show","premiumpress"); ?></div>
<img src="https://premiumpress1063.b-cdn.net/_demoimagesv10/demo/blocks/sponsored1.jpg" class="img-fluid <?php if(in_array($lay,array("","1"))){ echo "active-blue"; } ?>">
<div class="text-center"><input type="radio" name="admin_values[design][search_sponsored]" value="1" <?php if(in_array($lay,array("","1"))){ echo "checked"; } ?>></div>
</div>

<div class="col-md-6">
<div class="opacity-5 fs-sm mb-2"><?php echo __("Hide","premiumpress"); ?></div>
<img src="https://premiumpress1063.b-cdn.net/_demoimagesv10/demo/blocks/filters2.jpg" class="img-fluid <?php if(in_array($lay,array("0"))){ echo "active-blue"; } ?>">
<div class="text-center"><input type="radio" name="admin_values[design][search_sponsored]" value="0" <?php if(in_array($lay,array("0"))){ echo "checked"; } ?>></div>
</div>


<?php } /************************** */ ?>


<?php if(!in_array(THEME_KEY,array("cp")) && _ppt(array('maps','enable')) == 1 ){ $lay = _ppt(array('design', 'search_map')); ?>


<div class="col-md-12"><label><?php echo __("Map Display","premiumpress"); ?></label></div>
<div class="col-md-6">
<div class="opacity-5 fs-sm mb-2"><?php echo __("Show","premiumpress"); ?></div>
<img src="https://premiumpress1063.b-cdn.net/_demoimagesv10/demo/blocks/mapview1.jpg" class="img-fluid <?php if(in_array($lay,array("","1"))){ echo "active-blue"; } ?>">
<div class="text-center"><input type="radio" name="admin_values[design][search_map]" value="1" <?php if(in_array($lay,array("1"))){ echo "checked"; } ?>></div>
</div>

<div class="col-md-6">
<div class="opacity-5 fs-sm mb-2"><?php echo __("Hide","premiumpress"); ?></div>
<img src="https://premiumpress1063.b-cdn.net/_demoimagesv10/demo/blocks/filters2.jpg" class="img-fluid <?php if(in_array($lay,array("0"))){ echo "active-blue"; } ?>">
<div class="text-center"><input type="radio" name="admin_values[design][search_map]" value="0" <?php if(in_array($lay,array("","0"))){ echo "checked"; } ?>></div>
</div>

<?php } ?>
 

</div></div>
 
<div class="card-footer text-center py-4">
      <button type="submit" data-ppt-btn class="btn-primary"><?php echo __("Save Settings","premiumpress"); ?></button>
    </div>


</div>


      
<?php _ppt_template('framework/admin/_form-wrap-bottom' ); ?>



<?php

///////////////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////////


 
  $settings = array(
  
  "title" => __("Search Settings","premiumpress"), 
  "desc" => "", 

  
  );
  
_ppt_template('framework/admin/_form-wrap-top' ); ?>
   
<div class="card ">

 
<div class="p-3">
<div class="row">  


<div class="col-md-4 mt-3">

<label><?php echo __("Default Orderby","premiumpress"); ?></label>

<?php

$lay = _ppt(array('design', 'search_orderby'));
?>
<select class="form-control" name="admin_values[design][search_orderby]">

<option value="" <?php if( $lay == ""){ echo "selected=selected"; } ?>><?php echo __("Default","premiumpress"); ?></option>


<option value="featured" <?php if( $lay == "featured"){ echo "selected=selected"; } ?>><?php echo __("Featured","premiumpress"); ?> </option> 

<option value="title1" <?php if( $lay == "title1"){ echo "selected=selected"; } ?>><?php echo __("Title","premiumpress"); ?> (A-z)</option>
<option value="title2" <?php if( $lay == "title2"){ echo "selected=selected"; } ?>><?php echo __("Title","premiumpress"); ?> (Z-a)</option>

</select>



</div>



<div class="col-md-4 mt-3">
<label <?php if(defined('THEME_KEY') && in_array(THEME_KEY, array("cp"))){ ?> style="color:red"<?php } ?>><?php echo str_replace("%s", strtolower(__($CORE->LAYOUT("captions","2"),"premiumpress")),__("Expired %s","premiumpress")); ?></label>

<?php

$lay = _ppt(array('search', 'showexpired'));
?>
<select class="form-control" name="admin_values[search][showexpired]">

<option value="1" <?php if( $lay == "1"){ echo "selected=selected"; } ?>><?php echo __("Show","premiumpress"); ?></option>
<option value="0" <?php if( $lay == "0" || $lay == ""){ echo "selected=selected"; } ?>><?php echo __("Hide","premiumpress"); ?></option>

</select>


</div>



 
<script> 
function SearchLayout(v){
	if(v == "full"){
		jQuery("#cardlayout").val("grid");
	} 
		 
}
function CardLayout(v){
	if(v == "list"){
		jQuery("#searchLayout").val("sidebar");
	} 
		 
}
</script>  

<div class="col-md-4 mt-3">

<label><?php echo __("Display Style","premiumpress"); ?></label>

<?php

$lay = _ppt(array('searchcustom', 'cardlayout'));
if($lay == ""){

	if(defined('THEME_KEY') && in_array(THEME_KEY, array("cp"))){
		$lay = "list";
	}else{
		$lay = "grid";
	}

}
 
?>
<select class="form-control" name="admin_values[searchcustom][cardlayout]" id="cardlayout" onchange="CardLayout(this.value)">

<option value="grid" <?php if( $lay == "grid"){ echo "selected=selected"; } ?>><?php echo __("Grid","premiumpress"); ?></option>
<option value="list" <?php if( strtolower($lay) == "list"){ echo "selected=selected"; } ?>><?php echo __("List","premiumpress"); ?></option>

</select>

 
</div>



<div class="col-md-12"><hr /> <label><?php echo __("Display Amount","premiumpress"); ?></label> </div>
 
<?php /************************** */ ?>
<?php $lay = _ppt(array('search', 'perpage')); if($lay == "" || !is_numeric($lay)){ $lay = get_option('posts_per_page');  } ?>
 
<div class="col-md-4 ">
<div class="opacity-5 fs-sm mb-2"><?php echo __("Per Page","premiumpress"); ?></div>

<input class="form-control" name="admin_values[search][perpage]" placeholder="" value="<?php echo $lay; ?>">



</div>

<?php /************************** */ ?>

<div class="col-md-4">
<div class="opacity-5 fs-sm mb-2"><?php echo __("Per Row","premiumpress"); ?></div>


<?php

$perrow = _ppt(array('searchcustom', 'perrow'));
if($perrow == ""){
$perrow = 4;
}

?> 
<select class="form-control" name="admin_values[searchcustom][perrow]">

<option name="3" <?php if( $perrow == 3){ echo "selected=selected"; } ?>>3</option>
<option name="4" <?php if( $perrow == 4){ echo "selected=selected"; } ?>>4</option>
<option name="5" <?php if( $perrow == 5){ echo "selected=selected"; } ?>>5</option>

</select>
 

</div>


<?php if(_ppt(array('searchcustom', 'cardlayout')) == "list"){ ?>


  <input type="hidden" name="admin_values[searchcustom][mobileperrow]" value="2">

<?php }elseif(in_array(THEME_KEY,array("rt","dt","es"))){  ?>
<div class="col-md-4 ">
<div class="opacity-5 fs-sm mb-2"><?php echo __("Mobile View - Per Row","premiumpress"); ?></div>


<?php

$perrow = _ppt(array('searchcustom', 'mobileperrow'));
if($perrow == ""){
$perrow = 2;
}

?> 
<select class="form-control" name="admin_values[searchcustom][mobileperrow]">

<option name="1" <?php if( $perrow == 1){ echo "selected=selected"; } ?>>1</option>
<option name="2" <?php if( $perrow == 2){ echo "selected=selected"; } ?>>2</option> 

</select>
 

</div>
<?php } ?>



</div>

<hr>

<?php

///////////////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////////

$card_items = ppt_theme_search_card_items();

if(!empty($card_items)){
?>
 
<label><?php echo __("Display Options","premiumpress"); ?></label>

<div class="row no-gutters px-0 mt-2">
<?php foreach($card_items as $k => $f ){ ?>
        <div class="col-md-3">
        <label class="custom-control custom-checkbox"> 
        
        <input type="checkbox" 
        value="1" 
        class="custom-control-input" 
        id="searchcardvals_<?php echo $k; ?>check" 
        onchange="CheckBoxSel('#searchcardvals_<?php echo $k; ?>');"
         
		<?php if( in_array(_ppt(array('searchcardvals', $k)), array("","1")) ){ ?>checked=checked<?php } ?>> 
        
          <input type="hidden" name="admin_values[searchcardvals][<?php echo $k; ?>]" id="searchcardvals_<?php echo $k; ?>add" value="<?php if( in_array(_ppt(array('searchcardvals', $k)), array("","1")) ){ echo 1; }else{ echo 0; } ?>"> 
       
      	<span class="custom-control-label"><?php echo $f['name']; ?></span>
        </label>
        </div>
<?php  } ?>

</div>
 
<?php  } ?>




<hr />
<label><?php echo __("Page Access","premiumpress"); ?></label>
 
<div class="row no-guttersx px-0 mt-2">   
<?php 


$filters = array(

	1 => array("key" => "mustlogin", "name" =>  __("Users must be logged in.","premiumpress") ),

	2 => array("key" => "homesearch", "name" =>  __("Set homepage as search page.","premiumpress") ),
	 
	3 => array("key" => "newindow", "name" => str_replace("%s", strtolower(__($CORE->LAYOUT("captions","2"),"premiumpress")),  __("Open %s in a new window.","premiumpress") ) ),
	
);


if(defined('WEBSTORIES_VERSION') &&  _ppt(array('lst', 'default_listing_stories')) == 1  ){

$filters[4] = array("key" => "webstoriesattop", "name" =>  __("Replace sponsored ads with web stories.","premiumpress"));

}
 

foreach($filters as $k => $f ){ ?>
        <div class="col-md-6">
        <label class="custom-control custom-checkbox"> 
        
        <input type="checkbox" 
        value="1" 
        class="custom-control-input" 
        id="searchcustom_<?php echo $f['key']; ?>check" 
        onchange="CheckBoxSel('#searchcustom_<?php echo $f['key']; ?>');"
         
		<?php if( _ppt(array('search', $f['key'])) == 1){ ?>checked=checked<?php } ?>> 
        
          <input type="hidden" name="admin_values[search][<?php echo $f['key']; ?>]" id="searchcustom_<?php echo $f['key']; ?>add" value="<?php if( _ppt(array('search', $f['key'])) == 1){ echo 1; }else{ echo 0; } ?>"> 
       
      	<span class="custom-control-label"><?php echo $f['name']; ?></span>
        </label>
        </div>
<?php  } ?>
</div>




 
<script>
function CheckBoxSel(div){
	 
		
			if (jQuery(div+'check').is(':checked')) {			
				jQuery(div+'add').val(1);			
			}else{			
				jQuery(div+'add').val(0);
			}
		
}
</script>  
</div>

<div class="card-footer text-center py-4">
      <button type="submit" data-ppt-btn class="btn-primary"><?php echo __("Save Settings","premiumpress"); ?></button>
    </div>

    
    </div>
    


<?php _ppt_template('framework/admin/_form-wrap-bottom' ); ?>



<?php

///////////////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////////
?>
 
 


<?php

///////////////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////////


?>
 
 <?php

  $settings = array(
  
  "title" => __("Useful Links","premiumpress"), 
  "desc" => "", 
   
  
  );
  
_ppt_template('framework/admin/_form-wrap-top' ); ?>
   
 
<div class="card p-3"> 
 

<a href="javascript:void(0);" class="_admin_iconbox icon-box border-bottom-0" onclick="jQuery('#h-tab').trigger('click');window.scrollTo({ top: 0, behavior: 'smooth' });">
<i class="fal fa-home"></i><strong><?php echo __("Homepage Search Box","premiumpress"); ?></strong>
<p><?php echo __("If you have a search box on your homepage, edit it here.","premiumpress"); ?></p>
</a>


<div id="overviewlist"></div>   
 
</div>

<style>
.active-blue { border: 2px solid #5574de; }
</style>


<?php _ppt_template('framework/admin/_form-wrap-bottom' ); ?>