<?php
/**
* Custom Functions.
*
* @package Electrician Company
*/

if( !function_exists( 'electrician_company_sanitize_sidebar_option' ) ) :

    // Sidebar Option Sanitize.
    function electrician_company_sanitize_sidebar_option( $electrician_company_input ){

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

            return $electrician_company_input;

        }

        return;

    }

endif;

if ( ! function_exists( 'electrician_company_sanitize_checkbox' ) ) :

	/**
	 * Sanitize checkbox.
	 */
	function electrician_company_sanitize_checkbox( $electrician_company_checked ) {

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

	}

endif;


if ( ! function_exists( 'electrician_company_sanitize_select' ) ) :

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

endif;