From ba10cb9c0f89622909118960352e838f3686fd7a Mon Sep 17 00:00:00 2001 From: IanDelMar <42134098+IanDelMar@users.noreply.github.com> Date: Wed, 27 Jul 2022 09:04:27 +0200 Subject: [PATCH 1/2] rename understrap_theme_slug_sanitize_select() --- inc/customizer.php | 4 ++-- inc/deprecated.php | 19 +++++++++++++++++++ 2 files changed, 21 insertions(+), 2 deletions(-) diff --git a/inc/customizer.php b/inc/customizer.php index 33295a5f..802d68c8 100644 --- a/inc/customizer.php +++ b/inc/customizer.php @@ -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 ); diff --git a/inc/deprecated.php b/inc/deprecated.php index 18a1fb37..c463a6ab 100644 --- a/inc/deprecated.php +++ b/inc/deprecated.php @@ -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. From b4f8c1062c4f01fd3f2add29398e4c5a66eb7253 Mon Sep 17 00:00:00 2001 From: IanDelMar <42134098+IanDelMar@users.noreply.github.com> Date: Wed, 27 Jul 2022 10:18:55 +0200 Subject: [PATCH 2/2] use understrap_customize_sanitize_select() --- inc/customizer.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/inc/customizer.php b/inc/customizer.php index 802d68c8..8bee22bf 100644 --- a/inc/customizer.php +++ b/inc/customizer.php @@ -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' ),