<?php
/**
* Custom Functions.
*
* @package Omega Refrigeration
*/

if( !function_exists( 'omega_refrigeration_sanitize_sidebar_option' ) ) :

    // Sidebar Option Sanitize.
    function omega_refrigeration_sanitize_sidebar_option( $omega_refrigeration_input ){

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

            return $omega_refrigeration_input;

        }

        return;

    }

endif;

if ( ! function_exists( 'omega_refrigeration_sanitize_checkbox' ) ) :

	/**
	 * Sanitize checkbox.
	 */
	function omega_refrigeration_sanitize_checkbox( $omega_refrigeration_checked ) {

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

	}

endif;


if ( ! function_exists( 'omega_refrigeration_sanitize_select' ) ) :

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

endif;