PluginProbe
Booking Calendar / 11.8.4
Booking Calendar v11.8.4
11.8.4 11.8.3 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 All 204 releases
← All changes | includes/_toolbar_ui/toolbar_ui.php +99 -2670 10.1.311.8.4 View file →
@@ -1,4 +1,4 @@
1 1 <?php /**
2 2 * @version 1.1
3 3 * @package Any
4 4 * @category Toolbar. UI Elements for Admin Panel
@@ -11,11 +11,11 @@
11 11 */
12 12
13 13 if ( ! defined( 'ABSPATH' ) ) exit; // Exit, if accessed directly
14 14
15 -////////////////////////////////////////////////////////////////////////////////
15 +// ---------------------------------------------------------------------------------------------------------------------
16 16 // T o o l b a r s
17 -////////////////////////////////////////////////////////////////////////////////
17 +// ---------------------------------------------------------------------------------------------------------------------
18 18
19 19 /**
20 20 * Show top toolbar on Booking Listing page
21 21 *
@@ -24,110 +24,21 @@
24 24 function wpbc_ajx_bookings_toolbar( $escaped_search_request_params ) {
25 25
26 26 wpbc_clear_div();
27 27
28 - //wpbc_toolbar_search_by_id_bookings(); // Search bookings by ID - form at the top right side of the page
29 -
30 - // wpbc_toolbar_btn__view_mode(); // Vertical Buttons //FixIn: 9.8.15.2
31 -
32 28 // Toolbar ////////////////////////////////////////////////////////////////
33 29
34 30 $default_param_values = wpbc_ajx_get__request_params__names_default( 'default' );
35 31
36 - $selected_tab = ( isset( $escaped_search_request_params['ui_usr__default_selected_toolbar'] ) )
37 - ? $escaped_search_request_params['ui_usr__default_selected_toolbar']
38 - : $default_param_values['ui_usr__default_selected_toolbar'];
39 32
40 - ?><div id="toolbar_booking_listing" class="wpbc_ajx_toolbar"><?php
33 + ?><div id="toolbar_booking_listing" class="wpbc_ajx_toolbar" style="box-shadow: none;"><?php
41 34
42 - // <editor-fold defaultstate="collapsed" desc=" T O P T A B s " >
43 -
44 - wpbc_bs_toolbar_tabs_html_container_start();
45 -
46 - wpbc_bs_display_tab( array(
47 - 'title' => '&nbsp;' . __('Filters', 'booking')
48 - , 'hint' => array( 'title' => __('Filter bookings' ,'booking') , 'position' => 'top' )
49 - , 'onclick' => "jQuery('.ui_container_toolbar').hide();"
50 - . "jQuery('.ui_container_filters').show();"
51 - . "jQuery('.wpbc_ajx_toolbar .nav-tab').removeClass('nav-tab-active');" //FixIn: 9.8.15.2
52 - . "jQuery(this).addClass('nav-tab-active');"
53 - . "jQuery('.nav-tab i.icon-white').removeClass('icon-white');"
54 - . "jQuery('.nav-tab-active i').addClass('icon-white');"
55 - /**
56 - * It will save such changes, and if we have selected bookings, then deselect them
57 - */
58 - // . "wpbc_ajx_booking_send_search_request_with_params( { 'ui_usr__default_selected_toolbar': 'filters' });"
59 - /**
60 - * It will save changes with NEXT search request, but not immediately
61 - * it is handy, in case if we have selected bookings,
62 - * we will not lose selection.
63 - */
64 - . "wpbc_ajx_booking_listing.search_set_param( 'ui_usr__default_selected_toolbar', 'filters' );"
65 - , 'font_icon' => 'wpbc_icn_published_with_changes' //FixIn: 9.0.1.4 'glyphicon glyphicon-random'
66 - , 'default' => ( $selected_tab == 'filters' ) ? true : false
67 - ) );
68 - wpbc_bs_display_tab( array(
69 - 'title' => __('Actions', 'booking')
70 - , 'hint' => array( 'title' => __('Manage bookings' ,'booking') , 'position' => 'top' )
71 - , 'onclick' => "jQuery('.ui_container_toolbar').hide();"
72 - . "jQuery('.ui_container_actions').show();"
73 - . "jQuery('.wpbc_ajx_toolbar .nav-tab').removeClass('nav-tab-active');" //FixIn: 9.8.15.2
74 - . "jQuery(this).addClass('nav-tab-active');"
75 - . "jQuery('.nav-tab i.icon-white').removeClass('icon-white');"
76 - . "jQuery('.nav-tab-active i').addClass('icon-white');"
77 - /**
78 - * It will save such changes, and if we have selected bookings, then deselect them
79 - */
80 - // . "wpbc_ajx_booking_send_search_request_with_params( { 'ui_usr__default_selected_toolbar': 'actions' });"
81 - /**
82 - * It will save changes with NEXT search request, but not immediately
83 - * it is handy, in case if we have selected bookings,
84 - * we will not lose selection.
85 - */
86 - . "wpbc_ajx_booking_listing.search_set_param( 'ui_usr__default_selected_toolbar', 'actions' );"
87 - , 'font_icon' => 'wpbc_icn_adjust' //FixIn: 9.0.1.4 'glyphicon glyphicon-fire'
88 - , 'default' => ( $selected_tab == 'actions' ) ? true : false
89 -
90 - ) );
91 -
92 - if ( class_exists( 'wpdev_bk_personal' ) ) { //FixIn: 9.6.1.5
93 - wpbc_bs_display_tab( array(
94 - 'title' => __('Options', 'booking') //FixIn: 9.5.4.3
95 - , 'hint' => array( 'title' => __('User Options' ,'booking') , 'position' => 'top' )
96 - , 'onclick' => "jQuery('.ui_container_toolbar').hide();"
97 - . "jQuery('.ui_container_options').show();"
98 - . "jQuery('.wpbc_ajx_toolbar .nav-tab').removeClass('nav-tab-active');" //FixIn: 9.8.15.2
99 - . "jQuery(this).addClass('nav-tab-active');"
100 - . "jQuery('.nav-tab i.icon-white').removeClass('icon-white');"
101 - . "jQuery('.nav-tab-active i').addClass('icon-white');"
102 - /**
103 - * It will save such changes, and if we have selected bookings, then deselect them
104 - */
105 - // . "wpbc_ajx_booking_send_search_request_with_params( { 'ui_usr__default_selected_toolbar': 'options' });"
106 - /**
107 - * It will save changes with NEXT search request, but not immediately
108 - * it is handy, in case if we have selected bookings,
109 - * we will not lose selection.
110 - */
111 - . "wpbc_ajx_booking_listing.search_set_param( 'ui_usr__default_selected_toolbar', 'options' );"
112 - , 'font_icon' => 'wpbc_icn_tune' //FixIn: 9.0.1.4 'glyphicon glyphicon-fire'
113 - , 'default' => ( $selected_tab == 'options' ) ? true : false
114 - //, 'position' => 'right'
115 -
116 - ) );
117 - }
118 - wpbc_bs_dropdown_menu_help();
119 -
120 - wpbc_bs_toolbar_tabs_html_container_end();
121 -
122 - // </editor-fold>
123 -
124 - ////////////////////////////////////////////////////////////////////////////////////////////////////////////////
35 + // -------------------------------------------------------------------------------------------------------------
125 36 // Filters
126 - ////////////////////////////////////////////////////////////////////////////////////////////////////////////////
37 + // -------------------------------------------------------------------------------------------------------------
127 38 ?><div><?php //Required for bottom border radius in container
128 39
129 - ?><div class="ui_container ui_container_toolbar ui_container_filters ui_container_filter_row_1" style="<?php echo ( $selected_tab == 'filters' ) ? 'display: flex' : 'display: none' ?>;"><?php
40 + ?><div class="ui_container ui_container_toolbar ui_container_filters ui_container_filter_row_1" style="display: flex;background: transparent;padding: 6px 0;border: 0;"><?php
130 41
131 42 ?><div class="ui_group ui_group__dates_status ui_search_fields_group_1"><?php // array( 'class' => 'group_nowrap' ) // Elements at Several or One Line
132 43
133 44 wpbc_ajx__ui__booked_dates( $escaped_search_request_params, $default_param_values );
@@ -137,11 +48,21 @@
137 48 ?></div><?php
138 49
139 50 ?><div class="ui_group ui_group__keyword ui_search_fields_group_2"><?php // array( 'class' => 'group_nowrap' ) // Elements at Several or One Line
140 51
141 - wpbc_ajx_toolbar_keyword_search( $escaped_search_request_params, $default_param_values );
52 + wpbc_ajx__ui__booking_resources( $escaped_search_request_params, $default_param_values );
53 +
54 + /**
55 + * Render extension filters after the Booking Resource selector.
56 + *
57 + * @param array<string,mixed> $escaped_search_request_params Sanitized current filter values.
58 + * @param array<string,mixed> $default_param_values Default filter values.
59 + */
60 + do_action( 'wpbc_booking_listing_toolbar_after_resources', $escaped_search_request_params, $default_param_values );
61 +
62 + wpbc_ajx_toolbar_keyword_search( $escaped_search_request_params, $default_param_values );
142 63
143 - wpbc_ajx_toolbar_clear_keyword_search( $escaped_search_request_params, $default_param_values ); //FixIn: 9.7.2.3
64 + wpbc_ajx_toolbar_clear_keyword_search( $escaped_search_request_params, $default_param_values ); // FixIn: 9.7.2.3.
144 65
145 66 wpbc_ajx_toolbar_force_reload_button( $escaped_search_request_params, $default_param_values );
146 67
147 68 ?></div><?php
@@ -148,14 +69,14 @@
148 69
149 70 ?></div><?php
150 71
151 72
152 - ?><div class="ui_container ui_container_toolbar ui_container_small ui_container_filters ui_container_filter_row_2" style="<?php echo ( $selected_tab == 'filters' ) ? 'display: flex' : 'display: none' ?>;"><?php
73 + ?><div class="ui_container ui_container_toolbar ui_container_small ui_container_filters ui_container_filter_row_2" style="display: flex;background: transparent;padding: 6px 0;border: 0;"><?php
153 74
154 75 ?><div class="ui_group ui_group__statuses ui_search_fields_group_1"><?php // array( 'class' => 'group_nowrap' ) // Elements at Several or One Line
155 76
156 - wpbc_ajx__ui__booking_resources( $escaped_search_request_params, $default_param_values );
157 77
78 +
158 79 wpbc_ajx__ui__existing_or_trash( $escaped_search_request_params, $default_param_values );
159 80
160 81 wpbc_ajx__ui__all_or_new( $escaped_search_request_params, $default_param_values );
161 82
@@ -173,185 +94,18 @@
173 94
174 95 ?></div><?php //Required for bottom border radius in container
175 96
176 97
177 - // <editor-fold defaultstate="collapsed" desc=" A c t i o n s t o o l b a r " >
178 -
179 - ////////////////////////////////////////////////////////////////////////////////////////////////////////////////
180 - // Actions
181 - ////////////////////////////////////////////////////////////////////////////////////////////////////////////////
182 -
183 - ?><div class="ui_container ui_container_toolbar ui_container_small ui_container_actions ui_container_actions_row_1" style="<?php echo ( $selected_tab == 'actions' ) ? 'display: flex' : 'display: none' ?>;"><?php
184 -
185 - ?><div class="ui_group"><?php
186 -
187 - // Approve // Pending
188 - ?><div class="ui_element hide_button_if_no_selection"><?php
189 - wpbc_ajx__ui__action_button__approve( $escaped_search_request_params );
190 - wpbc_ajx__ui__action_button__pending( $escaped_search_request_params );
191 - ?></div><?php
192 -
193 - // Trash / Reject // Restore // Delete
194 - ?><div class="ui_element hide_button_if_no_selection"><?php
195 - wpbc_ajx__ui__action_button__trash( $escaped_search_request_params );
196 - wpbc_ajx__ui__action_button__restore( $escaped_search_request_params );
197 - wpbc_ajx__ui__action_button__delete( $escaped_search_request_params );
198 - wpbc_ajx__ui__action_text__delete_reason( $escaped_search_request_params );
199 - ?></div><?php
200 -
201 - // Empty Trash
202 - ?><div class="ui_element"><?php
203 - wpbc_ajx__ui__action_button__empty_trash( $escaped_search_request_params );
204 - ?></div><?php
205 -
206 - // Read All // Read // Unread
207 - ?><div class="ui_element"><?php
208 - wpbc_ajx__ui__action_button__readall( $escaped_search_request_params );
209 - wpbc_ajx__ui__action_button__read( $escaped_search_request_params );
210 - wpbc_ajx__ui__action_button__unread( $escaped_search_request_params );
211 - ?></div><?php
212 -
213 - // Print
214 - ?><div class="ui_element"><?php
215 - wpbc_ajx__ui__action_button__print( $escaped_search_request_params );
216 - ?></div><?php
217 -
218 - // Import
219 - ?><div class="ui_element"><?php
220 - wpbc_ajx__ui__action_button__import( $escaped_search_request_params );
221 - ?></div><?php
222 -
223 - // Export page to CSV // Export all pages to CSV
224 - ?><div class="ui_element"><?php
225 - wpbc_ajx__ui__action_button__export_csv( $escaped_search_request_params );
226 - // wpbc_ajx__ui__action_button__export_csv_page( $escaped_search_request_params );
227 - // wpbc_ajx__ui__action_button__export_csv_all( $escaped_search_request_params );
228 - ?></div><?php
229 -
230 - ?></div><?php
231 -
232 - ?></div><?php
233 - // </editor-fold>
234 -
235 -
236 - // <editor-fold defaultstate="collapsed" desc=" O p t i o n s t o o l b a r " >
237 -
238 - ////////////////////////////////////////////////////////////////////////////////////////////////////////////////
239 - // Options
240 - ////////////////////////////////////////////////////////////////////////////////////////////////////////////////
241 - if ( class_exists( 'wpdev_bk_personal' ) ) { //FixIn: 9.6.1.5
242 - ?><div class="ui_container ui_container_toolbar ui_container_small ui_container_options ui_container_options_row_1" style="<?php echo ( $selected_tab == 'options' ) ? 'display: flex' : 'display: none' ?>;"><?php
243 -
244 - ?><div class="ui_group"><?php
245 -
246 - /*
247 - // Is send Emails //FixIn: 9.6.1.5
248 - ?><div class="ui_element"><?php
249 - wpbc_ajx__ui__options_checkbox__send_emails( $escaped_search_request_params, $default_param_values );
250 - ?></div><?php
251 - */
252 -
253 - if ( class_exists( 'wpdev_bk_personal' ) ) {
254 - // Is Expand Notes
255 - ?><div class="ui_element"><?php
256 -
257 - wpbc_ajx__ui__options_checkbox__is_expand_remarks( $escaped_search_request_params, $default_param_values );
258 -
259 - ?></div><?php
260 - }
261 -
262 - ?></div><?php
263 -
264 - ?></div><?php
265 - }
266 - // </editor-fold>
267 -
268 98 ?></div><?php
269 99 }
270 100
271 -/**
272 - * Sorting
273 - *
274 - * @param $escaped_search_request_params - escaped search request parameters array
275 - * @param $defaults - default parameters values
276 - */
277 -function wpbc_ajx__ui__booking_sorting( $escaped_search_request_params, $defaults ){
278 101
279 - $params_addon = array(
280 - 'type' => 'span'
281 - , 'html' => ''// '<i class="menu_icon icon-1x wpbc_icn_event"></i>' //'<strong>' . __( 'Dates', 'booking ' ) . '</strong>'
282 - , 'icon' => array( 'icon_font' => 'wpbc_icn_swap_vert', 'position' => 'right', 'icon_img' => '' )
283 - , 'class' => 'wpbc_ui_button inactive'
284 - , 'style' => ''
285 - , 'attr' => array()
286 - );
287 102
288 - $select_options = array (
289 - 'booking_id__asc' => __( 'ID', 'booking' ) . ' <i class="menu_icon icon-1x wpbc-bi-arrow-up-short"></i>',
290 - 'booking_id__desc' => __( 'ID', 'booking' ) . ' <i class="menu_icon icon-1x wpbc-bi-arrow-down-short"></i>',
291 - 'divider1' => array( 'type' => 'html', 'html' => '<hr/>' ),
292 - 'dates__asc' => __( 'Dates', 'booking' ) . ' <i class="menu_icon icon-1x wpbc-bi-arrow-up-short"></i>',
293 - 'dates__desc' => __( 'Dates', 'booking' ) . ' <i class="menu_icon icon-1x wpbc-bi-arrow-down-short"></i>',
294 - );
295 - if ( class_exists( 'wpdev_bk_personal' ) ) {
296 - $select_options['divider2'] = array( 'type' => 'html', 'html' => '<hr/>' );
297 - $select_options['resource__asc'] = __( 'Resource', 'booking' ) . ' <i class="menu_icon icon-1x wpbc-bi-arrow-up-short"></i>';
298 - $select_options['resource__desc'] = __( 'Resource', 'booking' ) . ' <i class="menu_icon icon-1x wpbc-bi-arrow-down-short"></i>';
299 -
300 - }
301 - if ( class_exists( 'wpdev_bk_biz_s' ) ) {
302 - $select_options['divider3'] = array( 'type' => 'html', 'html' => '<hr/>' );
303 - $select_options['cost__asc'] = __( 'Cost', 'booking' ) . ' <i class="menu_icon icon-1x wpbc-bi-arrow-up-short"></i>';
304 - $select_options['cost__desc'] = __( 'Cost', 'booking' ) . ' <i class="menu_icon icon-1x wpbc-bi-arrow-down-short"></i>';
305 - }
306 -
307 - $params = array(
308 - 'id' => 'wh_sort'
309 - , 'default' => isset( $escaped_search_request_params['wh_sort'] ) ? $escaped_search_request_params['wh_sort'] : $defaults['wh_sort']
310 - , 'label' => ''//__('Sort by', 'booking') . ':'
311 - , 'title' => __('Sort by', 'booking')
312 - , 'hint' => array( 'title' => __('Sort bookings by' ,'booking') , 'position' => 'top' )
313 - , 'li_options' => $select_options
314 - );
315 -
316 - ?><div class="wpbc_ajx_toolbar wpbc_buttons_row">
317 - <div class="ui_container ui_container_small">
318 - <div class="ui_group">
319 - <div class="ui_element"><?php
320 -
321 - //wpbc_flex_addon( $params_addon );
322 -
323 - wpbc_flex_dropdown( $params );
324 -
325 - ?></div></div></div></div><?php
326 -}
327 -
328 -
329 -/**
330 - * Is email sending option - loacted inside of the page -- under the toolbar
331 - *
332 - * @param $escaped_search_request_params - escaped search request parameters array
333 - * @param $defaults - default parameters values
334 - */
335 -function wpbc_ajx__ui__booking__no_toolbar__is_email_sending( $escaped_search_request_params, $defaults ) { //FixIn: 9.6.1.5
336 -
337 - ?><div class="wpbc_ajx_toolbar wpbc_no_borders wpbc_not_toolbar_is_send_emails"><?php
338 - ?><div class="ui_container ui_container_micro"><?php
339 - ?><div class="ui_group"><?php
340 - ?><div class="ui_element"><?php
341 - wpbc_ajx__ui__options_checkbox__send_emails( $escaped_search_request_params, $defaults );
342 - ?></div><?php
343 - ?></div><?php
344 - ?></div><?php
345 - ?></div><?php
346 -}
347 -
348 -
349 103 // <editor-fold defaultstate="collapsed" desc=" T o o l b a r F i l t e r B u t t o n s " >
350 104
351 -////////////////////////////////////////////////////////////////////////////////
105 +// ---------------------------------------------------------------------------------------------------------------------
352 106 /// 1st row
353 -////////////////////////////////////////////////////////////////////////////////
107 +// ---------------------------------------------------------------------------------------------------------------------
354 108
355 109 /**
356 110 * Booked dates
357 111 *
@@ -361,9 +115,9 @@
361 115 function wpbc_ajx__ui__booked_dates( $escaped_search_request_params, $defaults ){
362 116
363 117 $params_addon = array(
364 118 'type' => 'span'
365 - , 'html' => ''// '<i class="menu_icon icon-1x wpbc_icn_event"></i>' //'<strong>' . __( 'Dates', 'booking ' ) . '</strong>'
119 + , 'html' => ''// '<i class="menu_icon icon-1x wpbc_icn_event"></i>' //'<strong>' . esc_html__( 'Dates', 'booking ' ) . '</strong>'
366 120 , 'icon' => array( 'icon_font' => 'wpbc_icn_event', 'position' => 'right', 'icon_img' => '' )
367 121 , 'class' => 'wpbc_ui_button inactive'
368 122 , 'style' => ''
369 123 , 'hint' => array( 'title' => __('Filter bookings by booking dates' ,'booking') , 'position' => 'top' )
@@ -455,9 +209,9 @@
455 209 // , 'onfocus' => "jQuery('#ui_wh_booking_date_radio_3').prop('checked', true);" // JavaScript code
456 210 //, 'onchange' => "console.log( 'ON CHANGE:', jQuery( this ).is(':checked') , 'in element:' , jQuery( this ) );" // JavaScript code
457 211 )
458 212 , array( 'type' => 'html', 'html' => '</div>' )
459 - //FixIn: 9.7.2.2
213 + // FixIn: 9.7.2.2.
460 214 , array( 'type' => 'html', 'html' => '<div class="ui_element" style="flex-flow: row wrap;padding:0;flex: 0 1 14px;order: 2;">' )
461 215 , array(
462 216 'type' => 'button'
463 217 , 'title' => '' // Title of the button
@@ -759,9 +513,9 @@
759 513 function wpbc_ajx__ui__booking_status( $escaped_search_request_params, $defaults ){
760 514
761 515 $params_addon = array(
762 516 'type' => 'span'
763 - , 'html' => ''// '<i class="menu_icon icon-1x wpbc_icn_event"></i>' //'<strong>' . __( 'Dates', 'booking ' ) . '</strong>'
517 + , 'html' => ''// '<i class="menu_icon icon-1x wpbc_icn_event"></i>' //'<strong>' . esc_html__( 'Dates', 'booking ' ) . '</strong>'
764 518 , 'icon' => array( 'icon_font' => 'wpbc_icn_done_all', 'position' => 'right', 'icon_img' => '' )
765 519 , 'class' => 'wpbc_ui_button inactive'
766 520 , 'style' => ''
767 521 , 'attr' => array()
@@ -808,10 +562,11 @@
808 562
809 563 $default_value = '';
810 564
811 565 // Old way of searching booking ID
566 + // phpcs:ignore WordPress.Security.NonceVerification.Recommended, WordPress.Security.NonceVerification.Missing
812 567 if ( ! empty( $_REQUEST['wh_booking_id'] ) ) {
813 - $wh_booking_id = intval( $_REQUEST['wh_booking_id'] );
568 + $wh_booking_id = intval( $_REQUEST['wh_booking_id'] ); // phpcs:ignore WordPress.Security.NonceVerification.Recommended, WordPress.Security.NonceVerification.Missing
814 569 if ( $wh_booking_id > 0 ) {
815 570 $_REQUEST['overwrite'] = 1;
816 571 $_REQUEST['keyword'] = 'id:' . $wh_booking_id;
817 572 }
@@ -816,12 +571,14 @@
816 571 $_REQUEST['keyword'] = 'id:' . $wh_booking_id;
817 572 }
818 573 }
819 574
575 + // phpcs:ignore WordPress.Security.NonceVerification.Recommended, WordPress.Security.NonceVerification.Missing
820 576 if ( ( ! empty( $_REQUEST['overwrite'] ) ) && ( ! empty( $_REQUEST['keyword'] ) ) ) {
821 577
822 - // Searching for booking(s) from URL: http://beta/wp-admin/admin.php?page=wpbc&view_mode=vm_booking_listing&keyword=id:2&overwrite=1
578 + // Searching for booking(s) from URL: http://beta/wp-admin/admin.php?page=wpbc&tab=vm_booking_listing&keyword=id:2&overwrite=1 .
823 579
580 + // phpcs:ignore WordPress.Security.NonceVerification.Recommended, WordPress.Security.NonceVerification.Missing, WordPress.Security.ValidatedSanitizedInput.InputNotValidated, WordPress.Security.ValidatedSanitizedInput.MissingUnslash, WordPress.Security.ValidatedSanitizedInput.InputNotSanitized
824 581 $default_value = wpbc_sanitize_text( $_REQUEST['keyword'] );
825 582
826 583 ?><script type="text/javascript">
827 584 jQuery( document ).ready( function (){
@@ -827,26 +584,26 @@
827 584 jQuery( document ).ready( function (){
828 585 // setTimeout( function () {
829 586 // wpbc_ajx_booking_listing.search_set_param( 'wh_booking_type', [0] );
830 587 // }, 950 );
831 - wpbc_ajx_booking_searching_after_few_seconds( '#<?php echo $el_id; ?>', 1000 ); // Immediate search after 0.5 second
588 + wpbc_ajx_booking_searching_after_few_seconds( '#<?php echo esc_attr( $el_id ); ?>', 1000 ); // Immediate search after 0.5 second
832 589 } );
833 590 </script><?php
834 591 }
835 592
836 - $params = array(
837 - 'type' => 'text'
838 - , 'id' => $el_id
839 - , 'name' => $el_id
840 - , 'label' => ''
841 - , 'disabled' => false
842 - , 'class' => ''
843 - , 'style' => ''
844 - , 'placeholder' => __( 'Enter keyword to search...', 'booking' )
845 - , 'attr' => array()
846 - , 'value' => $default_value
847 - , 'onfocus' => ''
848 - );
593 + $params = array(
594 + 'type' => 'text',
595 + 'id' => $el_id,
596 + 'name' => $el_id,
597 + 'label' => '',
598 + 'disabled' => false,
599 + 'class' => '',
600 + 'style' => '',
601 + 'placeholder' => __( 'Enter keyword to search...', 'booking' ),
602 + 'attr' => array(),
603 + 'value' => $default_value,
604 + 'onfocus' => '',
605 + );
849 606 ?><div class="ui_element"><?php
850 607 wpbc_flex_text( $params );
851 608 ?></div><?php
852 609 }
@@ -851,9 +608,9 @@
851 608 ?></div><?php
852 609 }
853 610
854 611
855 -//FixIn: 9.7.2.3
612 +// FixIn: 9.7.2.3.
856 613 function wpbc_ajx_toolbar_clear_keyword_search( $escaped_search_request_params, $defaults ){
857 614
858 615 $params = array(
859 616 'type' => 'button' ,
@@ -914,11 +671,11 @@
914 671 wpbc_flex_button( $params );
915 672 ?></div><?php
916 673 }
917 674
918 -////////////////////////////////////////////////////////////////////////////////
675 +// ---------------------------------------------------------------------------------------------------------------------
919 676 /// 2nd row
920 -////////////////////////////////////////////////////////////////////////////////
677 +// ---------------------------------------------------------------------------------------------------------------------
921 678
922 679 /**
923 680 * Booking resources
924 681 *
@@ -930,8 +687,12 @@
930 687 if ( ! class_exists( 'wpdev_bk_personal' ) ) {
931 688 return false;
932 689 }
933 690
691 + wpbc_bo_listing__resource_choosen( $escaped_search_request_params, $defaults );
692 +
693 + return; //TODO: 2025-04-29 relpace it.
694 +
934 695 $params_button = array(
935 696 'type' => 'button' ,
936 697 'title' => '',//__( 'Reset', 'booking' ) . '&nbsp;&nbsp;', // Title of the button
937 698 'hint' => array( 'title' => __( 'Remove all booking resources', 'booking' ), 'position' => 'top' ), // Hint
@@ -992,9 +753,9 @@
992 753 import = null
993 754 */
994 755 $resources_arr = wpbc_ajx_arrange_booking_resources_arr( $resources_sql_arr );
995 756 $style = '';
996 - $select_box_options = array(); //FixIn: 4.3.2.1
757 + $select_box_options = array(); // FixIn: 4.3.2.1.
997 758 if ( ! empty( $resources_arr ) ) {
998 759
999 760 $linear_resources_arr = $resources_arr['linear_resources'];
1000 761
@@ -1008,9 +769,9 @@
1008 769 }
1009 770
1010 771 $select_box_options[ /*implode( ',', $resources_id_arr )*/0 ] = array(
1011 772 'title' => __( 'All resources', 'booking' )
1012 - , 'attr' => array( 'title' => '<strong>' . __( 'All resources', 'booking' ) . '</strong>' )
773 + , 'attr' => array( 'title' => '<strong>' . esc_html__( 'All resources', 'booking' ) . '</strong>' )
1013 774 , 'style' => 'font-weight:600;'
1014 775 );
1015 776 }
1016 777
@@ -1041,9 +802,9 @@
1041 802 $params_select = array(
1042 803 'id' => $el_id // HTML ID of element
1043 804 , 'name' => $el_id
1044 805 , 'label' => '' // __( 'Next Days', 'booking' ) // Label (optional)
1045 - , 'style' => '' // CSS of select element
806 + , 'style' => 'display:none;' // CSS of select element
1046 807 , 'class' => 'chzn-select' // CSS Class of select element
1047 808 , 'multiple' => true
1048 809 , 'attr' => array( 'data-placeholder' => __( 'Select booking resources', 'booking' ) ) // Any additional attributes, if this radio | checkbox element
1049 810 , 'disabled' => false
@@ -1067,45 +828,50 @@
1067 828
1068 829 ?><script type="text/javascript">
1069 830 function remove_all_options_from_choozen( selectbox_id ){
1070 831 jQuery( selectbox_id + ' option' ).prop( 'selected', false ); // Disable selection in the real selectbox
1071 - jQuery( selectbox_id ).trigger( 'chosen:updated' ); // Remove all fields from the Choozen field //FixIn: 8.7.9.9
832 + jQuery( selectbox_id ).trigger( 'chosen:updated' ); // Remove all fields from the Choozen field // FixIn: 8.7.9.9.
1072 833 jQuery( selectbox_id ).trigger( 'change' );
1073 834 }
835 + <?php
836 + // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
837 + echo wpbc_jq_ready_start();
838 + ?>
839 + if ( 'function' === typeof( jQuery("#<?php echo esc_attr( $el_id ); ?>").chosen ) ) {
1074 840
1075 - if ( 'function' === typeof( jQuery("#<?php echo $el_id; ?>").chosen ) ) {
841 + jQuery( "#<?php echo esc_attr( $el_id ); ?>" ).chosen( {no_results_text: "No results matched"} );
1076 842
1077 - jQuery( "#<?php echo $el_id; ?>" ).chosen( {no_results_text: "No results matched"} );
843 + jQuery("#<?php echo esc_attr( $el_id ); ?>").chosen().on('change', function(va){ // Catch any selections in the Choozen
1078 844
1079 - jQuery("#<?php echo $el_id; ?>").chosen().on('change', function(va){ // Catch any selections in the Choozen
1080 -
1081 - if ( jQuery( "#<?php echo $el_id; ?>" ).val() != null ){
845 + if ( jQuery( "#<?php echo esc_attr( $el_id ); ?>" ).val() != null ){
1082 846 //So we are having aready values
1083 - jQuery.each( jQuery( "#<?php echo $el_id; ?>" ).val(), function ( index, value ){
847 + jQuery.each( jQuery( "#<?php echo esc_attr( $el_id ); ?>" ).val(), function ( index, value ){
1084 848
1085 849 if ( (value.indexOf( ',' ) > 0) || ('0' === value) ){ // Ok we are have array with all booking resources ID
1086 850
1087 851 // Disable selection in the real selectbox
1088 - jQuery( '#<?php echo $el_id; ?>' + ' option' ).removeAttr( 'selected' );
852 + jQuery( '#<?php echo esc_attr( $el_id ); ?>' + ' option' ).removeAttr( 'selected' );
1089 853
1090 854 // Select "All resources" option in real selectbox
1091 - jQuery( '#<?php echo $el_id; ?>' + ' option:first-child' ).prop( "selected", true );
855 + jQuery( '#<?php echo esc_attr( $el_id ); ?>' + ' option:first-child' ).prop( "selected", true );
1092 856
1093 857 //Highlight options in chosen, before removing
1094 - jQuery( '#<?php echo $el_id; ?>_chosen li.search-choice:not(:contains(' + '<?php echo html_entity_decode( esc_js( __( 'All resources', 'booking' ) ) ); ?>' + '))' )
1095 - .fadeOut( 350 ).fadeIn( 300 )
1096 - .fadeOut( 350 ).fadeIn( 400 )
1097 - .fadeOut( 350 ).fadeIn( 300 )
1098 - .fadeOut( 350 ).fadeIn( 400 )
1099 - .animate( {opacity: 1}, 4000 ) ;
858 + jQuery('#<?php echo esc_attr( $el_id ); ?>_chosen li.search-choice:not(:contains(' + '<?php
859 + // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
860 + echo html_entity_decode( esc_js( __( 'All resources', 'booking' ) ) ); ?>' + '))')
861 + .fadeOut(350).fadeIn(300)
862 + .fadeOut(350).fadeIn(400)
863 + .fadeOut(350).fadeIn(300)
864 + .fadeOut(350).fadeIn(400)
865 + .animate({opacity: 1}, 4000);
1100 866
1101 867 // Update chosen LI choices, relative selected options in selectbox
1102 868 var all_resources_timer = setTimeout( function (){
1103 869
1104 - jQuery( '#<?php echo $el_id; ?>' ).trigger( 'chosen:updated' ); // Remove all fields from the Choozen field
870 + jQuery( '#<?php echo esc_attr( $el_id ); ?>' ).trigger( 'chosen:updated' ); // Remove all fields from the Choozen field
1105 871 }, 2000 );
1106 872
1107 - var my_message = '<?php echo html_entity_decode( esc_js( __( 'Please note, its not possible to add new resources, if "All resources" option is selected. Please clear the selection, then add new resources.', 'booking' ) ), ENT_QUOTES ); ?>';
873 + var my_message = '<?php echo esc_js( __( 'Please note, its not possible to add new resources, if "All resources" option is selected. Please clear the selection, then add new resources.', 'booking' ) ); ?>';
1108 874 wpbc_admin_show_message( my_message, 'warning', 10000 );
1109 875 }
1110 876 } );
1111 877 }
@@ -1113,8 +879,12 @@
1113 879
1114 880 } else {
1115 881 alert( 'WPBC Error. JavaScript library "chosen" was not defined.' );
1116 882 }
883 + <?php
884 + // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
885 + echo wpbc_jq_ready_end();
886 + ?>
1117 887 </script><?php
1118 888 }
1119 889
1120 890 /**
@@ -1126,9 +896,9 @@
1126 896 function wpbc_ajx__ui__existing_or_trash( $escaped_search_request_params, $defaults ){
1127 897
1128 898 $params_addon = array(
1129 899 'type' => 'span'
1130 - , 'html' => ''// '<i class="menu_icon icon-1x wpbc_icn_event"></i>' //'<strong>' . __( 'Dates', 'booking ' ) . '</strong>'
900 + , 'html' => ''// '<i class="menu_icon icon-1x wpbc_icn_event"></i>' //'<strong>' . esc_html__( 'Dates', 'booking ' ) . '</strong>'
1131 901 , 'icon' => array( 'icon_font' => 'wpbc_icn_delete_outline', 'position' => 'right', 'icon_img' => '' )
1132 902 , 'class' => 'wpbc_ui_button inactive'
1133 903 , 'style' => ''
1134 904 , 'attr' => array()
@@ -1171,9 +941,9 @@
1171 941 function wpbc_ajx__ui__all_or_new( $escaped_search_request_params, $defaults ){
1172 942
1173 943 $params_addon = array(
1174 944 'type' => 'span'
1175 - , 'html' => ''// '<i class="menu_icon icon-1x wpbc_icn_event"></i>' //'<strong>' . __( 'Dates', 'booking ' ) . '</strong>'
945 + , 'html' => ''// '<i class="menu_icon icon-1x wpbc_icn_event"></i>' //'<strong>' . esc_html__( 'Dates', 'booking ' ) . '</strong>'
1176 946 , 'icon' => array( 'icon_font' => 'wpbc_icn_visibility', 'position' => 'right', 'icon_img' => '' )
1177 947 , 'class' => 'wpbc_ui_button inactive'
1178 948 , 'style' => ''
1179 949 , 'attr' => array()
@@ -1222,9 +992,9 @@
1222 992 function wpbc_ajx__ui__creation_date( $escaped_search_request_params, $defaults ){
1223 993
1224 994 $params_addon = array(
1225 995 'type' => 'span'
1226 - , 'html' => ''// '<i class="menu_icon icon-1x wpbc_icn_event"></i>' //'<strong>' . __( 'Dates', 'booking ' ) . '</strong>'
996 + , 'html' => ''// '<i class="menu_icon icon-1x wpbc_icn_event"></i>' //'<strong>' . esc_html__( 'Dates', 'booking ' ) . '</strong>'
1227 997 , 'icon' => array( 'icon_font' => 'wpbc_icn_edit_calendar', 'position' => 'right', 'icon_img' => '' )
1228 998 , 'class' => 'wpbc_ui_button inactive'
1229 999 , 'style' => ''
1230 1000 , 'attr' => array()
@@ -1341,9 +1111,9 @@
1341 1111 , 'style' => 'width:100%;' // CSS of select element
1342 1112 , 'class' => 'wpdevbk-filters-section-calendar' // CSS Class of select element
1343 1113 , 'disabled' => false
1344 1114 , 'attr' => array() // Any additional attributes, if this radio | checkbox element
1345 - , 'placeholder' => __('From' ,'booking') // date( 'Y-m-d' )
1115 + , 'placeholder' => __('From' ,'booking') // gmdate( 'Y-m-d' )
1346 1116 , 'value' => $request_input_el_default[ 'ui_wh_modification_date_checkin'] // Some Value from optins array that selected by default
1347 1117 , 'onfocus' => "jQuery('#ui_wh_modification_date_radio_3').prop('checked', true);" // JavaScript code
1348 1118 //, 'onchange' => "console.log( 'ON CHANGE:', jQuery( this ).is(':checked') , 'in element:' , jQuery( this ) );" // JavaScript code
1349 1119 )
@@ -1357,9 +1127,9 @@
1357 1127 , 'style' => 'width:100%;' // CSS of select element
1358 1128 , 'class' => 'wpdevbk-filters-section-calendar' // CSS Class of select element
1359 1129 , 'disabled' => false
1360 1130 , 'attr' => array() // Any additional attributes, if this radio | checkbox element
1361 - , 'placeholder' => __('To' ,'booking') // date( 'Y-m-d' )
1131 + , 'placeholder' => __('To' ,'booking') // gmdate( 'Y-m-d' )
1362 1132 , 'value' => $request_input_el_default[ 'ui_wh_modification_date_checkout'] // Some Value from optins array that selected by default
1363 1133 , 'onfocus' => "jQuery('#ui_wh_modification_date_radio_3').prop('checked', true);" // JavaScript code
1364 1134 //, 'onchange' => "console.log( 'ON CHANGE:', jQuery( this ).is(':checked') , 'in element:' , jQuery( this ) );" // JavaScript code
1365 1135 )
@@ -1454,9 +1224,9 @@
1454 1224 }
1455 1225
1456 1226 $params_addon = array(
1457 1227 'type' => 'span'
1458 - , 'html' => ''// '<i class="menu_icon icon-1x wpbc_icn_event"></i>' //'<strong>' . __( 'Dates', 'booking ' ) . '</strong>'
1228 + , 'html' => ''// '<i class="menu_icon icon-1x wpbc_icn_event"></i>' //'<strong>' . esc_html__( 'Dates', 'booking ' ) . '</strong>'
1459 1229 , 'icon' => array( 'icon_font' => 'wpbc_icn_payments', 'position' => 'right', 'icon_img' => '' )
1460 1230 , 'class' => 'wpbc_ui_button inactive'
1461 1231 , 'style' => ''
1462 1232 , 'attr' => array()
@@ -1515,9 +1285,9 @@
1515 1285 , 'style' => 'max-width:100%;width:100%;' // CSS of select element
1516 1286 , 'class' => '' // CSS Class of select element
1517 1287 , 'disabled' => false
1518 1288 , 'attr' => array() // Any additional attributes, if this radio | checkbox element
1519 - , 'placeholder' => __('Payment status' ,'booking') // date( 'Y-m-d' )
1289 + , 'placeholder' => __('Payment status' ,'booking') // gmdate( 'Y-m-d' )
1520 1290 , 'value' => $request_input_el_default[ 'ui_wh_pay_status_custom'] // Some Value from optins array that selected by default
1521 1291 , 'onfocus' => "jQuery('#ui_wh_pay_status_radio_1').prop('checked', true);" // JavaScript code
1522 1292 //, 'onchange' => "console.log( 'ON CHANGE:', jQuery( this ).is(':checked') , 'in element:' , jQuery( this ) );" // JavaScript code
1523 1293 )
@@ -1613,9 +1383,9 @@
1613 1383
1614 1384 $params = array(
1615 1385 'id' => $el_id // HTML ID of element
1616 1386 , 'name' => $el_id
1617 - , 'label' => '<span class="" style="font-weight:600;">' . __( 'Cost', 'booking' ) . ' <em style="color:#888;">(' . __( 'min-max', 'booking' ) . '):</em></span>'
1387 + , 'label' => '<span class="" style="font-weight:600;">' . esc_html__( 'Cost', 'booking' ) . ' <em style="color:#888;">(' . esc_html__( 'min-max', 'booking' ) . '):</em></span>'
1618 1388 , 'style' => 'max-width: 69px;' // CSS of select element
1619 1389 , 'class' => '' // CSS Class of select element
1620 1390 , 'disabled' => false
1621 1391 , 'attr' => array() // Any additional attributes, if this radio | checkbox element
@@ -1668,13 +1438,13 @@
1668 1438 'hint' => array( 'title' => __( 'Reload bookings listing', 'booking' ), 'position' => 'top' ), // Hint
1669 1439 'link' => 'javascript:void(0)', // Direct link or skip it
1670 1440 'action' => "wpbc_ajx_booking_send_search_request_with_params( { } );", // Some JavaScript
1671 1441 'icon' => array(
1672 - 'icon_font' => 'wpbc_icn_rotate_right wpbc_spin', //'wpbc_icn_rotate_left',
1442 + 'icon_font' => 'wpbc_icn_refresh wpbc_spin', //'wpbc_icn_rotate_left',
1673 1443 'position' => 'left',
1674 1444 'icon_img' => ''
1675 1445 ),
1676 - 'class' => 'wpbc_ui_button wpbc_ui_button_primary', // '' | 'wpbc_ui_button_primary'
1446 + 'class' => 'wpbc_ui_button wpbc_ui_button_primary0', // '' | 'wpbc_ui_button_primary'
1677 1447 'style' => '', // Any CSS class here
1678 1448 'mobile_show_text' => true, // Show or hide text, when viewing on Mobile devices (small window size).
1679 1449 'attr' => array( 'id' => 'wpbc_booking_listing_reload_button')
1680 1450 );
@@ -1686,2356 +1456,12 @@
1686 1456
1687 1457 // </editor-fold>
1688 1458
1689 1459
1690 -// <editor-fold defaultstate="collapsed" desc=" T o o l b a r A c t i o n B u t t o n s " >
1691 1460
1692 -////////////////////////////////////////////////////////////////////////////////
1693 -// T o o l b a r A C T I O N S UI elements
1694 -////////////////////////////////////////////////////////////////////////////////
1695 -
1696 - function wpbc_ajx__ui__action_button__approve( $escaped_search_request_params ){
1697 -
1698 - $booking_action = 'set_booking_approved';
1699 -
1700 - $el_id = 'ui_btn_' . $booking_action;
1701 -
1702 - if ( ! wpbc_is_user_can( $booking_action, wpbc_get_current_user_id() ) ) {
1703 - return false;
1704 - }
1705 -
1706 - $params = array(
1707 - 'type' => 'button' ,
1708 - 'title' => __( 'Approve', 'booking' ) . '&nbsp;&nbsp;', // Title of the button
1709 - 'hint' => array( 'title' => __( 'Approve selected bookings', 'booking' ), 'position' => 'top' ), // Hint
1710 - 'link' => 'javascript:void(0)', // Direct link or skip it
1711 - 'action' => "wpbc_ajx_booking_ajax_action_request( {
1712 - 'booking_action' : '{$booking_action}',
1713 - 'booking_id' : wpbc_get_selected_row_id(),
1714 - 'reason_of_action' : jQuery( '#reason_of_action' ).val(),
1715 - 'ui_clicked_element_id': '{$el_id}'
1716 - } );
1717 - wpbc_button_enable_loading_icon( this ); " ,
1718 - 'icon' => array(
1719 - 'icon_font' => 'wpbc_icn_check_circle_outline',
1720 - 'position' => 'right',
1721 - 'icon_img' => ''
1722 - ),
1723 - 'class' => 'wpbc_ui_button_primary hide_button_if_no_selection', // '' | 'wpbc_ui_button_primary'
1724 - 'style' => '', // Any CSS class here
1725 - 'mobile_show_text' => true, // Show or hide text, when viewing on Mobile devices (small window size).
1726 - 'attr' => array( 'id' => $el_id )
1727 - );
1728 -
1729 - wpbc_flex_button( $params );
1730 - }
1731 -
1732 - function wpbc_ajx__ui__action_button__pending( $escaped_search_request_params ){
1733 -
1734 - $booking_action = 'set_booking_pending';
1735 -
1736 - $el_id = 'ui_btn_' . $booking_action;
1737 -
1738 - if ( ! wpbc_is_user_can( $booking_action, wpbc_get_current_user_id() ) ) {
1739 - return false;
1740 - }
1741 -
1742 - $params = array(
1743 - 'type' => 'button' ,
1744 - 'title' => __( 'Pending', 'booking' ) . '&nbsp;&nbsp;', // Title of the button
1745 - 'hint' => array( 'title' => __( 'Set selected bookings as pending', 'booking' ), 'position' => 'top' ), // Hint
1746 - 'link' => 'javascript:void(0)', // Direct link or skip it
1747 - 'action' => "if ( wpbc_are_you_sure('" . esc_attr( __( 'Do you really want to set booking as pending ?', 'booking' ) ) . "') ) {
1748 - wpbc_ajx_booking_ajax_action_request( {
1749 - 'booking_action' : '{$booking_action}',
1750 - 'booking_id' : wpbc_get_selected_row_id(),
1751 - 'reason_of_action' : jQuery( '#reason_of_action' ).val(),
1752 - 'ui_clicked_element_id': '{$el_id}'
1753 - } );
1754 - wpbc_button_enable_loading_icon( this );
1755 - }" ,
1756 - 'icon' => array(
1757 - 'icon_font' => 'wpbc_icn_block',
1758 - 'position' => 'right',
1759 - 'icon_img' => ''
1760 - ),
1761 - 'class' => 'hide_button_if_no_selection', // '' | 'wpbc_ui_button_primary'
1762 - 'style' => '', // Any CSS class here
1763 - 'mobile_show_text' => true, // Show or hide text, when viewing on Mobile devices (small window size).
1764 - 'attr' => array( 'id' => $el_id )
1765 - );
1766 -
1767 - wpbc_flex_button( $params );
1768 - }
1769 -
1770 - function wpbc_ajx__ui__action_button__trash( $escaped_search_request_params ){
1771 -
1772 - $booking_action = 'move_booking_to_trash';
1773 -
1774 - $el_id = 'ui_btn_' . $booking_action;
1775 -
1776 - if ( ! wpbc_is_user_can( $booking_action, wpbc_get_current_user_id() ) ) {
1777 - return false;
1778 - }
1779 -
1780 - $params = array(
1781 - 'type' => 'button' ,
1782 - 'title' => __( 'Trash / Reject', 'booking' ) . '&nbsp;&nbsp;', // Title of the button
1783 - 'hint' => array( 'title' => __( 'Reject booking - move selected bookings to trash', 'booking' ), 'position' => 'top' ), // Hint
1784 - 'link' => 'javascript:void(0)', // Direct link or skip it
1785 - 'action' => "if ( wpbc_are_you_sure('" . esc_attr( __( 'Do you really want to do this ?', 'booking' ) ) . "') ) {
1786 - wpbc_ajx_booking_ajax_action_request( {
1787 - 'booking_action' : '{$booking_action}',
1788 - 'booking_id' : wpbc_get_selected_row_id(),
1789 - 'reason_of_action' : jQuery( '#reason_of_action' ).val(),
1790 - 'ui_clicked_element_id': '{$el_id}'
1791 - } );
1792 - wpbc_button_enable_loading_icon( this );
1793 - }" ,
1794 - 'icon' => array(
1795 - 'icon_font' => 'wpbc_icn_delete_outline',
1796 - 'position' => 'right',
1797 - 'icon_img' => ''
1798 - ),
1799 - 'class' => 'hide_button_if_no_selection', // '' | 'wpbc_ui_button_primary'
1800 - 'style' => '', // Any CSS class here
1801 - 'mobile_show_text' => true, // Show or hide text, when viewing on Mobile devices (small window size).
1802 - 'attr' => array( 'id' => $el_id )
1803 - );
1804 -
1805 - wpbc_flex_button( $params );
1806 - }
1807 -
1808 - function wpbc_ajx__ui__action_button__restore( $escaped_search_request_params ){
1809 -
1810 - $booking_action = 'restore_booking_from_trash';
1811 -
1812 - $el_id = 'ui_btn_' . $booking_action;
1813 -
1814 - if ( ! wpbc_is_user_can( $booking_action, wpbc_get_current_user_id() ) ) {
1815 - return false;
1816 - }
1817 -
1818 - $params = array(
1819 - 'type' => 'button' ,
1820 - 'title' => __( 'Restore', 'booking' ) . '&nbsp;&nbsp;', // Title of the button
1821 - 'hint' => array( 'title' => __( 'Restore selected bookings', 'booking' ), 'position' => 'top' ), // Hint
1822 - 'link' => 'javascript:void(0)', // Direct link or skip it
1823 - 'action' => "if ( wpbc_are_you_sure('" . esc_attr( __( 'Do you really want to do this ?', 'booking' ) ) . "') ) {
1824 - wpbc_ajx_booking_ajax_action_request( {
1825 - 'booking_action' : '{$booking_action}',
1826 - 'booking_id' : wpbc_get_selected_row_id(),
1827 - 'reason_of_action' : jQuery( '#reason_of_action' ).val(),
1828 - 'ui_clicked_element_id': '{$el_id}'
1829 - } );
1830 - wpbc_button_enable_loading_icon( this );
1831 - }" ,
1832 - 'icon' => array(
1833 - 'icon_font' => 'wpbc_icn_rotate_left',
1834 - 'position' => 'right',
1835 - 'icon_img' => ''
1836 - ),
1837 - 'class' => 'hide_button_if_no_selection', // '' | 'wpbc_ui_button_primary'
1838 - 'style' => '', // Any CSS class here
1839 - 'mobile_show_text' => true, // Show or hide text, when viewing on Mobile devices (small window size).
1840 - 'attr' => array( 'id' => $el_id )
1841 - );
1842 -
1843 - wpbc_flex_button( $params );
1844 - }
1845 -
1846 - function wpbc_ajx__ui__action_button__delete( $escaped_search_request_params ){
1847 -
1848 - $booking_action = 'delete_booking_completely';
1849 -
1850 - $el_id = 'ui_btn_' . $booking_action;
1851 -
1852 - if ( ! wpbc_is_user_can( $booking_action, wpbc_get_current_user_id() ) ) {
1853 - return false;
1854 - }
1855 -
1856 - $params = array(
1857 - 'type' => 'button' ,
1858 - 'title' => __( 'Delete', 'booking' ) . '&nbsp;&nbsp;', // Title of the button
1859 - 'hint' => array( 'title' => __( 'Delete selected bookings', 'booking' ), 'position' => 'top' ), // Hint
1860 - 'link' => 'javascript:void(0)', // Direct link or skip it
1861 - 'action' => "if ( wpbc_are_you_sure('" . esc_attr( __( 'Do you really want to delete selected booking(s) ?', 'booking' ) ) . "') ) {
1862 - wpbc_ajx_booking_ajax_action_request( {
1863 - 'booking_action' : '{$booking_action}',
1864 - 'booking_id' : wpbc_get_selected_row_id(),
1865 - 'reason_of_action' : jQuery( '#reason_of_action' ).val(),
1866 - 'ui_clicked_element_id': '{$el_id}'
1867 - } );
1868 - wpbc_button_enable_loading_icon( this );
1869 - }" ,
1870 - 'icon' => array(
1871 - 'icon_font' => 'wpbc_icn_close',
1872 - 'position' => 'right',
1873 - 'icon_img' => ''
1874 - ),
1875 - 'class' => 'hide_button_if_no_selection', // '' | 'wpbc_ui_button_primary'
1876 - 'style' => '', // Any CSS class here
1877 - 'mobile_show_text' => true, // Show or hide text, when viewing on Mobile devices (small window size).
1878 - 'attr' => array( 'id' => $el_id )
1879 - );
1880 -
1881 - wpbc_flex_button( $params );
1882 - }
1883 -
1884 - function wpbc_ajx__ui__action_text__delete_reason( $escaped_search_request_params ){
1885 -
1886 - $params = array(
1887 - 'type' => 'text'
1888 - , 'id' => 'reason_of_action'
1889 - , 'name' => 'reason_of_action'
1890 - , 'label' => ''
1891 - , 'disabled' => false
1892 - , 'class' => 'hide_button_if_no_selection'
1893 - , 'style' => ''
1894 - , 'placeholder' => __( 'Reason of action', 'booking' )
1895 - , 'attr' => array()
1896 - , 'value' => ''
1897 - , 'onfocus' => ''
1898 - );
1899 - wpbc_flex_text( $params );
1900 - }
1901 -
1902 - function wpbc_ajx__ui__action_button__readall( $escaped_search_request_params ){
1903 -
1904 - $booking_action = 'set_booking_as_read';
1905 -
1906 - $el_id = 'ui_btn_all_' . $booking_action;
1907 -
1908 - if ( ! wpbc_is_user_can( $booking_action, wpbc_get_current_user_id() ) ) {
1909 - return false;
1910 - }
1911 -
1912 - $params = array(
1913 - 'type' => 'button' ,
1914 - 'title' => __( 'Read All', 'booking' ) . '&nbsp;&nbsp;', // Title of the button
1915 - 'hint' => array( 'title' => __( 'Mark as read all bookings', 'booking' ), 'position' => 'top' ), // Hint
1916 - 'link' => 'javascript:void(0)', // Direct link or skip it
1917 - 'action' => "wpbc_ajx_booking_ajax_action_request( {
1918 - 'booking_action' : '{$booking_action}',
1919 - 'booking_id' : '-1',
1920 - 'reason_of_action' : jQuery( '#reason_of_action' ).val(),
1921 - 'ui_clicked_element_id': '{$el_id}'
1922 - } );
1923 - wpbc_button_enable_loading_icon( this ); " ,
1924 - 'icon' => array(
1925 - 'icon_font' => 'wpbc_icn_disabled_visible',
1926 - 'position' => 'right',
1927 - 'icon_img' => ''
1928 - ),
1929 - 'class' => '', // '' | 'wpbc_ui_button_primary'
1930 - 'style' => '', // Any CSS class here
1931 - 'mobile_show_text' => !true, // Show or hide text, when viewing on Mobile devices (small window size).
1932 - 'attr' => array( 'id' => $el_id )
1933 - );
1934 -
1935 - wpbc_flex_button( $params );
1936 - }
1937 -
1938 - function wpbc_ajx__ui__action_button__read( $escaped_search_request_params ){
1939 -
1940 - $booking_action = 'set_booking_as_read';
1941 -
1942 - $el_id = 'ui_btn_' . $booking_action;
1943 -
1944 - if ( ! wpbc_is_user_can( $booking_action, wpbc_get_current_user_id() ) ) {
1945 - return false;
1946 - }
1947 -
1948 - $params = array(
1949 - 'type' => 'button' ,
1950 - 'title' => __( 'Read', 'booking' ) . '&nbsp;&nbsp;', // Title of the button
1951 - 'hint' => array( 'title' => __( 'Mark as read selected bookings', 'booking' ), 'position' => 'top' ), // Hint
1952 - 'link' => 'javascript:void(0)', // Direct link or skip it
1953 - 'action' => "wpbc_ajx_booking_ajax_action_request( {
1954 - 'booking_action' : '{$booking_action}',
1955 - 'booking_id' : wpbc_get_selected_row_id(),
1956 - 'reason_of_action' : jQuery( '#reason_of_action' ).val(),
1957 - 'ui_clicked_element_id': '{$el_id}'
1958 - } );
1959 - wpbc_button_enable_loading_icon( this ); " ,
1960 - 'icon' => array(
1961 - 'icon_font' => 'wpbc_icn_visibility_off',
1962 - 'position' => 'right',
1963 - 'icon_img' => ''
1964 - ),
1965 - 'class' => 'hide_button_if_no_selection', // '' | 'wpbc_ui_button_primary'
1966 - 'style' => '', // Any CSS class here
1967 - 'mobile_show_text' => !true, // Show or hide text, when viewing on Mobile devices (small window size).
1968 - 'attr' => array( 'id' => $el_id )
1969 - );
1970 -
1971 - wpbc_flex_button( $params );
1972 - }
1973 -
1974 - function wpbc_ajx__ui__action_button__unread( $escaped_search_request_params ){
1975 -
1976 - $booking_action = 'set_booking_as_unread';
1977 -
1978 - $el_id = 'ui_btn_' . $booking_action;
1979 -
1980 - if ( ! wpbc_is_user_can( $booking_action, wpbc_get_current_user_id() ) ) {
1981 - return false;
1982 - }
1983 -
1984 - $params = array(
1985 - 'type' => 'button' ,
1986 - 'title' => __( 'Unread', 'booking' ) . '&nbsp;&nbsp;', // Title of the button
1987 - 'hint' => array( 'title' => __( 'Mark as Unread selected bookings', 'booking' ), 'position' => 'top' ), // Hint
1988 - 'link' => 'javascript:void(0)', // Direct link or skip it
1989 - 'action' => "wpbc_ajx_booking_ajax_action_request( {
1990 - 'booking_action' : '{$booking_action}',
1991 - 'booking_id' : wpbc_get_selected_row_id(),
1992 - 'reason_of_action' : jQuery( '#reason_of_action' ).val(),
1993 - 'ui_clicked_element_id': '{$el_id}'
1994 - } );
1995 - wpbc_button_enable_loading_icon( this ); " ,
1996 - 'icon' => array(
1997 - 'icon_font' => 'wpbc_icn_visibility',
1998 - 'position' => 'right',
1999 - 'icon_img' => ''
2000 - ),
2001 - 'class' => 'hide_button_if_no_selection', // '' | 'wpbc_ui_button_primary'
2002 - 'style' => '', // Any CSS class here
2003 - 'mobile_show_text' => !true, // Show or hide text, when viewing on Mobile devices (small window size).
2004 - 'attr' => array( 'id' => $el_id )
2005 - );
2006 -
2007 - wpbc_flex_button( $params );
2008 - }
2009 -
2010 - function wpbc_ajx__ui__action_button__print( $escaped_search_request_params ){
2011 - $user_bk_id = 1;
2012 - $params = array(
2013 - 'type' => 'button',
2014 - 'title' => __( 'Print', 'booking' ) . '&nbsp;&nbsp;',
2015 - 'hint' => array(
2016 - 'title' => __( 'Print bookings listing', 'booking' ),
2017 - 'position' => 'top'
2018 - ),
2019 - 'link' => 'javascript:void(0)',
2020 - 'action' => "wpbc_print_dialog__show();",
2021 - 'icon' => array(
2022 - 'icon_font' => 'wpbc_icn_print',
2023 - 'position' => 'right',
2024 - 'icon_img' => ''
2025 - ),
2026 - 'class' => '',
2027 - 'style' => '',
2028 - 'attr' => array(),
2029 - 'mobile_show_text' => true
2030 - );
2031 - wpbc_flex_button( $params );
2032 - }
2033 -
2034 - function wpbc_ajx__ui__action_button__import( $escaped_search_request_params ){
2035 -
2036 - $booking_action = 'import_google_calendar';
2037 -
2038 - if ( ! wpbc_is_user_can( $booking_action, wpbc_get_current_user_id() ) ) {
2039 - return false;
2040 - }
2041 -
2042 -
2043 - $booking_gcal_feed = get_bk_option( 'booking_gcal_feed');
2044 -
2045 - if ( ( ! class_exists( 'wpdev_bk_personal' ) ) && ( $booking_gcal_feed == '' ) ) {
2046 - $is_this_btn_disabled = true;
2047 - } else {
2048 - $is_this_btn_disabled = false;
2049 - }
2050 -
2051 - $params = array(
2052 - 'type' => 'button',
2053 - 'title' => __( 'Import', 'booking' ) . '&nbsp;&nbsp;',
2054 - 'hint' => array(
2055 - 'title' => __( 'Import Google Calendar Events', 'booking' ),
2056 - 'position' => 'top'
2057 - ),
2058 - 'link' => 'javascript:void(0)',
2059 - 'action' => " if ( 'function' === typeof( jQuery('#wpbc_modal__import_google_calendar__section').wpbc_my_modal ) ) {
2060 - jQuery('#wpbc_modal__import_google_calendar__section').wpbc_my_modal('show');
2061 - } else {
2062 - alert( 'Warning! wpbc_my_modal module has not found. Please, recheck about any conflicts by deactivating other plugins.');
2063 - }",
2064 - 'icon' => array(
2065 - 'icon_font' => 'wpbc_icn_event',
2066 - 'position' => 'right',
2067 - 'icon_img' => ''
2068 - ),
2069 - 'class' => '',//( $is_this_btn_disabled ? ' disabled' : '' ),
2070 - 'style' => '',
2071 - 'attr' => array(),
2072 - 'mobile_show_text' => true
2073 - );
2074 - wpbc_flex_button( $params );
2075 - }
2076 -
2077 - function wpbc_ajx__ui__action_button__export_csv( $escaped_search_request_params ){
2078 -
2079 - if ( ! class_exists( 'wpdev_bk_personal' ) ) {
2080 - return false;
2081 - }
2082 -
2083 - $booking_action = 'export_csv';
2084 - $el_id = 'ui_btn_' . $booking_action;
2085 -
2086 - if ( ! wpbc_is_user_can( $booking_action, wpbc_get_current_user_id() ) ) {
2087 - return false;
2088 - }
2089 -
2090 - $params = array(
2091 - 'type' => 'button',
2092 - 'title' => __( 'Export to CSV', 'booking' ) . '&nbsp;&nbsp;',
2093 - 'hint' => array(
2094 - 'title' => __( 'Export bookings to CSV format', 'booking' ),
2095 - 'position' => 'top'
2096 - ),
2097 - 'link' => 'javascript:void(0)',
2098 - //'action' => wpbc_csv_get_url_for_button( 'page' ),
2099 - 'action' => "if ( 'function' === typeof( jQuery('#wpbc_modal__export_csv__section').wpbc_my_modal ) ) {
2100 - jQuery('#wpbc_modal__export_csv__section').wpbc_my_modal('show');
2101 - } else {
2102 - alert( 'Warning! wpbc_my_modal module has not found. Please, recheck about any conflicts by deactivating other plugins.');
2103 - }",
2104 - 'icon' => array(
2105 - 'icon_font' => 'wpbc_icn_file_upload',
2106 - 'position' => 'right',
2107 - 'icon_img' => ''
2108 - ),
2109 - 'class' => '',
2110 - 'style' => '',
2111 - 'attr' => array( 'id' => $el_id ),
2112 - 'mobile_show_text' => true
2113 - );
2114 - wpbc_flex_button( $params );
2115 - }
2116 -
2117 - function wpbc_ajx__ui__action_button__export_csv_page( $escaped_search_request_params ){
2118 -
2119 - if ( ! class_exists( 'wpdev_bk_personal' ) ) {
2120 - return false;
2121 - }
2122 -
2123 - $booking_action = 'export_csv';
2124 - $el_id = 'ui_btn_' . $booking_action;
2125 -
2126 - if ( ! wpbc_is_user_can( $booking_action, wpbc_get_current_user_id() ) ) {
2127 - return false;
2128 - }
2129 -
2130 - $params = array(
2131 - 'type' => 'button',
2132 - 'title' => __( 'Export page to CSV', 'booking' ) . '&nbsp;&nbsp;',
2133 - 'hint' => array(
2134 - 'title' => __( 'Export only current page of bookings to CSV format', 'booking' ),
2135 - 'position' => 'top'
2136 - ),
2137 - 'link' => 'javascript:void(0)',
2138 - //'action' => wpbc_csv_get_url_for_button( 'page' ),
2139 - 'action' => "wpbc_ajx_booking__ui_click__export_csv( {
2140 - 'booking_action' : '{$booking_action}',
2141 - 'ui_clicked_element_id': '{$el_id}',
2142 - 'export_type': 'csv_page'
2143 - } );",
2144 - 'icon' => array(
2145 - 'icon_font' => 'wpbc_icn_file_upload',
2146 - 'position' => 'right',
2147 - 'icon_img' => ''
2148 - ),
2149 - 'class' => '',
2150 - 'style' => '',
2151 - 'attr' => array( 'id' => $el_id ),
2152 - 'mobile_show_text' => true
2153 - );
2154 - wpbc_flex_button( $params );
2155 - }
2156 -
2157 - function wpbc_ajx__ui__action_button__export_csv_all( $escaped_search_request_params ){
2158 -
2159 - if ( ! class_exists( 'wpdev_bk_personal' ) ) {
2160 - return false;
2161 - }
2162 -
2163 - $booking_action = 'export_csv';
2164 - $el_id = 'ui_btn_' . $booking_action . '_all';
2165 -
2166 - if ( ! wpbc_is_user_can( $booking_action, wpbc_get_current_user_id() ) ) {
2167 - return false;
2168 - }
2169 -
2170 - $params = array(
2171 - 'type' => 'button',
2172 - 'title' => __( 'Export all pages to CSV', 'booking' ) . '&nbsp;&nbsp;',
2173 - 'hint' => array(
2174 - 'title' => __( 'Export All bookings to CSV format', 'booking' ),
2175 - 'position' => 'top'
2176 - ),
2177 - 'link' => 'javascript:void(0)',
2178 - //'action' => wpbc_csv_get_url_for_button( 'all' ),
2179 - 'action' => "wpbc_ajx_booking__ui_click__export_csv( {
2180 - 'booking_action' : '{$booking_action}',
2181 - 'ui_clicked_element_id': '{$el_id}',
2182 - 'export_type': 'csv_all'
2183 - } );",
2184 -
2185 - 'icon' => array(
2186 - 'icon_font' => 'wpbc_icn_publish',
2187 - 'position' => 'right',
2188 - 'icon_img' => ''
2189 - ),
2190 - 'class' => '',
2191 - 'style' => '',
2192 - 'attr' => array( 'id' => $el_id ),
2193 - 'mobile_show_text' => true
2194 - );
2195 - wpbc_flex_button( $params );
2196 - }
2197 -
2198 - function wpbc_ajx__ui__action_button__empty_trash( $escaped_search_request_params ){
2199 -
2200 - $booking_action = 'empty_trash';
2201 -
2202 - $el_id = 'ui_btn_' . $booking_action;
2203 -
2204 - if ( ! wpbc_is_user_can( $booking_action, wpbc_get_current_user_id() ) ) {
2205 - return false;
2206 - }
2207 -
2208 - $params = array(
2209 - 'type' => 'button' ,
2210 - 'title' => __( 'Empty Trash', 'booking' ) . '&nbsp;&nbsp;', // Title of the button
2211 - 'hint' => array( 'title' => __( 'Empty Trash', 'booking' ), 'position' => 'top' ), // Hint
2212 - 'link' => 'javascript:void(0)', // Direct link or skip it
2213 - 'action' => "if ( wpbc_are_you_sure('" . esc_attr( __( 'Do you really want to do this ?', 'booking' ) ) . "') ) {
2214 - wpbc_ajx_booking_ajax_action_request( {
2215 - 'booking_action' : '{$booking_action}',
2216 - 'ui_clicked_element_id': '{$el_id}'
2217 - } );
2218 - wpbc_button_enable_loading_icon( this );
2219 - }" ,
2220 - 'icon' => array(
2221 - 'icon_font' => 'wpbc_icn_delete_forever',
2222 - 'position' => 'right',
2223 - 'icon_img' => ''
2224 - ),
2225 - 'class' => '', // '' | 'wpbc_ui_button_primary'
2226 - 'style' => '', // Any CSS class here
2227 - 'mobile_show_text' => true, // Show or hide text, when viewing on Mobile devices (small window size).
2228 - 'attr' => array( 'id' => $el_id )
2229 - );
2230 -
2231 - wpbc_flex_button( $params );
2232 - }
2233 -// </editor-fold>
2234 -
2235 -
2236 -// <editor-fold defaultstate="collapsed" desc=" T o o l b a r O p t i o n s B u t t o n s " >
2237 -
2238 -
2239 -function wpbc_ajx__ui__options_checkbox__send_emails( $escaped_search_request_params, $defaults ){
2240 -
2241 - $el_id = 'ui_usr__send_emails';
2242 -
2243 - $el_value = isset( $escaped_search_request_params[ $el_id ] ) ? $escaped_search_request_params[ $el_id ] : $defaults[ $el_id ];
2244 -
2245 - $params_checkbox = array(
2246 - 'id' => $el_id // HTML ID of element
2247 - , 'name' => $el_id
2248 - , 'label' => array( 'title' => __( 'Emails sending', 'booking' ) , 'position' => 'right' ) //FixIn: 9.6.1.5
2249 - , 'style' => '' // CSS of select element
2250 - , 'class' => '' // CSS Class of select element
2251 - , 'disabled' => false
2252 - , 'attr' => array() // Any additional attributes, if this radio | checkbox element
2253 - , 'legend' => '' // aria-label parameter
2254 - , 'value' => $el_value // Some Value from optins array that selected by default
2255 - , 'selected' => ( ( 'send' == $el_value ) ? true : false ) // Selected or not
2256 - //, 'onfocus' => "console.log( 'ON FOCUS:', jQuery( this ).is(':checked') , 'in element:' , jQuery( this ) );" // JavaScript code
2257 - , 'onchange' => "wpbc_ajx_booking_send_search_request_with_params( {'ui_usr__send_emails': (jQuery( this ).is(':checked') ? 'send' : 'not_send') } );" // JavaScript code
2258 - //, 'hint' => array( 'title' => __('Filter bookings by booking status' ,'booking') , 'position' => 'top' )
2259 - );
2260 -
2261 - wpbc_flex_toggle( $params_checkbox );
2262 -}
2263 -
2264 -
2265 -function wpbc_ajx__ui__options_checkbox__is_expand_remarks( $escaped_search_request_params, $defaults ){
2266 -
2267 - $el_id = 'ui_usr__is_expand_remarks';
2268 -
2269 - $el_value = isset( $escaped_search_request_params[ $el_id ] ) ? $escaped_search_request_params[ $el_id ] : $defaults[ $el_id ];
2270 -
2271 - $params_checkbox = array(
2272 - 'id' => $el_id // HTML ID of element
2273 - , 'name' => $el_id
2274 - , 'label' => array( 'title' => __( 'Show / hide notes', 'booking' ) , 'position' => 'left' )
2275 - , 'legend' => __('Check this box if you want to open notes section by default in Booking Listing page.' ,'booking')
2276 - , 'style' => '' // CSS of select element
2277 - , 'class' => '' // CSS Class of select element
2278 - , 'disabled' => false
2279 - , 'attr' => array() // Any additional attributes, if this radio | checkbox element
2280 - , 'legend' => '' // aria-label parameter
2281 - , 'value' => $el_value // Some Value from optins array that selected by default
2282 - , 'selected' => ( ( 'On' == $el_value ) ? true : false ) // Selected or not
2283 - //, 'onfocus' => "console.log( 'ON FOCUS:', jQuery( this ).is(':checked') , 'in element:' , jQuery( this ) );" // JavaScript code
2284 - , 'onchange' => "wpbc_ajx_booking_send_search_request_with_params( {'ui_usr__is_expand_remarks': (jQuery( this ).is(':checked') ? 'On' : 'Off') } );" // JavaScript code
2285 - );
2286 -
2287 - wpbc_flex_toggle( $params_checkbox );
2288 -}
2289 -// </editor-fold>
2290 -
2291 -////////////////////////////////////////////////////////////////////////////////
2292 -// Complex elements
2293 -////////////////////////////////////////////////////////////////////////////////
2294 -
2295 -/**
2296 - * Show FLEX Dropdown
2297 - *
2298 - * Dropdown always have value as array. For example: [ '0' ], [ '4', '10' ] or [ '6', '', '2022-05-24' ]
2299 - *
2300 - * @param array $args
2301 - *
2302 - * = Simple Example: ==================================================================================================
2303 -
2304 - $params = array(
2305 - 'id' => 'wh_approved'
2306 - , 'default' => isset( $escaped_search_request_params['wh_approved'] ) ? $escaped_search_request_params['wh_approved'] : $defaults['wh_approved']
2307 - , 'label' => ''//__('Status', 'booking') . ':'
2308 - , 'title' => __('Status', 'booking')
2309 - , 'hint' => array( 'title' => __('Filter bookings by booking status' ,'booking') , 'position' => 'top' )
2310 - , 'li_options' => array (
2311 - '0' => __( 'Pending', 'booking' ),
2312 - '1' => __( 'Approved', 'booking' ),
2313 - 'divider1' => array( 'type' => 'html', 'html' => '<hr/>' ),
2314 - // 'header1' => array( 'type' => 'header', 'title' => __( 'Default', 'booking' ) ),
2315 - 'any' => array(
2316 - 'type' => 'simple',
2317 - 'value' => '',
2318 - // 'disabled' => true,
2319 - 'title' => __( 'Any', 'booking' )
2320 - ),
2321 - )
2322 - );
2323 -
2324 - ?><div class="ui_element ui_nowrap"><?php
2325 -
2326 - wpbc_flex_dropdown( $params );
2327 -
2328 - ?></div><?php
2329 - *
2330 - *
2331 - * = Complex Example: =================================================================================================
2332 - *
2333 -
2334 - $params_addon = array(
2335 - 'type' => 'span'
2336 - , 'html' => ''// '<i class="menu_icon icon-1x wpbc_icn_event"></i>' //'<strong>' . __( 'Dates', 'booking ' ) . '</strong>'
2337 - , 'icon' => array( 'icon_font' => 'wpbc_icn_event', 'position' => 'right', 'icon_img' => '' )
2338 - , 'class' => 'wpbc_ui_button inactive'
2339 - , 'style' => ''
2340 - , 'attr' => array()
2341 - );
2342 -
2343 - $dates_interval = array(
2344 - 1 => '1' . ' ' . __('day' ,'booking')
2345 - , 2 => '2' . ' ' . __('days' ,'booking')
2346 - , 3 => '3' . ' ' . __('days' ,'booking')
2347 - , 4 => '4' . ' ' . __('days' ,'booking')
2348 - , 5 => '5' . ' ' . __('days' ,'booking')
2349 - , 6 => '6' . ' ' . __('days' ,'booking')
2350 - , 7 => '1' . ' ' . __('week' ,'booking')
2351 - , 14 => '2' . ' ' . __('weeks' ,'booking')
2352 - , 30 => '1' . ' ' . __('month' ,'booking')
2353 - , 60 => '2' . ' ' . __('months' ,'booking')
2354 - , 90 => '3' . ' ' . __('months' ,'booking')
2355 - , 183 => '6' . ' ' . __('months' ,'booking')
2356 - , 365 => '1' . ' ' . __('Year' ,'booking')
2357 - );
2358 -
2359 - $request_input_el_default = array(
2360 - 'wh_booking_date' => isset( $escaped_search_request_params['wh_booking_date'] ) ? $escaped_search_request_params['wh_booking_date'] : $defaults['wh_booking_date'],
2361 - 'ui_wh_booking_date_radio' => isset( $escaped_search_request_params['ui_wh_booking_date_radio'] ) ? $escaped_search_request_params['ui_wh_booking_date_radio'] : $defaults['ui_wh_booking_date_radio'],
2362 - 'ui_wh_booking_date_next' => isset( $escaped_search_request_params['ui_wh_booking_date_next'] ) ? $escaped_search_request_params['ui_wh_booking_date_next'] : $defaults['ui_wh_booking_date_next'],
2363 - 'ui_wh_booking_date_prior' => isset( $escaped_search_request_params['ui_wh_booking_date_prior'] ) ? $escaped_search_request_params['ui_wh_booking_date_prior'] : $defaults['ui_wh_booking_date_prior'],
2364 - 'ui_wh_booking_date_checkin' => isset( $escaped_search_request_params['ui_wh_booking_date_checkin'] ) ? $escaped_search_request_params['ui_wh_booking_date_checkin'] : $defaults['ui_wh_booking_date_checkin'],
2365 - 'ui_wh_booking_date_checkout' => isset( $escaped_search_request_params['ui_wh_booking_date_checkout'] ) ? $escaped_search_request_params['ui_wh_booking_date_checkout'] : $defaults['ui_wh_booking_date_checkout']
2366 - );
2367 -
2368 - $options = array (
2369 - // 'header2' => array( 'type' => 'header', 'title' => __( 'Complex Days', 'booking' ) ),
2370 - // 'disabled1' => array( 'type' => 'simple', 'value' => '19', 'title' => __( 'This is option was disabled', 'booking' ), 'disabled' => true ),
2371 -
2372 - '0' => __( 'Current dates', 'booking' ),
2373 - '1' => __( 'Today', 'booking' ),
2374 - '2' => __( 'Previous dates', 'booking' ),
2375 - '3' => __( 'All dates', 'booking' ),
2376 -
2377 - 'divider1' => array( 'type' => 'html', 'html' => '<hr/>' ),
2378 -
2379 - '9' => __( 'Today check in/out', 'booking' ),
2380 - '7' => __( 'Check In - Tomorrow', 'booking' ),
2381 - '8' => __( 'Check Out - Tomorrow', 'booking' ),
2382 -
2383 - 'divider2' => array( 'type' => 'html', 'html' => '<hr/>' ),
2384 -
2385 - // Next [ '4', '10' ] - radio button (if selected) value '4' and select-box with selected value '10'
2386 - 'next' => array(
2387 - 'type' => 'complex',
2388 - 'class' => 'ui_complex_option_element',
2389 - // recheck if LI selected: $options['next']['selected_options_value'] == $params['default], e.g. ~ [ '4', '10' ]
2390 - 'selected_options_value' => array(
2391 - 1 => array( 'value' ), // $options['next']['input_options'][ 1 ]['value'] '4'
2392 - 4 => array( 'value' ) // $options['next']['input_options'][ 4 ]['value'] '10'
2393 - ),
2394 - // Get selected Title, for dropdown if $options['next'] selected
2395 - 'selected_options_title' => array(
2396 - 1 => array( 'label', 'title' ), // $options['next']['input_options'][ 1 ]['label'][ 'title' ] 'Next'
2397 - 'text1' => ': ', // if key 'text1' not exist in ['input_options'], then it text ': '
2398 - 4 => array( 'options', $request_input_el_default['ui_wh_booking_date_next'] ) // '10 days'
2399 - ),
2400 - 'input_options' => array(
2401 - array( 'type' => 'html', 'html' => '<div class="ui_element">' )
2402 - , array( // Default options from simple input element, like: wpbc_flex_radio()
2403 - 'type' => 'radio'
2404 - , 'id' => 'ui_wh_booking_date_radio_1' // HTML ID of element
2405 - , 'name' => 'ui_wh_booking_date_radio'
2406 - , 'label' => array( 'title' => __('Next' ,'booking') , 'position' => 'right' )
2407 - , 'style' => '' // CSS of select element
2408 - , 'class' => '' // CSS Class of select element
2409 - , 'disabled' => false
2410 - , 'attr' => array() // Any additional attributes, if this radio | checkbox element
2411 - , 'legend' => '' // aria-label parameter
2412 - , 'value' => '4'
2413 - , 'selected' => ( $request_input_el_default[ 'ui_wh_booking_date_radio' ] == '4' ) ? true : false // Selected or not
2414 - , 'onfocus' => "console.log( 'ON FOCUS:', jQuery( this ).is(':checked') , 'in element:' , jQuery( this ) );" // JavaScript code
2415 - , 'onchange' => "console.log( 'ON CHANGE:', jQuery( this ).is(':checked') , 'in element:' , jQuery( this ) );" // JavaScript code
2416 - )
2417 - , array( 'type' => 'html', 'html' => '</div>' )
2418 - , array( 'type' => 'html', 'html' => '<div class="ui_element">' )
2419 - , array(
2420 - 'type' => 'select'
2421 - , 'attr' => array()
2422 - , 'name' => 'ui_wh_booking_date_next'
2423 - , 'id' => 'ui_wh_booking_date_next'
2424 - , 'options' => $dates_interval
2425 - , 'value' => $request_input_el_default[ 'ui_wh_booking_date_next']
2426 - , 'onfocus' => "jQuery('#ui_wh_booking_date_radio_1').prop('checked', true);" // JavaScript code
2427 - , 'onchange' => "console.log( 'ON CHANGE:', jQuery( this ).is(':checked') , 'in element:' , jQuery( this ) );" // JavaScript code
2428 - )
2429 - , array( 'type' => 'html', 'html' => '</div>' )
2430 - )
2431 - ),
2432 -
2433 - // Prior [ '5', '10' ]
2434 - 'prior' => array(
2435 - 'type' => 'complex',
2436 - 'class' => 'ui_complex_option_element',
2437 - 'style' => 'min-width: 244px;',
2438 - 'selected_options_value' => array( 1 => array( 'value' ), 4 => array( 'value' ) ), // 4 => array( 'value' ) --> $complex_option['input_options'][4]['value']
2439 - 'selected_options_title' => array( 1 => array( 'label', 'title' )
2440 - , 'text1' => ': '
2441 - , 4 => array( 'options' , $request_input_el_default[ 'ui_wh_booking_date_prior'] )
2442 - ), // 1 => array( 'label', 'title' ) --> $complex_option['input_options'][1]['label'][ 'title' ]
2443 - 'input_options' => array(
2444 - array( 'type' => 'html', 'html' => '<div class="ui_element">' )
2445 - , array(
2446 - 'type' => 'radio'
2447 -
2448 - , 'id' => 'ui_wh_booking_date_radio_2' // HTML ID of element
2449 - , 'name' => 'ui_wh_booking_date_radio'
2450 - , 'label' => array( 'title' => __('Prior' ,'booking') , 'position' => 'right' )
2451 - , 'style' => '' // CSS of select element
2452 - , 'class' => '' // CSS Class of select element
2453 - , 'disabled' => false
2454 - , 'attr' => array() // Any additional attributes, if this radio | checkbox element
2455 - , 'legend' => '' // aria-label parameter
2456 - , 'value' => '5' // Some Value from optins array that selected by default
2457 - , 'selected' => ( $request_input_el_default[ 'ui_wh_booking_date_radio' ] == '5' ) ? true : false // Selected or not
2458 - , 'onfocus' => "console.log( 'ON FOCUS:', jQuery( this ).is(':checked') , 'in element:' , jQuery( this ) );" // JavaScript code
2459 - , 'onchange' => "console.log( 'ON CHANGE:', jQuery( this ).is(':checked') , 'in element:' , jQuery( this ) );" // JavaScript code
2460 - )
2461 - , array( 'type' => 'html', 'html' => '</div>' )
2462 - , array( 'type' => 'html', 'html' => '<div class="ui_element">' )
2463 - , array(
2464 - 'type' => 'select'
2465 - , 'attr' => array()
2466 - , 'name' => 'ui_wh_booking_date_prior'
2467 - , 'id' => 'ui_wh_booking_date_prior'
2468 - , 'options' => $dates_interval
2469 - , 'value' => $request_input_el_default[ 'ui_wh_booking_date_prior']
2470 - , 'onfocus' => "jQuery('#ui_wh_booking_date_radio_2').prop('checked', true);" // JavaScript code
2471 - , 'onchange' => "console.log( 'ON CHANGE:', jQuery( this ).is(':checked') , 'in element:' , jQuery( this ) );" // JavaScript code
2472 - )
2473 - , array( 'type' => 'html', 'html' => '</div>' )
2474 - )
2475 - ),
2476 -
2477 - // Fixed [ '6', '', '2022-05-21']
2478 - 'fixed' => array(
2479 - 'type' => 'complex',
2480 - 'class' => 'ui_complex_option_element',
2481 - 'selected_options_value' => array( 1 => array( 'value' ), 4 => array( 'value' ), 7 => array( 'value' ) ), // 4 => array( 'value' ) --> $complex_option['input_options'][4]['value']
2482 - 'selected_options_title' => array( 1 => array( 'label', 'title' ), 'text1' => ': ', 4 => array( 'value' ), 'text2' => ' - ' ,7 => array( 'value' ) ), // 1 => array( 'label', 'title' ) --> $complex_option['input_options'][1]['label'][ 'title' ]
2483 - 'input_options' => array(
2484 - array( 'type' => 'html', 'html' => '<div class="ui_element" style="flex:1 1 100%;margin-top:5px;">' )
2485 - , array(
2486 - 'type' => 'radio'
2487 -
2488 - , 'id' => 'ui_wh_booking_date_radio_3' // HTML ID of element
2489 - , 'name' => 'ui_wh_booking_date_radio'
2490 - , 'label' => array( 'title' => __('Dates' ,'booking') , 'position' => 'right' )
2491 - , 'style' => '' // CSS of select element
2492 - , 'class' => '' // CSS Class of select element
2493 - , 'disabled' => false
2494 - , 'attr' => array() // Any additional attributes, if this radio | checkbox element
2495 - , 'legend' => '' // aria-label parameter
2496 - , 'value' => '6' // Some Value from optins array that selected by default
2497 - , 'selected' => ( $request_input_el_default[ 'ui_wh_booking_date_radio' ] == '6' ) ? true : false // Selected or not
2498 - , 'onfocus' => "console.log( 'ON FOCUS:', jQuery( this ).is(':checked') , 'in element:' , jQuery( this ) );" // JavaScript code
2499 - , 'onchange' => "console.log( 'ON CHANGE:', jQuery( this ).is(':checked') , 'in element:' , jQuery( this ) );" // JavaScript code
2500 - )
2501 - , array( 'type' => 'html', 'html' => '</div>' )
2502 - , array( 'type' => 'html', 'html' => '<div class="ui_element" style="flex-flow: row wrap;padding: 4px 4px 4px 0;">' )
2503 - , array(
2504 - 'type' => 'text'
2505 - , 'id' => 'ui_wh_booking_date_checkin' // HTML ID of element
2506 - , 'name' => 'ui_wh_booking_date_checkin'
2507 - , 'label' => ''//__('Check-in' ,'booking')
2508 - , 'style' => 'width:100%;' // CSS of select element
2509 - , 'class' => 'wpdevbk-filters-section-calendar' // CSS Class of select element
2510 - , 'disabled' => false
2511 - , 'attr' => array() // Any additional attributes, if this radio | checkbox element
2512 - , 'placeholder' => __('Check-in' ,'booking')
2513 - , 'value' => $request_input_el_default[ 'ui_wh_booking_date_checkin'] // Some Value from optins array that selected by default
2514 - , 'onfocus' => "jQuery('#ui_wh_booking_date_radio_3').prop('checked', true);" // JavaScript code
2515 - , 'onchange' => "console.log( 'ON CHANGE:', jQuery( this ).is(':checked') , 'in element:' , jQuery( this ) );" // JavaScript code
2516 - )
2517 - , array( 'type' => 'html', 'html' => '</div>' )
2518 - , array( 'type' => 'html', 'html' => '<div class="ui_element" style="flex-flow: row wrap;padding: 4px 0 4px 4px;">' )
2519 - , array(
2520 - 'type' => 'text'
2521 - , 'id' => 'ui_wh_booking_date_checkout' // HTML ID of element
2522 - , 'name' => 'ui_wh_booking_date_checkout'
2523 - , 'label' => ''//__('Check-out' ,'booking')
2524 - , 'style' => 'width:100%;' // CSS of select element
2525 - , 'class' => 'wpdevbk-filters-section-calendar' // CSS Class of select element
2526 - , 'disabled' => false
2527 - , 'attr' => array() // Any additional attributes, if this radio | checkbox element
2528 - , 'placeholder' => __('Check-out' ,'booking')
2529 - , 'value' => $request_input_el_default[ 'ui_wh_booking_date_checkout'] // Some Value from optins array that selected by default
2530 - , 'onfocus' => "jQuery('#ui_wh_booking_date_radio_3').prop('checked', true);" // JavaScript code
2531 - , 'onchange' => "console.log( 'ON CHANGE:', jQuery( this ).is(':checked') , 'in element:' , jQuery( this ) );" // JavaScript code
2532 - )
2533 - , array( 'type' => 'html', 'html' => '</div>' )
2534 - )
2535 - ),
2536 -
2537 - 'divider3' => array( 'type' => 'html', 'html' => '<hr/>' ),
2538 -
2539 - // Buttons
2540 - 'buttons1' => array(
2541 - 'type' => 'complex',
2542 - 'class' => 'ui_complex_option_element',
2543 - 'style' => 'justify-content: flex-end;',
2544 - 'input_options' => array(
2545 - array( 'type' => 'html', 'html' => '<div class="ui_element" style="flex: 0 1 auto;margin: 0;">' )
2546 - , array(
2547 - 'type' => 'button'
2548 - , 'title' => __( 'Apply', 'booking' ) // Title of the button
2549 - , 'hint' => '' // , 'hint' => array( 'title' => __('Select status' ,'booking') , 'position' => 'bottom' )
2550 - , 'link' => 'javascript:void(0)' // Direct link or skip it
2551 - , 'action' => "wpbc_ui_dropdown_apply_click( {
2552 - 'dropdown_id' : 'wh_booking_date',
2553 - 'dropdown_radio_name': 'ui_wh_booking_date_radio'
2554 - } );" // JavaScript code
2555 - , 'class' => 'wpbc_ui_button_primary' // wpbc_ui_button | wpbc_ui_button_primary
2556 - , 'icon' => ''
2557 - , 'font_icon' => ''
2558 - , 'icon_position' => 'left' // Position of icon relative to Text: left | right
2559 - , 'style' => '' // Any CSS class here
2560 - , 'mobile_show_text' => false // Show or hide text, when viewing on Mobile devices (small window size).
2561 - , 'attr' => array()
2562 - )
2563 - , array( 'type' => 'html', 'html' => '</div>' )
2564 - , array( 'type' => 'html', 'html' => '<div class="ui_element" style="flex: 0 1 auto;margin: 0 0 0 1em;">' )
2565 - , array(
2566 - 'type' => 'button'
2567 - , 'title' => __( 'Close', 'booking' ) // Title of the button
2568 - , 'hint' => '' // , 'hint' => array( 'title' => __('Select status' ,'booking') , 'position' => 'bottom' )
2569 - , 'link' => 'javascript:void(0)' // Direct link or skip it
2570 - , 'action' => "wpbc_ui_dropdown_close_click( 'wh_booking_date' );" // JavaScript code
2571 - , 'class' => '' // wpbc_ui_button | wpbc_ui_button_primary
2572 - , 'icon' => ''
2573 - , 'font_icon' => ''
2574 - , 'icon_position' => 'left' // Position of icon relative to Text: left | right
2575 - , 'style' => '' // Any CSS class here
2576 - , 'mobile_show_text' => false // Show or hide text, when viewing on Mobile devices (small window size).
2577 - , 'attr' => array()
2578 - )
2579 - , array( 'type' => 'html', 'html' => '</div>' )
2580 - )
2581 - ),
2582 - );
2583 -
2584 - $params = array(
2585 - 'id' => 'wh_booking_date'
2586 - , 'default' => $request_input_el_default[ 'wh_booking_date' ]
2587 - , 'label' => ''//__('Approve 1', 'booking') . ':'
2588 - , 'title' => ''//__('Approve 2', 'booking')
2589 - , 'hint' => array( 'title' => __('Filter bookings by booking dates' ,'booking') , 'position' => 'top' )
2590 - , 'align' => 'left'
2591 - , 'li_options' => $options
2592 - );
2593 -
2594 - ?><div class="ui_element ui_nowrap"><?php
2595 -
2596 - wpbc_flex_addon( $params_addon );
2597 -
2598 - wpbc_flex_dropdown( $params );
2599 -
2600 - ?></div><?php
2601 -
2602 - *
2603 - * =====================================================================================================================
2604 - */
2605 -function wpbc_flex_dropdown( $args = array() ) {
2606 -
2607 - // $milliseconds = round( microtime( true ) * 1000 );
2608 -
2609 - $defaults = array(
2610 - 'id' => '' // HTML ID of element Example: 'wh_booking_date'
2611 - , 'default' => array() // Selected by default value(s) Example: 'default' => array( $defaults['wh_booking_date'] , $defaults['wh_booking_date2'] )
2612 - , 'hint' => '' // Mouse over tooltip Example: 'hint' => array( 'title' => __('Select status' ,'booking') , 'position' => 'bottom' )
2613 - , 'style' => '' // CSS style of dropdown element (optional)
2614 - , 'class' => '' // CSS class of dropdown element (optional)
2615 - , 'label' => '' // Label of element "at Top of element"
2616 - , 'title' => '' // Title of element "Inside of element"
2617 - , 'align' => 'left' // Align: left | right
2618 - , 'li_options' => array() // Options
2619 - , 'disabled' => array() // If some options disabled, then option values list here
2620 - , 'onfocus' => '' // JavaScript code
2621 - , 'onchange' => '' // JavaScript code
2622 - , 'is_use_for_template' => false // In case, if we are using it for template, then we skip JavaScript code for initial value. Need to define it manually. //FixIn: 9.4.3.5
2623 - );
2624 - $params = wp_parse_args( $args, $defaults );
2625 -
2626 - // If default value not array, then define it as single value in arr.
2627 - if ( ! is_array( $params['default'] ) ) {
2628 - $params['default'] = array( $params['default'] );
2629 - }
2630 -
2631 - ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
2632 - /**
2633 - * Recomposition of simple options configuration from
2634 - * 'any' => __( 'Any', 'booking' )
2635 - * to
2636 - * 'any' => array( 'type' => 'simple', 'value' => 'any', 'title' => __( 'Any', 'booking' ) );
2637 - */
2638 - $is_this_simple_list = true;
2639 - foreach ( $params['li_options'] as $key_value => $option_data ) {
2640 -
2641 - if ( ! is_array( $option_data ) ) {
2642 -
2643 - $params['li_options'][ $key_value ] = array( 'type' => 'simple', 'value' => (string) $key_value, 'title' => $option_data );
2644 -
2645 - } else {
2646 - if ( ( isset( $option_data['type'] ) ) && ( 'complex' == $option_data['type'] ) ) {
2647 - $is_this_simple_list = false;
2648 - }
2649 - }
2650 - }
2651 - ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
2652 -
2653 -
2654 - ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
2655 - // Rechecking about selected LI option, based on $params['default'] like ['4','10'] and getting title of such option
2656 - ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
2657 - $default_selected_title = array();
2658 - foreach ( $params['li_options'] as $li_option ) {
2659 -
2660 - if ( 'simple' == $li_option['type'] ) {
2661 - if ( $li_option['value'] === $params['default'][0] ) {
2662 - $default_selected_title = $li_option['title'] ;
2663 - }
2664 - }
2665 -
2666 - if ( 'complex' == $li_option['type'] ) {
2667 -
2668 - // $option[ 'selected_options_value' ] => array( 1 => array( 'value' ), 4 => array( 'value' ) ),
2669 - // $option[ 'selected_options_title' ] => array( 1 => array( 'label', 'title' ), 'text1' => ': ', 4 => array( 'value' ) ),
2670 -
2671 - // Get value of this LI
2672 - $li_this_value = array();
2673 - if ( isset( $li_option['selected_options_value'] ) )
2674 - foreach ( $li_option['selected_options_value'] as $li_key => $input_keys ) {
2675 -
2676 - if ( isset( $li_option['input_options'][ $li_key ] ) ) { // ['input_options'][4]
2677 -
2678 - $li_input_deep_value = $li_option['input_options'][ $li_key ];
2679 -
2680 - foreach ( $input_keys as $input_key_value ) {
2681 -
2682 - if ( isset( $li_input_deep_value[$input_key_value] ) ) { // ['input_options'][4]['value']
2683 - $li_input_deep_value = $li_input_deep_value[ $input_key_value ];
2684 - }
2685 - }
2686 - $li_this_value[] = $li_input_deep_value;
2687 - }
2688 - }
2689 -
2690 - // Is this LI selected ?
2691 - $is_same_value = array_diff( $params['default'], $li_this_value ) == array();
2692 -
2693 - if ( $is_same_value ) {
2694 -
2695 - // Get value of this LI
2696 - $li_this_value = array();
2697 - foreach ( $li_option['selected_options_title'] as $li_key => $input_keys ) {
2698 -
2699 - if ( isset( $li_option['input_options'][ $li_key ] ) ) { // ['input_options'][4]
2700 -
2701 - $li_input_deep_value = $li_option['input_options'][ $li_key ];
2702 -
2703 - foreach ( $input_keys as $input_key_value ) {
2704 -
2705 - if ( isset( $li_input_deep_value[$input_key_value] ) ) { // ['input_options'][4]['value']
2706 - $li_input_deep_value = $li_input_deep_value[ $input_key_value ];
2707 - }
2708 - }
2709 - $li_this_value[] = $li_input_deep_value;
2710 - } else {
2711 - $li_this_value[] = $input_keys; //some text
2712 - }
2713 - }
2714 -
2715 - $default_selected_title = implode( '', $li_this_value );
2716 - }
2717 - }
2718 -
2719 - if ( ! empty( $default_selected_title ) ) {
2720 - break;
2721 - }
2722 - }
2723 -
2724 - if ( is_array( $default_selected_title ) ) {
2725 - $default_selected_title = implode( '', $default_selected_title ); // Error:: ? no values ?
2726 - }
2727 -
2728 -
2729 - ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
2730 - // Show only, if $item_params['label'] ! EMPTY
2731 - wpbc_flex_label(
2732 - array(
2733 - 'id' => $params['id']
2734 - , 'label' => $params['label']
2735 - , 'class' => 'wpbc_ui_dropdown__outside_label'
2736 - )
2737 - );
2738 -
2739 - ?><div class="wpbc_ui_dropdown <?php echo esc_attr( $params['class'] ); ?>"
2740 - style="<?php echo esc_attr( $params['style'] ); ?>"
2741 - ><?php
2742 -
2743 - ?><a href="javascript:void(0)"
2744 - id="<?php echo esc_attr( $params['id'] ); ?>_selector"
2745 - data-toggle="wpbc_dropdown"
2746 - class="wpbc_ui_control wpbc_ui_button dropdown-toggle <?php
2747 - echo ( ! empty( $params['hint'] ) ) ? 'tooltip_' . $params['hint']['position'] . ' ' : '' ;
2748 - ?>"
2749 - <?php if (! $is_this_simple_list ) { ?>
2750 - onclick="javascript:jQuery('#<?php echo $params['id']; ?>_container').show();"
2751 - <?php } ?>
2752 - <?php if ( ! empty( $params['hint'] ) ) { ?>
2753 - title="<?php echo esc_attr( $params['hint']['title'] ); ?>"
2754 - <?php } ?>
2755 - <?php echo wpbc_get_custom_attr( $params ); ?>
2756 - ><?php
2757 -
2758 - ?><label class="wpbc_ui_dropdown__inside_label" <?php if ( empty( $params['title'] ) ) { echo ' style="display:none;" '; } ?> ><?php
2759 -
2760 - echo html_entity_decode(
2761 - wp_kses_post( $params['title'] ) // Sanitizes content for allowed HTML tags for post content
2762 - , ENT_QUOTES // Convert &quot; to " and '
2763 - , get_bloginfo( 'charset' ) // 'UTF-8' or other
2764 - ); // Convert &amp;dash; to &dash; etc...
2765 - ?>: <?php
2766 - ?></label> <?php
2767 -
2768 - ?><span class="wpbc_selected_in_dropdown" ><?php
2769 - echo html_entity_decode(
2770 - wp_kses_post( $default_selected_title ) // Sanitizes content for allowed HTML tags for post content
2771 - , ENT_QUOTES // Convert &quot; to " and '
2772 - , get_bloginfo( 'charset' ) // 'UTF-8' or other
2773 - ); // Convert &amp;dash; to &dash; etc...
2774 - ?></span> &nbsp; <?php
2775 -
2776 - ?><span class="wpbc_ui_dropdown__inside_caret"></span><?php
2777 -
2778 - ?></a><?php
2779 -
2780 - ?><ul id="<?php echo $params['id']; ?>_container" class="ui_dropdown_menu ui_dropdown_menu-<?php echo esc_attr( $params['align'] ); ?>" ><?php
2781 -
2782 - wpbc_flex_dropdown__options( $params, array( 'is_this_simple_list' => $is_this_simple_list ) );
2783 -
2784 - ?></ul><?php
2785 -
2786 - ?><input type="hidden"
2787 - autocomplete="off"
2788 - value=""
2789 - id="<?php echo esc_attr( $params['id'] ); ?>"
2790 - name="<?php echo esc_attr( $params['id'] ); ?>"
2791 - /><?php
2792 - if( ! $params['is_use_for_template'] ){ //FixIn: 9.4.3.5
2793 - ?>
2794 - <script type="text/javascript">
2795 - <?php /* document.getElementById("<?php echo $params['id']; ?>").value = "<?php echo wp_slash( json_encode($params['default'] ) ); ?>"; */ ?>
2796 - jQuery(document).ready(function(){
2797 -
2798 - jQuery( '#<?php echo $params['id']; ?>').val( "<?php echo wp_slash( json_encode( $params['default'] ) ); ?>" );
2799 -
2800 - <?php if (! empty( $params['onchange'] )) { ?>
2801 -
2802 - jQuery( '#<?php echo $params['id']; ?>' ).on( 'change', function( event ){
2803 -
2804 - <?php echo $params['onchange']; ?>
2805 - });
2806 -
2807 - <?php } ?>
2808 -
2809 - <?php if (! empty( $params['onfocus'] )) { ?>
2810 -
2811 - jQuery( '#<?php echo $params['id']; ?>_selector' ).on( 'focus', function( event ){
2812 -
2813 - <?php echo $params['onfocus']; ?>
2814 - });
2815 -
2816 - <?php } ?>
2817 - })
2818 - </script>
2819 - <?php
2820 - }
2821 - ?></div><?php
2822 -}
2823 -
2824 -/**
2825 - * Options list for Dropdown
2826 - *
2827 - * @param $params
2828 - * @param array $args
2829 - */
2830 -function wpbc_flex_dropdown__options( $params, $args = array() ) {
2831 -
2832 - $defaults = array(
2833 - // 'milliseconds' => round( microtime( true ) * 1000 ),
2834 - 'is_this_simple_list' => true
2835 - );
2836 - $args = wp_parse_args( $args, $defaults );
2837 -
2838 -
2839 - foreach ( $params['li_options'] as $option_name => $li_option ) {
2840 -
2841 - $default_option = array(
2842 - 'type' => ''
2843 - , 'class' => ''
2844 - , 'style' => ''
2845 - , 'title' => ''
2846 - , 'disabled' => false
2847 - , 'attr' => array()
2848 - , 'value' => ''
2849 - , 'html' => ''
2850 - );
2851 - $li_option = wp_parse_args( $li_option, $default_option );
2852 -
2853 -
2854 - // Is disabled ?
2855 - if ( true === in_array( $li_option['value'], $params['disabled'] ) ) {
2856 - $li_option['disabled'] = true;
2857 - }
2858 - if ( $li_option['disabled'] ) {
2859 - $li_option['class'] .= ' disabled';
2860 - }
2861 - // Is header ?
2862 - if ( 'header' == $li_option['type'] ) {
2863 - $li_option['class'] .= ' dropdown-header';
2864 - }
2865 -
2866 -
2867 - ?><li role="presentation"
2868 - class="<?php echo esc_attr( $li_option['class'] ); ?>"
2869 - style="<?php echo esc_attr( $li_option['style'] ); ?>"
2870 - <?php echo wpbc_get_custom_attr( $li_option ); ?>
2871 - ><?php
2872 -
2873 - switch ( $li_option['type'] ) {
2874 -
2875 - case 'simple':
2876 -
2877 - ?><a role="menuitem"
2878 - tabindex="-1"
2879 - <?php if ( ! $li_option['disabled'] ) {
2880 -
2881 - if( false !== filter_var( $li_option['value'], FILTER_VALIDATE_URL ) ){ ?>
2882 -
2883 - href="<?php echo $li_option['value']; ?>"
2884 -
2885 - <?php } else { ?>
2886 -
2887 - href="javascript:void(0)"
2888 - onclick="javascript: wpbc_ui_dropdown_simple_click( {
2889 - 'dropdown_id' : '<?php echo $params['id']; ?>'
2890 - , 'is_this_simple_list': <?php echo ( $args['is_this_simple_list'] ) ? 'true' : 'false'; ?>
2891 - , 'value' : '<?php echo $li_option['value']; ?>'
2892 - , '_this' : this
2893 - } );"
2894 - <?php }
2895 -
2896 - } ?>
2897 - ><?php
2898 - echo $li_option['title'];
2899 - ?></a><?php
2900 -
2901 - break;
2902 -
2903 - case 'html':
2904 - echo $li_option['html'];
2905 - break;
2906 -
2907 - case 'header':
2908 - echo $li_option['title'];
2909 - break;
2910 -
2911 - case 'complex' :
2912 -
2913 - foreach ( $li_option['input_options'] as $input_option ) {
2914 -
2915 - switch ( $input_option['type'] ) {
2916 -
2917 - case 'html':
2918 - echo $input_option['html'];
2919 - break;
2920 -
2921 - case 'button':
2922 - wpbc_flex_button( $input_option );
2923 - break;
2924 -
2925 - case 'label':
2926 - wpbc_flex_label( $input_option );
2927 - break;
2928 -
2929 - case 'text':
2930 - wpbc_flex_text( $input_option );
2931 - break;
2932 -
2933 - case 'select':
2934 - wpbc_flex_select( $input_option );
2935 - break;
2936 -
2937 - case 'checkbox':
2938 - wpbc_flex_checkbox( $input_option );
2939 - break;
2940 -
2941 - case 'radio':
2942 - wpbc_flex_radio( $input_option );
2943 - break;
2944 -
2945 - case 'addon':
2946 - wpbc_flex_addon( $input_option );
2947 - break;
2948 -
2949 - default: // Default
2950 - }
2951 - }
2952 - break;
2953 -
2954 - default: // Default
2955 - }
2956 -
2957 - ?></li><?php
2958 - }
2959 -}
2960 -
2961 -
2962 -////////////////////////////////////////////////////////////////////////////////
2963 -// Simple elements
2964 -////////////////////////////////////////////////////////////////////////////////
2965 -
2966 -/**
2967 - * Show FLEX Button
2968 - *
2969 - * @param array $item
2970 - array(
2971 - 'type' => 'button'
2972 - , 'title' => '' // Title of the button
2973 - , 'hint' => '' // , 'hint' => array( 'title' => __('Select status' ,'booking') , 'position' => 'bottom' )
2974 - , 'link' => 'javascript:void(0)' // Direct link or skip it
2975 - , 'action' => '' // Some JavaScript to execure, for example run the function
2976 - , 'class' => '' // wpbc_ui_button | wpbc_ui_button_primary
2977 - , 'icon' => ''
2978 - , 'font_icon' => ''
2979 - , 'icon_position' => 'left' // Position of icon relative to Text: left | right
2980 - , 'style' => '' // Any CSS class here
2981 - , 'mobile_show_text' => false // Show or hide text, when viewing on Mobile devices (small window size).
2982 - , 'attr' => array()
2983 - );
2984 - */
2985 -function wpbc_flex_button( $item ) {
2986 -
2987 - $default_item_params = array(
2988 - 'type' => 'button'
2989 - , 'title' => '' // Title of the button
2990 - , 'hint' => '' // , 'hint' => array( 'title' => __('Select status' ,'booking') , 'position' => 'bottom' )
2991 - , 'link' => 'javascript:void(0)' // Direct link or skip it
2992 - , 'action' => '' // Some JavaScript to execure, for example run the function
2993 - , 'id' => '' // '' | 'wpbc_ui_button_primary'
2994 - , 'class' => '' // '' | 'wpbc_ui_button_primary'
2995 - , 'icon' => false // array( 'icon_font' => 'wpbc_icn_check_circle_outline', 'position' => 'right', 'icon_img' => '' )
2996 - , 'style' => '' // Any CSS class here
2997 - , 'mobile_show_text' => false // Show or hide text, when viewing on Mobile devices (small window size).
2998 - , 'attr' => array()
2999 - , 'options' => array( 'link' => 'esc_attr' ) // array( 'link' => 'decode' )
3000 - );
3001 - $item_params = wp_parse_args( $item, $default_item_params );
3002 -
3003 - $css_button_class = esc_attr( $item_params['class'] );
3004 -
3005 - if ( 'wpbc_button_as_icon' !== $css_button_class ) {
3006 - $css_button_class = 'wpbc_ui_button ' . $css_button_class;
3007 - }
3008 -
3009 - ?><a class="wpbc_ui_control <?php echo $css_button_class;
3010 - echo ( ! empty( $item_params['hint'] ) ) ? ' tooltip_' . esc_attr( $item_params['hint']['position'] ) . ' ' : '' ; ?>"
3011 - style="<?php echo esc_attr( $item_params['style'] ); ?>"
3012 - href="<?php
3013 - if ( 'esc_attr' == $item_params['options']['link'] ) {
3014 - echo esc_attr( $item_params['link'] );
3015 - }
3016 - if ( 'decode' == $item_params['options']['link'] ) {
3017 - echo str_replace( '"', '', htmlspecialchars_decode( esc_attr( $item_params['link'] ), ENT_QUOTES ) );
3018 - }
3019 - if ( 'no_decode' == $item_params['options']['link'] ) {
3020 - echo str_replace( '"', '', $item_params['link'] );
3021 - }
3022 - ?>"
3023 - <?php if ( ! empty( $item_params['id'] ) ) { ?>
3024 - id="<?php echo $item_params['id']; ?>"
3025 - <?php } ?>
3026 - <?php if ( ! empty( $item_params['action'] ) ) { ?>
3027 - onclick="javascript:<?php echo wpbc_esc_js( $item_params['action'] ); ?>"
3028 - <?php } ?>
3029 - <?php if ( ! empty( $item_params['hint'] ) ) { ?>
3030 - title="<?php echo esc_attr( $item_params['hint']['title'] ); ?>"
3031 - <?php } ?>
3032 - <?php echo wpbc_get_custom_attr( $item_params ); ?>
3033 - ><?php
3034 - $btn_icon = '';
3035 -
3036 - // Icon
3037 - if ( ( ! empty( $item_params['icon'] ) ) && ( is_array( $item_params['icon'] ) ) ) {
3038 -
3039 - // Icon IMG
3040 - if ( ! empty( $item_params['icon']['icon_img'] ) ) {
3041 -
3042 - if ( substr( $item_params['icon']['icon_img'], 0, 4 ) != 'http' ) {
3043 - $img_path = WPBC_PLUGIN_URL . '/assets/img/' . $item_params['icon']['icon_img'];
3044 - } else {
3045 - $img_path = $item_params['icon']['icon_img'];
3046 - }
3047 - $btn_icon = '<img class="menuicons" src="' . esc_url( $img_path ) . '" />'; // Img Icon
3048 - }
3049 -
3050 - // Icon Font
3051 - if ( ! empty( $item_params['icon']['icon_font'] ) ) {
3052 - $btn_icon = '<i class="menu_icon icon-1x ' . esc_attr( $item_params['icon']['icon_font'] ) . '"></i>'; // Font Icon
3053 - }
3054 - }
3055 -
3056 - if ( ( ! empty( $btn_icon ) ) && ( $item_params['icon']['position'] == 'left' ) ) {
3057 -
3058 - echo $btn_icon;
3059 -
3060 - if ( ! empty( $item_params['title'] ) ) {
3061 - echo '&nbsp;';
3062 - }
3063 - }
3064 -
3065 - // Text
3066 - echo '<span' . ( ( ( ! empty( $btn_icon ) ) && ( ! $item_params['mobile_show_text'] ) )? ' class="in-button-text"' : '' ) . '>';
3067 -
3068 - echo html_entity_decode(
3069 - wp_kses_post( $item_params['title'] ) // Sanitizes content for allowed HTML tags for post content
3070 - , ENT_QUOTES // Convert &quot; to " and '
3071 - , get_bloginfo( 'charset' ) // 'UTF-8' or other
3072 - ); // Convert &amp;dash; to &dash; etc...
3073 -
3074 - if ( ( ! empty( $btn_icon ) ) && ( $item_params['icon']['position'] == 'right' ) ) {
3075 - echo '&nbsp;';
3076 - }
3077 -
3078 - echo '</span>';
3079 -
3080 - if ( ( ! empty( $btn_icon ) ) && ( $item_params['icon']['position'] == 'right' ) ) {
3081 - echo $btn_icon;
3082 - }
3083 - ?></a><?php
3084 -}
3085 -
3086 -/**
3087 - * Show FLEX Label
3088 - *
3089 - * @param array $item
3090 - array(
3091 - 'id' => '' // HTML ID of INPUT element
3092 - , 'label' => __('Text..','booking') // Label text here
3093 - , 'style' => '' // CSS of select element
3094 - , 'class' => '' // CSS Class of select element
3095 - , 'disabled' => false
3096 - , 'attr' => array() // Any additional attributes
3097 - )
3098 -*/
3099 -function wpbc_flex_label( $item ) {
3100 -
3101 - $default_item_params = array(
3102 - 'id' => '' // HTML ID of element
3103 - , 'label' => '' // Label
3104 - , 'style' => '' // CSS of select element
3105 - , 'class' => '' // CSS Class of select element
3106 - , 'disabled' => false
3107 - , 'hint' => '' // , 'hint' => array( 'title' => __('Select status' ,'booking') , 'position' => 'bottom' )
3108 - , 'attr' => array() // Any additional attributes, if this radio | checkbox element
3109 - );
3110 - $item_params = wp_parse_args( $item, $default_item_params );
3111 -
3112 - if ( ( ! empty( $item_params['label'] ) ) || ( ! empty( $btn_icon ) ) ) {
3113 -
3114 - ?><label for="<?php echo esc_attr( $item_params['id'] ); ?>"
3115 - class="wpbc_ui_control_label <?php echo esc_attr( $item_params['class'] );
3116 - echo ( ! empty( $item_params['hint'] ) ) ? ' tooltip_' . esc_attr( $item_params['hint']['position'] ) . ' ' : '' ; ?>"
3117 - style="<?php echo esc_attr( $item_params['style'] ); ?>"
3118 - <?php if ( ! empty( $item_params['hint'] ) ) { ?>
3119 - title="<?php echo esc_attr( $item_params['hint']['title'] ); ?>"
3120 - <?php } ?>
3121 - <?php disabled( $item_params['disabled'], true ); ?>
3122 - <?php echo wpbc_get_custom_attr( $item_params ); ?>
3123 - ><?php
3124 -
3125 - echo html_entity_decode(
3126 - wp_kses_post( $item_params['label'] ) // Sanitizes content for allowed HTML tags for post content
3127 - , ENT_QUOTES // Convert &quot; to " and '
3128 - , get_bloginfo( 'charset' ) // 'UTF-8' or other
3129 - ); // Convert &amp;dash; to &dash; etc...
3130 - ?></label><?php
3131 - }
3132 -
3133 -}
3134 -
3135 -/**
3136 - * Show FLEX text
3137 - *
3138 - * @param array $item
3139 - *
3140 - * Example:
3141 - $params_checkbox = array(
3142 - 'id' => 'my_check_id' // HTML ID of element
3143 - , 'name' => 'my_check_id'
3144 - , 'label' => __('Approve' ,'booking')
3145 - , 'style' => '' // CSS of select element
3146 - , 'class' => '' // CSS Class of select element
3147 - , 'disabled' => false
3148 - , 'attr' => array() // Any additional attributes, if this radio | checkbox element
3149 - , 'placeholder' => ''
3150 - , 'value' => 'CHECK_VAL_1' // Some Value from optins array that selected by default
3151 - , 'onfocus' => "console.log( 'ON FOCUS:', jQuery( this ).is(':checked') , 'in element:' , jQuery( this ) );" // JavaScript code
3152 - , 'onchange' => "console.log( 'ON CHANGE:', jQuery( this ).is(':checked') , 'in element:' , jQuery( this ) );" // JavaScript code
3153 - );
3154 - ?><div class="ui_element"><?php
3155 -
3156 - wpbc_flex_text( $params_select );
3157 -
3158 - ?></div><?php
3159 - *
3160 - */
3161 -function wpbc_flex_text( $item ) {
3162 -
3163 - $default_item_params = array(
3164 - 'type' => 'text'
3165 - , 'id' => ''
3166 - , 'name' => ''
3167 - , 'label' => ''
3168 - , 'disabled' => false
3169 - , 'class' => ''
3170 - , 'style' => ''
3171 - , 'placeholder' => ''
3172 - , 'attr' => array()
3173 - , 'value' => ''
3174 - , 'is_escape_value' => true
3175 - , 'onfocus' => '' // JavaScript code
3176 - , 'onchange' => '' // JavaScript code
3177 - , 'onkeydown' => '' // JavaScript code
3178 -
3179 - );
3180 - $item_params = wp_parse_args( $item, $default_item_params );
3181 -
3182 - if ( ( empty( $item_params['name'] ) )
3183 - && ( ! empty( $item_params['id'] ) )
3184 - ) {
3185 - $item_params['name'] = $item_params['id'];
3186 - }
3187 -
3188 - // Show only, if $item_params['label'] ! EMPTY
3189 - wpbc_flex_label(
3190 - array(
3191 - 'id' => $item_params['id']
3192 - , 'label' => $item_params['label']
3193 - )
3194 - );
3195 -
3196 - if ( $item_params['is_escape_value'] ) {
3197 - $escaped_value = esc_attr( $item_params['value'] );
3198 - } else {
3199 - $escaped_value = $item_params['value'];
3200 - }
3201 -
3202 - ?><input type="<?php echo esc_attr( $item_params['type'] ); ?>"
3203 - id="<?php echo esc_attr( $item_params['id'] ); ?>"
3204 - name="<?php echo esc_attr( $item_params['name'] ); ?>"
3205 - style="<?php echo esc_attr( $item_params['style'] ); ?>"
3206 - class="wpbc_ui_control wpbc_ui_text <?php echo esc_attr( $item_params['class'] ); ?>"
3207 - placeholder="<?php echo esc_attr( $item_params['placeholder'] ); ?>"
3208 - value="<?php echo $escaped_value; ?>"
3209 - autocomplete="off"
3210 - <?php disabled( $item_params['disabled'], true ); ?>
3211 - <?php echo wpbc_get_custom_attr( $item_params ); ?>
3212 - <?php
3213 - if ( ! empty( $item_params['onfocus'] ) ) {
3214 - ?> onfocus="javascript:<?php echo wpbc_esc_js( $item_params['onfocus'] ); ?>" <?php
3215 - }
3216 - if ( ! empty( $item_params['onchange'] ) ) {
3217 - ?> onchange="javascript:<?php echo wpbc_esc_js( $item_params['onchange'] ); ?>" <?php
3218 - }
3219 - if ( ! empty( $item_params['onkeydown'] ) ) {
3220 - ?> onkeydown="javascript:<?php echo wpbc_esc_js( $item_params['onkeydown'] ); ?>" <?php
3221 - }
3222 - ?>
3223 - /><?php
3224 -}
3225 -
3226 -/**
3227 - * Show FLEX textarea
3228 - *
3229 - * @param array $item
3230 - *
3231 - * Example:
3232 - $params_textarea = array(
3233 - 'id' => 'my_check_id' // HTML ID of element
3234 - , 'name' => 'my_check_id'
3235 - , 'label' => __('Approve' ,'booking')
3236 - , 'style' => '' // CSS of select element
3237 - , 'class' => '' // CSS Class of select element
3238 - , 'disabled' => false
3239 - , 'attr' => array() // Any additional attributes, if this radio | checkbox element
3240 - , 'rows' => '3'
3241 - , 'cols' => '50'
3242 - , 'placeholder' => ''
3243 - , 'value' => 'Test VAL 1' // Some Value from optins array that selected by default
3244 - , 'onfocus' => "console.log( 'ON FOCUS:', jQuery( this ).val() , 'in element:' , jQuery( this ) );" // JavaScript code
3245 - , 'onchange' => "console.log( 'ON CHANGE:', jQuery( this ).val() , 'in element:' , jQuery( this ) );" // JavaScript code
3246 - );
3247 - ?><div class="ui_element"><?php
3248 -
3249 - wpbc_flex_textarea( $params_textarea );
3250 -
3251 - ?></div><?php
3252 - *
3253 - */
3254 -function wpbc_flex_textarea( $item ) {
3255 -
3256 - $default_item_params = array(
3257 - 'id' => ''
3258 - , 'name' => ''
3259 - , 'label' => ''
3260 - , 'disabled' => false
3261 - , 'class' => ''
3262 - , 'style' => ''
3263 - , 'placeholder' => ''
3264 - , 'attr' => array()
3265 - , 'rows' => '3'
3266 - , 'cols' => '50'
3267 - , 'value' => ''
3268 - , 'is_escape_value' => true
3269 - , 'onfocus' => '' // JavaScript code
3270 - , 'onchange' => '' // JavaScript code
3271 - );
3272 - $item_params = wp_parse_args( $item, $default_item_params );
3273 -
3274 - if ( ( empty( $item_params['name'] ) )
3275 - && ( ! empty( $item_params['id'] ) )
3276 - ) {
3277 - $item_params['name'] = $item_params['id'];
3278 - }
3279 -
3280 - // Show only, if $item_params['label'] ! EMPTY
3281 - wpbc_flex_label(
3282 - array(
3283 - 'id' => $item_params['id']
3284 - , 'label' => $item_params['label']
3285 - )
3286 - );
3287 -
3288 - if ( $item_params['is_escape_value'] ) {
3289 - $escaped_value = esc_textarea( $item_params['value'] );
3290 - } else {
3291 - $escaped_value = $item_params['value'];
3292 - }
3293 -
3294 - ?><textarea id="<?php echo esc_attr( $item_params['id'] ); ?>"
3295 - name="<?php echo esc_attr( $item_params['name'] ); ?>"
3296 - style="<?php echo esc_attr( $item_params['style'] ); ?>"
3297 - class="wpbc_ui_control wpbc_ui_textarea <?php echo esc_attr( $item_params['class'] ); ?>"
3298 - placeholder="<?php echo esc_attr( $item_params['placeholder'] ); ?>"
3299 - autocomplete="off"
3300 - rows="<?php echo esc_attr( $item_params['rows'] ); ?>"
3301 - cols="<?php echo esc_attr( $item_params['cols'] ); ?>"
3302 - <?php disabled( $item_params['disabled'], true ); ?>
3303 - <?php echo wpbc_get_custom_attr( $item_params ); ?>
3304 - <?php
3305 - if ( ! empty( $item_params['onfocus'] ) ) {
3306 - ?> onfocus="javascript:<?php echo wpbc_esc_js( $item_params['onfocus'] ); ?>" <?php
3307 - }
3308 - if ( ! empty( $item_params['onchange'] ) ) {
3309 - ?> onchange="javascript:<?php echo wpbc_esc_js( $item_params['onchange'] ); ?>" <?php
3310 - }
3311 - ?>
3312 - ><?php echo $escaped_value; ?></textarea><?php
3313 -}
3314 -
3315 -/**
3316 - * Show FLEX selectbox
3317 - *
3318 - * @param array $item
3319 - array(
3320 - 'id' => '' // HTML ID of element
3321 - , 'name' => ''
3322 - , 'style' => '' // CSS of select element
3323 - , 'class' => '' // CSS Class of select element
3324 - , 'multiple' => false
3325 - , 'disabled' => false
3326 - , 'attr' => array() // Any additional attributes, if this radio | checkbox element
3327 - , 'options' => array() // Associated array of titles and values
3328 - , 'disabled_options' => array() // If some options disbaled, then its must list here
3329 - , 'value' => '' // Some Value from optins array that selected by default
3330 - , 'onfocus' => "console.log( 'ON FOCUS:', jQuery( this ).val(), 'in element:' , jQuery( this ) );" // JavaScript code
3331 - , 'onchange' => "console.log( 'ON CHANGE:', jQuery( this ).val(), 'in element:' , jQuery( this ) );" // JavaScript code
3332 - )
3333 - *
3334 - *
3335 - * Simple Example :
3336 - *
3337 - $params_select = array(
3338 - 'id' => 'next_days' // HTML ID of element
3339 - , 'name' => 'next_days'
3340 - , 'label' => '' // __( 'Next Days', 'booking' ) // Label (optional)
3341 - , 'style' => '' // CSS of select element
3342 - , 'class' => '' // CSS Class of select element
3343 - , 'multiple' => false
3344 - , 'attr' => array() // Any additional attributes, if this radio | checkbox element
3345 - , 'disabled' => false
3346 - , 'disabled_options' => array( 2, 30 ) // If some options disabled, then it has to list here
3347 - , 'options' => array( // Associated array of titles and values
3348 - , 1 => '1' . ' ' . __('day' ,'booking')
3349 - , 2 => '2' . ' ' . __('days' ,'booking')
3350 - , 7 => '1' . ' ' . __('week' ,'booking')
3351 - , 30 => '1' . ' ' . __('month' ,'booking')
3352 - , 365 => '1' . ' ' . __('Year' ,'booking')
3353 - )
3354 -
3355 - , 'value' => ( isset( $escaped_search_request_params[ 'next_days' ] ) ) ? $escaped_search_request_params[ 'next_days' ] : '183' // Some Value from options array that selected by default
3356 - , 'onfocus' => "console.log( 'ON FOCUS:', jQuery( this ).val(), 'in element:' , jQuery( this ) );" // JavaScript code
3357 - , 'onchange' => "console.log( 'ON CHANGE:', jQuery( this ).val(), 'in element:' , jQuery( this ) );" // JavaScript code
3358 -
3359 - );
3360 -
3361 - ?><div class="ui_element"><?php
3362 -
3363 - wpbc_flex_select( $params_select );
3364 -
3365 - ?></div><?php
3366 - *
3367 - *
3368 - *
3369 - * Example complex:
3370 - *
3371 - *
3372 - *
3373 -
3374 - $params_select = array(
3375 - 'id' => 'next_days' // HTML ID of element
3376 - , 'name' => 'next_days'
3377 - , 'label' => '<span class="" style="font-weight:600;">' . __( 'Cost', 'booking' ) . ' <em style="color:#888;">(' . __( 'min-max', 'booking' ) . '):</em></span>'
3378 - , 'style' => '' // CSS of select element
3379 - , 'class' => '' // CSS Class of select element
3380 - , 'multiple' => false
3381 - , 'attr' => array() // Any additional attributes, if this radio | checkbox element
3382 - , 'disabled' => false
3383 - , 'disabled_options' => array( 2, 5 ) // If some options disabled, then it has to list here
3384 - , 'options' => array( // Associated array of titles and values: array( $option_value => $option_data, ... )
3385 - 'group_days' => array( 'optgroup' => true, 'close' => false, 'title' => __( 'days', 'booking' ) )
3386 - , 1 => '1' . ' ' . __('day' ,'booking')
3387 - , 2 => '2' . ' ' . __('days' ,'booking')
3388 - , 3 => '3' . ' ' . __('days' ,'booking')
3389 - , 4 => '4' . ' ' . __('days' ,'booking')
3390 - , 5 => '5' . ' ' . __('days' ,'booking')
3391 - , 6 => '6' . ' ' . __('days' ,'booking')
3392 - , 'group_days_end' => array( 'optgroup' => true, 'close' => true )
3393 -
3394 - , 'group_weeks' => array( 'optgroup' => true, 'close' => false, 'title' => __( 'weeks', 'booking' ) )
3395 - , 7 => '1' . ' ' . __('week' ,'booking')
3396 - , 14 => '2' . ' ' . __('weeks' ,'booking')
3397 - , 'group_weeks_end' => array( 'optgroup' => true, 'close' => true )
3398 -
3399 - , 'group_months' => array( 'optgroup' => true, 'close' => false, 'title' => __( 'months', 'booking' ) )
3400 - , 30 => '1' . ' ' . __('month' ,'booking')
3401 - , 60 => '2' . ' ' . __('months' ,'booking')
3402 - , 90 => '3' . ' ' . __('months' ,'booking')
3403 - , 183 => '6' . ' ' . __('months' ,'booking')
3404 - , 365 => '1' . ' ' . __('Year' ,'booking')
3405 - , 'group_months_end' => array( 'optgroup' => true, 'close' => true )
3406 -
3407 - , 'complex_value' => array(
3408 - 'title' => 'Complex Option Here' // Text in selectbox option
3409 - , 'style' => '' // CSS of select element
3410 - , 'class' => '' // CSS Class of select element
3411 - , 'disabled' => false
3412 - , 'selected' => true
3413 - , 'attr' => array() // Any additional attributes, if this radio | checkbox element
3414 - , 'optgroup' => false // Use only if you need to show OPTGROUP - Also need to use 'title' of start, end 'close' for END
3415 - , 'close' => false
3416 - )
3417 - )
3418 -
3419 - , 'value' => ( isset( $escaped_search_request_params[ 'next_days' ] ) ) ? $escaped_search_request_params[ 'next_days' ] : '183' // Some Value from options array that selected by default
3420 - , 'onfocus' => "console.log( 'ON FOCUS:', jQuery( this ).val(), 'in element:' , jQuery( this ) );" // JavaScript code
3421 - , 'onchange' => "console.log( 'ON CHANGE:', jQuery( this ).val(), 'in element:' , jQuery( this ) );" // JavaScript code
3422 -
3423 - );
3424 -
3425 - ?><div class="ui_element"><?php
3426 -
3427 - wpbc_flex_select( $params_select );
3428 -
3429 - ?></div><?php
3430 -
3431 - *
3432 - */
3433 -function wpbc_flex_select( $item ) {
3434 -
3435 - $default_item_params = array(
3436 - 'id' => '' // HTML ID of element
3437 - , 'name' => ''
3438 - , 'label' => '' // Label
3439 - , 'style' => '' // CSS of select element
3440 - , 'class' => '' // CSS Class of select element
3441 - , 'multiple' => false
3442 - , 'disabled' => false
3443 - , 'attr' => array() // Any additional attributes, if this radio | checkbox element
3444 - , 'options' => array() // Associated array of titles and values: array( $option_value => $option_data, ... )
3445 - , 'disabled_options' => array() // If some options disabled, then it has to list here
3446 - , 'value' => '' // Some Value from options array that selected by default
3447 - , 'onfocus' => '' // JavaScript code
3448 - , 'onchange' => '' // JavaScript code
3449 - );
3450 - $item_params = wp_parse_args( $item, $default_item_params );
3451 -
3452 - // Show only, if $item_params['label'] ! EMPTY
3453 - wpbc_flex_label(
3454 - array(
3455 - 'id' => $item_params['id']
3456 - , 'label' => $item_params['label']
3457 - )
3458 - );
3459 -
3460 - ?><select
3461 - id="<?php echo esc_attr( $item_params['id'] ); ?>"
3462 - name="<?php echo esc_attr( $item_params['name'] ); echo ( $item_params['multiple'] ? '[]' : '' ); ?>"
3463 - class="wpbc_ui_control wpbc_ui_select <?php echo esc_attr( $item_params['class'] ); ?>"
3464 - style="<?php echo esc_attr( $item_params['style'] ); ?>"
3465 - <?php disabled( $item_params['disabled'], true ); ?>
3466 - <?php echo wpbc_get_custom_attr( $item_params ); ?>
3467 - <?php echo ( $item_params['multiple'] ? ' multiple="MULTIPLE"' : '' ); ?>
3468 - <?php
3469 - if ( ! empty( $item_params['onfocus'] ) ) {
3470 - ?> onfocus="javascript:<?php echo wpbc_esc_js( $item_params['onfocus'] ); ?>" <?php
3471 - }
3472 - if ( ! empty( $item_params['onchange'] ) ) {
3473 - ?> onchange="javascript:<?php echo wpbc_esc_js( $item_params['onchange'] ); ?>" <?php
3474 - }
3475 - ?>
3476 - autocomplete="off"
3477 - ><?php
3478 - foreach ( $item_params['options'] as $option_value => $option_data ) {
3479 -
3480 - if ( ! is_array( $option_data ) ) {
3481 - $option_data = array( 'title' => $option_data );
3482 - $is_was_simple = true;
3483 - } else {
3484 - $is_was_simple = false;
3485 - }
3486 -
3487 - $default_option_params = array(
3488 - 'title' => '' // Text in selectbox option
3489 - , 'style' => '' // CSS of select element
3490 - , 'class' => '' // CSS Class of select element
3491 - , 'disabled' => false
3492 - , 'selected' => false
3493 - , 'attr' => array() // Any additional attributes, if this radio | checkbox element
3494 -
3495 - , 'optgroup' => false // Use only if you need to show OPTGROUP - Also need to use 'title' of start, end 'close' for END
3496 - , 'close' => false
3497 -
3498 - );
3499 - $option_data = wp_parse_args( $option_data, $default_option_params );
3500 -
3501 - if ( $option_data['optgroup'] ) { // OPTGROUP
3502 -
3503 - if ( ! $option_data['close'] ) {
3504 - ?><optgroup label="<?php echo esc_attr( $option_data['title'] ); ?>"><?php
3505 - } else {
3506 - ?></optgroup><?php
3507 - }
3508 -
3509 - } else { // OPTION
3510 -
3511 - ?><option
3512 - value="<?php echo esc_attr( $option_value ); ?>"
3513 - <?php
3514 - if ( $is_was_simple ) {
3515 - selected( $option_value, $item_params['value'] );
3516 - disabled( in_array( $option_value, $item_params['disabled_options'] ), true );
3517 - }
3518 - ?>
3519 - class="<?php echo esc_attr( $option_data['class'] ); ?>"
3520 - style="<?php echo esc_attr( $option_data['style'] ); ?>"
3521 - <?php echo wpbc_get_custom_attr( $option_data ); ?>
3522 - <?php selected( $option_data['selected'], true ); ?>
3523 - <?php disabled( $option_data['disabled'], true ); ?>
3524 -
3525 - <?php
3526 - if ( ! empty( $item_params['value'] ) ) {
3527 -
3528 - if ( is_array( $item_params['value'] ) ) {
3529 - selected( in_array( esc_attr( $option_value ), $item_params['value'] ), true ); // SELECT multiple, have several items
3530 - } else {
3531 - selected( $item_params['value'], esc_attr( $option_value ) ); //Recheck global selected parameter
3532 - }
3533 - }
3534 - ?>
3535 -
3536 - ><?php
3537 - echo html_entity_decode(
3538 - wp_kses_post( $option_data['title'] ) // Sanitizes content for allowed HTML tags for post content
3539 - , ENT_QUOTES // Convert &quot; to " and '
3540 - , get_bloginfo( 'charset' ) // 'UTF-8' or other
3541 - ); // Convert &amp;dash; to &dash; etc...
3542 -
3543 -
3544 - ?></option><?php
3545 - }
3546 - }
3547 - ?></select><?php
3548 -}
3549 -
3550 -/**
3551 - * Show FLEX checkbox
3552 - *
3553 - * @param array $item
3554 - *
3555 - * Example:
3556 - $params_checkbox = array(
3557 - 'id' => 'my_check_id' // HTML ID of element
3558 - , 'name' => 'my_check_id'
3559 - , 'label' => array( 'title' => __('Approve' ,'booking') , 'position' => 'right' )
3560 - , 'style' => '' // CSS of select element
3561 - , 'class' => '' // CSS Class of select element
3562 - , 'disabled' => false
3563 - , 'attr' => array() // Any additional attributes, if this radio | checkbox element
3564 - , 'legend' => '' // aria-label parameter
3565 - , 'value' => 'CHECK_VAL_1' // Some Value from optins array that selected by default
3566 - , 'selected' => !false // Selected or not
3567 - , 'onfocus' => "console.log( 'ON FOCUS:', jQuery( this ).is(':checked') , 'in element:' , jQuery( this ) );" // JavaScript code
3568 - , 'onchange' => "console.log( 'ON CHANGE:', jQuery( this ).is(':checked') , 'in element:' , jQuery( this ) );" // JavaScript code
3569 - , 'is_use_toggle' => false // Show checkbox as toggle
3570 - , 'hint' => '' // , 'hint' => array( 'title' => __('Select status' ,'booking') , 'position' => 'bottom' )
3571 - );
3572 - ?><div class="ui_element"><?php
3573 -
3574 - wpbc_flex_checkbox( $params_select );
3575 -
3576 - ?></div><?php
3577 - */
3578 -function wpbc_flex_checkbox( $item ) {
3579 -
3580 - $default_item_params = array(
3581 - 'type' => 'checkbox'
3582 - , 'id' => '' // HTML ID of element
3583 - , 'name' => ''
3584 - , 'label' => '' // Label Example: 'label' => array( 'title' => __('Select status' ,'booking') , 'position' => 'left' )
3585 - , 'style' => '' // CSS of select element
3586 - , 'class' => '' // CSS Class of select element
3587 - , 'disabled' => false
3588 - , 'attr' => array() // Any additional attributes, if this radio | checkbox element
3589 - , 'legend' => '' // aria-label parameter
3590 - , 'value' => '' // Some Value from optins array that selected by default
3591 - , 'selected' => false // Selected or not
3592 - , 'onfocus' => '' // JavaScript code
3593 - , 'onchange' => '' // JavaScript code
3594 - , 'is_use_toggle' => false // Show checkbox as toggle
3595 - , 'hint' => '' // , 'hint' => array( 'title' => __('Select status' ,'booking') , 'position' => 'bottom' )
3596 - );
3597 - $item_params = wp_parse_args( $item, $default_item_params );
3598 -
3599 -
3600 - // Use toggle element, instead of checkbox.
3601 - if ( $item_params['is_use_toggle'] ) {
3602 -
3603 - wpbc_flex_toggle( $item );
3604 - return;
3605 - }
3606 -
3607 - if ( ( ! empty( $item_params['label'] ) ) && ( 'left' == $item_params['label']['position'] ) ) {
3608 - wpbc_flex_label( array( 'id' => $item_params['id'], 'label' => $item_params['label']['title'] ) );
3609 - }
3610 -
3611 - ?><input type="<?php echo esc_attr( $item_params['type'] ); ?>"
3612 - id="<?php echo esc_attr( $item_params['id'] ); ?>"
3613 - name="<?php echo esc_attr( $item_params['name'] ); ?>"
3614 - value="<?php echo esc_attr( $item_params['value'] ); ?>"
3615 - aria-label="<?php echo esc_attr( $item_params['legend'] ); ?>"
3616 - class="wpbc_ui_<?php echo esc_attr( $item_params['type'] ); ?> <?php echo esc_attr( $item_params['class'] ); ?> <?php echo ( ! empty( $item_params['hint'] ) ) ? ' tooltip_' . esc_attr( $item_params['hint']['position'] ) . ' ' : '' ; ?>"
3617 - style="<?php echo esc_attr( $item_params['style'] ); ?>"
3618 - <?php
3619 - if ( ! empty( $item_params['hint'] ) ) { ?>
3620 - title="<?php echo esc_attr( $item_params['hint']['title'] ); ?>" <?php
3621 - }
3622 - ?>
3623 - <?php echo wpbc_get_custom_attr( $item_params ); ?>
3624 - <?php checked( $item_params['selected'], true ); ?>
3625 - <?php disabled( $item_params['disabled'], true ); ?>
3626 - <?php
3627 - if ( ! empty( $item_params['onfocus'] ) ) {
3628 - ?> onfocus="javascript:<?php echo wpbc_esc_js( $item_params['onfocus'] ); ?>" <?php
3629 - }
3630 - if ( ! empty( $item_params['onchange'] ) ) {
3631 - ?> onchange="javascript:<?php echo wpbc_esc_js( $item_params['onchange'] ); ?>" <?php
3632 - }
3633 - ?>
3634 - autocomplete="off"
3635 - /><?php
3636 -
3637 - if ( ( ! empty( $item_params['label'] ) ) && ( 'right' == $item_params['label']['position'] ) ) {
3638 - wpbc_flex_label( array( 'id' => $item_params['id'], 'label' => $item_params['label']['title'] ) );
3639 - }
3640 -}
3641 -
3642 -
3643 -/**
3644 - * Show FLEX toggle instead of checkbox
3645 - *
3646 - * @param array $item
3647 - *
3648 - * Example:
3649 - $params_checkbox = array(
3650 - 'id' => 'my_check_id' // HTML ID of element
3651 - , 'name' => 'my_check_id'
3652 - , 'label' => array( 'title' => __('Approve' ,'booking') , 'position' => 'right' )
3653 - , 'style' => '' // CSS of select element
3654 - , 'toggle_style' => '' // Styles CSS of toggle container
3655 - , 'toggle_class' => '' // Class CSS of toggle container
3656 - , 'class' => '' // CSS Class of input element
3657 - , 'disabled' => false
3658 - , 'attr' => array() // Any additional attributes, if this radio | checkbox element
3659 - , 'legend' => '' // aria-label parameter
3660 - , 'value' => 'CHECK_VAL_1' // Some Value from optins array that selected by default
3661 - , 'selected' => !false // Selected or not
3662 - , 'onfocus' => "console.log( 'ON FOCUS:', jQuery( this ).is(':checked') , 'in element:' , jQuery( this ) );" // JavaScript code
3663 - , 'onchange' => "console.log( 'ON CHANGE:', jQuery( this ).is(':checked') , 'in element:' , jQuery( this ) );" // JavaScript code
3664 - );
3665 - ?><div class="ui_element"><?php
3666 -
3667 - wpbc_flex_toggle( $params_select );
3668 -
3669 - ?></div><?php
3670 - */
3671 -function wpbc_flex_toggle( $item ){
3672 -
3673 - $default_item_params = array(
3674 - 'type' => 'checkbox'
3675 - , 'id' => '' // HTML ID of element
3676 - , 'name' => ''
3677 - , 'label' => '' // Label Example: 'label' => array( 'title' => __('Select status' ,'booking') , 'position' => 'left' )
3678 - , 'style' => '' // CSS of select element
3679 - , 'toggle_style' => '' // Styles CSS of toggle container
3680 - , 'toggle_class' => '' // Class CSS of toggle container
3681 - , 'class' => '' // CSS Class of input element
3682 - , 'disabled' => false
3683 - , 'attr' => array() // Any additional attributes, if this radio | checkbox element
3684 - , 'legend' => '' // aria-label parameter
3685 - , 'value' => '' // Some Value from optins array that selected by default
3686 - , 'selected' => false // Selected or not
3687 - , 'onfocus' => '' // JavaScript code
3688 - , 'onchange' => '' // JavaScript code
3689 - , 'hint' => '' // , 'hint' => array( 'title' => __('Select status' ,'booking') , 'position' => 'bottom' )
3690 - );
3691 - $item_params = wp_parse_args( $item, $default_item_params );
3692 - /**
3693 - * Structure:
3694 - ?><span class="wpbc_ui__toggle">
3695 - <input type="checkbox" name="field_name" id="wpbc_field_id" value="On" />
3696 - <label class="wpbc_ui__toggle_icon" for="wpbc_field_id"></label>
3697 - <label class="wpbc_ui__toggle_label" for="wpbc_field_id">Some Text</label>
3698 - <i class="wpbc_help_tooltip"></i>
3699 - </span><?php
3700 - */
3701 -
3702 - ?><span class="wpbc_ui__toggle <?php echo esc_attr( $item_params['toggle_class'] ); ?>" style="<?php echo esc_attr( $item_params['toggle_style'] ); ?>"><?php
3703 -
3704 - ?><input type="<?php echo esc_attr( $item_params['type'] ); ?>"
3705 - id="<?php echo esc_attr( $item_params['id'] ); ?>"
3706 - name="<?php echo esc_attr( $item_params['name'] ); ?>"
3707 - value="<?php echo esc_attr( $item_params['value'] ); ?>"
3708 - aria-label="<?php echo esc_attr( $item_params['legend'] ); ?>"
3709 - class="wpbc_ui_<?php echo esc_attr( $item_params['type'] ); ?> <?php echo esc_attr( $item_params['class'] ); ?>"
3710 - <?php echo wpbc_get_custom_attr( $item_params ); ?>
3711 - <?php checked( $item_params['selected'], true ); ?>
3712 - <?php disabled( $item_params['disabled'], true ); ?>
3713 - <?php
3714 - if ( ! empty( $item_params['onfocus'] ) ) {
3715 - ?> onfocus="javascript:<?php echo wpbc_esc_js( $item_params['onfocus'] ); ?>" <?php
3716 - }
3717 - if ( ! empty( $item_params['onchange'] ) ) {
3718 - ?> onchange="javascript:<?php echo wpbc_esc_js( $item_params['onchange'] ); ?>" <?php
3719 - }
3720 - ?>
3721 - autocomplete="off"
3722 - /><?php
3723 -
3724 - ?><label class="wpbc_ui__toggle_icon
3725 - <?php echo ( ! empty( $item_params['hint'] ) ) ? ' tooltip_' . esc_attr( $item_params['hint']['position'] ) . ' ' : '' ; ?>
3726 - "
3727 - for="<?php echo esc_attr( $item_params['id'] ); ?>"
3728 - <?php
3729 - if ( ! empty( $item_params['hint'] ) ) { ?>
3730 - title="<?php echo esc_attr( $item_params['hint']['title'] ); ?>" <?php
3731 - }
3732 - ?>
3733 - ></label><?php
3734 -
3735 - if ( ! empty( $item_params['label'] ) ) {
3736 - wpbc_flex_label( array( 'id' => $item_params['id'], 'class' => 'wpbc_ui__toggle_label', 'label' => $item_params['label']['title'] ) );
3737 - }
3738 -
3739 - ?><i class="wpbc_help_tooltip"></i><?php
3740 -
3741 - ?></span><?php
3742 -
3743 -}
3744 -
3745 -
3746 -/**
3747 - * Show FLEX radio button
3748 - *
3749 - * @param array $item
3750 - *
3751 - * Example:
3752 - $params_checkbox = array(
3753 - 'id' => 'my_check_id' // HTML ID of element
3754 - , 'name' => 'my_check_id'
3755 - , 'label' => array( 'title' => __('Approve' ,'booking') , 'position' => 'right' )
3756 - , 'style' => '' // CSS of select element
3757 - , 'class' => '' // CSS Class of select element
3758 - , 'disabled' => false
3759 - , 'attr' => array() // Any additional attributes, if this radio | checkbox element
3760 - , 'legend' => '' // aria-label parameter
3761 - , 'value' => 'CHECK_VAL_1' // Some Value from optins array that selected by default
3762 - , 'selected' => !false // Selected or not
3763 - , 'onfocus' => "console.log( 'ON FOCUS:', jQuery( this ).is(':checked') , 'in element:' , jQuery( this ) );" // JavaScript code
3764 - , 'onchange' => "console.log( 'ON CHANGE:', jQuery( this ).val() , 'in element:' , jQuery( this ) );" // JavaScript code
3765 - );
3766 - ?><div class="ui_element"><?php
3767 -
3768 - wpbc_flex_radio( $params_select );
3769 -
3770 - $params_checkbox['id'] = 'my_check_id2';
3771 - $params_checkbox['value'] = 'CHECK_VAL_2';
3772 -
3773 - wpbc_flex_radio( $params_select );
3774 -
3775 - ?></div><?php
3776 - */
3777 -function wpbc_flex_radio( $item ) {
3778 - $item['type'] = 'radio';
3779 - $item['is_use_toggle'] = false;
3780 - wpbc_flex_checkbox( $item );
3781 -}
3782 -
3783 -/**
3784 - * Show FLEX addon (image or text can be here)
3785 - *
3786 - * @param array $item
3787 - array(
3788 - 'type' => 'span' // HTML tag that will bound content
3789 - , 'html' => '' // Any other HTML content
3790 - , 'icon' => false // array( 'icon_font' => 'wpbc_icn_check_circle_outline', 'position' => 'right', 'icon_img' => '' )
3791 - , 'style' => '' // CSS of select element
3792 - , 'class' => '' // CSS Class of select element // default included class is .wpbc_ui_addon
3793 - , 'attr' => array() // Any additional attributes
3794 - );
3795 - * Example 1:
3796 -` $params_span = array(
3797 - 'type' => 'span'
3798 - , 'html' => '<i class="menu_icon icon-1x wpbc_icn_event"></i> &nbsp; Approve '
3799 - , 'icon' => false // array( 'icon_font' => 'wpbc_icn_check_circle_outline', 'position' => 'right', 'icon_img' => '' )
3800 - , 'class' => 'wpbc_ui_button inactive ui_nowrap'
3801 - , 'style' => ''
3802 - , 'attr' => array()
3803 - );
3804 -
3805 - ?><div class="ui_element"><?php
3806 -
3807 - wpbc_flex_addon( $params_span );
3808 -
3809 - wpbc_flex_text( $params_text );
3810 -
3811 - wpbc_flex_addon( $params_span );
3812 -
3813 - ?></div><?php
3814 - * Example 2:
3815 - $params_addon = array(
3816 - 'type' => 'span'
3817 - , 'html' => ''// '<i class="menu_icon icon-1x wpbc_icn_event"></i>' //'<strong>' . __( 'Dates', 'booking ' ) . '</strong>'
3818 - , 'icon' => array( 'icon_font' => 'wpbc_icn_event', 'position' => 'right', 'icon_img' => '' )
3819 - , 'class' => 'wpbc_ui_button inactive'
3820 - , 'style' => ''
3821 - , 'attr' => array()
3822 - );
3823 - ?><div class="ui_element ui_nowrap"><?php
3824 - wpbc_flex_addon( $params_addon );
3825 - ?></div><?php
3826 -
3827 - */
3828 -function wpbc_flex_addon( $item ) {
3829 -
3830 - $default_item_params = array(
3831 - 'type' => 'span'
3832 - , 'html' => ''
3833 - , 'icon' => false
3834 - , 'class' => ''
3835 - , 'style' => ''
3836 - , 'hint' => '' // , 'hint' => array( 'title' => __('Select status' ,'booking') , 'position' => 'bottom' )
3837 - , 'attr' => array()
3838 - );
3839 - $item_params = wp_parse_args( $item, $default_item_params );
3840 -
3841 - // Icon
3842 - $btn_icon = '';
3843 - if ( ( ! empty( $item_params['icon'] ) ) && ( is_array( $item_params['icon'] ) ) ) {
3844 -
3845 - // Icon IMG
3846 - if ( ! empty( $item_params['icon']['icon_img'] ) ) {
3847 -
3848 - if ( substr( $item_params['icon']['icon_img'], 0, 4 ) != 'http' ) {
3849 - $img_path = WPBC_PLUGIN_URL . '/assets/img/' . $item_params['icon']['icon_img'];
3850 - } else {
3851 - $img_path = $item_params['icon']['icon_img'];
3852 - }
3853 - $btn_icon = '<img class="menuicons" src="' . esc_url( $img_path ) . '" />'; // Img Icon
3854 - }
3855 -
3856 - // Icon Font
3857 - if ( ! empty( $item_params['icon']['icon_font'] ) ) {
3858 - $btn_icon = '<i class="menu_icon icon-1x ' . esc_attr( $item_params['icon']['icon_font'] ) . '"></i>'; // Font Icon
3859 - }
3860 - }
3861 -
3862 - ?><<?php echo esc_attr( $item_params['type'] ); ?>
3863 - class="wpbc_ui_control wpbc_ui_addon <?php echo esc_attr( $item_params['class'] );
3864 - echo ( ! empty( $item_params['hint'] ) ) ? ' tooltip_' . esc_attr( $item_params['hint']['position'] ) . ' ' : '' ; ?>"
3865 - style="<?php echo esc_attr( $item_params['style'] ); ?>"
3866 - <?php echo wpbc_get_custom_attr( $item_params ); ?>
3867 - <?php if ( ! empty( $item_params['hint'] ) ) { ?>
3868 - title="<?php echo esc_attr( $item_params['hint']['title'] ); ?>"
3869 - <?php } ?>
3870 -
3871 - ><?php
3872 -
3873 - if ( ( ! empty( $btn_icon ) ) && ( 'left' == $item_params['icon']['position'] ) ) {
3874 - echo $btn_icon;
3875 - }
3876 -
3877 - echo html_entity_decode(
3878 - wp_kses_post( $item_params['html'] ) // Sanitizes content for allowed HTML tags for post content
3879 - , ENT_QUOTES // Convert &quot; to " and '
3880 - , get_bloginfo( 'charset' ) // 'UTF-8' or other
3881 - ); // Convert &amp;dash; to &dash; etc...
3882 -
3883 -
3884 - if ( ( ! empty( $btn_icon ) ) && ( 'right' == $item_params['icon']['position'] ) ) {
3885 - echo $btn_icon;
3886 - }
3887 -
3888 - ?></<?php echo esc_attr( $item_params['type'] ); ?>><?php
3889 -}
3890 -
3891 -function wpbc_flex_divider( $item = array() ){
3892 -
3893 - $default_item_params = array(
3894 - 'type' => 'span'
3895 - , 'html' => ''
3896 - , 'icon' => false
3897 - , 'class' => ''
3898 - , 'style' => ''
3899 - , 'hint' => '' // , 'hint' => array( 'title' => __('Select status' ,'booking') , 'position' => 'bottom' )
3900 - , 'attr' => array()
3901 - );
3902 - $item_params = wp_parse_args( $item, $default_item_params );
3903 -
3904 - ?><div class="wpbc_ui_control ui_elements_divider <?php echo esc_attr( $item_params['class'] );
3905 - echo ( ! empty( $item_params['hint'] ) ) ? ' tooltip_' . esc_attr( $item_params['hint']['position'] ) . ' ' : '' ; ?>"
3906 - style="<?php echo esc_attr( $item_params['style'] ); ?>"
3907 - <?php echo wpbc_get_custom_attr( $item_params ); ?>
3908 - <?php if ( ! empty( $item_params['hint'] ) ) { ?>
3909 - title="<?php echo esc_attr( $item_params['hint']['title'] ); ?>"
3910 - <?php } ?>
3911 - ></div><?php
3912 -}
3913 -
3914 -/**
3915 - * Show FLEX Vertical line for "wpbc_ui_control" elements with vertical border color
3916 - *
3917 - * @param $item array
3918 - *
3919 - * @return void
3920 - *
3921 - * Example:
3922 - * ?><div class="ui_element ui_nowrap"><?php
3923 - wpbc_flex_vertical_color( array(
3924 - 'vertical_line' => 'border-left: 4px solid #11be4c;'
3925 - ) );
3926 - * ?></div><?php
3927 - */
3928 -function wpbc_flex_vertical_color( $item = array() ){
3929 -
3930 - $default_item_params = array(
3931 - 'id' => ''
3932 - , 'html' => '<span></span>'
3933 - , 'icon' => false
3934 - , 'class' => ''
3935 - , 'style' => ''
3936 - , 'hint' => '' // , 'hint' => array( 'title' => __('Select status' ,'booking') , 'position' => 'bottom' )
3937 - , 'attr' => array()
3938 - , 'vertical_line' => 'border-left: 4px solid #11be4c;'
3939 - );
3940 - $item_params = wp_parse_args( $item, $default_item_params );
3941 -
3942 - ?><div
3943 - id="<?php echo esc_attr( $item_params['id'] ); ?>"
3944 - class="wpbc_ui_control wpbc_ui_button ui_elements_vertical_color <?php echo esc_attr( $item_params['class'] );
3945 - echo ( ! empty( $item_params['hint'] ) ) ? ' tooltip_' . esc_attr( $item_params['hint']['position'] ) . ' ' : '' ; ?>"
3946 - style="<?php echo esc_attr( $item_params['vertical_line'] ) . ';'; ?>padding: 0;<?php echo esc_attr( $item_params['style'] ); ?>"
3947 - <?php echo wpbc_get_custom_attr( $item_params ); ?>
3948 - <?php if ( ! empty( $item_params['hint'] ) ) { ?>
3949 - title="<?php echo esc_attr( $item_params['hint']['title'] ); ?>"
3950 - <?php } ?>
3951 - ><?php echo $item_params['html']; ?></div><?php
3952 -
3953 -}
3954 -
3955 -
3956 -
3957 -
3958 -/**
3959 - * Show FLEX Horizontal Text Bar line for "wpbc_ui_control" elements with vertical border color
3960 - *
3961 - * @param $item array
3962 - *
3963 - * @return void
3964 - *
3965 - * Example:
3966 - *
3967 - $params_text_bar_1 = array( 'id' => ''
3968 - , 'html' => '1. ' . __( 'Calendar Skin', 'booking' )
3969 - , 'option_class' => 'wpbc_option_step wpbc_passed_step' // 'wpbc_option_step', 'wpbc_option_separator', 'wpbc_option_step wpbc_selected_step', 'wpbc_option_separator wpbc_passed_step'
3970 - , 'class' => ''
3971 - , 'style' => 'height:auto;'
3972 - , 'hint' => '' // , 'hint' => array( 'title' => __('Select status' ,'booking') , 'position' => 'bottom' )
3973 - , 'attr' => array()
3974 - , 'tag' => 'span'
3975 - );
3976 - $params_text_bar_hr = array('id' => ''
3977 - , 'html' => '&gt;'
3978 - , 'option_class' => 'wpbc_option_separator' // 'wpbc_option_step', 'wpbc_option_separator', 'wpbc_option_step wpbc_selected_step', 'wpbc_option_separator wpbc_passed_step'
3979 - , 'class' => ''
3980 - , 'style' => 'height:auto;'
3981 - , 'hint' => '' // , 'hint' => array( 'title' => __('Select status' ,'booking') , 'position' => 'bottom' )
3982 - , 'attr' => array()
3983 - , 'tag' => 'span'
3984 - );
3985 -
3986 - $params_text_bar_2 = $params_text_bar_1;
3987 - $params_text_bar_2['html'] = '2. ' . __( 'Calendar size', 'booking' );
3988 - $params_text_bar_2['option_class'] = 'wpbc_option_step wpbc_selected_step';
3989 -
3990 - $params_text_bar_3 = $params_text_bar_1;
3991 - $params_text_bar_3['html'] = '3. ' . __( 'Dates selection', 'booking' );
3992 - $params_text_bar_3['option_class'] = 'wpbc_option_step';
3993 -
3994 - * ?><div class="ui_element ui_nowrap"><?php
3995 - *
3996 - wpbc_flex_horizontal_text_bar( $params_text_bar_1 );
3997 -
3998 - wpbc_flex_horizontal_text_bar( $params_text_bar_hr );
3999 -
4000 - wpbc_flex_horizontal_text_bar( $params_text_bar_2 );
4001 -
4002 - * ?></div><?php
4003 - */
4004 -function wpbc_flex_horizontal_text_bar( $item = array() ){
4005 -
4006 - $default_item_params = array(
4007 - 'id' => ''
4008 - , 'html' => '<span></span>'
4009 - , 'class' => ''
4010 - , 'style' => ''
4011 - , 'hint' => '' // , 'hint' => array( 'title' => __('Select status' ,'booking') , 'position' => 'bottom' )
4012 - , 'attr' => array()
4013 - , 'tag' => 'span'
4014 - , 'option_class' => 'wpbc_option_step' // 'wpbc_option_step', 'wpbc_option_separator', 'wpbc_option_step wpbc_selected_step', 'wpbc_option_separator wpbc_passed_step'
4015 - );
4016 - $item_params = wp_parse_args( $item, $default_item_params );
4017 -
4018 - ?><<?php echo esc_attr( $item_params['tag'] ); ?>
4019 - <?php if ( ! empty( $item_params['id'] ) ) { echo ' id="' . esc_attr( $item_params['id'] ) . '" '; } ?>
4020 - class="wpbc_ui_control wpbc_ui_addon wpbc_text_bar <?php echo esc_attr( $item_params['class'] );
4021 - echo ( ! empty( $item_params['hint'] ) ) ? ' tooltip_' . esc_attr( $item_params['hint']['position'] ) . ' ' : '' ; ?>"
4022 - style="<?php echo esc_attr( $item_params['style'] ); ?>"
4023 - <?php echo wpbc_get_custom_attr( $item_params ); ?>
4024 - <?php if ( ! empty( $item_params['hint'] ) ) { ?>
4025 - title="<?php echo esc_attr( $item_params['hint']['title'] ); ?>"
4026 - <?php } ?>
4027 - ><span class="<?php echo esc_attr( $item_params['option_class'] ); ?>"><?php
4028 - echo $item_params['html'];
4029 - ?></span></<?php echo esc_attr( $item_params['tag'] ); ?>><?php
4030 -
4031 -}
4032 -
4033 -
4034 -
4035 -////////////////////////////////////////////////////////////////////////////////
1461 +// ---------------------------------------------------------------------------------------------------------------------
4036 1462 // JS & CSS Loading
4037 -////////////////////////////////////////////////////////////////////////////////
1463 +// ---------------------------------------------------------------------------------------------------------------------
4038 1464
4039 1465 /**
4040 1466 * CSS files loading
4041 1467 *
@@ -4044,9 +1470,9 @@
4044 1470 function wpbc_ajx_toolbar_enqueue_css_files( $where_to_load ) {
4045 1471
4046 1472 if ( ( is_admin() ) && ( in_array( $where_to_load, array( 'admin', 'both' ) ) ) ) {
4047 1473
4048 - wp_enqueue_style( 'wpbc-flex-toolbar', wpbc_plugin_url( '/includes/_toolbar_ui/_src/toolbar_ui.css' ), array(), WP_BK_VERSION_NUM );
1474 + wp_enqueue_style( 'wpbc-flex-toolbar', wpbc_plugin_url( '/includes/_toolbar_ui/_out/toolbar_ui.css' ), array(), WP_BK_VERSION_NUM );
4049 1475 }
4050 1476 }
4051 1477 add_action( 'wpbc_enqueue_css_files', 'wpbc_ajx_toolbar_enqueue_css_files', 50 );
4052 1478
@@ -4061,12 +1487,12 @@
4061 1487 $in_footer = true;
4062 1488
4063 1489 if ( ( is_admin() ) && ( in_array( $where_to_load, array( 'admin', 'both' ) ) ) ) {
4064 1490
4065 - wp_enqueue_script( 'wpbc-flex-toolbar-ui', wpbc_plugin_url( '/includes/_toolbar_ui/_out/toolbar_ui.js' ), array( 'wpbc-global-vars' ), WP_BK_VERSION_NUM, $in_footer );
1491 + wp_enqueue_script( 'wpbc-flex-toolbar-ui', wpbc_plugin_url( '/includes/_toolbar_ui/_out/toolbar_ui.js' ), array( 'wpbc_all' ), WP_BK_VERSION_NUM, $in_footer );
4066 1492
4067 1493 /**
4068 - * wp_localize_script( 'wpbc-global-vars', 'wpbc_live_request_obj'
1494 + * wp_localize_script( 'wpbc_all', 'wpbc_live_request_obj'
4069 1495 , array(
4070 1496 'contacts' => '',
4071 1497 'reminders' => ''
4072 1498 )
@@ -4073,5 +1499,8 @@
4073 1499 );
4074 1500 */
4075 1501 }
4076 1502 }
4077 -add_action( 'wpbc_enqueue_js_files', 'wpbc_ajx_toolbar_enqueue_js_files', 50 );
1503 +add_action( 'wpbc_enqueue_js_files', 'wpbc_ajx_toolbar_enqueue_js_files', 50 );
1504 +
1505 +
1506 +// 2024-08-13