default ); } /** * Sanitize site layout * * @since 1.0.0 */ function astrad_sanitize_site_layout( $input ) { $valid_keys = array( 'fullwidth_layout' => esc_html__( 'Fullwidth Layout', 'astrad' ), 'boxed_layout' => esc_html__( 'Boxed Layout', 'astrad' ) ); if ( array_key_exists( $input, $valid_keys ) ) { return $input; } else { return ''; } } /** * switch option (show/hide) * * @since 1.0.0 */ function astrad_sanitize_switch_option( $input ) { $valid_keys = array( 'show' => esc_html__( 'Show', 'astrad' ), 'hide' => esc_html__( 'Hide', 'astrad' ) ); if ( array_key_exists( $input, $valid_keys ) ) { return $input; } else { return ''; } } /** * sanitize function for Radio type * * @since 1.0.0 */ function astrad_sanitize_radio_option( $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 ); }