<?php
/**
* Custom Functions.
*
* @package Spa Parlor
*/

if( !function_exists( 'spa_parlor_sanitize_sidebar_option' ) ) :

    // Sidebar Option Sanitize.
    function spa_parlor_sanitize_sidebar_option( $spa_parlor_input ){

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

            return $spa_parlor_input;

        }

        return;

    }

endif;

if ( ! function_exists( 'spa_parlor_sanitize_checkbox' ) ) :

	/**
	 * Sanitize checkbox.
	 */
	function spa_parlor_sanitize_checkbox( $spa_parlor_checked ) {

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

	}

endif;


if ( ! function_exists( 'spa_parlor_sanitize_select' ) ) :

    /**
     * Sanitize select.
     */
    function spa_parlor_sanitize_select( $spa_parlor_input, $spa_parlor_setting ) {
        $spa_parlor_input = sanitize_text_field( $spa_parlor_input );
        $spa_parlor_choices = $spa_parlor_setting->manager->get_control( $spa_parlor_setting->id )->choices;
        return ( array_key_exists( $spa_parlor_input, $spa_parlor_choices ) ? $spa_parlor_input : $spa_parlor_setting->default );
    }

endif;