PluginProbe
Booking Calendar / 11.8.2
Booking Calendar v11.8.2
11.8.2 11.8.1 11.8 11.7 11.6.1 11.6 11.5 11.4.3 11.4.2 11.4.1 11.4 11.3 11.2.1 11.2 11.1 11.0 10.15.7 10.15.6 10.1.3 10.10 10.10.1 10.10.2 10.11 10.11.2 10.11.3 All 202 releases
← All changes | includes/_functions/booking_data__parse.php +9 -26 11.711.8.2 View file →
@@ -1,4 +1,4 @@
1 1 <?php
2 2 /**
3 3 * @version 1.0
4 4 * @package Booking Calendar
@@ -816,34 +816,17 @@
816 816 foreach ( $booking_form_fields_arr as $form_key => $booking_form_element ) {
817 817
818 818 $booking_form = isset( $booking_form_element['form'] ) ? (string) $booking_form_element['form'] : '';
819 819
820 - $types = 'text[*]?|email[*]?|time[*]?|textarea[*]?|select[*]?|selectbox[*]?|checkbox[*]?|radio|acceptance|captchac|captchar|file[*]?|quiz';
821 - $regex = '%\[\s*(' . $types . ')(\s+[a-zA-Z][0-9a-zA-Z:._-]*)([-0-9a-zA-Z:#_/|\s]*)?((?:\s*(?:"[^"]*"|\'[^\']*\'))*)?\s*\]%';
822 - $regex2 = '%\[\s*(country[*]?|starttime[*]?|endtime[*]?)(\s*[a-zA-Z]*[0-9a-zA-Z:._-]*)([-0-9a-zA-Z:#_/|\s]*)*((?:\s*(?:"[^"]*"|\'[^\']*\'))*)?\s*\]%';
823 -
824 - $fields_matches = array();
825 - $fields_matches2 = array();
826 -
827 - $fields_count = preg_match_all( $regex, $booking_form, $fields_matches );
828 - $fields_count2 = preg_match_all( $regex2, $booking_form, $fields_matches2 );
829 -
830 - foreach ( $fields_matches2 as $key => $value ) {
831 -
832 - if ( 2 === (int) $key ) {
833 - $value = $fields_matches2[1];
834 - }
835 -
836 - if ( ! isset( $fields_matches[ $key ] ) || ! is_array( $fields_matches[ $key ] ) ) {
837 - $fields_matches[ $key ] = array();
838 - }
839 -
840 - foreach ( $value as $single_value ) {
841 - $fields_matches[ $key ][] = $single_value;
842 - }
843 - }
844 -
845 - $fields_count += $fields_count2;
820 + // Keep field-assignment inventories aligned with the shared shortcode parser. Builder choice fields can
821 + // contain named attributes such as default="1", which the former duplicate regex did not recognize.
822 + $parsed_booking_fields = '' !== trim( $booking_form ) ? wpbc_get_fields_from_booking_form( $booking_form ) : false;
823 + $fields_count = 0;
824 + $fields_matches = array_fill( 0, 5, array() );
825 +
826 + if ( false !== $parsed_booking_fields ) {
827 + list( $fields_count, $fields_matches ) = $parsed_booking_fields;
828 + }
846 829
847 830 $booking_form_fields_arr[ $form_key ]['num'] = $fields_count;
848 831 $booking_form_fields_arr[ $form_key ]['listing'] = array();
849 832