<?php
/**
* Custom Functions.
*
* @package Vacation Rental Booking
*/

if( !function_exists( 'vacation_rental_booking_sanitize_sidebar_option' ) ) :

    // Sidebar Option Sanitize.
    function vacation_rental_booking_sanitize_sidebar_option( $vacation_rental_booking_input ){

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

            return $vacation_rental_booking_input;

        }

        return;

    }

endif;

if ( ! function_exists( 'vacation_rental_booking_sanitize_checkbox' ) ) :

	/**
	 * Sanitize checkbox.
	 */
	function vacation_rental_booking_sanitize_checkbox( $vacation_rental_booking_checked ) {

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

	}

endif;


if ( ! function_exists( 'vacation_rental_booking_sanitize_select' ) ) :

    /**
     * Sanitize select.
     */
    function vacation_rental_booking_sanitize_select( $vacation_rental_booking_input, $vacation_rental_booking_setting ) {
        $vacation_rental_booking_input = sanitize_text_field( $vacation_rental_booking_input );
        $vacation_rental_booking_choices = $vacation_rental_booking_setting->manager->get_control( $vacation_rental_booking_setting->id )->choices;
        return ( array_key_exists( $vacation_rental_booking_input, $vacation_rental_booking_choices ) ? $vacation_rental_booking_input : $vacation_rental_booking_setting->default );
    }

endif;