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

if( !function_exists( 'trucking_company_sanitize_sidebar_option' ) ) :

    // Sidebar Option Sanitize.
    function trucking_company_sanitize_sidebar_option( $trucking_company_input ){

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

            return $trucking_company_input;

        }

        return;

    }

endif;

if ( ! function_exists( 'trucking_company_sanitize_checkbox' ) ) :

	/**
	 * Sanitize checkbox.
	 */
	function trucking_company_sanitize_checkbox( $trucking_company_checked ) {

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

	}

endif;


if ( ! function_exists( 'trucking_company_sanitize_select' ) ) :

    /**
     * Sanitize select.
     */
    function trucking_company_sanitize_select( $trucking_company_input, $trucking_company_setting ) {
        $trucking_company_input = sanitize_text_field( $trucking_company_input );
        $trucking_company_choices = $trucking_company_setting->manager->get_control( $trucking_company_setting->id )->choices;
        return ( array_key_exists( $trucking_company_input, $trucking_company_choices ) ? $trucking_company_input : $trucking_company_setting->default );
    }

endif;