<?php
/**
* Custom Functions.
*
* @package Car Rental Service
*/

if( !function_exists( 'car_rental_service_sanitize_sidebar_option' ) ) :

    // Sidebar Option Sanitize.
    function car_rental_service_sanitize_sidebar_option( $car_rental_service_input ){

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

            return $car_rental_service_input;

        }

        return;

    }

endif;

if ( ! function_exists( 'car_rental_service_sanitize_checkbox' ) ) :

	/**
	 * Sanitize checkbox.
	 */
	function car_rental_service_sanitize_checkbox( $car_rental_service_checked ) {

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

	}

endif;


if ( ! function_exists( 'car_rental_service_sanitize_select' ) ) :

    /**
     * Sanitize select.
     */
    function car_rental_service_sanitize_select( $car_rental_service_input, $car_rental_service_setting ) {
        $car_rental_service_input = sanitize_text_field( $car_rental_service_input );
        $car_rental_service_choices = $car_rental_service_setting->manager->get_control( $car_rental_service_setting->id )->choices;
        return ( array_key_exists( $car_rental_service_input, $car_rental_service_choices ) ? $car_rental_service_input : $car_rental_service_setting->default );
    }

endif;