<?php
/**
* Custom Functions.
*
* @package Solar Energy Engine
*/

if( !function_exists( 'solar_energy_engine_sanitize_sidebar_option' ) ) :

    // Sidebar Option Sanitize.
    function solar_energy_engine_sanitize_sidebar_option( $solar_energy_engine_input ){

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

            return $solar_energy_engine_input;

        }

        return;

    }

endif;

if ( ! function_exists( 'solar_energy_engine_sanitize_checkbox' ) ) :

	/**
	 * Sanitize checkbox.
	 */
	function solar_energy_engine_sanitize_checkbox( $solar_energy_engine_checked ) {

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

	}

endif;


if ( ! function_exists( 'solar_energy_engine_sanitize_select' ) ) :

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

endif;
