<?php
/**
* Custom Functions.
*
* @package Modern Art Gallery
*/

if( !function_exists( 'modern_art_gallery_sanitize_sidebar_option' ) ) :

    // Sidebar Option Sanitize.
    function modern_art_gallery_sanitize_sidebar_option( $modern_art_gallery_input ){

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

            return $modern_art_gallery_input;

        }

        return;

    }

endif;

if ( ! function_exists( 'modern_art_gallery_sanitize_checkbox' ) ) :

	/**
	 * Sanitize checkbox.
	 */
	function modern_art_gallery_sanitize_checkbox( $modern_art_gallery_checked ) {

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

	}

endif;


if ( ! function_exists( 'modern_art_gallery_sanitize_select' ) ) :

    /**
     * Sanitize select.
     */
    function modern_art_gallery_sanitize_select( $modern_art_gallery_input, $modern_art_gallery_setting ) {
        $modern_art_gallery_input = sanitize_text_field( $modern_art_gallery_input );
        $modern_art_gallery_choices = $modern_art_gallery_setting->manager->get_control( $modern_art_gallery_setting->id )->choices;
        return ( array_key_exists( $modern_art_gallery_input, $modern_art_gallery_choices ) ? $modern_art_gallery_input : $modern_art_gallery_setting->default );
    }

endif;