rename all files named mt- to sad-
This commit is contained in:
47
inc/customizer/sad-sanitize.php
Normal file
47
inc/customizer/sad-sanitize.php
Normal file
@ -0,0 +1,47 @@
|
||||
<?php
|
||||
/**
|
||||
* Sanitize customizer field
|
||||
*
|
||||
* @package Sophia After Dark
|
||||
* @since 1.0.0
|
||||
*/
|
||||
|
||||
if ( ! function_exists( 'sophia_after_dark_sanitize_checkbox' ) ) :
|
||||
|
||||
/**
|
||||
* Sanitize checkbox.
|
||||
*
|
||||
* @since 1.0.0
|
||||
*
|
||||
* @param bool $checked Whether the checkbox is checked.
|
||||
* @return bool Whether the checkbox is checked.
|
||||
*/
|
||||
function sophia_after_dark_sanitize_checkbox( $checked ) {
|
||||
return ( ( isset( $checked ) && true === $checked ) ? true : false );
|
||||
}
|
||||
|
||||
endif;
|
||||
|
||||
if ( ! function_exists( 'sophia_after_dark_sanitize_select' ) ) :
|
||||
|
||||
/**
|
||||
* Sanitize select.
|
||||
*
|
||||
* @since 1.0.0
|
||||
*
|
||||
* @param mixed $input The value to sanitize.
|
||||
* @param WP_Customize_Setting $setting WP_Customize_Setting instance.
|
||||
* @return mixed Sanitized value.
|
||||
*/
|
||||
function sophia_after_dark_sanitize_select( $input, $setting ) {
|
||||
// Ensure input is a slug.
|
||||
$input = sanitize_key( $input );
|
||||
|
||||
// Get list of choices from the control associated with the setting.
|
||||
$choices = $setting->manager->get_control( $setting->id )->choices;
|
||||
|
||||
// If the input is a valid key, return it; otherwise, return the default.
|
||||
return ( array_key_exists( $input, $choices ) ? $input : $setting->default );
|
||||
}
|
||||
|
||||
endif;
|
Reference in New Issue
Block a user