$subvalue ) { $value[ $key ] = esc_attr( $subvalue ); } return $value; } return esc_attr( $value ); } function alurra_sanitize_number_decimal( $number, $setting ) { // Ensure $number is an absolute integer (whole number, zero or decimal). filter_var( $number, FILTER_FLAG_ALLOW_FRACTION ); // If the input is an absolute integer, return it; otherwise, return the default return ( $number ? $number : $setting->default ); } function alurra_sanitize_number_absint( $number, $setting ) { // Ensure $number is an absolute integer (whole number, zero or greater). $number = absint( $number ); // If the input is an absolute integer, return it; otherwise, return the default return ( $number ? $number : $setting->default ); } /** Radio Sanitize */ function alurra_sanitize_radio( $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 ); } // Function for sanitizing Hex color function alurra_sanitize_hex_colour( $color ){ if ( '' === $color ) return ''; // 3 or 6 hex digits, or the empty string. if ( preg_match('|^#([A-Fa-f0-9]{3}){1,2}$|', $color ) ) return $color; }