<?php
/**
* Custom Functions.
*
* @package Elegant Jewellery
*/

if( !function_exists( 'elegant_jewellery_sanitize_sidebar_option' ) ) :

    // Sidebar Option Sanitize.
    function elegant_jewellery_sanitize_sidebar_option( $elegant_jewellery_input ){

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

            return $elegant_jewellery_input;

        }

        return;

    }

endif;

if ( ! function_exists( 'elegant_jewellery_sanitize_checkbox' ) ) :

	/**
	 * Sanitize checkbox.
	 */
	function elegant_jewellery_sanitize_checkbox( $elegant_jewellery_checked ) {

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

	}

endif;


if ( ! function_exists( 'elegant_jewellery_sanitize_select' ) ) :

    /**
     * Sanitize select.
     */
    function elegant_jewellery_sanitize_select( $elegant_jewellery_input, $elegant_jewellery_setting ) {
        $elegant_jewellery_input = sanitize_text_field( $elegant_jewellery_input );
        $elegant_jewellery_choices = $elegant_jewellery_setting->manager->get_control( $elegant_jewellery_setting->id )->choices;
        return ( array_key_exists( $elegant_jewellery_input, $elegant_jewellery_choices ) ? $elegant_jewellery_input : $elegant_jewellery_setting->default );
    }

endif;