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 | core/sync/wpbc-gcal-class.php +135 -113 10.1.311.8.4 View file →
@@ -66,9 +66,11 @@
66 66 if ( $this->is_silent )
67 67 return;
68 68
69 69 ?><script type="text/javascript">
70 - var my_message = '<?php echo html_entity_decode( esc_js( $message ),ENT_QUOTES) ; ?>';
70 + var my_message = '<?php
71 + // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
72 + echo html_entity_decode( esc_js( $message ),ENT_QUOTES) ; ?>';
71 73 wpbc_admin_show_message( my_message, '<?php echo ( $is_error ? 'error' : 'info' ); ?>', <?php echo ( $is_error ? '60000' : '3000' ); ?> );
72 74 </script><?php
73 75
74 76 return;
@@ -76,12 +78,13 @@
76 78 //$message = str_replace("'", '&#039;', $message);
77 79 $message = esc_js($message);
78 80
79 81 ?> <script type="text/javascript"> if (jQuery('#ajax_message').length > 0 ) {
80 - <?php if ($is_spin ) { ?>
81 - jQuery('#ajax_message').html('<div class="updated ajax_message<?php echo ($is_error?' error':''); ?>" id="ajax_message"><div style="float:left;"><?php echo $message; ?></div><div class="wpbc_spin_loader"><img style="vertical-align:middle;box-shadow:none;width:14px;" src="'+_wpbc.get_other_param( 'url_plugin' )+'/assets/img/ajax-loader.gif"></div></div>');
82 + <?php if ($is_spin ) { ?>
83 + jQuery('#ajax_message').html('<div class="updated ajax_message<?php echo ($is_error?' error':''); ?>" id="ajax_message"><div style="float:left;"><?php echo esc_js( $message ); ?></div><div id="ajax_message_wpbc_spin_loader" class="wpbc_spin_loader"></div></div>');
84 + wpbc__spin_loader__mini__show( 'ajax_message_wpbc_spin_loader', {'show_here': {'where': 'inside'}} );
82 85 <?php } else { ?>
83 - jQuery('#ajax_message').html('<div class="updated ajax_message<?php echo ($is_error?' error':''); ?>" id="ajax_message"><?php echo $message; ?></div>');
86 + jQuery('#ajax_message').html('<div class="updated ajax_message<?php echo ($is_error?' error':''); ?>" id="ajax_message"><?php echo esc_js( $message ); ?></div>');
84 87 <?php } ?>
85 88 }</script> <?php
86 89 }
87 90
@@ -123,9 +126,9 @@
123 126 case "second":
124 127 $booking_gcal_events_from_offset = intval( $booking_gcal_events_from[1] );
125 128 break;
126 129 case "minute":
127 - $booking_gcal_events_from_offset = intval( $booking_gcal_events_from[1] ) * 60 ; //FixIn: 9.7.3.15
130 + $booking_gcal_events_from_offset = intval( $booking_gcal_events_from[1] ) * 60 ; // FixIn: 9.7.3.15.
128 131 break;
129 132 case "hour":
130 133 $booking_gcal_events_from_offset = intval( $booking_gcal_events_from[1] ) * 3600 ;
131 134 break;
@@ -146,21 +149,21 @@
146 149
147 150 switch ( $booking_gcal_events_from ) {
148 151 //Don't just use time() for 'now', as this will effectively make cache duration 1 second. Instead set to previous minute. Events in Google Calendar cannot be set to precision of seconds anyway
149 152 case 'now':
150 - $this->booking_gcal_events_from = mktime( intval( date( 'H' ) ), intval( date( 'i' ) ), 0, intval( date( 'm' ) ), intval( date( 'j' ) ), intval( date( 'Y' ) ) ) + $offset;
153 + $this->booking_gcal_events_from = mktime( intval( gmdate( 'H' ) ), intval( gmdate( 'i' ) ), 0, intval( gmdate( 'm' ) ), intval( gmdate( 'j' ) ), intval( gmdate( 'Y' ) ) ) + $offset;
151 154 break;
152 155 case 'today':
153 - $this->booking_gcal_events_from = mktime( 0, 0, 0, intval( date( 'm' ) ), intval( date( 'j' ) ), intval( date( 'Y' ) ) ) + $offset;
156 + $this->booking_gcal_events_from = mktime( 0, 0, 0, intval( gmdate( 'm' ) ), intval( gmdate( 'j' ) ), intval( gmdate( 'Y' ) ) ) + $offset;
154 157 break;
155 158 case 'week':
156 - $this->booking_gcal_events_from = mktime( 0, 0, 0, intval( date( 'm' ) ), ( intval( date( 'j' ) ) - intval( date( 'w' ) ) + intval( $this->start_of_week ) ), intval( date( 'Y' ) ) ) + $offset;
159 + $this->booking_gcal_events_from = mktime( 0, 0, 0, intval( gmdate( 'm' ) ), ( intval( gmdate( 'j' ) ) - intval( gmdate( 'w' ) ) + intval( $this->start_of_week ) ), intval( gmdate( 'Y' ) ) ) + $offset;
157 160 break;
158 161 case 'month-start':
159 - $this->booking_gcal_events_from = mktime( 0, 0, 0, intval( date( 'm' ) ), 1, intval( date( 'Y' ) ) ) + $offset;
162 + $this->booking_gcal_events_from = mktime( 0, 0, 0, intval( gmdate( 'm' ) ), 1, intval( gmdate( 'Y' ) ) ) + $offset;
160 163 break;
161 164 case 'month-end':
162 - $this->booking_gcal_events_from = mktime( 0, 0, 0, intval( date( 'm' ) ) + 1, 1, intval( date( 'Y' ) ) ) + $offset;
165 + $this->booking_gcal_events_from = mktime( 0, 0, 0, intval( gmdate( 'm' ) ) + 1, 1, intval( gmdate( 'Y' ) ) ) + $offset;
163 166 break;
164 167 case 'date':
165 168 $offset = explode('-', $offset);
166 169 $this->booking_gcal_events_from = mktime( 0, 0, 0, intval( $offset[1] ), intval( $offset[2] ), intval( $offset[0] ) );
@@ -180,9 +183,9 @@
180 183 case "second":
181 184 $booking_gcal_events_until_offset = intval( $booking_gcal_events_until[1] );
182 185 break;
183 186 case "minute":
184 - $booking_gcal_events_until_offset = intval( $booking_gcal_events_until[1] ) * 60; //FixIn: 9.8.15.1
187 + $booking_gcal_events_until_offset = intval( $booking_gcal_events_until[1] ) * 60; // FixIn: 9.8.15.1.
185 188 break;
186 189 case "hour":
187 190 $booking_gcal_events_until_offset = intval( $booking_gcal_events_until[1] ) * 3600;
188 191 break;
@@ -201,21 +204,21 @@
201 204 public function set_events_until( $booking_gcal_events_until, $offset = 0 ){
202 205
203 206 switch ( $booking_gcal_events_until ) {
204 207 case 'now':
205 - $this->booking_gcal_events_until = mktime( intval( date( 'H' ) ), intval( date( 'i' ) ), 0, intval( date( 'm' ) ), intval( date( 'j' ) ), intval( date( 'Y' ) ) ) + $offset;
208 + $this->booking_gcal_events_until = mktime( intval( gmdate( 'H' ) ), intval( gmdate( 'i' ) ), 0, intval( gmdate( 'm' ) ), intval( gmdate( 'j' ) ), intval( gmdate( 'Y' ) ) ) + $offset;
206 209 break;
207 210 case 'today':
208 - $this->booking_gcal_events_until = mktime( 0, 0, 0, intval( date( 'm' ) ), intval( date( 'j' ) ), intval( date( 'Y' ) ) ) + $offset;
211 + $this->booking_gcal_events_until = mktime( 0, 0, 0, intval( gmdate( 'm' ) ), intval( gmdate( 'j' ) ), intval( gmdate( 'Y' ) ) ) + $offset;
209 212 break;
210 213 case 'week':
211 - $this->booking_gcal_events_until = mktime( 0, 0, 0, intval( date( 'm' ) ), ( intval( date( 'j' ) ) - intval( date( 'w' ) ) + intval( $this->start_of_week ) ), intval( date( 'Y' ) ) ) + $offset;
214 + $this->booking_gcal_events_until = mktime( 0, 0, 0, intval( gmdate( 'm' ) ), ( intval( gmdate( 'j' ) ) - intval( gmdate( 'w' ) ) + intval( $this->start_of_week ) ), intval( gmdate( 'Y' ) ) ) + $offset;
212 215 break;
213 216 case 'month-start':
214 - $this->booking_gcal_events_until = mktime( 0, 0, 0, intval( date( 'm' ) ), 1, intval( date( 'Y' ) ) ) + $offset;
217 + $this->booking_gcal_events_until = mktime( 0, 0, 0, intval( gmdate( 'm' ) ), 1, intval( gmdate( 'Y' ) ) ) + $offset;
215 218 break;
216 219 case 'month-end':
217 - $this->booking_gcal_events_until = mktime( 0, 0, 0, intval( date( 'm' ) ) + 1, 1, intval( date( 'Y' ) ) ) + $offset;
220 + $this->booking_gcal_events_until = mktime( 0, 0, 0, intval( gmdate( 'm' ) ) + 1, 1, intval( gmdate( 'Y' ) ) ) + $offset;
218 221 break;
219 222 case 'date':
220 223 $offset = explode('-', $offset);
221 224 $this->booking_gcal_events_until = mktime( 0, 0, 0, intval( $offset[1] ), intval( $offset[2] ), intval( $offset[0] ) );
@@ -237,9 +240,9 @@
237 240
238 241 //Convert an ISO date/time to a UNIX timestamp
239 242 private function iso_to_ts( $iso ) {
240 243 sscanf( $iso, "%u-%u-%uT%u:%u:%uZ", $year, $month, $day, $hour, $minute, $second );
241 - $year = intval((string) $year); //FixIn: 9.6.3.7
244 + $year = intval((string) $year); // FixIn: 9.6.3.7.
242 245 $month = intval((string) $month);
243 246 $day = intval((string) $day);
244 247 $hour = intval((string) $hour);
245 248 $minute = intval((string) $minute);
@@ -258,9 +261,9 @@
258 261
259 262 // $url = $this->feed_url;
260 263 //
261 264 // // Break the feed URL up into its parts (scheme, host, path, query)
262 -// $url_parts = parse_url( $url );
265 +// $url_parts = wp_parse_url( $url );
263 266 //
264 267 // if (! isset($url_parts['path'])) // Something wrong with URL
265 268 // return false;
266 269 //
@@ -285,11 +288,11 @@
285 288 // Set API key
286 289 $url .= '?key=' . $api_key;
287 290
288 291
289 - $args['timeMin'] = urlencode( date( 'c', $this->booking_gcal_events_from - $gmt_offset ) );
292 + $args['timeMin'] = urlencode( gmdate( 'c', $this->booking_gcal_events_from - $gmt_offset ) );
290 293
291 - $args['timeMax'] = urlencode( date( 'c', $this->booking_gcal_events_until - $gmt_offset ) );
294 + $args['timeMax'] = urlencode( gmdate( 'c', $this->booking_gcal_events_until - $gmt_offset ) );
292 295
293 296 $args['maxResults'] = $this->booking_gcal_events_max;
294 297
295 298 $args['singleEvents'] = 'True'; //'False'; // Each recurrent event will be showing as separate booking. Google Description: Whether to expand recurring events into instances and only return single one-off events and instances of recurring events, but not the underlying recurring events themselves. Optional. The default is False.
@@ -300,10 +303,10 @@
300 303 $url = add_query_arg( $args, $url );
301 304
302 305
303 306 // //Append the feed specific parameters to the querystring
304 -// $query .= '&start-min=' . date( 'Y-m-d\TH:i:s', $this->booking_gcal_events_from - $gmt_offset );
305 -// $query .= '&start-max=' . date( 'Y-m-d\TH:i:s', $this->booking_gcal_events_until - $gmt_offset );
307 +// $query .= '&start-min=' . gmdate( 'Y-m-d\TH:i:s', $this->booking_gcal_events_from - $gmt_offset );
308 +// $query .= '&start-max=' . gmdate( 'Y-m-d\TH:i:s', $this->booking_gcal_events_until - $gmt_offset );
306 309 // $query .= '&max-results=' . $this->booking_gcal_events_max;
307 310 //
308 311 // if ( ! empty( $this->booking_gcal_timezone ) )
309 312 // $query .= '&ctz=' . $this->booking_gcal_timezone;
@@ -360,15 +363,15 @@
360 363
361 364 //debuge($range_dates, $range_time);
362 365 $bktype = $this->getResource();
363 366
364 - //FixIn: 8.6.1.4
367 + // FixIn: 8.6.1.4.
365 368 // if ( ( class_exists( 'wpdev_bk_biz_s' ) )
366 369 // && ( get_bk_option( 'booking_range_selection_time_is_active') == 'On' )
367 370 // && ( get_bk_option( 'booking_ics_import_add_change_over_time' ) !== 'Off' )
368 371 // && ( get_bk_option( 'booking_ics_import_append_checkout_day' ) !== 'Off' )
369 372 // ) {
370 - if ( 'On' == get_bk_option( 'booking_ics_import_append_checkout_day' ) ) { //FixIn: 2.0.27.1 //FixIn: 9.5.4.1
373 + if ( 'On' == get_bk_option( 'booking_ics_import_append_checkout_day' ) ) { //FixIn: 2.0.27.1 // FixIn: 9.5.4.1.
371 374 // Add one additional day to .ics event (useful in some cases for bookings with change-over days),
372 375 // if the imported .ics dates is coming without check in/our times
373 376 // Later system is adding check in/out times from Booking Calendar to this event
374 377 $range_dates_arr = explode( ',', $range_dates );
@@ -381,15 +384,15 @@
381 384 $ics_event_check_out = date_i18n( "d.m.Y", $ics_event_check_out );
382 385 $range_dates .= ', ' . $ics_event_check_out;
383 386 }
384 387
385 - //FixIn: 8.6.1.1
388 + // FixIn: 8.6.1.1.
386 389 if ( empty( $range_time ) ) {
387 390
388 391 if ( ( class_exists( 'wpdev_bk_biz_s' ) )
389 392 && ( get_bk_option( 'booking_range_selection_time_is_active') == 'On' )
390 393 && ( get_bk_option( 'booking_ics_import_add_change_over_time' ) !== 'Off' )
391 - ) { //FixIn: 2.0.5.1
394 + ) { // FixIn: 2.0.5.1.
392 395 //Add check in/out times to full day events
393 396 $wpbc_check_in = get_bk_option( 'booking_range_selection_start_time' );// . ':01'; // ' 14:00:01'
394 397 $wpbc_check_out = get_bk_option( 'booking_range_selection_end_time' ); // . ':02'; // ' 10:00:02';
395 398 $range_time = $wpbc_check_in . ' - ' . $wpbc_check_out;
@@ -484,12 +487,13 @@
484 487 case 403:
485 488 $this->error = __( 'Access to this feed was denied (403). Please ensure you have public sharing enabled for your calendar.' ,'booking');
486 489 break;
487 490 default:
491 + /* translators: 1: ... */
488 492 $this->error = sprintf( __( 'The feed data could not be retrieved. Error code: %s. Please ensure your feed URL is correct.' ,'booking'), '<strong>' . $raw_data['response']['code'] . '</strong>' );
489 493
490 494 if (isset( $raw_data['body'] ))
491 - $this->error .= '<br><br><strong>' . __( 'Info', 'booking' ) . '</strong>: <code>' . $raw_data['body'] . '</code>';
495 + $this->error .= '<br><br><strong>' . esc_html__( 'Info', 'booking' ) . '</strong>: <code>' . $raw_data['body'] . '</code>';
492 496
493 497 }
494 498 }
495 499 } else {
@@ -502,8 +506,9 @@
502 506 if ( ! empty($this->error) ) {
503 507 $is_spin = false;
504 508 $is_error = true;
505 509 $this->show_message( $this->error , $is_spin, $is_error);
510 + // phpcs:ignore WordPress.Security.NonceVerification.Recommended, WordPress.Security.NonceVerification.Missing
506 511 if ( ( isset( $_REQUEST['action'] ) ) && ( 'WPBC_AJX_BOOKING_ACTIONS' == $_REQUEST['action'] ) ) {
507 512 return false;
508 513 }
509 514 die;
@@ -545,9 +550,9 @@
545 550
546 551 $start_date = $this->iso_to_ts( $event_dates_start['dateTime'] );
547 552 $end_date = $this->iso_to_ts( $event_dates_end['dateTime'] );
548 553
549 - //FixIn: 8.9.4.2
554 + // FixIn: 8.9.4.2.
550 555 /**
551 556 * Check for situation, when we are having times starting or ending at the midnight: 00:00:00
552 557 * Because in this "IF section" we are checking events dates with times (in the previous "IF section" was FULL day events,
553 558 * we need to be sure that the event do not start or end at 00:00 Otherwise Booking Calendar will
@@ -553,15 +558,15 @@
553 558 * we need to be sure that the event do not start or end at 00:00 Otherwise Booking Calendar will
554 559 * show such date as fully booked!
555 560 */
556 561 $start_date_unix = $start_date;
557 - $check_start_date = wpbc_datetime_localized( date( 'Y-m-d H:i:s', $start_date_unix ), 'Y-m-d H:i:s' );
562 + $check_start_date = wpbc_datetime_localized( gmdate( 'Y-m-d H:i:s', $start_date_unix ), 'Y-m-d H:i:s' );
558 563 if ( substr( $check_start_date, 11 ) === '00:00:00' ) {
559 564 $start_date_unix = $start_date_unix + 61;
560 565 $start_date = $start_date_unix;
561 566 }
562 567 $end_date_unix = $end_date;
563 - $check_end_date = wpbc_datetime_localized( date( 'Y-m-d H:i:s', $end_date_unix ), 'Y-m-d H:i:s' );
568 + $check_end_date = wpbc_datetime_localized( gmdate( 'Y-m-d H:i:s', $end_date_unix ), 'Y-m-d H:i:s' );
564 569 if ( substr( $check_end_date, 11 ) === '00:00:00' ) {
565 570 $end_date_unix = $end_date_unix - 2;
566 571 $end_date = $end_date_unix;
567 572 }
@@ -597,11 +602,11 @@
597 602 return array($dates_comma, $range_time);
598 603 }
599 604
600 605
601 - ////////////////////////////////////////////////////////////////////////////
606 + // -----------------------------------------------------------------------------------------------------------------
602 607 // Create New bookings based on $this->events array.
603 - ////////////////////////////////////////////////////////////////////////////
608 + // -----------------------------------------------------------------------------------------------------------------
604 609 public function createNewBookingsFromEvents( $exist_bookings_guid = array() ) {
605 610
606 611 foreach ($this->events as $key => $event) {
607 612
@@ -635,9 +640,10 @@
635 640 $this->events[$key]['id'] = $booking_id;
636 641
637 642 // Add notes to the booking relative source of imported booking
638 643 if ( class_exists( 'wpdev_bk_personal' ) ) {
639 - $remark_text = '[' . wpbc_datetime_localized( date( 'Y-m-d H:i:s' ), 'Y-m-d H:i:s' ) . '] ' . sprintf( __( 'Imported from %s ', 'booking-manager' ), 'Google Calendar' );
644 + /* translators: 1: ... */
645 + $remark_text = '[' . wpbc_datetime_localized( gmdate( 'Y-m-d H:i:s' ), 'Y-m-d H:i:s' ) . '] ' . sprintf( __( 'Imported from %s ', 'booking' ), 'Google Calendar' );
640 646 $remark_text = str_replace( '%', '&#37;', $remark_text );
641 647 $remark_text = str_replace( array( '"', "'" ), '', $remark_text );
642 648 $remark_text = trim( $remark_text );
643 649 $is_append = true;
@@ -660,15 +666,15 @@
660 666 . '<strong> Google Calendar ' . __( 'Event', 'booking' ) . '</strong> '. 'UID' . ': ' . $request_save_params['sync_gid']
661 667 . '<hr/>'
662 668 . ' <span style="color:#8b2122;">' . $booking_save_arr['ajx_data']['ajx_after_action_message'] . '</span>'
663 669 . '<hr/>'
664 - . ' <strong>' . __( 'Resource', 'booking' ) . ' ID : ' . '</strong>' . $request_save_params['resource_id']
665 - . ' <strong>' . __( 'Dates', 'booking' ) .': ' . '</strong>' . $request_save_params['dates_ddmmyy_csv']
670 + . ' <strong>' . esc_html__( 'Resource', 'booking' ) . ' ID : ' . '</strong>' . $request_save_params['resource_id']
671 + . ' <strong>' . esc_html__( 'Dates', 'booking' ) .': ' . '</strong>' . $request_save_params['dates_ddmmyy_csv']
666 672 . ( ( ! empty( $parsed_booking_data_arr['rangetime'] ) )
667 - ? ( ' <strong>' . __( 'Times', 'booking' ) . ': ' . '</strong>' . $parsed_booking_data_arr['rangetime'] )
673 + ? ( ' <strong>' . esc_html__( 'Times', 'booking' ) . ': ' . '</strong>' . $parsed_booking_data_arr['rangetime'] )
668 674 : ''
669 675 )
670 - //. ' <strong>' . __( 'Data', 'booking' ) . ': ' . ' </strong>'
676 + //. ' <strong>' . esc_html__( 'Data', 'booking' ) . ': ' . ' </strong>'
671 677 . $plain_form_data_show
672 678 . '</div>';
673 679
674 680 unset( $this->events[ $key ] );
@@ -679,42 +685,43 @@
679 685 }
680 686
681 687 return $this->events;
682 688 }
683 -
684 -
685 - ////////////////////////////////////////////////////////////////////////////
686 - // Get Already exist same bookings
687 - ////////////////////////////////////////////////////////////////////////////
688 - public function getExistBookings_gid( $events_array ) {
689 -
690 - $sql_sync_gid = array();
691 - foreach ($events_array as $event) {
692 - $sql_sync_gid[] = $event['sync_gid'];
693 - }
694 - $sql_sync_gid= implode( "','",$sql_sync_gid );
695 -
696 - $exist_bookings_guid = array();
697 689
698 - $booking_condition_import_only_new = get_bk_option( 'booking_condition_import_only_new' ); //FixIn: 9.8.15.8
699 - if ( ( ! empty( $sql_sync_gid ) ) && ( 'On' === $booking_condition_import_only_new ) ) {
700 - global $wpdb;
701 - $exist_bookings = $wpdb->get_results( "SELECT * FROM {$wpdb->prefix}booking WHERE sync_gid IN ('{$sql_sync_gid}') AND trash != 1" ); //FixIn: 9.8.15.8
702 - foreach ($exist_bookings as $bk) {
703 - $exist_bookings_guid[]=$bk->sync_gid;
704 - }
705 - }
706 - return $exist_bookings_guid;
707 - }
708 -
709 -
710 - ////////////////////////////////////////////////////////////////////////////
711 - // Show Table of imported Events
712 - ////////////////////////////////////////////////////////////////////////////
713 - public function showImportedEvents( ) {
714 - ////////////////////////////////////////////////////////////////////////
715 - ?>
716 - <div id="gcal_imported_events<?php echo $this->getResource(); ?>" class="table-responsive">
690 +
691 + // -----------------------------------------------------------------------------------------------------------------
692 + // Get Already exist same bookings
693 + // -----------------------------------------------------------------------------------------------------------------
694 + public function getExistBookings_gid( $events_array ) {
695 +
696 + $sql_sync_gid = array();
697 + foreach ( $events_array as $event ) {
698 + $sql_sync_gid[] = $event['sync_gid'];
699 + }
700 + $sql_sync_gid = implode( "','", $sql_sync_gid );
701 +
702 + $exist_bookings_guid = array();
703 +
704 + $booking_condition_import_only_new = get_bk_option( 'booking_condition_import_only_new' ); // FixIn: 9.8.15.8.
705 + if ( ( ! empty( $sql_sync_gid ) ) && ( 'On' === $booking_condition_import_only_new ) ) {
706 + global $wpdb;
707 + // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching, WordPress.DB.PreparedSQL.NotPrepared, PluginCheck.Security.DirectDB.UnescapedDBParameter, WordPress.DB.PreparedSQL.InterpolatedNotPrepared
708 + $exist_bookings = $wpdb->get_results( "SELECT * FROM {$wpdb->prefix}booking WHERE sync_gid IN ('{$sql_sync_gid}') AND trash != 1" ); // FixIn: 9.8.15.8.
709 + foreach ( $exist_bookings as $bk ) {
710 + $exist_bookings_guid[] = $bk->sync_gid;
711 + }
712 + }
713 +
714 + return $exist_bookings_guid;
715 + }
716 +
717 +
718 + // -----------------------------------------------------------------------------------------------------------------
719 + // Show Table of imported Events
720 + // -----------------------------------------------------------------------------------------------------------------
721 + public function showImportedEvents() {
722 + ?>
723 + <div id="gcal_imported_events<?php echo esc_attr( $this->getResource() ); ?>" class="table-responsive">
717 724 <table style="width:99%;margin-top:45px;border:1px solid #ccc;"
718 725
719 726 class="resource_table0 booking_table0 table table-striped "
720 727 cellpadding="0" cellspacing="0">
@@ -720,54 +727,68 @@
720 727 cellpadding="0" cellspacing="0">
721 728 <?php
722 729
723 730 if (function_exists ('wpbc_db__get_resource_title')) {
724 - echo '<tr><td colspan="6" style="padding:5px 10px;font-style:italic;"> <h4>' , wpbc_get_resource_title( $this->getResource() ) , '</h4></td></tr>';
731 + echo '<tr><td colspan="6" style="padding:5px 10px;font-style:italic;"> <h4>' , wp_kses_post( wpbc_get_resource_title( $this->getResource() ) ) , '</h4></td></tr>';
725 732 }
726 733
727 734 ?>
728 735 <?php // Headers ?>
729 736 <tr>
730 - <th style="text-align:center;width:15px;"><input type="checkbox" onclick="javascript:jQuery('#gcal_imported_events<?php echo $this->getResource(); ?> .events_items').attr('checked', this.checked);" class="" id="events_items_all" name="events_items_all" /></th>
731 - <th style="text-align:center;width:10px;height:35px;"> <?php _e('ID' ,'booking'); ?> </th>
732 - <th style="text-align:center;height:35px;width:220px;" style="border-left: 1px solid #ccc;"> <?php _e('Title' ,'booking'); ?> </th>
733 - <th style="text-align:center;"> <?php _e('Info' ,'booking'); ?> </th>
734 - <th style="text-align:center;"> <?php _e('Dates' ,'booking'); ?> </th>
735 - <th style="text-align:center;width:10px;height:35px;"> <?php _e('GID' ,'booking'); ?> </th>
737 + <th style="text-align:center;width:15px;"><input type="checkbox" onclick="javascript:jQuery('#gcal_imported_events<?php echo esc_attr( $this->getResource() ); ?> .events_items').attr('checked', this.checked);" class="" id="events_items_all" name="events_items_all" /></th>
738 + <th style="text-align:center;width:10px;height:35px;"> <?php esc_html_e('ID' ,'booking'); ?> </th>
739 + <th style="text-align:center;height:35px;width:220px;" style="border-left: 1px solid #ccc;"> <?php esc_html_e('Title' ,'booking'); ?> </th>
740 + <th style="text-align:center;"> <?php esc_html_e('Info' ,'booking'); ?> </th>
741 + <th style="text-align:center;"> <?php esc_html_e('Dates' ,'booking'); ?> </th>
742 + <th style="text-align:center;width:10px;height:35px;"> <?php esc_html_e('GID' ,'booking'); ?> </th>
736 743 </tr>
737 744 <?php
738 745 $alternative_color = '';
739 746 if (! empty($this->events))
740 747 foreach ($this->events as $bt) {
741 -
742 - if ( $alternative_color == '')
743 - $alternative_color = ' class="alternative_color" ';
744 - else
745 - $alternative_color = '';
746 - ?>
747 - <tr id="gcal_imported_events_id_<?php echo $bt['id']; ?>">
748 - <td <?php echo $alternative_color; ?> style="border-left: 0;border-right: 1px solid #ccc;">
749 -<!-- <span class="wpbc_mobile_legend"><?php _e('Selection' ,'booking'); ?>:</span>-->
750 - <input type="checkbox" class="events_items" id="events_items_<?php echo $bt['id']; ?>" value="<?php echo $bt['id']; ?>" name="events_items_<?php echo $bt['id']; ?>" /></td>
751 - <td style="border-right: 0;border-left: 1px solid #ccc;text-align: center;" <?php echo $alternative_color; ?> >
752 -<!-- <span class="wpbc_mobile_legend"><?php _e('ID' ,'booking'); ?>:</span>-->
753 - <?php echo $bt['id']; ?></td>
754 - <td <?php echo $alternative_color; ?> style="border-right: 0;border-left: 1px solid #ccc;">
755 -<!-- <span class="wpbc_mobile_legend"><?php _e('Title' ,'booking'); ?>:</span>-->
756 - <span ><?php echo $bt['title']; ?></span>
748 +
749 + if ( $alternative_color == '' ) {
750 + $alternative_color = ' class="alternative_color" ';
751 + } else {
752 + $alternative_color = '';
753 + }
754 + ?>
755 + <tr id="gcal_imported_events_id_<?php echo esc_attr( $bt['id'] ); ?>">
756 + <td <?php
757 + // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
758 + echo $alternative_color; ?> style="border-left: 0;border-right: 1px solid #ccc;">
759 +<!-- <span class="wpbc_mobile_legend"><?php esc_html_e('Selection' ,'booking'); ?>:</span>-->
760 + <input type="checkbox" class="events_items" id="events_items_<?php echo esc_attr( $bt['id'] ); ?>" value="<?php
761 + // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
762 + echo $bt['id']; ?>" name="events_items_<?php echo esc_attr( $bt['id'] ); ?>" /></td>
763 + <td style="border-right: 0;border-left: 1px solid #ccc;text-align: center;" <?php
764 + // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
765 + echo $alternative_color; ?> >
766 +<!-- <span class="wpbc_mobile_legend"><?php esc_html_e('ID' ,'booking'); ?>:</span>-->
767 + <?php echo esc_attr( $bt['id'] ); ?></td>
768 + <td <?php
769 + // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
770 + echo $alternative_color; ?> style="border-right: 0;border-left: 1px solid #ccc;">
771 +<!-- <span class="wpbc_mobile_legend"><?php esc_html_e('Title' ,'booking'); ?>:</span>-->
772 + <span ><?php echo esc_html( $bt['title'] ); ?></span>
757 773 </td>
758 - <td style="border-right: 0;border-left: 1px solid #ccc;text-align: center;" <?php echo $alternative_color; ?> >
759 -<!-- <span class="wpbc_mobile_legend"><?php _e('Info' ,'booking'); ?>:</span>-->
760 - <span ><?php echo $bt['description']; ?></span><br/>
761 - <?php
762 - if (! empty($bt['location']) )
763 - echo '<span >', __('Location:' ,'booking'), ': ' , $bt['location'], '</span>';
774 + <td style="border-right: 0;border-left: 1px solid #ccc;text-align: center;" <?php
775 + // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
776 + echo $alternative_color; ?> >
777 +<!-- <span class="wpbc_mobile_legend"><?php esc_html_e('Info' ,'booking'); ?>:</span>-->
778 + <span ><?php echo esc_html( $bt['description'] ); ?></span><br/>
779 + <?php
780 + if ( ! empty( $bt['location'] ) ) {
781 + echo wp_kses_post( '<span >' . esc_html__( 'Location:', 'booking' ) . ': ' . $bt['location'] . '</span>' );
782 + }
764 783 ?>
765 784 </td>
766 785
767 - <td style="border-right: 0;border-left: 1px solid #ccc;text-align: center;" <?php echo $alternative_color; ?> >
786 + <td style="border-right: 0;border-left: 1px solid #ccc;text-align: center;" <?php
787 + // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
788 + echo $alternative_color; ?> >
768 789 <span class="wpbc-listing-collumn booking-dates field-dates field-booking-date">
769 -<!-- <span class="wpbc_mobile_legend"><?php _e('Dates' ,'booking'); ?>:</span>-->
790 +<!-- <span class="wpbc_mobile_legend"><?php esc_html_e('Dates' ,'booking'); ?>:</span>-->
770 791 <div class="booking_dates_full" ><?php
771 792 $bt['dates'] = explode(', ', $bt['dates']);
772 793 foreach ($bt['dates'] as $keyd=>$valued) {
773 794
@@ -776,15 +797,17 @@
776 797
777 798 $bt['dates'][$keyd] = '<a href="javascript:void(0)" class="field-booking-date">' . $valued[0] . '</a>';
778 799 }
779 800 $bt['dates'] = implode('<span class="date_tire">, </span>', $bt['dates']);
780 - echo $bt['dates'];//date_i18n('d.m.Y H:i',$bt['start_time'] ), ' - ', date_i18n('d.m.Y H:i',$bt['end_time']); ?>
801 + echo wp_kses_post( $bt['dates'] );//date_i18n('d.m.Y H:i',$bt['start_time'] ), ' - ', date_i18n('d.m.Y H:i',$bt['end_time']); ?>
781 802 </div>
782 803 </span>
783 804 </td>
784 - <td style="border-right: 0;border-left: 1px solid #ccc;text-align: center;" <?php echo $alternative_color; ?> >
785 -<!-- <span class="wpbc_mobile_legend"><?php _e('GID' ,'booking'); ?>:</span>-->
786 - <?php echo $bt['sync_gid']; ?></td>
805 + <td style="border-right: 0;border-left: 1px solid #ccc;text-align: center;" <?php
806 + // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
807 + echo $alternative_color; ?> >
808 +<!-- <span class="wpbc_mobile_legend"><?php esc_html_e('GID' ,'booking'); ?>:</span>-->
809 + <?php echo wp_kses_post( $bt['sync_gid'] ); ?></td>
787 810 </tr>
788 811 <?php } ?>
789 812
790 813 <tr class="wpbc_table_footer">
@@ -789,23 +812,22 @@
789 812
790 813 <tr class="wpbc_table_footer">
791 814 <td colspan="6" style="text-align: center;">
792 815 <a href="javascript:void(0)" class="button button-primary" style="float:none;margin:10px;"
793 - onclick="javascript:location.reload();" ><?php _e('Reload page' ,'booking'); ?></a>
816 + onclick="javascript:location.reload();" ><?php esc_html_e('Reload page' ,'booking'); ?></a>
794 817 <a href="javascript:void(0)" class="button" style="float:none;margin:10px;"
795 - onclick="javascript:jQuery('#gcal_imported_events<?php echo $this->getResource(); ?>').remove();" ><?php _e('Hide' ,'booking'); ?></a>
818 + onclick="javascript:jQuery('#gcal_imported_events<?php echo esc_attr( $this->getResource() ); ?>').remove();" ><?php esc_html_e('Hide' ,'booking'); ?></a>
796 819 <a href="javascript:void(0)" class="button" style="float:none;margin:10px;"
797 820 onclick="javascript: if ( wpbc_are_you_sure('<?php echo esc_js(__('Do you really want to delete selected booking(s) ?' ,'booking')); ?>') ) {
798 821 //delete_booking(
799 822 trash__restore_booking( 1, <?php //FixIn: 7.0.1 ?>
800 - get_selected_bookings_id_in_this_list('#gcal_imported_events<?php echo $this->getResource(); ?> .events_items', 13)
801 - , <?php echo $this->getUserID(); ?>
802 - , '<?php echo wpbc_get_maybe_reloaded_booking_locale(); ?>'
823 + get_selected_bookings_id_in_this_list('#gcal_imported_events<?php echo esc_attr( $this->getResource() ); ?> .events_items', 13)
824 + , <?php echo esc_attr( $this->getUserID() ); ?>
825 + , '<?php echo esc_attr( wpbc_get_maybe_reloaded_booking_locale() ); ?>'
803 826 , 1
804 827 );
805 828 } "
806 - ><?php _e('Delete selected booking(s)' ,'booking'); ?></i></a>
807 -
829 + ><?php esc_html_e('Delete selected booking(s)' ,'booking'); ?></i></a>
808 830 </td>
809 831 </tr>
810 832
811 833 </table>
@@ -810,9 +832,9 @@
810 832
811 833 </table>
812 834 </div>
813 835 <script type="text/javascript">
814 - jQuery("#gcal_imported_events<?php echo $this->getResource(); ?>").insertAfter("#toolbar_booking_listing");
836 + jQuery("#gcal_imported_events<?php echo esc_attr( $this->getResource() ); ?>").insertAfter("#toolbar_booking_listing");
815 837 </script>
816 838 <?php
817 839 }
818 840