<?php
/**
* Custom Functions.
*
* @package Travel Destination
*/

if( !function_exists( 'travel_destination_sanitize_sidebar_option' ) ) :

    // Sidebar Option Sanitize.
    function travel_destination_sanitize_sidebar_option( $travel_destination_input ){

        $travel_destination_metabox_options = array( 'global-sidebar','left-sidebar','right-sidebar','no-sidebar' );
        if( in_array( $travel_destination_input,$travel_destination_metabox_options ) ){

            return $travel_destination_input;

        }

        return;

    }

endif;

if ( ! function_exists( 'travel_destination_sanitize_checkbox' ) ) :

	/**
	 * Sanitize checkbox.
	 */
	function travel_destination_sanitize_checkbox( $travel_destination_checked ) {

		return ( ( isset( $travel_destination_checked ) && true === $travel_destination_checked ) ? true : false );

	}

endif;


if ( ! function_exists( 'travel_destination_sanitize_select' ) ) :

    /**
     * Sanitize select.
     */
    function travel_destination_sanitize_select( $travel_destination_input, $travel_destination_setting ) {
        $travel_destination_input = sanitize_text_field( $travel_destination_input );
        $choices = $travel_destination_setting->manager->get_control( $travel_destination_setting->id )->choices;
        return ( array_key_exists( $travel_destination_input, $choices ) ? $travel_destination_input : $travel_destination_setting->default );
    }

endif;