Merge pull request #1837 from IanDelMar/rename-sanitize-select

Rename understrap_theme_slug_sanitize_select()
This commit is contained in:
Brian Coords 2022-08-05 08:20:16 -07:00 committed by GitHub
commit 249e0e4b19
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 24 additions and 5 deletions

View File

@ -78,7 +78,7 @@ if ( ! function_exists( 'understrap_theme_customize_register' ) ) {
array(
'default' => 'container',
'type' => 'theme_mod',
'sanitize_callback' => 'understrap_theme_slug_sanitize_select',
'sanitize_callback' => 'understrap_customize_sanitize_select',
'capability' => 'edit_theme_options',
)
);
@ -123,7 +123,7 @@ if ( ! function_exists( 'understrap_theme_customize_register' ) ) {
),
'section' => 'understrap_theme_layout_options',
'type' => 'select',
'sanitize_callback' => 'understrap_theme_slug_sanitize_select',
'sanitize_callback' => 'understrap_customize_sanitize_select',
'choices' => array(
'collapse' => __( 'Collapse', 'understrap' ),
'offcanvas' => __( 'Offcanvas', 'understrap' ),
@ -155,7 +155,7 @@ if ( ! function_exists( 'understrap_theme_customize_register' ) ) {
),
'section' => 'understrap_theme_layout_options',
'type' => 'select',
'sanitize_callback' => 'understrap_theme_slug_sanitize_select',
'sanitize_callback' => 'understrap_customize_sanitize_select',
'choices' => array(
'right' => __( 'Right sidebar', 'understrap' ),
'left' => __( 'Left sidebar', 'understrap' ),
@ -195,7 +195,7 @@ if ( ! function_exists( 'understrap_theme_customize_register' ) ) {
} // End of if function_exists( 'understrap_theme_customize_register' ).
add_action( 'customize_register', 'understrap_theme_customize_register' );
if ( ! function_exists( 'understrap_theme_slug_sanitize_select' ) ) {
if ( ! function_exists( 'understrap_customize_sanitize_select' ) ) {
/**
* Sanitize select.
*
@ -204,7 +204,7 @@ if ( ! function_exists( 'understrap_theme_slug_sanitize_select' ) ) {
* @return string|bool Sanitized slug if it is a valid choice; the setting default for
* invalid choices and false in all other cases.
*/
function understrap_theme_slug_sanitize_select( $input, $setting ) {
function understrap_customize_sanitize_select( $input, $setting ) {
// Ensure input is a slug (lowercase alphanumeric characters, dashes and underscores are allowed only).
$input = sanitize_key( $input );

View File

@ -8,6 +8,25 @@
// Exit if accessed directly.
defined( 'ABSPATH' ) || exit;
if ( ! function_exists( 'understrap_theme_slug_sanitize_select' ) ) {
/**
* Sanitize select.
*
* @param string $input Slug to sanitize.
* @param WP_Customize_Setting $setting Setting instance.
* @return string|bool Sanitized slug if it is a valid choice; the setting default for
* invalid choices and false in all other cases.
*/
function understrap_theme_slug_sanitize_select( $input, $setting ) {
_deprecated_function(
'understrap_theme_slug_sanitize_select',
'1.2.0',
'understrap_customize_sanitize_select'
);
return understrap_customize_sanitize_select( $input, $setting );
}
}
if ( ! function_exists( 'understrap_adjust_body_class' ) ) {
/**
* Setup body classes.