| @@ -1,4 +1,4 @@ | ||
| 1 | 1 | <?php |
| 2 | 2 | /** |
| 3 | 3 | * Templates functions for showing Steps Timeline in Booking form and in Wizard. |
| 4 | 4 | * |
| @@ -98,9 +98,9 @@ | ||
| 98 | 98 | } |
| 99 | 99 | |
| 100 | 100 | |
| 101 | 101 | /** |
| 102 | - * Update [steps_timline] shortcode | |
| 102 | + * Update [steps_timeline] shortcode | |
| 103 | 103 | * |
| 104 | 104 | * @param string $form_content - Form Content. |
| 105 | 105 | * @param int $resource_id - Resource ID. |
| 106 | 106 | * @param string $custom_booking_form_name - Custom booking form name ?. |
| @@ -109,9 +109,9 @@ | ||
| 109 | 109 | */ |
| 110 | 110 | function wpbc_update_bookingform_content__steps_timeline( $form_content, $resource_id, $custom_booking_form_name = '' ) { |
| 111 | 111 | |
| 112 | 112 | // $hint_html = wpbc_ui__steps_timeline__get_html( 3, 2 ); |
| 113 | - // $form_content = str_replace( '[steps_timline]', $hint_html, $form_content ); | |
| 113 | + // $form_content = str_replace( '[steps_timeline]', $hint_html, $form_content ); | |
| 114 | 114 | |
| 115 | 115 | /** |
| 116 | 116 | * Example: array( |
| 117 | 117 | * content => "<span class="wpbc_top_news_dismiss">[wpbc_dismiss6764]</span>" |
| @@ -124,9 +124,10 @@ | ||
| 124 | 124 | * ) |
| 125 | 125 | * ) |
| 126 | 126 | */ |
| 127 | 127 | |
| 128 | - $shortcodes_arr = wpbc_get_shortcodes_in_text__as_unique_replace( $form_content, array( 'steps_timline' ) ); | |
| 128 | + $form_content = str_replace( 'steps_timline', 'steps_timeline', $form_content ); | |
| 129 | + $shortcodes_arr = wpbc_get_shortcodes_in_text__as_unique_replace( $form_content, array( 'steps_timeline' ) ); | |
| 129 | 130 | $string = $shortcodes_arr['content']; |
| 130 | 131 | |
| 131 | 132 | |
| 132 | 133 | foreach ( $shortcodes_arr['shortcodes'] as $shortcode_text_to_replace => $shortcode_params_arr ) { |
| @@ -141,12 +142,20 @@ | ||
| 141 | 142 | } |
| 142 | 143 | $new_html = '<span class="wpbc_steps_for_timeline__'.esc_attr($shortcode_text_to_replace).'">'; |
| 143 | 144 | $new_html .= wpbc_ui__steps_timeline__get_html( $steps_count, $step_number ); |
| 144 | 145 | $new_html .= '</span>'; |
| 145 | - if ( isset( $shortcode_params_arr['params']['color'] ) ) { | |
| 146 | - $color = esc_attr( $shortcode_params_arr['params']['color'] ); | |
| 147 | - $new_html .= '<style type="text/css"> .booking_form_div .wpbc_steps_for_timeline__'.esc_attr($shortcode_text_to_replace).' .wpbc_steps_for_timeline_container { --wpbc_steps_for_timeline_active_color: ' . $color . '; } </style>'; | |
| 148 | - } | |
| 146 | + if ( isset( $shortcode_params_arr['params']['color'] ) ) { | |
| 147 | + $raw_color = sanitize_text_field( (string) $shortcode_params_arr['params']['color'] ); | |
| 148 | + // Read compatibility for forms exported by early 11.5 development builds. | |
| 149 | + if ( 'accent' === $raw_color ) { | |
| 150 | + $color = 'var(--wpbc_form-accent-color, var(--wpbc_timepicker-selected-bg-color, #6b96ce))'; | |
| 151 | + } else { | |
| 152 | + $color = sanitize_hex_color( $raw_color ); | |
| 153 | + } | |
| 154 | + if ( $color ) { | |
| 155 | + $new_html .= '<style type="text/css"> .booking_form_div .wpbc_steps_for_timeline__' . esc_attr( $shortcode_text_to_replace ) . ' .wpbc_steps_for_timeline_container { --wpbc_steps_for_timeline_active_color: ' . esc_html( $color ) . '; } </style>'; | |
| 156 | + } | |
| 157 | + } | |
| 149 | 158 | $string = str_replace( '[' . $shortcode_text_to_replace . ']', $new_html, $string ); |
| 150 | 159 | } |
| 151 | 160 | |
| 152 | 161 | return $string; |