PluginProbe
Booking Calendar / 11.8.3
Booking Calendar v11.8.3
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 | includes/_functions/booking_data__get.php +21 -15 10.1111.8.3 View file →
@@ -1,4 +1,4 @@
1 1 <?php
2 2 /**
3 3 * @version 1.0
4 4 * @package Booking Calendar
@@ -24,25 +24,29 @@
24 24 * @param $resource_id
25 25 *
26 26 * @return string
27 27 */
28 -function wpbc_get_resource_title( $resource_id = 1 ) {
28 +function wpbc_get_resource_title( $resource_id = 1 ) {
29 29
30 30 $resource_title = '';
31 31
32 - if ( function_exists( 'wpbc_db__get_resource_title' ) ) {
32 + if ( function_exists( 'wpbc_db__get_resource_title' ) ) {
33 33
34 34 $resource_title = wpbc_db__get_resource_title( $resource_id );
35 35
36 36 if (! empty($resource_title)) {
37 37 $resource_title = wpbc_lang( $resource_title );
38 - }
39 - }
38 + }
39 + }
40 + if ( '' === $resource_title && function_exists( 'wpbc_booking_resource_content_repository' ) ) {
41 + $resource_content = wpbc_booking_resource_content_repository()->get( $resource_id );
42 + $resource_title = ! empty( $resource_content['title'] ) ? wpbc_lang( $resource_content['title'] ) : '';
43 + }
44 +
45 + return $resource_title;
46 +}
40 47
41 - return $resource_title;
42 -}
43 48
44 -
45 49 /**
46 50 * Get parent booking resource title (translated/localized)
47 51 *
48 52 * @param $resource_id
@@ -136,9 +140,9 @@
136 140
137 141 global $wpdb;
138 142
139 143 $slct_sql = $wpdb->prepare( "SELECT * FROM {$wpdb->prefix}booking WHERE booking_id = %d LIMIT 0,1", $booking_id );
140 - // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching, WordPress.DB.PreparedSQL.NotPrepared
144 + // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching, WordPress.DB.PreparedSQL.NotPrepared, PluginCheck.Security.DirectDB.UnescapedDBParameter
141 145 $sql_results = $wpdb->get_row( $slct_sql );
142 146
143 147 if ( ! empty( $sql_results ) ) {
144 148 return $sql_results;
@@ -165,9 +169,9 @@
165 169 $sql .= " ORDER BY booking_id, type_id, booking_date ";
166 170 } else {
167 171 $sql .= " ORDER BY booking_id, booking_date ";
168 172 }
169 - // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching, WordPress.DB.PreparedSQL.NotPrepared
173 + // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching, WordPress.DB.PreparedSQL.NotPrepared, PluginCheck.Security.DirectDB.UnescapedDBParameter
170 174 $sql_results = $wpdb->get_results( $sql );
171 175
172 176 if ( ! empty( $sql_results ) ) {
173 177 return $sql_results;
@@ -185,9 +189,9 @@
185 189 */
186 190 function wpbc_db_get_booking_modification_date( $booking_id ) {
187 191 // FixIn: 8.0.1.7.
188 192 global $wpdb;
189 - // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching, WordPress.DB.PreparedSQL.NotPrepared
193 + // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching, WordPress.DB.PreparedSQL.NotPrepared, PluginCheck.Security.DirectDB.UnescapedDBParameter
190 194 $modification_date = ' ' . $wpdb->get_var( $wpdb->prepare( "SELECT modification_date FROM {$wpdb->prefix}booking WHERE booking_id = %d ", $booking_id ) );
191 195
192 196 return $modification_date;
193 197 }
@@ -409,12 +413,14 @@
409 413 $replace[ 'dates' ] = $formated_booking_dates; // July 28, 2016 16:00 - July 28, 2016 18:00
410 414 $replace[ 'check_in_date' ] = $my_check_in_date; // July 28, 2016 16:00
411 415 $replace[ 'check_out_date' ] = $my_check_out_date; // July 28, 2016 18:00
412 416 $replace[ 'check_out_plus1day'] = $my_check_out_plus1day; // July 29, 2016 18:00
413 - $replace[ 'dates_count' ] = count( $sql_days_only_array ); // 1
414 - $replace[ 'days_count' ] = count( $sql_days_only_array ); // 1
415 - $replace[ 'nights_count' ] = ( $replace[ 'days_count' ] > 1 ) ? ( $replace[ 'days_count' ] - 1 ) : $replace[ 'days_count' ]; // 1
416 417
418 + $replace['dates_count'] = count( $sql_days_only_array ); // 1
419 + $replace['days_count'] = intval( $replace['dates_count'] ); // FixIn: 10.15.1.3.
420 + $replace['nights_count'] = ( $replace['days_count'] > 1 ) ? intval( $replace['days_count'] - 1 ) : 1;
421 + $replace['days_count_plus1day'] = intval( $replace['days_count'] + 1 );
422 +
417 423 // FixIn: 9.7.3.16.
418 424 $replace[ 'cancel_date_hint' ] = $cancel_date_hint; // 11/11/2013
419 425 // FixIn: 10.0.0.31.
420 426 $replace[ 'pre_checkin_date_hint' ] = $pre_checkin_date_hint; // 11/11/2013
@@ -498,10 +504,10 @@
498 504 list( $replace['creation_year'], $replace['creation_month'], $replace['creation_day'] ) = explode( '-', $creation_date[0] );
499 505 list( $replace['creation_hour'], $replace['creation_minutes'], $replace['creation_seconds'] ) = explode( ':', $creation_date[1] );
500 506 }
501 507
502 - return $replace;
503 -}
508 + return $replace;
509 +}
504 510
505 511 /**
506 512 * Get additional parameters to the replace array for specific booking
507 513 *