var $wpdev_bk_personal; function __construct() { // In AJAX request it DO NOT RUNNING. Important note $this->popover_front_end_js_is_writed = false; if ( class_exists( 'wpdev_bk_personal' ) ) { $this->wpdev_bk_personal = new wpdev_bk_personal(); } else { $this->wpdev_bk_personal = false; } // User defined - hooks add_action( 'wpdev_bk_add_calendar', array( &$this, 'add_calendar_action' ), 10, 2 ); add_action( 'wpdev_bk_add_form', array( &$this, 'add_booking_form_action' ), 10, 2 ); add_bk_action( 'wpdevbk_add_form', array( &$this, 'add_booking_form_action' ) ); add_filter( 'wpdev_bk_get_form', array( &$this, 'get_booking_form_action' ), 10, 2 ); add_bk_filter( 'wpdevbk_get_booking_form', array( &$this, 'get_booking_form_action' ) ); add_filter( 'wpdev_bk_get_showing_date_format', array( &$this, 'get_showing_date_format' ), 10, 1 ); // Get script for calendar activation add_bk_filter( 'pre_get_calendar_html', array( &$this, 'pre_get_calendar_html' ) ); add_action( 'init', array( $this, 'wpbc_shortcodes_init' ), 9999 ); // <- priority to load it last } // /** * S H O R T C O D E s Init * * @return void */ function wpbc_shortcodes_init(){ add_shortcode( 'booking', array( &$this, 'booking_shortcode' ) ); add_shortcode( 'bookingcalendar', array( &$this, 'booking_calendar_only_shortcode' ) ); add_shortcode( 'bookingform', array( &$this, 'bookingform_shortcode' ) ); add_shortcode( 'bookingedit', array( &$this, 'bookingedit_shortcode' ) ); add_shortcode( 'bookingsearch', array( &$this, 'bookingsearch_shortcode' ) ); add_shortcode( 'bookingsearchresults', array( &$this, 'bookingsearchresults_shortcode' ) ); add_shortcode( 'bookingselect', array( &$this, 'bookingselect_shortcode' ) ); add_shortcode( 'bookingresource', array( &$this, 'bookingresource_shortcode' ) ); add_shortcode( 'bookingtimeline', array( &$this, 'bookingtimeline_shortcode' ) ); add_shortcode( 'bookingcustomerlisting', array( &$this, 'bookingcustomerlisting_shortcode' ) ); // FixIn: 8.1.3.5. } // function silent_deactivate_WPBC() { deactivate_plugins( WPBC_PLUGIN_DIRNAME . '/' . WPBC_PLUGIN_FILENAME, true ); } // Change date format function get_showing_date_format( $mydate ) { $date_format = get_bk_option( 'booking_date_format' ); if ( $date_format == '' ) { $date_format = "d.m.Y"; } $time_format = get_bk_option( 'booking_time_format' ); if ( $time_format !== false ) { $time_format = ' ' . $time_format; $my_time = gmdate( 'H:i:s', $mydate ); if ( $my_time == '00:00:00' ) { $time_format = ''; } } else { $time_format = ''; } // return gmdate($date_format . $time_format , $mydate); return date_i18n( $date_format, $mydate ) . '' . date_i18n( $time_format, $mydate ) . ''; } // // /** * Generate booking CAPTCHA fields for booking form * * @param $bk_tp resource ID * * @return string|true */ function createCapthaContent($bk_tp) { $admin_uri = ltrim( str_replace( get_site_url( null, '', 'admin' ), '', admin_url( 'admin.php?' ) ), '/' ); $server_request_uri = ( ( isset( $_SERVER['REQUEST_URI'] ) ) ? sanitize_text_field( $_SERVER['REQUEST_URI'] ) : '' ); /* phpcs:ignore WordPress.Security.NonceVerification.Missing, WordPress.Security.ValidatedSanitizedInput.MissingUnslash */ /* FixIn: sanitize_unslash */ if ( ( get_bk_option( 'booking_is_use_captcha' ) !== 'On' ) || ( ( strpos( $server_request_uri, $admin_uri ) !== false ) && ( ! wpbc_is_settings_form_page() ) ) ) { return ''; } else { $html = wpbc_captcha__simple__generate_html_content( $bk_tp ); return $html; } } // Get default Booking resource function get_default_type() { if ( $this->wpdev_bk_personal !== false ) { // phpcs:ignore WordPress.Security.NonceVerification.Recommended, WordPress.Security.NonceVerification.Missing if ( ( isset( $_GET['booking_type'] ) ) && ( $_GET['booking_type'] != '' ) ) { $bk_type = sanitize_text_field( wp_unslash( $_GET['booking_type'] ) ); /* phpcs:ignore WordPress.Security.NonceVerification.Recommended, WordPress.Security.NonceVerification.Missing */ /* FixIn: sanitize_unslash */ } else { $bk_type = $this->wpdev_bk_personal->get_default_booking_resource_id(); } } else { $bk_type = 1; } return $bk_type; } // // // Get HTML for the initilizing inline calendars function pre_get_calendar_html( $resource_id=1, $cal_count=1, $bk_otions=array() ){ //SHORTCODE: /* * [booking type=56 form_type='standard' nummonths=4 * options='{calendar months_num_in_row=2 width=682px cell_height=48px}'] */ $bk_otions = wpbc_parse_calendar_options($bk_otions); /* options: [months_num_in_row] => 2 [width] => 341px define: width: 100%; max-width:341px; [strong_width] => 341px define: width:341px; [cell_height] => 48px */ $width = $months_num_in_row = $cell_height = ''; if (!empty($bk_otions)){ if ( isset( $bk_otions['months_num_in_row'] ) ) { $months_num_in_row = $bk_otions['months_num_in_row']; } if ( isset( $bk_otions['width'] ) ) { $width = 'width:100%;max-width:' . $bk_otions['width'] . ';'; // FixIn: 9.3.1.5. } if ( isset( $bk_otions['strong_width'] ) ) { $width .= 'width:' . $bk_otions['strong_width'] . ';'; // FixIn: 9.3.1.6. } if ( isset( $bk_otions['cell_height'] ) ) { $cell_height = $bk_otions['cell_height']; } if ( isset( $bk_otions['strong_cell_height'] ) ) { // FixIn: 9.7.3.3. $cell_height = $bk_otions['strong_cell_height'] . '!important;'; } } /* FixIn: 9.7.3.4 */ if ( ! empty( $cell_height ) ) { // phpcs:ignore WordPress.WP.EnqueuedResources.NonEnqueuedStylesheet $style = ''; } else { $style = ''; } // FixIn: 8.2.1.27. $booking_timeslot_day_bg_as_available = get_bk_option( 'booking_timeslot_day_bg_as_available' ); $booking_timeslot_day_bg_as_available = ( $booking_timeslot_day_bg_as_available === 'On' ) ? ' wpbc_timeslot_day_bg_as_available' : ''; //FixIn: 9.8.1 $is_custom_width_css = ( empty( $width ) ) ? ' wpbc_no_custom_width ' : ''; $calendar = $style. '
' . '
' . __('Calendar is loading...' ,'booking'). '
'. '
'. ''; $booking_is_show_powered_by_notice = get_bk_option( 'booking_is_show_powered_by_notice' ); if ( ( ! class_exists( 'wpdev_bk_personal' ) ) && ( $booking_is_show_powered_by_notice == 'On' ) ) { $calendar .= '
Powered by Booking Calendar
'; } $calendar .= ''; // Calendar code $calendar .= wpbc_get_calendar_legend(); // FixIn: 9.4.3.6. $calendar_css_class_outer = 'wpbc_calendar_wraper'; // FixIn: 7.0.1.24. $is_booking_change_over_days_triangles = get_bk_option( 'booking_change_over_days_triangles' ); if ( $is_booking_change_over_days_triangles !== 'Off' ) { $calendar_css_class_outer .= ' wpbc_change_over_triangle'; } // filenames, such as 'multidays.css' $calendar_skin_name = basename( get_bk_option( 'booking_skin' ) ); if ( wpbc_is_calendar_skin_legacy( $calendar_skin_name ) ) { $calendar_css_class_outer .= ' wpbc_calendar_skin_legacy'; //. wpbc_get_slug_format( get_bk_option( 'booking_skin' ) ); } $calendar = '
' . $calendar . '
'; return $calendar; } // Get booking form function get_booking_form_action( $resource_id = 1, $my_boook_count = 1, $my_booking_form = 'standard', $my_selected_dates_without_calendar = '', $start_month_calendar = false, $bk_otions = array() ) { $res = $this->add_booking_form_action($resource_id,$my_boook_count, 0, $my_booking_form , $my_selected_dates_without_calendar, $start_month_calendar, $bk_otions ); return $res; } //Show booking form from action call - wpdev_bk_add_form function add_booking_form_action( $resource_id = 1, $cal_count = 1, $is_echo = 1, $my_booking_form = 'standard', $my_selected_dates_without_calendar = '', $start_month_calendar = false, $bk_otions = array() ) { $additional_bk_types = array(); if ( strpos($resource_id,';') !== false ) { $additional_bk_types = explode(';',$resource_id); $resource_id = $additional_bk_types[0]; } //-------------------------------------------------------------------------------------------------------------- // Check if booking resource exist if ( $resource_id == '' ) { $my_result = __( 'Booking resource type is not defined. This can be, when at the URL is wrong booking hash.', 'booking' ); if ( $is_echo ) { // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped echo $my_result; } else { return $my_result; } return; } $is_booking_resource_exist = apply_bk_filter('wpdev_is_booking_resource_exist',true, $resource_id, $is_echo ); if (! $is_booking_resource_exist) { if ( $is_echo ) echo 'Booking resource does not exist.' . ' [ID=' . esc_attr( $resource_id ) . ']'; return 'Booking resource does not exist.' . ' [ID=' . esc_attr( $resource_id ) . ']'; } //-------------------------------------------------------------------------------------------------------------- // Define $this->client_side_active_params_of_user to specific User, // depends from belonging booking resource to specific User make_bk_action('check_multiuser_params_for_client_side', $resource_id ); //-------------------------------------------------------------------------------------------------------------- // Get Booking ID and booking resource ID, if we EDIT booking // phpcs:ignore WordPress.Security.NonceVerification.Recommended, WordPress.Security.NonceVerification.Missing if ( isset( $_GET['booking_hash'] ) ) { $get_booking_hash = ( ( isset( $_GET['booking_hash'] ) ) ? sanitize_text_field( wp_unslash( $_GET['booking_hash'] ) ) : '' ); /* phpcs:ignore WordPress.Security.NonceVerification.Recommended, WordPress.Security.NonceVerification.Missing */ /* FixIn: sanitize_unslash */ $my_booking_id_type = wpbc_hash__get_booking_id__resource_id( $get_booking_hash ); $is_error = false; // FixIn: 9.1.3.2. if ( $my_booking_id_type !== false ) { list( $my_edited_bk_id, $my_boook_type ) = $my_booking_id_type; if ( $my_boook_type == '' ) { $is_error ='' . esc_html__('Oops!' ,'booking') . ' ' . __('We could not find your booking. The link you used may be incorrect or has expired. If you need assistance, please contact our support team.' ,'booking'); } } else { $is_error = '' . esc_html__('Oops!' ,'booking') . ' ' . __('We could not find your booking. The link you used may be incorrect or has expired. If you need assistance, please contact our support team.' ,'booking'); } if ( false !== $is_error ) { if ( $is_echo ) { // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped echo $is_error; } return $is_error; } // Check situation when we have editing "child booking resource", so need to reupdate calendar and form to have it for parent resource. // phpcs:ignore WordPress.Security.NonceVerification.Recommended, WordPress.Security.NonceVerification.Missing if ( ( ! isset( $_GET['booking_pay'] ) ) && ( ! isset( $_GET['resource_no_update'] ) ) && ( function_exists( 'wpbc_is_this_child_resource' ) ) && ( wpbc_is_this_child_resource( $my_boook_type ) ) ){ $bk_parent_br_id = wpbc_get_parent_resource( $my_boook_type ); $resource_id = $bk_parent_br_id; } } //-------------------------------------------------------------------------------------------------------------- // Get JS vars for Booked dates | Rates | Availability & define function for showing calendar $start_script_code = wpbc__calendar__load( array( 'resource_id' => $resource_id, 'aggregate_resource_id_arr' => $additional_bk_types, 'selected_dates_without_calendar' => $my_selected_dates_without_calendar, 'calendar_number_of_months' => $cal_count, 'start_month_calendar' => $start_month_calendar, 'shortcode_options' => $bk_otions, 'custom_form' => ( isset( $_GET['booking_form'] ) ) ? wpbc_clean_text_value( $_GET['booking_form'] ) : $my_booking_form // phpcs:ignore WordPress.Security.NonceVerification.Recommended, WordPress.Security.NonceVerification.Missing, WordPress.Security.ValidatedSanitizedInput.MissingUnslash, WordPress.Security.ValidatedSanitizedInput.InputNotSanitized )); if ( $my_selected_dates_without_calendar !== '' ) { // FixIn: 9.3.1.1. // Disable booked time slots, for predefined selected date in the booking form (it's shortcode for booking form, without the calendar) $start_script_code .= ''; // FixIn: 10.1.3.7. } //-------------------------------------------------------------------------------------------------------------- // Get booking form content $my_result = ' ' . $this->get__client_side_booking_content($resource_id, $my_booking_form, $my_selected_dates_without_calendar, $cal_count, $bk_otions ) . ' ' . $start_script_code ; $my_result = apply_filters('wpdev_booking_form', $my_result , $resource_id); // Add DIV structure, where to show payment form make_bk_action('finish_check_multiuser_params_for_client_side', $resource_id ); if ( $is_echo ) { // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped echo $my_result; } else { return $my_result; } } /** * For [bookingcalendar ... ] shortcode Only! * * @param $resource_id * @param $cal_count * @param $is_echo * @param $start_month_calendar * @param $bk_otions * * @return string|void */ function add_calendar_action( $resource_id = 1, $cal_count = 1, $is_echo = 1, $start_month_calendar = false, $bk_otions = array() ) { $additional_bk_types = array(); if ( strpos($resource_id,';') !== false ) { $additional_bk_types = explode(';',$resource_id); $resource_id = $additional_bk_types[0]; } make_bk_action('check_multiuser_params_for_client_side', $resource_id ); // phpcs:ignore WordPress.Security.NonceVerification.Recommended, WordPress.Security.NonceVerification.Missing if (isset($_GET['booking_hash'])) { $get_booking_hash = ( ( isset( $_GET['booking_hash'] ) ) ? sanitize_text_field( wp_unslash( $_GET['booking_hash'] ) ) : '' ); /* phpcs:ignore WordPress.Security.NonceVerification.Recommended, WordPress.Security.NonceVerification.Missing */ /* FixIn: sanitize_unslash */ $my_booking_id_type = wpbc_hash__get_booking_id__resource_id( $get_booking_hash ); if ($my_booking_id_type != false) if ($my_booking_id_type[1]=='') { $my_result = '' . esc_html__('Oops!' ,'booking') . ' ' . __('We could not find your booking. The link you used may be incorrect or has expired. If you need assistance, please contact our support team.' ,'booking'); if ( $is_echo ) { // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped echo $my_result; } else { return $my_result; } return; } } $start_script_code = wpbc__calendar__load( array( 'resource_id' => $resource_id, 'aggregate_resource_id_arr' => $additional_bk_types, 'selected_dates_without_calendar' => '', 'calendar_number_of_months' => $cal_count, 'start_month_calendar' => $start_month_calendar, 'custom_form' => 'standard' // Because we show only 'AVAILABILITY CALENDAR' without the form, at all. )); $my_result = '
' . $this->pre_get_calendar_html( $resource_id, $cal_count, $bk_otions ); $my_result .= ' ' . $start_script_code ; $my_result = apply_filters('wpdev_booking_calendar', $my_result , $resource_id); $booking_form_is_using_bs_css = get_bk_option( 'booking_form_is_using_bs_css' ); $my_result = '' . $my_result . ''; make_bk_action('finish_check_multiuser_params_for_client_side', $resource_id ); if ( $is_echo ) { // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped echo $my_result; } else { return $my_result; } } // Get content at client side of C A L E N D A R function get__client_side_booking_content( $resource_id = 1, $my_booking_form = 'standard', $my_selected_dates_without_calendar = '', $cal_count = 1, $bk_otions = array() ) { $nl = '
'; // New line if ($my_selected_dates_without_calendar=='') { // Get HTML with [calendar] shortcode and Styles for calendar. Get legend html. $calendar = $this->pre_get_calendar_html( $resource_id, $cal_count, $bk_otions ); } else { $calendar = ''; // Calendar code } // FixIn: 8.2.1.1. $form = '
'; // FixIn: 6.0.1.5. $custom_params = array(); if (! empty($bk_otions)) { $param ='\s*([name|value]+)=[\'"]{1}([^\'"]+)[\'"]{1}\s*'; // Find all possible options $pattern_to_search='%\s*{([^\s]+)' . $param . $param .'}\s*[,]?\s*%'; preg_match_all($pattern_to_search, $bk_otions, $matches, PREG_SET_ORDER); //debuge($matches); foreach ( $matches as $matche_value ) { if ( $matche_value[1] == 'parameter' ) { $custom_params[ $matche_value[3] ]= $matche_value[5]; } } } // FixIn: 6.0.1.5. if ( $this->wpdev_bk_personal !== false ) { $form .= $this->wpdev_bk_personal->get_booking_form( $resource_id, $my_booking_form, $custom_params ); } else { $form .= wpbc_simple_form__get_booking_form__as_html( $resource_id ); } // Insert calendar into form if ( strpos( $form, '[calendar]' ) !== false ) { $form = str_replace( '[calendar]', $calendar, $form ); } else { $form = '
' . $calendar . '
' . $nl . $form; } // Replace additional calendars like [calendar id=9] to HTML and JS code $form = apply_bk_filter( 'wpdev_check_for_additional_calendars_in_form' , $form , $resource_id , array( 'booking_form' => $my_booking_form , 'selected_dates' => $my_selected_dates_without_calendar , 'cal_count' => $cal_count , 'otions' => $bk_otions ) ); if ( strpos($form, '[captcha]') !== false ) { $captcha = $this->createCapthaContent($resource_id); $form =str_replace('[captcha]', $captcha ,$form); } // Set additional "Check in/out" times, if activated to use change-over days! $form = apply_filters( 'wpbc_booking_form_html__update__append_change_over_times', $form, $resource_id ); // Add booking type field $form .= '
'; $submitting = '
'; //Params: $action = -1, $name = "_wpnonce", $referer = true , $echo = true $wpbc_nonce = wp_nonce_field('CALCULATE_THE_COST', ( "wpbc_nonceCALCULATE_THE_COST" . $resource_id) , true , false ); $res = $form . $submitting . $wpbc_nonce; $my_random_id = time() * wp_rand(0,1000); $my_random_id = 'form_id'. $my_random_id; $booking_form_is_using_bs_css = get_bk_option( 'booking_form_is_using_bs_css'); $booking_form_format_type = get_bk_option( 'booking_form_format_type'); $booking_form_theme = get_bk_option( 'booking_form_theme'); $return_form = '
' . '
' . '' . $res. '
'; $return_form .= '
'; if ($my_selected_dates_without_calendar == '' ) { // Check according already shown Booking Calendar and set do not visible of it $return_form .= ''; // FixIn: 10.1.3.7. } else { //FixIn:6.1.1.16 // FixIn: 8.2.1.13. $return_form .= ''; // FixIn: 10.1.3.7. } $is_use_auto_fill_for_logged = get_bk_option( 'booking_is_use_autofill_4_logged_user' ) ; // phpcs:ignore WordPress.Security.NonceVerification.Recommended, WordPress.Security.NonceVerification.Missing if (! isset($_GET['booking_hash'])) if ($is_use_auto_fill_for_logged == 'On') { $curr_user = wpbc_get_current_user(); if ( $curr_user->ID > 0 ) { $user_nick_name = get_user_meta( $curr_user->ID, 'nickname' ); $user_nick_name = ( empty( $user_nick_name ) ) ? '' : $user_nick_name[0]; // FixIn: 8.7.1.5. $return_form .= ''; // FixIn: 10.1.3.7. } } return $return_form ; } //
// FixIn: 8.7.11.13. function wpbc_test_speed_shortcode( $attr ) { if ( wpbc_is_on_edit_page() ) { return wpbc_get_preview_for_shortcode( 'booking_test_speed', $attr ); // FixIn: 9.9.0.39. } $attr = wpbc_escape_shortcode_params( $attr ); //FixIn: 9.7.3.6.1 echo '

Booking Calendar Test

'; $datesArray = Array( '2021-09-10' , '2021-09-11' , '2021-09-12' , '2021-09-13' , '2021-09-14' , '2021-09-15' , '2021-09-16' , '2021-09-17' , '2021-09-18' ) ; for( $i = 0; $i < 1 ; $i++) { $result = wpbc_api_is_dates_booked( $datesArray, $resource_id = 13 ); //debuge((int) $result ); } debuge_speed('(int)'); echo '
'; echo '
'; } // // FixIn: 8.1.3.5. /** Listing customners bookings in timeline view * * @param $attr - The same parameters as for bookingtimeline shortcode (function) * * @return mixed|string|void */ function bookingcustomerlisting_shortcode( $attr ){ if ( ! class_exists( 'wpdev_bk_personal' ) ) { return '' . esc_html__('This shortcode available in Pro versions, only!' ,'booking') . ' '; } if ( wpbc_is_on_edit_page() ) { return wpbc_get_preview_for_shortcode( 'bookingcustomerlisting', $attr ); // FixIn: 9.9.0.39. } $attr = wpbc_escape_shortcode_params( $attr ); //FixIn: 9.7.3.6.1 // FixIn: 8.4.5.11. if (! is_array($attr)) { $attr = array(); } // phpcs:ignore WordPress.Security.NonceVerification.Recommended, WordPress.Security.NonceVerification.Missing if ( ( isset( $_GET['booking_hash'] ) ) || ( isset( $attr['booking_hash'] ) ) ) { // phpcs:ignore WordPress.Security.NonceVerification.Recommended, WordPress.Security.NonceVerification.Missing if ( isset( $_GET['booking_hash'] ) ) { $get_booking_hash = ( ( isset( $_GET['booking_hash'] ) ) ? sanitize_text_field( wp_unslash( $_GET['booking_hash'] ) ) : '' ); /* phpcs:ignore WordPress.Security.NonceVerification.Recommended, WordPress.Security.NonceVerification.Missing */ /* FixIn: sanitize_unslash */ $my_booking_id_type = wpbc_hash__get_booking_id__resource_id( $get_booking_hash ); $attr['booking_hash'] = $get_booking_hash; } else { $my_booking_id_type = wpbc_hash__get_booking_id__resource_id( $attr['booking_hash'] ); } if ( $my_booking_id_type !== false ) { if ( ! isset( $attr['type' ] ) ) { // 8.1.3.5.2 $br_list = wpbc_get_all_booking_resources_list(); $br_list = array_keys( $br_list ); $br_list = implode(',',$br_list); $attr['type' ] = $br_list; //wpbc_get_default_resource(); } if ( ! isset( $attr['view_days_num' ] ) ) { $attr['view_days_num' ] = 30; } if ( ! isset( $attr['scroll_start_date' ] ) ) { $attr['scroll_start_date' ] = ''; } if ( ! isset( $attr['scroll_day' ] ) ) { $attr['scroll_day' ] = 0; } if ( ! isset( $attr['scroll_month' ] ) ) { $attr['scroll_month' ] = 0; } if ( ! isset( $attr['header_title' ] ) ) { $attr['header_title' ] = __( 'My bookings' , 'booking'); } $timeline_results = $this->bookingtimeline_shortcode( $attr ); return $timeline_results ; } else { return '' . esc_html__('Oops!' ,'booking') . ' ' . esc_html__('We could not find your booking. The link you used may be incorrect or has expired. If you need assistance, please contact our support team.' ,'booking'); } } else { return __( 'This page can only be accessed through links in emails related to your booking.', 'booking' ) . '
' /* translators: 1: ... */ . sprintf( __( 'Please check more about configuration at %1$sthis page%2$s', 'booking' ), '', '.' ) . ''; } } /** * TimeLine shortcode * * @param type $attr * @return type * * Shortcodes exmaples: * * ** Matrix: * 1 Month View Mode: [bookingtimeline type="3,4,1,5,6,7,8,9,2,10,11,12,14" view_days_num=30 scroll_start_date="" scroll_month=0 header_title='All Bookings'] * 2 Months View Mode: [bookingtimeline type="1,5,6,7,8,9,2,10,11,12,3,4,14" view_days_num=60 scroll_start_date="" scroll_month=-1 header_title='All Bookings'] * 1 Week View Mode: [bookingtimeline type="3,4" view_days_num=7 scroll_start_date="" scroll_day=-7 header_title='All Bookings'] * 1 Day View Mode: [bookingtimeline type="3,4" view_days_num=1 scroll_start_date="" scroll_day=0 header_title='All Bookings'] ** Single: * 1 Month View Mode: [bookingtimeline type="4" view_days_num=30 scroll_start_date="" scroll_day=-15 scroll_month=0 header_title='All Bookings'] * 3 Months View Mode: [bookingtimeline type="4" view_days_num=90 scroll_start_date="" scroll_day=-30] * 1 Year View Mode: [bookingtimeline type="4" view_days_num=365 scroll_start_date="" scroll_month=-3] */ function bookingtimeline_shortcode($attr) { if ( wpbc_is_on_edit_page() ) { return wpbc_get_preview_for_shortcode( 'bookingtimeline', $attr ); // FixIn: 9.9.0.39. } $attr = wpbc_escape_shortcode_params( $attr ); //FixIn: 9.7.3.6.1 // FixIn: 8.6.1.13. $timeline_results = bookingflextimeline_shortcode($attr); return $timeline_results; } // Replace MARK at post with content at client side ----- [booking nummonths='1' type='1'] function booking_shortcode($attr) { if ( wpbc_is_on_edit_page() ) { return wpbc_get_preview_for_shortcode( 'booking', $attr ); // FixIn: 9.9.0.39. } $attr = wpbc_escape_shortcode_params( $attr ); //FixIn: 9.7.3.6.1 // phpcs:ignore WordPress.Security.NonceVerification.Recommended, WordPress.Security.NonceVerification.Missing if ( isset( $_GET['booking_hash'] ) ) { return __( 'You need to use special shortcode [bookingedit] for booking editing.', 'booking' ) . ' ' /* translators: 1: ... */ . sprintf( __( 'Please check FAQ instruction how to configure it here %s', 'booking' ) , 'https://wpbookingcalendar.com/faq/configure-editing-cancel-payment-bookings-for-visitors/' ); } //if ( function_exists( 'wpbc_br_cache' ) ) $br_cache = wpbc_br_cache(); // Init booking resources cache $my_boook_count = get_bk_option( 'booking_client_cal_count' ); $my_boook_type = 1; $my_booking_form = 'standard'; $start_month_calendar = false; $bk_otions = array(); if ( isset( $attr['nummonths'] ) ) { $my_boook_count = $attr['nummonths']; } if ( isset( $attr['resource_id'] ) ) { $attr['type'] = intval( $attr['resource_id'] ); // FixIn: 10.2.2.2. } if ( isset( $attr['type'] ) ) { $my_boook_type = intval( $attr['type'] ); // FixIn: 10.2.2.2. } if ( isset( $attr['form_type'] ) ) { $my_booking_form = $attr['form_type']; } if ( isset( $attr['agregate'] ) && (! empty( $attr['agregate'] )) ) { $additional_bk_types = $attr['agregate']; $my_boook_type .= ';'.$additional_bk_types; } if ( isset( $attr['aggregate'] ) && (! empty( $attr['aggregate'] )) ) { $additional_bk_types = $attr['aggregate']; $my_boook_type .= ';'.$additional_bk_types; } if ( isset( $attr['startmonth'] ) ) { // Set start month of calendar, fomrat: '2011-1' $start_month_calendar = explode( '-', $attr['startmonth'] ); if ( (is_array($start_month_calendar)) && ( count($start_month_calendar) > 1) ) { } else $start_month_calendar = false; } if ( isset( $attr['options'] ) ) { $bk_otions = $attr['options']; } $res = $this->add_booking_form_action( $my_boook_type, $my_boook_count, 0, $my_booking_form, '', $start_month_calendar, $bk_otions ); return $res; } // Replace MARK at post with content at client side ----- [booking nummonths='1' type='1'] function booking_calendar_only_shortcode($attr) { if ( wpbc_is_on_edit_page() ) { return wpbc_get_preview_for_shortcode( 'bookingcalendar', $attr ); // FixIn: 9.9.0.39. } $attr = wpbc_escape_shortcode_params( $attr ); //FixIn: 9.7.3.6.1 //if ( function_exists( 'wpbc_br_cache' ) ) $br_cache = wpbc_br_cache(); // Init booking resources cache $my_boook_count = get_bk_option( 'booking_client_cal_count' ); $my_boook_type = 1; $start_month_calendar = false; $bk_otions = array(); if ( isset( $attr['nummonths'] ) ) { $my_boook_count = $attr['nummonths']; } if ( isset( $attr['resource_id'] ) ) { $attr['type'] = intval( $attr['resource_id'] ); // FixIn: 10.2.2.2. } if ( isset( $attr['type'] ) ) { $my_boook_type = intval( $attr['type'] ); // FixIn: 10.2.2.2. } if ( isset( $attr['agregate'] ) && (! empty( $attr['agregate'] )) ) { $additional_bk_types = $attr['agregate']; $my_boook_type .= ';'.$additional_bk_types; } if ( isset( $attr['aggregate'] ) && (! empty( $attr['aggregate'] )) ) { // FixIn: 8.3.3.8. $additional_bk_types = $attr['aggregate']; $my_boook_type .= ';'.$additional_bk_types; } if ( isset( $attr['startmonth'] ) ) { // Set start month of calendar, fomrat: '2011-1' $start_month_calendar = explode( '-', $attr['startmonth'] ); if ( (is_array($start_month_calendar)) && ( count($start_month_calendar) > 1) ) { } else $start_month_calendar = false; } if ( isset( $attr['options'] ) ) { $bk_otions = $attr['options']; } $res = $this->add_calendar_action($my_boook_type,$my_boook_count, 0, $start_month_calendar, $bk_otions ); $start_script_code = "
"; return "
" . $start_script_code . $res . '
'; // FixIn: 8.0.1.2. } // Show only booking form, with already selected dates function bookingform_shortcode($attr) { if ( wpbc_is_on_edit_page() ) { return wpbc_get_preview_for_shortcode( 'bookingform', $attr ); // FixIn: 9.9.0.39. } $attr = wpbc_escape_shortcode_params( $attr ); //FixIn: 9.7.3.6.1 //if ( function_exists( 'wpbc_br_cache' ) ) $br_cache = wpbc_br_cache(); // Init booking resources cache $my_boook_type = 1; $my_booking_form = 'standard'; $my_boook_count = 1; $my_selected_dates_without_calendar = ''; if ( isset( $attr['resource_id'] ) ) { $attr['type'] = intval( $attr['resource_id'] ); // FixIn: 10.2.2.2. } if ( isset( $attr['type'] ) ) { $my_boook_type = intval( $attr['type'] ); // FixIn: 10.2.2.2. } if ( isset( $attr['form_type'] ) ) { $my_booking_form = $attr['form_type']; } if ( isset( $attr['selected_dates'] ) ) { $my_selected_dates_without_calendar = $attr['selected_dates']; } //$my_selected_dates_without_calendar = '20.08.2010, 29.08.2010'; $res = $this->add_booking_form_action($my_boook_type,$my_boook_count, 0 , $my_booking_form, $my_selected_dates_without_calendar, false ); return $res; } // Show booking form for editing function bookingedit_shortcode($attr) { if ( wpbc_is_on_edit_page() ) { return wpbc_get_preview_for_shortcode( 'bookingedit', $attr ); // FixIn: 9.9.0.39. } $attr = wpbc_escape_shortcode_params( $attr ); //FixIn: 9.7.3.6.1 //if ( function_exists( 'wpbc_br_cache' ) ) $br_cache = wpbc_br_cache(); // Init booking resources cache // phpcs:ignore WordPress.Security.NonceVerification.Recommended, WordPress.Security.NonceVerification.Missing if ( isset( $_GET['wpbc_hash'] ) ) { if ( function_exists( 'wpbc_parse_one_way_hash' ) ) { $get_wpbc_hash = ( ( isset( $_GET['wpbc_hash'] ) ) ? sanitize_text_field( wp_unslash( $_GET['wpbc_hash'] ) ) : '' ); /* phpcs:ignore WordPress.Security.NonceVerification.Recommended, WordPress.Security.NonceVerification.Missing */ /* FixIn: sanitize_unslash */ $one_way_hash_response = wpbc_parse_one_way_hash( $get_wpbc_hash ); return $one_way_hash_response; } } $my_boook_count = get_bk_option( 'booking_client_cal_count' ); $my_boook_type = 1; $my_booking_form = 'standard'; $bk_otions = array(); if ( isset( $attr['nummonths'] ) ) { $my_boook_count = $attr['nummonths']; } if ( isset( $attr['resource_id'] ) ) { $attr['type'] = $attr['resource_id']; } if ( isset( $attr['type'] ) ) { $my_boook_type = $attr['type']; } if ( isset( $attr['form_type'] ) ) { $my_booking_form = $attr['form_type']; } if ( isset( $attr['agregate'] ) && (! empty( $attr['agregate'] )) ) { // FixIn: 7.0.1.26. $additional_bk_types = $attr['agregate']; $my_boook_type .= ';'.$additional_bk_types; } if ( isset( $attr['aggregate'] ) && (! empty( $attr['aggregate'] )) ) { $additional_bk_types = $attr['aggregate']; $my_boook_type .= ';'.$additional_bk_types; } if ( isset( $attr['options'] ) ) { $bk_otions = $attr['options']; } // phpcs:ignore WordPress.Security.NonceVerification.Recommended, WordPress.Security.NonceVerification.Missing if (isset($_GET['booking_hash'])) { $get_booking_hash = ( ( isset( $_GET['booking_hash'] ) ) ? sanitize_text_field( wp_unslash( $_GET['booking_hash'] ) ) : '' ); /* phpcs:ignore WordPress.Security.NonceVerification.Recommended, WordPress.Security.NonceVerification.Missing */ /* FixIn: sanitize_unslash */ $my_booking_id_type = wpbc_hash__get_booking_id__resource_id( $get_booking_hash ); if ($my_booking_id_type !== false) { $my_edited_bk_id = $my_booking_id_type[0]; $my_boook_type = $my_booking_id_type[1]; if ($my_boook_type == '') return '' . esc_html__('Oops!' ,'booking') . ' ' . esc_html__('We could not find your booking. The link you used may be incorrect or has expired. If you need assistance, please contact our support team.' ,'booking'); } else { return '' . esc_html__('Oops!' ,'booking') . ' ' . esc_html__('We could not find your booking. The link you used may be incorrect or has expired. If you need assistance, please contact our support team.' ,'booking'); } } else { return __('This page can only be accessed through links in emails related to your booking.' ,'booking') . '
' /* translators: 1: ... */ . sprintf( __( 'Please check more about configuration at %1$sthis page%2$s', 'booking' ) , '' , '.') . ''; } $res = $this->add_booking_form_action($my_boook_type,$my_boook_count, 0 , $my_booking_form, '', false, $bk_otions ); // phpcs:ignore WordPress.Security.NonceVerification.Recommended, WordPress.Security.NonceVerification.Missing if (isset($_GET['booking_pay'])) { // Payment form if ( 'On' == get_bk_option( 'booking_super_admin_receive_regular_user_payments' ) ){ // FixIn: 9.2.3.8. make_bk_action('make_force_using_this_user', -999 ); // '-999' - This ID "by default" is the ID of super booking admin user } $get_booking_hash = ( ( isset( $_GET['booking_hash'] ) ) ? sanitize_text_field( wp_unslash( $_GET['booking_hash'] ) ) : '' ); /* phpcs:ignore WordPress.Security.NonceVerification.Recommended, WordPress.Security.NonceVerification.Missing */ /* FixIn: sanitize_unslash */ $res = wpbc_do_shortcode__booking_confirm( array( 'booking_hash' => $get_booking_hash ) ); if ( 'On' == get_bk_option( 'booking_super_admin_receive_regular_user_payments' ) ){ // FixIn: 9.2.3.8. make_bk_action( 'finish_force_using_this_user' ); } } return $res; } // Search form function bookingsearch_shortcode($attr) { if ( ! class_exists( 'wpdev_bk_personal' ) ) { return '' . esc_html__( 'This shortcode available in Pro versions, only!', 'booking' ) . ' '; } if ( wpbc_is_on_edit_page() ) { return wpbc_get_preview_for_shortcode( 'bookingsearch', $attr ); // FixIn: 9.9.0.39. } $attr = wpbc_escape_shortcode_params( $attr ); //FixIn: 9.7.3.6.1 $search_form = ''; if ( function_exists( 'wpbc_search_avy__show_search_form' ) ) { ob_start(); $search_form_content = wpbc_search_avy__show_search_form( $attr ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped echo $search_form_content; $search_form = ob_get_clean(); } return $search_form ; } /** * Search Results Shortcode -- Show 'Search Results' at New Page * * @param $attr * * @return string */ function bookingsearchresults_shortcode($attr) { if ( ! class_exists( 'wpdev_bk_personal' ) ) { return '' . esc_html__('This shortcode available in Pro versions, only!' ,'booking') . ' '; } if ( wpbc_is_on_edit_page() ) { return wpbc_get_preview_for_shortcode( 'bookingsearchresults', $attr ); // FixIn: 9.9.0.39. } $attr = wpbc_escape_shortcode_params( $attr ); //FixIn: 9.7.3.6.1 //if ( function_exists( 'wpbc_br_cache' ) ) $br_cache = wpbc_br_cache(); // Init booking resources cache $search_results_to_show = ''; if ( function_exists( 'wpbc_search_avy__show_search_results' ) ) { ob_start(); wpbc_search_avy__show_search_results( $attr ); // FixIn: 10.0.0.37. $search_results_to_show .= ob_get_clean(); } return $search_results_to_show; } // Select Booking form using the selectbox function bookingselect_shortcode($attr) { if ( ! class_exists( 'wpdev_bk_personal' ) ) { return '' . esc_html__('This shortcode available in Pro versions, only!' ,'booking') . ' '; } if ( wpbc_is_on_edit_page() ) { return wpbc_get_preview_for_shortcode( 'bookingselect', $attr ); // FixIn: 9.9.0.39. } $attr = wpbc_escape_shortcode_params( $attr ); //FixIn: 9.7.3.6.1 //if ( function_exists( 'wpbc_br_cache' ) ) $br_cache = wpbc_br_cache(); // Init booking resources cache $search_form = apply_bk_filter('wpdev_get_booking_select_form','', $attr ); return $search_form ; } // Select Booking form using the selectbox function bookingresource_shortcode($attr) { if ( ! class_exists( 'wpdev_bk_personal' ) ) { return '' . esc_html__('This shortcode available in Pro versions, only!' ,'booking') . ' '; } if ( wpbc_is_on_edit_page() ) { return wpbc_get_preview_for_shortcode( 'bookingresource', $attr ); // FixIn: 9.9.0.39. } $attr = wpbc_escape_shortcode_params( $attr ); //FixIn: 9.7.3.6.1 //if ( function_exists( 'wpbc_br_cache' ) ) $br_cache = wpbc_br_cache(); // Init booking resources cache $search_form = apply_bk_filter('wpbc_booking_resource_info','', $attr ); return $search_form ; } //
}