PluginProbe
Booking Calendar / 11.8.2
Booking Calendar v11.8.2
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 10.11.2 All 203 releases
← All changes | core/wpbc_functions.php +270 -58 10.1011.8.2 View file →
@@ -13,8 +13,104 @@
13 13 */
14 14
15 15 if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
16 16
17 + /**
18 + * Get Logo for conversation.
19 + *
20 + * @param string $svg_color - main color.
21 + * @param string $svg_color_alt - alt color.
22 + *
23 + * @return void
24 + */
25 + function wpbc_get_svg_logo( $svg_color = '#000', $svg_color_alt = '#fff', $opacity = '0.1' ) {
26 +
27 +// $svg_icon_integarted = '<svg xmlns="http://www.w3.org/2000/svg" xml:space="preserve" viewBox="150 150 850 850">'
28 +// . '<path style="fill:' . $svg_color . '" d="M224.3 117.81c0-7.62 6.18-13.8 13.8-13.8h104.13c7.62 0 13.8 6.18 13.8 13.8v239.06c-58.48 32.03-105.14 82.96-131.74 144.58V117.81z"/>'
29 +// . '<path style="fill:' . $svg_color . ';" d="M224.3 620.3c0-152.27 123.43-275.7 275.7-275.7 69.48 0 132.95 25.7 181.43 68.11l-93.55 93.55c-24.31-18.76-54.79-29.92-87.88-29.92-79.51 0-143.96 64.45-143.96 143.96S420.49 764.26 500 764.26c33.09 0 63.57-11.16 87.88-29.92l93.55 93.55C632.95 870.3 569.48 896 500 896c-152.27 0-275.7-123.44-275.7-275.7z"/>'
30 +// . '<path style="fill:' . $svg_color_alt . '" fill-opacity="' . $opacity . '" d="m681.43 827.89-93.55-93.55c34.11-26.33 56.08-67.62 56.08-114.04s-21.97-87.71-56.08-114.04l93.55-93.55c57.78 50.54 94.27 124.8 94.27 207.59s-36.49 157.05-94.27 207.59z"/>'
31 +// . '</svg>';
32 +//
33 +//
34 +// $svg_icon_integarted = '<svg xmlns="http://www.w3.org/2000/svg" id="Layer_1" version="1.1" viewBox="0 0 600 600">
35 +// <path id="O_Letter" d="M298.22 197.55c-92.32 0-167.15 77.82-167.15 173.81s74.84 173.82 167.15 173.82 167.15-77.82 167.15-173.82-74.84-173.81-167.15-173.81Zm0 264.53c-50.1 0-90.71-40.61-90.71-90.71s40.61-90.71 90.71-90.71 90.71 40.61 90.71 90.71-40.61 90.71-90.71 90.71Z" style="fill:' . $svg_color_alt . ';" fill-opacity="' . $opacity . '" />
36 +// <path id="C_Letter" d="M363.75 434.1c-14.85 15.51-35.16 25.76-57.84 27.66-54.87 4.6-101.64-41.14-98.23-96.1 2.94-47.44 42.35-85.01 90.54-85.01 24.84 0 47.34 9.98 63.72 26.16 5.86 5.78 15.29 5.73 21.11-.09l35.14-35.14c5.69-5.69 5.9-14.87.43-20.77-30.41-32.83-73.1-53.26-120.4-53.26-92.32 0-167.15 77.82-167.15 173.81s74.84 173.82 167.15 173.82c48.49 0 92.15-21.47 122.68-55.76 5.29-5.94 5.02-14.97-.6-20.59l-35.05-35.05c-5.98-5.98-15.67-5.79-21.51.32Z" style="fill:' . $svg_color . ';"/>
37 +// <path d="M130.69 357.28v2.59c0 .27.06.53.17.76a123.1 123.1 0 0 1-.17-3.35Zm4.51-50.82c12.34-39.07 38.32-70.02 77.79-97.04.92-.63 1.48-1.67 1.48-2.79V59.95c0-4.28-3.68-7.76-8.22-7.76h-3.76c-18.56 0-73.17 40.3-71.79 60.62l-.17 192.91c0 2.74 3.86 3.34 4.68.73Z" style="fill:' . $svg_color . ';"/>
38 +// </svg>';
39 +//
40 +// $svg_icon_integarted = '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 600 600">
41 +// <path d="M311.92 214.22c-92.32 0-167.15 77.82-167.15 173.81s74.84 173.82 167.15 173.82 167.15-77.82 167.15-173.82-74.84-173.81-167.15-173.81Zm0 264.53c-50.1 0-90.71-40.61-90.71-90.71s40.61-90.71 90.71-90.71 90.71 40.61 90.71 90.71-40.61 90.71-90.71 90.71Z" style="fill:' . $svg_color_alt . ';" fill-opacity="' . $opacity . '" />
42 +// <path d="M377.45 450.77c-14.85 15.51-35.16 25.76-57.84 27.66-54.87 4.6-101.64-41.14-98.23-96.1 2.94-47.44 42.35-85.01 90.54-85.01 24.84 0 47.34 9.98 63.72 26.16 5.86 5.78 15.29 5.73 21.11-.09l35.14-35.14c5.69-5.69 5.9-14.87.43-20.77-30.41-32.83-73.1-53.26-120.4-53.26-92.32 0-167.15 77.82-167.15 173.81s74.84 173.82 167.15 173.82c48.49 0 92.15-21.47 122.68-55.76 5.29-5.94 5.02-14.97-.6-20.59l-35.05-35.05c-5.98-5.98-15.67-5.79-21.51.32Z" style="fill:' . $svg_color . ';"/>
43 +// <path d="M149.45 318.12c12.34-39.07 38.32-70.02 77.79-97.04.92-.63 1.48-1.67 1.48-2.79V71.62c0-4.28-3.68-7.76-8.22-7.76h-3.76c-18.56 0-73.17 40.3-71.79 60.62l-.17 192.91c0 2.74 3.86 3.34 4.68.73Z" style="fill:' . $svg_color . ';"/>
44 +// </svg>';
45 +//
46 +// $svg_icon_integarted = '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 550 550">
47 +// <path d="M275 176.36c-92.32 0-167.15 77.82-167.15 173.81S182.69 523.99 275 523.99s167.15-77.82 167.15-173.82S367.31 176.36 275 176.36Zm0 264.53c-50.1 0-90.71-40.61-90.71-90.71s40.61-90.71 90.71-90.71 90.71 40.61 90.71 90.71-40.61 90.71-90.71 90.71Z" style="fill:#ffd25b"/>
48 +// <path d="M340.53 412.91c-14.85 15.51-35.16 25.76-57.84 27.66-54.87 4.6-101.64-41.14-98.23-96.1 2.94-47.44 42.35-85.01 90.54-85.01 24.84 0 47.34 9.98 63.72 26.16 5.86 5.78 15.29 5.73 21.11-.09l35.14-35.14c5.69-5.69 5.9-14.87.43-20.77-30.41-32.83-73.1-53.26-120.4-53.26-92.32 0-167.15 77.82-167.15 173.81S182.69 523.99 275 523.99c48.49 0 92.15-21.47 122.68-55.76 5.29-5.94 5.02-14.97-.6-20.59l-35.05-35.05c-5.98-5.98-15.67-5.79-21.51.32Z" style="fill:#193db2"/>
49 +// <path d="M112.53 280.27c12.34-39.07 38.32-70.02 77.79-97.04.92-.63 1.48-1.67 1.48-2.79V33.76c0-4.28-3.68-7.76-8.22-7.76h-3.76c-18.56 0-73.17 40.3-71.79 60.62l-.17 192.91c0 2.74 3.86 3.34 4.68.73Z" style="fill:#451fff"/>
50 +// </svg>';
51 +
52 + // FixIn: 10.11.3.3.
53 + $svg_icon_integarted = '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 550 550">'
54 + . '<path d="M275 162.36c-92.32 0-167.15 77.82-167.15 173.81S182.69 509.99 275 509.99s167.15-77.82 167.15-173.82S367.31 162.36 275 162.36Zm0 264.53c-50.1 0-90.71-40.61-90.71-90.71s40.61-90.71 90.71-90.71 90.71 40.61 90.71 90.71-40.61 90.71-90.71 90.71Z" style="fill:' . $svg_color_alt . ';" fill-opacity="' . $opacity . '" />'
55 + . '<path d="M340.53 398.91c-14.85 15.51-35.16 25.76-57.84 27.66-54.87 4.6-101.64-41.14-98.23-96.1 2.94-47.44 42.35-85.01 90.54-85.01 24.84 0 47.34 9.98 63.72 26.16 5.86 5.78 15.29 5.73 21.11-.09l35.14-35.14c5.69-5.69 5.9-14.87.43-20.77-30.41-32.83-73.1-53.26-120.4-53.26-92.32 0-167.15 77.82-167.15 173.81S182.69 509.99 275 509.99c48.49 0 92.15-21.47 122.68-55.76 5.29-5.94 5.02-14.97-.6-20.59l-35.05-35.05c-5.98-5.98-15.67-5.79-21.51.32Z" style="fill:' . $svg_color . ';"/>'
56 + . '<path d="M112.53 261.27c12.34-39.07 38.32-70.02 77.79-97.04.92-.63 1.48-1.67 1.48-2.79V14.76c0-4.28-3.68-7.76-8.22-7.76h-3.76c-18.56 0-73.17 40.3-71.79 60.62l-.17 192.91c0 2.74 3.86 3.34 4.68.73Z" style="fill:' . $svg_color . ';"/>'
57 + . '</svg>';
58 +
59 +
60 + return $svg_icon_integarted;
61 + }
62 +
63 +
64 + /**
65 + * Get Logo for Background Image.
66 + *
67 + * @param string $svg_color - main color.
68 + * @param string $svg_color_alt - alt color.
69 + *
70 + * @return void
71 + */
72 + function wpbc_get_svg_logo_for_background( $svg_color = '#000', $svg_color_alt = '#fff', $opacity = '0.2' ) {
73 +
74 + $svg_icon_integarted = wpbc_get_svg_logo( $svg_color, $svg_color_alt, $opacity );
75 +
76 + $svg_icon_integarted = sprintf( 'data:image/svg+xml;base64,%s', base64_encode( $svg_icon_integarted ) );
77 +
78 + return $svg_icon_integarted;
79 + }
80 +
81 + /**
82 + * Get Logo as HTML element.
83 + *
84 + * @param array $params - logo parameters.
85 + *
86 + * @return string
87 + */
88 + function wpbc_get_svg_logo_for_html( $params = array() ) {
89 +
90 + // FixIn: 10.12.1.6.
91 + $defaults = array(
92 + 'svg_color' => '#ccc',
93 + 'svg_color_alt' => '#aaa',
94 + 'opacity' => '0.4',
95 + 'style_default' => 'background-repeat: no-repeat; background-position: center; display: inline-block; vertical-align: top;',
96 + 'style_adjust' => 'background-size: 18px auto; width: 20px; height: 20px; margin-top: 6px;', // This parameters, the adjust size of the logo and position.
97 + 'css_class' => '',
98 + );
99 +
100 + $params = wp_parse_args( $params, $defaults );
101 +
102 + $svg_logo_for_background = wpbc_get_svg_logo_for_background( $params['svg_color'], $params['svg_color_alt'], $params['opacity'] );
103 +
104 + $svg_icon_integarted = '<i';
105 + $svg_icon_integarted .= ' class="wpbc_svg_logo ' . esc_attr( $params['css_class'] ) . '"';
106 + $svg_icon_integarted .= ' style="' . esc_attr( $params['style_default'] ) . esc_attr( $params['style_adjust'] );
107 + $svg_icon_integarted .= 'background-image: url(\'' . esc_attr( $svg_logo_for_background ) . '\') !important;"';
108 + $svg_icon_integarted .= '></i>';
109 +
110 + return $svg_icon_integarted;
111 + }
112 +
17 113 // <editor-fold defaultstate="collapsed" desc=" == Get html preview of shortcode for Edit pages == " >
18 114
19 115 /**
20 116 * Get html preview of shortcode for Edit pages in Elementor and at Block editors
@@ -269,8 +365,41 @@
269 365 $calendar_skins_options_real[] = array( 'optgroup' => true, 'close' => true );
270 366
271 367 return $calendar_skins_options_real;
272 368 }
369 +
370 +
371 + function wpbc_get_calendar_skin_options_with_legacy_sections(){
372 +
373 + // FixIn: 10.3.0.5.
374 + // Calendar Skin /////////////////////////////////////////////////////
375 + $cal_arr = wpbc_get_calendar_skin_options( WPBC_PLUGIN_URL );
376 +
377 + $upload_dir = wp_upload_dir(); // Check if this skin exist in the Custom User folder at the http://example.com/wp-content/uploads/wpbc_skins/
378 + $custom_user_skin_folder = $upload_dir['basedir'];
379 + $custom_user_skin_url = $upload_dir['baseurl'];
380 +
381 + $transformed_cal_arr = array();
382 + foreach ( $cal_arr as $calendar_skin_url => $calendar_name ) {
383 + if ( false !== strpos( $calendar_skin_url, WPBC_PLUGIN_URL ) ) {
384 +
385 + $relative_cal_skin_path = str_replace( WPBC_PLUGIN_URL, '', $calendar_skin_url );
386 +
387 + if ( file_exists( $custom_user_skin_folder . $relative_cal_skin_path ) ) {
388 + // Custom Skin
389 + $transformed_cal_arr[ $custom_user_skin_url . $relative_cal_skin_path ] = $calendar_name;
390 + } else {
391 + // Plugin Usual Skins
392 + $transformed_cal_arr[ WPBC_PLUGIN_URL . $relative_cal_skin_path ] = $calendar_name;
393 + }
394 + } else {
395 + // OptGroups
396 + $transformed_cal_arr[ $calendar_skin_url ] = $calendar_name;
397 + }
398 + }
399 +
400 + return $transformed_cal_arr;
401 + }
273 402 // </editor-fold>
274 403
275 404
276 405 // <editor-fold defaultstate="collapsed" desc=" == Files functions == " >
@@ -415,9 +544,22 @@
415 544
416 545 function wpbc_can_i_load_on__resources_page() {
417 546
418 547 if (
419 - ( isset( $_REQUEST['page'] ) ) && ( $_REQUEST['page'] === 'wpbc-resources' ) // phpcs:ignore WordPress.Security.NonceVerification.Recommended
548 + ( isset( $_REQUEST['page'] ) )
549 + && (
550 + ( $_REQUEST['page'] === 'wpbc-resources' ) // phpcs:ignore WordPress.Security.NonceVerification.Recommended
551 + || (
552 + ( $_REQUEST['page'] === 'wpbc-booking-resources' ) // phpcs:ignore WordPress.Security.NonceVerification.Recommended
553 + && function_exists( 'wpbc_is_11_6_features_enabled' )
554 + && wpbc_is_11_6_features_enabled()
555 + )
556 + || (
557 + ( $_REQUEST['page'] === 'wpbc-catalog-booking-resources' ) // phpcs:ignore WordPress.Security.NonceVerification.Recommended
558 + && function_exists( 'wpbc_is_11_6_features_enabled' )
559 + && wpbc_is_11_6_features_enabled()
560 + )
561 + )
420 562 ) {
421 563 return true;
422 564 }
423 565
@@ -438,8 +580,9 @@
438 580 wpbc_can_i_load_on__resources_page()
439 581 && ( ! wpbc_can_i_load_on__searchable_resources_page() )
440 582 )
441 583 || wpbc_is_setup_wizard_page()
584 + || wpbc_is_builder_booking_form_page()
442 585 // || wpbc_is_bookings_page() // FixIn: 10.6.6.2.
443 586 ){
444 587 return true;
445 588 } else {
@@ -453,9 +596,15 @@
453 596 * @return bool
454 597 */
455 598 function wpbc_can_i_load_on_this_page__modal_search_options() {
456 599
457 - if ( wpbc_can_i_load_on__searchable_resources_page() ){
600 + if (
601 + wpbc_can_i_load_on__searchable_resources_page()
602 + || (
603 + function_exists( 'wpbc_catalog_searchable_resources_is_page' )
604 + && wpbc_catalog_searchable_resources_is_page()
605 + )
606 + ) {
458 607 return true;
459 608 } else {
460 609 return false;
461 610 }
@@ -668,9 +817,9 @@
668 817 $sql_req = "SELECT bk.booking_id FROM {$wpdb->prefix}booking as bk WHERE bk.is_new = 1 {$trash_bookings} ";
669 818
670 819 $sql_req = apply_bk_filter( 'get_sql_for_checking_new_bookings', $sql_req );
671 820 $sql_req = apply_bk_filter( 'get_sql_for_checking_new_bookings_multiuser', $sql_req );
672 - // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching, WordPress.DB.PreparedSQL.NotPrepared
821 + // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching, WordPress.DB.PreparedSQL.NotPrepared, PluginCheck.Security.DirectDB.UnescapedDBParameter
673 822 $bookings = $wpdb->get_results( $sql_req );
674 823 $bookings_count = count( $bookings );
675 824
676 825 update_bk_option( 'booking_cache__new_bookings__number', $bookings_count );
@@ -696,18 +845,18 @@
696 845
697 846 $id_of_new_bookings = implode( ',', $id_of_new_bookings );
698 847 $id_of_new_bookings = wpbc_clean_like_string_for_db( $id_of_new_bookings );
699 848
700 -
849 + // FixIn: 10.12.1.5.
701 850 if ( 'all' === $id_of_new_bookings ) {
702 - $update_sql = "UPDATE {$wpdb->prefix}booking AS bk SET bk.is_new = {$is_new} WHERE bk.is_new != {$is_new} "; // FixIn: 8.2.1.18.
851 + $update_sql = "UPDATE {$wpdb->prefix}booking SET is_new = {$is_new} WHERE is_new != {$is_new} "; // FixIn: 8.2.1.18.
703 852
704 853 $update_sql = apply_bk_filter( 'update_sql_for_checking_new_bookings', $update_sql, 0, $user_id );
705 854 } else {
706 - $update_sql = "UPDATE {$wpdb->prefix}booking AS bk SET bk.is_new = {$is_new} WHERE bk.booking_id IN ( {$id_of_new_bookings} ) ";
855 + $update_sql = "UPDATE {$wpdb->prefix}booking SET is_new = {$is_new} WHERE booking_id IN ( {$id_of_new_bookings} ) ";
707 856 }
708 857
709 - // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching, WordPress.DB.PreparedSQL.NotPrepared
858 + // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching, WordPress.DB.PreparedSQL.NotPrepared, PluginCheck.Security.DirectDB.UnescapedDBParameter
710 859 if ( false === $wpdb->query( $update_sql ) ) {
711 860 debuge_error( 'Error during updating status of bookings at DB', __FILE__, __LINE__ );
712 861 die();
713 862 }
@@ -918,12 +1067,23 @@
918 1067 echo 'closed';
919 1068 }
920 1069 }
921 1070 ?>"
922 - style="<?php if ( ! $params['is_section_visible_after_load'] ) {
923 - echo 'display:none';
924 - }
925 - ?>"
1071 + style="<?php
1072 +
1073 + $force_visible = false;
1074 +
1075 + // phpcs:ignore WordPress.Security.NonceVerification.Recommended, WordPress.Security.NonceVerification.Missing
1076 + $do_expand = ( ( isset( $_REQUEST['do_expand'] ) ) ? sanitize_text_field( wp_unslash( $_REQUEST['do_expand'] ) ) : '' );
1077 +
1078 + if ( $my_close_open_win_id === $do_expand ) {
1079 + $force_visible = true;
1080 + }
1081 +
1082 + if ( ( ! $params['is_section_visible_after_load'] ) && ( ! $force_visible ) ) {
1083 + echo 'display:none';
1084 + }
1085 + ?>"
926 1086 ><div class="postbox-header" style="display: flex;flex-flow: row nowrap;border-bottom: 1px solid #ccd0d4;">
927 1087 <h3 class='hndle' style="flex: 1 1 auto;border: none;">
928 1088 <span><?php
929 1089 // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
@@ -928,9 +1088,12 @@
928 1088 <span><?php
929 1089 // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
930 1090 echo $title;
931 1091 ?></span>
932 - <?php echo wp_kses_post( $params['dismiss_button'] ); ?>
1092 + <?php
1093 + // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
1094 + echo $params['dismiss_button'];
1095 + ?>
933 1096 </h3>
934 1097 <?php if ( $params['is_show_minimize'] ) { ?>
935 1098 <div title="<?php esc_attr_e('Click to toggle','booking'); ?>" class="handlediv"
936 1099 onclick="javascript:wpbc_verify_window_opening(<?php echo esc_attr( wpbc_get_current_user_id() ); ?>, '<?php echo esc_attr( $my_close_open_win_id ); ?>');"
@@ -1176,9 +1339,9 @@
1176 1339
1177 1340 global $wpdb;
1178 1341
1179 1342 $sql = $wpdb->prepare( "SELECT DISTINCT approved FROM {$wpdb->prefix}bookingdates WHERE booking_id = %d ORDER BY booking_date", $booking_id );
1180 - // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching, WordPress.DB.PreparedSQL.NotPrepared
1343 + // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching, WordPress.DB.PreparedSQL.NotPrepared, PluginCheck.Security.DirectDB.UnescapedDBParameter
1181 1344 $dates_result = $wpdb->get_results( $sql );
1182 1345
1183 1346 foreach ( $dates_result as $my_date ) {
1184 1347
@@ -1205,9 +1368,9 @@
1205 1368 global $wpdb;
1206 1369
1207 1370 $update_sql = "UPDATE {$wpdb->prefix}bookingdates SET approved = '1' WHERE booking_id IN ({$booking_id});";
1208 1371
1209 - // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching, WordPress.DB.PreparedSQL.NotPrepared
1372 + // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching, WordPress.DB.PreparedSQL.NotPrepared, PluginCheck.Security.DirectDB.UnescapedDBParameter
1210 1373 if ( false === $wpdb->query( $update_sql ) ) {
1211 1374 return false;
1212 1375 }
1213 1376
@@ -1213,52 +1376,52 @@
1213 1376
1214 1377 // In case if the booking was in Trash, then restore it.
1215 1378 // FixIn: 10.8.1.1.
1216 1379
1217 - // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching, WordPress.DB.PreparedSQL.NotPrepared, WordPress.DB.PreparedSQL.InterpolatedNotPrepared
1218 - if ( false === $wpdb->query( "UPDATE {$wpdb->prefix}booking AS bk SET bk.trash = 0 WHERE booking_id IN ({$booking_id})" ) ) {
1380 + // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching, WordPress.DB.PreparedSQL.NotPrepared, WordPress.DB.PreparedSQL.InterpolatedNotPrepared, PluginCheck.Security.DirectDB.UnescapedDBParameter
1381 + if ( false === $wpdb->query( "UPDATE {$wpdb->prefix}booking SET trash = 0 WHERE booking_id IN ({$booking_id})" ) ) {
1219 1382 return false;
1220 1383 }
1221 1384
1222 1385 return true;
1223 1386 }
1224 -
1225 -
1226 - /**
1227 - * Approve specific booking and send email about this.
1228 - *
1229 - * @param int $booking_id - ID of booking
1230 - * @param string $email_reason
1231 - */
1232 - function wpbc_auto_approve_booking( $booking_id , $email_reason = '' ) {
1233 -
1234 - $booking_id = wpbc_clean_digit_or_csd( $booking_id ); // Check paramter if it number or comma separated list of numbers
1235 -
1236 - if ( is_numeric( $booking_id ) ) { // FixIn: 8.1.2.8.
1237 - if ( ! wpbc_is_booking_approved( $booking_id ) ) {
1238 - do_action( 'wpbc_booking_approved', $booking_id, 1 ); // FixIn: 8.7.6.1.
1239 1387
1240 - wpbc_send_email_approved( $booking_id, 1, $email_reason );
1241 - }
1242 - } else {
1243 - $booking_id_arr = explode( ',',$booking_id );
1244 - foreach ( $booking_id_arr as $bk_id ) {
1245 - if ( ! wpbc_is_booking_approved( $bk_id ) ) {
1246 - do_action( 'wpbc_booking_approved', $bk_id, 1 ); // FixIn: 8.7.6.1.
1247 - wpbc_send_email_approved( $bk_id, 1, $email_reason );
1248 - }
1249 - }
1388 +
1389 +/**
1390 + * Approve specific booking and send email about this.
1391 + *
1392 + * @param int $booking_id - ID of booking
1393 + * @param string $email_reason
1394 + */
1395 +function wpbc_auto_approve_booking( $booking_id, $email_reason = '' ) {
1396 +
1397 + $booking_id = wpbc_clean_digit_or_csd( $booking_id ); // Check paramter if it number or comma separated list of numbers.
1398 +
1399 + if ( is_numeric( $booking_id ) ) { // FixIn: 8.1.2.8.
1400 + if ( ! wpbc_is_booking_approved( $booking_id ) ) {
1401 + do_action( 'wpbc_booking_approved', $booking_id, 1 ); // FixIn: 8.7.6.1.
1402 +
1403 + wpbc_send_email_approved( $booking_id, 1, $email_reason );
1404 + }
1405 + } else {
1406 + $booking_id_arr = explode( ',', $booking_id );
1407 + foreach ( $booking_id_arr as $bk_id ) {
1408 + if ( ! wpbc_is_booking_approved( $bk_id ) ) {
1409 + do_action( 'wpbc_booking_approved', $bk_id, 1 ); // FixIn: 8.7.6.1.
1410 + wpbc_send_email_approved( $bk_id, 1, $email_reason );
1250 1411 }
1251 -
1252 - $db_result = wpbc_db__booking_approve( $booking_id );
1253 -
1254 - if ( false === $db_result ){
1255 -
1256 - wpbc_redirect( site_url() );
1257 - }
1258 1412 }
1413 + }
1259 1414
1415 + $db_result = wpbc_db__booking_approve( $booking_id );
1260 1416
1417 + if ( false === $db_result ) {
1418 +
1419 + wpbc_redirect( site_url() );
1420 + }
1421 +}
1422 +
1423 +
1261 1424 /**
1262 1425 * Set as Pending specific booking and send email about this.
1263 1426 *
1264 1427 * @param int $booking_id - ID of booking
@@ -1284,9 +1447,9 @@
1284 1447 }
1285 1448 }
1286 1449
1287 1450 $update_sql = "UPDATE {$wpdb->prefix}bookingdates SET approved = '0' WHERE booking_id IN ({$booking_id});";
1288 - // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching, WordPress.DB.PreparedSQL.NotPrepared
1451 + // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching, WordPress.DB.PreparedSQL.NotPrepared, PluginCheck.Security.DirectDB.UnescapedDBParameter
1289 1452 if ( false === $wpdb->query( $update_sql ) ) {
1290 1453
1291 1454 wpbc_redirect( site_url() );
1292 1455 }
@@ -1315,10 +1478,11 @@
1315 1478 }
1316 1479 }
1317 1480 // Send decline emails.
1318 1481 wpbc_send_email_trash( $booking_id, 1, $email_reason );
1319 - // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching, WordPress.DB.PreparedSQL.NotPrepared, WordPress.DB.PreparedSQL.InterpolatedNotPrepared
1320 - if ( false === $wpdb->query( "UPDATE {$wpdb->prefix}booking AS bk SET bk.trash = 1 WHERE booking_id IN ({$booking_id})" ) ) {
1482 + // FixIn: 10.12.1.5.
1483 + // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching, WordPress.DB.PreparedSQL.NotPrepared, WordPress.DB.PreparedSQL.InterpolatedNotPrepared, PluginCheck.Security.DirectDB.UnescapedDBParameter
1484 + if ( false === $wpdb->query( "UPDATE {$wpdb->prefix}booking SET trash = 1 WHERE booking_id IN ({$booking_id})" ) ) {
1321 1485
1322 1486 wpbc_redirect( site_url() );
1323 1487 }
1324 1488 }
@@ -1536,18 +1700,18 @@
1536 1700 * @return array
1537 1701 *
1538 1702 * Example:
1539 1703 *
1540 - * $php_performance = php_performance_START( 'emails_sending' , $php_performance );
1704 + * $php_performance = wpbc_php_performance_START( 'emails_sending' , $php_performance );
1541 1705 *
1542 1706 * ... some code here ...
1543 1707 *
1544 - * $php_performance = php_performance_END( 'emails_sending' , $php_performance );
1708 + * $php_performance = wpbc_php_performance_END( 'emails_sending' , $php_performance );
1545 1709 *
1546 1710 * echo 'Time of execution: ' . $php_performancep['emails_sending']
1547 1711 *
1548 1712 */
1549 - function php_performance_START( $name, $php_performance ) {
1713 + function wpbc_php_performance_START( $name, $php_performance ) {
1550 1714
1551 1715 if ( empty( $php_performance ) ) {
1552 1716 $php_performance = array();
1553 1717 }
@@ -1566,18 +1730,18 @@
1566 1730 * @return array
1567 1731 *
1568 1732 * Example:
1569 1733 *
1570 - * $php_performance = php_performance_START( 'emails_sending' , $php_performance );
1734 + * $php_performance = wpbc_php_performance_START( 'emails_sending' , $php_performance );
1571 1735 *
1572 1736 * ... some code here ...
1573 1737 *
1574 - * $php_performance = php_performance_END( 'emails_sending' , $php_performance );
1738 + * $php_performance = wpbc_php_performance_END( 'emails_sending' , $php_performance );
1575 1739 *
1576 1740 * echo 'Time of execution: ' . $php_performancep['emails_sending']
1577 1741 *
1578 1742 */
1579 - function php_performance_END( $name, $php_performance ) {
1743 + function wpbc_php_performance_END( $name, $php_performance ) {
1580 1744
1581 1745 if ( empty( $php_performance ) ) {
1582 1746 $php_performance = array();
1583 1747 }
@@ -1603,5 +1767,53 @@
1603 1767 WPBC_Action_Scheduler_Compatibility::raise_time_limit( $limit_in_seconds_int );
1604 1768 }
1605 1769
1606 1770
1607 - // </editor-fold>
1771 + // </editor-fold>
1772 +
1773 +
1774 +
1775 +/**
1776 + * Temp fix of styles for edit specific season filter or rate.
1777 + *
1778 + * @return void
1779 + */
1780 +function wpbc_add_css_to_hide_seasons() {
1781 +
1782 + // TODO: 2025-05-03 temp fix of view edit filter
1783 + ?>
1784 + <style tye="text/css">
1785 + .wpdvlp-sub-tabs,
1786 + #wpbc_dcoupons_table, #wpbc_discountcoupons,
1787 + #bulk-action-selector-bottom,
1788 + #toolbar_booking_resources,
1789 + #toolbar_seasonfilters,
1790 + #wpbc_seasonfilters,
1791 + #wpbc_booking_resource_table{
1792 + display: none !important;
1793 + }
1794 + .wpbc_round_white_panel {
1795 + background: #fff;
1796 + padding: 1px 20px 20px;
1797 + border-radius: 10px
1798 + }
1799 + .header_for_cost_object_edit {
1800 + font-size: 20px;
1801 + padding: 0 0 15px;
1802 + border-bottom: 2px solid #f2f2f2;
1803 + margin: 15px 0;
1804 + line-height: 1.5;
1805 + display: flex;
1806 + flex-flow: row nowrap;
1807 + justify-content: space-between;
1808 + align-items: flex-start;
1809 + }
1810 + .in_header_container_for_resource_title {
1811 + color: #5379aa;
1812 + margin-left: 0.3em;
1813 + }
1814 + .header_for_cost_object_edit__close i.wpbc_icn_close::before {
1815 + font-size: 22px;
1816 + }
1817 + </style>
1818 + <?php
1819 +}