Skip to content

Commit

Permalink
Merge pull request #1837 from IanDelMar/rename-sanitize-select
Browse files Browse the repository at this point in the history
Rename understrap_theme_slug_sanitize_select()
  • Loading branch information
bacoords committed Aug 5, 2022
2 parents 3769f3c + b4f8c10 commit 249e0e4
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 5 deletions.
10 changes: 5 additions & 5 deletions inc/customizer.php
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ function understrap_theme_customize_register( $wp_customize ) {
array(
'default' => 'container',
'type' => 'theme_mod',
'sanitize_callback' => 'understrap_theme_slug_sanitize_select',
'sanitize_callback' => 'understrap_customize_sanitize_select',
'capability' => 'edit_theme_options',
)
);
Expand Down Expand Up @@ -123,7 +123,7 @@ function understrap_theme_customize_register( $wp_customize ) {
),
'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' ),
Expand Down Expand Up @@ -155,7 +155,7 @@ function understrap_theme_customize_register( $wp_customize ) {
),
'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' ),
Expand Down Expand Up @@ -195,7 +195,7 @@ function understrap_theme_customize_register( $wp_customize ) {
} // 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.
*
Expand All @@ -204,7 +204,7 @@ function understrap_theme_customize_register( $wp_customize ) {
* @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 );
Expand Down
19 changes: 19 additions & 0 deletions inc/deprecated.php
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down

0 comments on commit 249e0e4

Please sign in to comment.