<?php
/**
* Custom Functions.
*
* @package Wind Energy
*/

if( !function_exists( 'wind_energy_sanitize_sidebar_option' ) ) :

    // Sidebar Option Sanitize.
    function wind_energy_sanitize_sidebar_option( $wind_energy_input ){

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

            return $wind_energy_input;

        }

        return;

    }

endif;

if ( ! function_exists( 'wind_energy_sanitize_checkbox' ) ) :

	/**
	 * Sanitize checkbox.
	 */
	function wind_energy_sanitize_checkbox( $wind_energy_checked ) {

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

	}

endif;


if ( ! function_exists( 'wind_energy_sanitize_select' ) ) :

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

endif;
