| @@ -44,13 +44,13 @@ | ||
| 44 | 44 | |
| 45 | 45 | // <editor-fold defaultstate="collapsed" desc=" S H O R T C O D E S "> |
| 46 | 46 | |
| 47 | 47 | // FixIn: 8.1.3.5. |
| 48 | - /** Listing customners bookings in timeline view | |
| 48 | + /** Render verified customer access and the customer's booking list. | |
| 49 | 49 | * |
| 50 | - * @param $attr - The same parameters as for bookingtimeline shortcode (function) | |
| 50 | + * @param array $attr Shortcode attributes. | |
| 51 | 51 | * |
| 52 | - * @return mixed|string|void | |
| 52 | + * @return string Customer verification or booking-listing HTML. | |
| 53 | 53 | */ |
| 54 | 54 | function bookingcustomerlisting_shortcode( $attr ){ |
| 55 | 55 | |
| 56 | 56 | if ( ! class_exists( 'wpdev_bk_personal' ) ) { |
| @@ -61,67 +61,15 @@ | ||
| 61 | 61 | return wpbc_get_preview_for_shortcode( 'bookingcustomerlisting', $attr ); // FixIn: 9.9.0.39. |
| 62 | 62 | } |
| 63 | 63 | |
| 64 | 64 | $attr = wpbc_escape_shortcode_params( $attr ); //FixIn: 9.7.3.6.1 |
| 65 | + $attr = is_array( $attr ) ? $attr : array(); | |
| 65 | 66 | |
| 66 | - // FixIn: 8.4.5.11. | |
| 67 | - if (! is_array($attr)) { | |
| 68 | - $attr = array(); | |
| 67 | + if ( ! function_exists( 'wpbc_customer_bookings_render_shortcode' ) ) { | |
| 68 | + return '<strong>' . esc_html__( 'Customer booking access is temporarily unavailable.', 'booking' ) . '</strong>'; | |
| 69 | 69 | } |
| 70 | - // phpcs:ignore WordPress.Security.NonceVerification.Recommended, WordPress.Security.NonceVerification.Missing | |
| 71 | - if ( ( isset( $_GET['booking_hash'] ) ) || ( isset( $attr['booking_hash'] ) ) ) { | |
| 72 | 70 | |
| 73 | - | |
| 74 | - // phpcs:ignore WordPress.Security.NonceVerification.Recommended, WordPress.Security.NonceVerification.Missing | |
| 75 | - if ( isset( $_GET['booking_hash'] ) ) { | |
| 76 | - $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 */ | |
| 77 | - $my_booking_id_type = wpbc_hash__get_booking_id__resource_id( $get_booking_hash ); | |
| 78 | - | |
| 79 | - $attr['booking_hash'] = $get_booking_hash; | |
| 80 | - } else { | |
| 81 | - $my_booking_id_type = wpbc_hash__get_booking_id__resource_id( $attr['booking_hash'] ); | |
| 82 | - } | |
| 83 | - | |
| 84 | - if ( $my_booking_id_type !== false ) { | |
| 85 | - | |
| 86 | - if ( ! isset( $attr['type' ] ) ) { // 8.1.3.5.2 | |
| 87 | - | |
| 88 | - $br_list = wpbc_get_all_booking_resources_list(); | |
| 89 | - $br_list = array_keys( $br_list ); | |
| 90 | - $br_list = implode(',',$br_list); | |
| 91 | - $attr['type' ] = $br_list; //wpbc_get_default_resource(); | |
| 92 | - } | |
| 93 | - if ( ! isset( $attr['view_days_num' ] ) ) { | |
| 94 | - $attr['view_days_num' ] = 30; | |
| 95 | - } | |
| 96 | - if ( ! isset( $attr['scroll_start_date' ] ) ) { | |
| 97 | - $attr['scroll_start_date' ] = ''; | |
| 98 | - } | |
| 99 | - if ( ! isset( $attr['scroll_day' ] ) ) { | |
| 100 | - $attr['scroll_day' ] = 0; | |
| 101 | - } | |
| 102 | - if ( ! isset( $attr['scroll_month' ] ) ) { | |
| 103 | - $attr['scroll_month' ] = 0; | |
| 104 | - } | |
| 105 | - if ( ! isset( $attr['header_title' ] ) ) { | |
| 106 | - $attr['header_title' ] = __( 'My bookings' , 'booking'); | |
| 107 | - } | |
| 108 | - | |
| 109 | - $timeline_results = $this->bookingtimeline_shortcode( $attr ); | |
| 110 | - | |
| 111 | - return $timeline_results ; | |
| 112 | - | |
| 113 | - } else { | |
| 114 | - return '<div class="wpbc_after_booking_thank_you_section"><div class="wpbc_ty__container"><div class="wpbc_ty__header"><strong>' . esc_html__('Oops!' ,'booking') . '</strong> ' . 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') . '</div></div></div>'; | |
| 115 | - } | |
| 116 | - | |
| 117 | - } else { | |
| 118 | - return __( 'This page can only be accessed through links in emails related to your booking.', 'booking' ) | |
| 119 | - . ' <br/><em>' | |
| 120 | - /* translators: 1: ... */ | |
| 121 | - . sprintf( __( 'Please check more about configuration at %1$sthis page%2$s', 'booking' ), '<a href="https://wpbookingcalendar.com/faq/configure-editing-cancel-payment-bookings-for-visitors/" target="_blank">', '</a>.' ) | |
| 122 | - . '</em>'; | |
| 123 | - } | |
| 71 | + return wpbc_customer_bookings_render_shortcode( $attr ); | |
| 124 | 72 | } |
| 125 | 73 | |
| 126 | 74 | /** |
| 127 | 75 | * TimeLine shortcode |
| @@ -358,5 +306,5 @@ | ||
| 358 | 306 | return $search_form ; |
| 359 | 307 | } |
| 360 | 308 | |
| 361 | 309 | // </editor-fold> |
| 362 | -} | |
| 310 | +} | |