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 +105 -20 10.11.311.8.2 View file →
@@ -77,9 +77,40 @@
77 77
78 78 return $svg_icon_integarted;
79 79 }
80 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() ) {
81 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 +
82 113 // <editor-fold defaultstate="collapsed" desc=" == Get html preview of shortcode for Edit pages == " >
83 114
84 115 /**
85 116 * Get html preview of shortcode for Edit pages in Elementor and at Block editors
@@ -334,8 +365,41 @@
334 365 $calendar_skins_options_real[] = array( 'optgroup' => true, 'close' => true );
335 366
336 367 return $calendar_skins_options_real;
337 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 + }
338 402 // </editor-fold>
339 403
340 404
341 405 // <editor-fold defaultstate="collapsed" desc=" == Files functions == " >
@@ -480,9 +544,22 @@
480 544
481 545 function wpbc_can_i_load_on__resources_page() {
482 546
483 547 if (
484 - ( 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 + )
485 562 ) {
486 563 return true;
487 564 }
488 565
@@ -503,8 +580,9 @@
503 580 wpbc_can_i_load_on__resources_page()
504 581 && ( ! wpbc_can_i_load_on__searchable_resources_page() )
505 582 )
506 583 || wpbc_is_setup_wizard_page()
584 + || wpbc_is_builder_booking_form_page()
507 585 // || wpbc_is_bookings_page() // FixIn: 10.6.6.2.
508 586 ){
509 587 return true;
510 588 } else {
@@ -518,9 +596,15 @@
518 596 * @return bool
519 597 */
520 598 function wpbc_can_i_load_on_this_page__modal_search_options() {
521 599
522 - 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 + ) {
523 607 return true;
524 608 } else {
525 609 return false;
526 610 }
@@ -733,9 +817,9 @@
733 817 $sql_req = "SELECT bk.booking_id FROM {$wpdb->prefix}booking as bk WHERE bk.is_new = 1 {$trash_bookings} ";
734 818
735 819 $sql_req = apply_bk_filter( 'get_sql_for_checking_new_bookings', $sql_req );
736 820 $sql_req = apply_bk_filter( 'get_sql_for_checking_new_bookings_multiuser', $sql_req );
737 - // 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
738 822 $bookings = $wpdb->get_results( $sql_req );
739 823 $bookings_count = count( $bookings );
740 824
741 825 update_bk_option( 'booking_cache__new_bookings__number', $bookings_count );
@@ -761,18 +845,18 @@
761 845
762 846 $id_of_new_bookings = implode( ',', $id_of_new_bookings );
763 847 $id_of_new_bookings = wpbc_clean_like_string_for_db( $id_of_new_bookings );
764 848
765 -
849 + // FixIn: 10.12.1.5.
766 850 if ( 'all' === $id_of_new_bookings ) {
767 - $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.
768 852
769 853 $update_sql = apply_bk_filter( 'update_sql_for_checking_new_bookings', $update_sql, 0, $user_id );
770 854 } else {
771 - $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} ) ";
772 856 }
773 857
774 - // 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
775 859 if ( false === $wpdb->query( $update_sql ) ) {
776 860 debuge_error( 'Error during updating status of bookings at DB', __FILE__, __LINE__ );
777 861 die();
778 862 }
@@ -1255,9 +1339,9 @@
1255 1339
1256 1340 global $wpdb;
1257 1341
1258 1342 $sql = $wpdb->prepare( "SELECT DISTINCT approved FROM {$wpdb->prefix}bookingdates WHERE booking_id = %d ORDER BY booking_date", $booking_id );
1259 - // 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
1260 1344 $dates_result = $wpdb->get_results( $sql );
1261 1345
1262 1346 foreach ( $dates_result as $my_date ) {
1263 1347
@@ -1284,9 +1368,9 @@
1284 1368 global $wpdb;
1285 1369
1286 1370 $update_sql = "UPDATE {$wpdb->prefix}bookingdates SET approved = '1' WHERE booking_id IN ({$booking_id});";
1287 1371
1288 - // 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
1289 1373 if ( false === $wpdb->query( $update_sql ) ) {
1290 1374 return false;
1291 1375 }
1292 1376
@@ -1292,10 +1376,10 @@
1292 1376
1293 1377 // In case if the booking was in Trash, then restore it.
1294 1378 // FixIn: 10.8.1.1.
1295 1379
1296 - // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching, WordPress.DB.PreparedSQL.NotPrepared, WordPress.DB.PreparedSQL.InterpolatedNotPrepared
1297 - 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})" ) ) {
1298 1382 return false;
1299 1383 }
1300 1384
1301 1385 return true;
@@ -1363,9 +1447,9 @@
1363 1447 }
1364 1448 }
1365 1449
1366 1450 $update_sql = "UPDATE {$wpdb->prefix}bookingdates SET approved = '0' WHERE booking_id IN ({$booking_id});";
1367 - // 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
1368 1452 if ( false === $wpdb->query( $update_sql ) ) {
1369 1453
1370 1454 wpbc_redirect( site_url() );
1371 1455 }
@@ -1394,10 +1478,11 @@
1394 1478 }
1395 1479 }
1396 1480 // Send decline emails.
1397 1481 wpbc_send_email_trash( $booking_id, 1, $email_reason );
1398 - // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching, WordPress.DB.PreparedSQL.NotPrepared, WordPress.DB.PreparedSQL.InterpolatedNotPrepared
1399 - 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})" ) ) {
1400 1485
1401 1486 wpbc_redirect( site_url() );
1402 1487 }
1403 1488 }
@@ -1615,18 +1700,18 @@
1615 1700 * @return array
1616 1701 *
1617 1702 * Example:
1618 1703 *
1619 - * $php_performance = php_performance_START( 'emails_sending' , $php_performance );
1704 + * $php_performance = wpbc_php_performance_START( 'emails_sending' , $php_performance );
1620 1705 *
1621 1706 * ... some code here ...
1622 1707 *
1623 - * $php_performance = php_performance_END( 'emails_sending' , $php_performance );
1708 + * $php_performance = wpbc_php_performance_END( 'emails_sending' , $php_performance );
1624 1709 *
1625 1710 * echo 'Time of execution: ' . $php_performancep['emails_sending']
1626 1711 *
1627 1712 */
1628 - function php_performance_START( $name, $php_performance ) {
1713 + function wpbc_php_performance_START( $name, $php_performance ) {
1629 1714
1630 1715 if ( empty( $php_performance ) ) {
1631 1716 $php_performance = array();
1632 1717 }
@@ -1645,18 +1730,18 @@
1645 1730 * @return array
1646 1731 *
1647 1732 * Example:
1648 1733 *
1649 - * $php_performance = php_performance_START( 'emails_sending' , $php_performance );
1734 + * $php_performance = wpbc_php_performance_START( 'emails_sending' , $php_performance );
1650 1735 *
1651 1736 * ... some code here ...
1652 1737 *
1653 - * $php_performance = php_performance_END( 'emails_sending' , $php_performance );
1738 + * $php_performance = wpbc_php_performance_END( 'emails_sending' , $php_performance );
1654 1739 *
1655 1740 * echo 'Time of execution: ' . $php_performancep['emails_sending']
1656 1741 *
1657 1742 */
1658 - function php_performance_END( $name, $php_performance ) {
1743 + function wpbc_php_performance_END( $name, $php_performance ) {
1659 1744
1660 1745 if ( empty( $php_performance ) ) {
1661 1746 $php_performance = array();
1662 1747 }