<?php
/**
 * sanitize functions to allow styling of the templates
 *
 * @package MatrixAddons
 * @subpackage trainify
 * @since 1.0.0
 */

if(!function_exists('sanitize_trainify_show_hide')){
	
	function sanitize_trainify_show_hide($value){

		$sanitize_value = 'show';
		switch($value){
			case 'show':
			case 'hide':
				$sanitize_value = $value;
				break;
			default:
				$sanitize_value = 'show';
				break;
		}
		return $sanitize_value;

	}

}

if(!function_exists('sanitize_trainify_enable_disable')){
	
	function sanitize_trainify_enable_disable($value){

		$sanitize_value = 'enable';
		switch($value){
			case 'enable':
			case 'disable':
				$sanitize_value = $value;
				break;
			default:
				$sanitize_value = 'enable';
				break;
		}
		return $sanitize_value;

	}

}


if(!function_exists('sanitize_trainify_posttype_values')){
	
	function sanitize_trainify_posttype_values($value){

		$sanitize_value = 'page';
		$post_types = trainify_framework_posttypes();
		if(isset($post_types[$value])){
			$sanitize_value = $value;
		}
		return $sanitize_value;

	}

}

if(!function_exists('sanitize_trainify_transition_effect')){
	
	function sanitize_trainify_transition_effect($value){

		$sanitize_value = 'fade';
		$transition_effects = array(
			'fade'       => esc_html__( 'Fade', 'trainify' ),
			'slide'    => esc_html__( 'Slide', 'trainify' ),
		);
		if(isset($transition_effects[$value])){
			$sanitize_value = $value;
		}
		return $sanitize_value;

	}

}

if(!function_exists('sanitize_trainify_thumbnail_size')){
	
	function sanitize_trainify_thumbnail_size($value){

		$sanitize_value = 'full';
		$thumbnail_list = trainify_framework_get_image_sizes();
		if(isset($thumbnail_list[$value])){
			$sanitize_value = $value;
		}
		return $sanitize_value;

	}

}

if(!function_exists('sanitize_trainify_site_layout')){
	
	function sanitize_trainify_site_layout($value){

		$sanitize_value = 'tff_fullwidth_layout';
		switch($value){
			case 'tff_fullwidth_layout':
			case 'tff_boxed_width_layout':
				$sanitize_value = $value;
				break;
			default:
				$sanitize_value = 'tff_fullwidth_layout';
				break;
		}
		return $sanitize_value;

	}

}


if(!function_exists('sanitize_trainify_widget_layout')){
	
	function sanitize_trainify_widget_layout($value){

		$sanitize_value = 'layout2';
		switch($value){
			case 'layout1':
			case 'layout2':
				$sanitize_value = $value;
				break;
			default:
				$sanitize_value = 'layout2';
				break;
		}
		return $sanitize_value;

	}

}