activities_helper.php
1 year ago
agent_helper.php
1 year ago
auth_helper.php
9 months ago
blocks_helper.php
1 year ago
booking_helper.php
1 year ago
bricks_helper.php
1 year ago
bundles_helper.php
1 year ago
calendar_helper.php
9 months ago
carts_helper.php
1 year ago
connector_helper.php
1 year ago
csv_helper.php
9 months ago
customer_helper.php
9 months ago
customer_import_helper.php
9 months ago
database_helper.php
9 months ago
debug_helper.php
1 year ago
defaults_helper.php
1 year ago
elementor_helper.php
1 year ago
email_helper.php
9 months ago
encrypt_helper.php
1 year ago
events_helper.php
1 year ago
form_helper.php
9 months ago
icalendar_helper.php
1 year ago
image_helper.php
1 year ago
invoices_helper.php
9 months ago
license_helper.php
1 year ago
location_helper.php
1 year ago
marketing_systems_helper.php
1 year ago
meeting_systems_helper.php
1 year ago
menu_helper.php
9 months ago
meta_helper.php
1 year ago
migrations_helper.php
1 year ago
money_helper.php
1 year ago
notifications_helper.php
9 months ago
order_intent_helper.php
9 months ago
orders_helper.php
1 year ago
otp_helper.php
9 months ago
pages_helper.php
1 year ago
params_helper.php
1 year ago
payments_helper.php
1 year ago
price_breakdown_helper.php
1 year ago
process_jobs_helper.php
1 year ago
processes_helper.php
1 year ago
replacer_helper.php
1 year ago
resource_helper.php
1 year ago
roles_helper.php
9 months ago
router_helper.php
1 year ago
service_helper.php
1 year ago
sessions_helper.php
1 year ago
settings_helper.php
9 months ago
short_links_systems_helper.php
9 months ago
shortcodes_helper.php
9 months ago
sms_helper.php
1 year ago
steps_helper.php
9 months ago
stripe_connect_helper.php
9 months ago
styles_helper.php
9 months ago
support_topics_helper.php
1 year ago
time_helper.php
9 months ago
timeline_helper.php
9 months ago
transaction_helper.php
1 year ago
transaction_intent_helper.php
1 year ago
util_helper.php
9 months ago
version_specific_updates_helper.php
9 months ago
whatsapp_helper.php
1 year ago
work_periods_helper.php
1 year ago
wp_datetime.php
1 year ago
wp_user_helper.php
1 year ago
shortcodes_helper.php
420 lines
| 1 | <?php |
| 2 | |
| 3 | class OsShortcodesHelper { |
| 4 | |
| 5 | // [latepoint_calendar] |
| 6 | public static function shortcode_latepoint_calendar( array $atts = [] ): string { |
| 7 | $atts = shortcode_atts( [ |
| 8 | 'date' => 'now', |
| 9 | 'show_services' => false, |
| 10 | 'show_agents' => false, |
| 11 | 'show_locations' => false, |
| 12 | 'view' => 'month' |
| 13 | ], $atts ); |
| 14 | $output = ''; |
| 15 | try { |
| 16 | $target_date = new OsWpDateTime( $atts['date'] ); |
| 17 | } catch ( Exception $e ) { |
| 18 | $target_date = new OsWpDateTime( 'now' ); |
| 19 | } |
| 20 | |
| 21 | $restrictions = []; |
| 22 | if ( $atts['show_services'] ) { |
| 23 | $restrictions['show_services'] = $atts['show_services']; |
| 24 | } |
| 25 | if ( $atts['show_agents'] ) { |
| 26 | $restrictions['show_agents'] = $atts['show_agents']; |
| 27 | } |
| 28 | if ( $atts['show_locations'] ) { |
| 29 | $restrictions['show_locations'] = $atts['show_locations']; |
| 30 | } |
| 31 | $output .= OsEventsHelper::events_grid( $target_date, [], $atts['view'], $restrictions ); |
| 32 | |
| 33 | return $output; |
| 34 | } |
| 35 | |
| 36 | // [latepoint_resources] |
| 37 | public static function shortcode_latepoint_resources( $atts ) { |
| 38 | $atts = shortcode_atts( array( |
| 39 | 'id' => false, |
| 40 | 'button_caption' => esc_html__( 'Book Now', 'latepoint' ), |
| 41 | 'items' => 'services', // services, agents, locations, bundles |
| 42 | 'item_ids' => '', |
| 43 | 'group_ids' => '', |
| 44 | 'columns' => 4, |
| 45 | 'limit' => false, |
| 46 | 'button_border_radius' => false, |
| 47 | 'button_bg_color' => false, |
| 48 | 'button_text_color' => false, |
| 49 | 'button_font_size' => false, |
| 50 | 'show_locations' => false, |
| 51 | 'show_agents' => false, |
| 52 | 'show_services' => false, |
| 53 | 'show_service_categories' => false, |
| 54 | 'selected_location' => false, |
| 55 | 'selected_bundle' => false, |
| 56 | 'selected_agent' => false, |
| 57 | 'selected_service' => false, |
| 58 | 'selected_duration' => false, |
| 59 | 'selected_total_attendees' => false, |
| 60 | 'selected_service_category' => false, |
| 61 | 'calendar_start_date' => false, |
| 62 | 'selected_start_date' => false, |
| 63 | 'selected_start_time' => false, |
| 64 | 'hide_side_panel' => false, |
| 65 | 'hide_summary' => false, |
| 66 | 'hide_image' => false, |
| 67 | 'hide_price' => false, |
| 68 | 'hide_description' => false, |
| 69 | 'source_id' => false, |
| 70 | 'classname' => false, |
| 71 | 'btn_classes' => false, |
| 72 | 'btn_wrapper_classes' => false |
| 73 | ), $atts ); |
| 74 | |
| 75 | if ($atts['items'] == 'bundles' && $atts['selected_service']) { |
| 76 | $atts['selected_service'] = false; |
| 77 | } |
| 78 | if ($atts['items'] == 'services' && $atts['selected_bundle']) { |
| 79 | $atts['selected_bundle'] = false; |
| 80 | } |
| 81 | |
| 82 | // Data attributes setup |
| 83 | $data_atts = ''; |
| 84 | if ( ( $atts['items'] != 'locations' ) && $atts['show_locations'] ) { |
| 85 | $data_atts .= 'data-show-locations="' . esc_attr($atts['show_locations']) . '" '; |
| 86 | } |
| 87 | if ( ( $atts['items'] != 'agents' ) && $atts['show_agents'] ) { |
| 88 | $data_atts .= 'data-show-agents="' . esc_attr($atts['show_agents']) . '" '; |
| 89 | } |
| 90 | if ( ( $atts['items'] != 'services' ) && $atts['show_services'] ) { |
| 91 | $data_atts .= 'data-show-services="' . esc_attr($atts['show_services']) . '" '; |
| 92 | } |
| 93 | if ( ( $atts['items'] != 'services' ) && $atts['show_service_categories'] ) { |
| 94 | $data_atts .= 'data-show-service-categories="' . esc_attr($atts['show_service_categories']) . '" '; |
| 95 | } |
| 96 | if ( ( $atts['items'] != 'locations' ) && $atts['selected_location'] ) { |
| 97 | $data_atts .= 'data-selected-location="' . esc_attr($atts['selected_location']) . '" '; |
| 98 | } |
| 99 | if ( ( $atts['items'] != 'agents' ) && $atts['selected_agent'] ) { |
| 100 | $data_atts .= 'data-selected-agent="' . esc_attr($atts['selected_agent']) . '" '; |
| 101 | } |
| 102 | if ( ( $atts['items'] != 'bundles' ) && $atts['selected_bundle'] ) { |
| 103 | $data_atts .= 'data-selected-bundle="' . esc_attr($atts['selected_bundle']) . '" '; |
| 104 | } |
| 105 | if ( ( $atts['items'] != 'services' ) && $atts['selected_service'] ) { |
| 106 | $data_atts .= 'data-selected-service="' . esc_attr($atts['selected_service']) . '" '; |
| 107 | } |
| 108 | if ( $atts['selected_duration'] ) { |
| 109 | $data_atts .= 'data-selected-duration="' . esc_attr($atts['selected_duration']) . '" '; |
| 110 | } |
| 111 | if ( $atts['selected_total_attendees'] ) { |
| 112 | $data_atts .= 'data-selected-total-attendees="' . esc_attr($atts['selected_total_attendees']) . '" '; |
| 113 | } |
| 114 | if ( ( $atts['items'] != 'services' ) && $atts['selected_service_category'] ) { |
| 115 | $data_atts .= 'data-selected-service-category="' . esc_attr($atts['selected_service_category']) . '" '; |
| 116 | } |
| 117 | if ( $atts['calendar_start_date'] ) { |
| 118 | $data_atts .= 'data-calendar-start-date="' . esc_attr($atts['calendar_start_date']) . '" '; |
| 119 | } |
| 120 | if ( $atts['selected_start_date'] ) { |
| 121 | $data_atts .= 'data-selected-start-date="' . esc_attr($atts['selected_start_date']) . '" '; |
| 122 | } |
| 123 | if ( $atts['selected_start_time'] ) { |
| 124 | $data_atts .= 'data-selected-start-time="' . esc_attr($atts['selected_start_time']) . '" '; |
| 125 | } |
| 126 | if ( $atts['hide_side_panel'] == 'yes' ) { |
| 127 | $data_atts .= 'data-hide-side-panel="yes" '; |
| 128 | } |
| 129 | if ( $atts['hide_summary'] == 'yes' ) { |
| 130 | $data_atts .= 'data-hide-summary="yes" '; |
| 131 | } |
| 132 | if ( $atts['source_id'] ) { |
| 133 | $data_atts .= 'data-source-id="' . esc_attr($atts['source_id']) . '" '; |
| 134 | } |
| 135 | |
| 136 | $block_classes = $atts['classname'] ? " " . $atts['classname'] : ""; |
| 137 | $resource_item_classes = $atts['id'] ? ' resource-item-' . $atts['id'] : ''; |
| 138 | |
| 139 | $btn_wrapper_classes = $atts['btn_wrapper_classes'] ?: " wp-block-button"; |
| 140 | $btn_classes = $atts['btn_classes'] ?: " wp-block-button__link"; |
| 141 | |
| 142 | $output = '<div class="latepoint-resources-items-w resources-columns-' . esc_attr($atts['columns']) . esc_attr($block_classes) . '">'; |
| 143 | |
| 144 | if ( $atts['item_ids'] ) { |
| 145 | $ids = OsUtilHelper::explode_and_trim( $atts['item_ids'] ); |
| 146 | $clean_item_ids = OsUtilHelper::clean_numeric_ids( $ids ); |
| 147 | } else { |
| 148 | $clean_item_ids = []; |
| 149 | } |
| 150 | if ( $atts['group_ids'] ) { |
| 151 | $ids = OsUtilHelper::explode_and_trim( $atts['group_ids'] ); |
| 152 | $clean_group_ids = OsUtilHelper::clean_numeric_ids( $ids ); |
| 153 | } else { |
| 154 | $clean_group_ids = []; |
| 155 | } |
| 156 | switch ( $atts['items'] ) { |
| 157 | case 'services': |
| 158 | $services = new OsServiceModel(); |
| 159 | if ( $atts['limit'] && is_numeric( $atts['limit'] ) ) { |
| 160 | $services->set_limit( $atts['limit'] ); |
| 161 | } |
| 162 | if ( $clean_item_ids ) { |
| 163 | $services->where( [ 'id' => $clean_item_ids ] ); |
| 164 | } |
| 165 | if ( $clean_group_ids ) { |
| 166 | $services->where( [ 'category_id' => $clean_group_ids ] ); |
| 167 | } |
| 168 | $services = $services->should_be_active()->should_not_be_hidden()->order_by( 'order_number asc' )->get_results_as_models(); |
| 169 | foreach ( $services as $service ) { |
| 170 | $output .= '<div class="resource-item '. esc_attr($resource_item_classes) .'">'; |
| 171 | if ($atts['hide_image'] !== 'yes' && !empty( $service->description_image_id )) { |
| 172 | $output .= '<div class="ri-media" style="background-image: url(' . $service->get_description_image_url() . ')"></div>'; |
| 173 | } |
| 174 | $output .= '<div class="ri-name"><h3>' . esc_html($service->name) . '</h3></div>'; |
| 175 | |
| 176 | if ($atts['hide_price'] !== 'yes' && $service->price_min > 0) { |
| 177 | $service_price_formatted = ( $service->price_min != $service->price_max ) ? __( 'Starts at', 'latepoint' ) . ' ' . $service->price_min_formatted : $service->price_min_formatted; |
| 178 | $output .= '<div class="ri-price">' . $service_price_formatted . '</div>'; |
| 179 | } |
| 180 | if ($atts['hide_description'] !== 'yes' && ! empty( $service->short_description)) { |
| 181 | $output .= '<div class="ri-description">' . wp_kses_post($service->short_description) . '</div>'; |
| 182 | } |
| 183 | $output .= '<div class="ri-buttons ' . esc_attr($btn_wrapper_classes) . '"> |
| 184 | <a href="#" ' . $data_atts . ' class="latepoint-book-button os_trigger_booking ' . esc_attr($btn_classes) . '" data-selected-service="' . esc_attr($service->id) . '">' . wp_kses_post($atts['button_caption']) . '</a> |
| 185 | </div>'; |
| 186 | $output .= '</div>'; |
| 187 | } |
| 188 | break; |
| 189 | case 'agents': |
| 190 | $agents = new OsAgentModel(); |
| 191 | if ( $atts['limit'] && is_numeric( $atts['limit'] ) ) { |
| 192 | $agents->set_limit( $atts['limit'] ); |
| 193 | } |
| 194 | if ( $atts['item_ids'] ) { |
| 195 | $ids = OsUtilHelper::explode_and_trim( $atts['item_ids'] ); |
| 196 | $ids = OsUtilHelper::clean_numeric_ids( $ids ); |
| 197 | if ( $ids ) { |
| 198 | $agents->where( [ 'id' => $ids ] ); |
| 199 | } |
| 200 | } |
| 201 | if ( $clean_item_ids ) { |
| 202 | $agents->where( [ 'id' => $clean_item_ids ] ); |
| 203 | } |
| 204 | $agents = $agents->should_be_active()->get_results_as_models(); |
| 205 | foreach ( $agents as $agent ) { |
| 206 | $output .= '<div class="resource-item '. esc_attr($resource_item_classes) .' ri-centered">'; |
| 207 | $output .= ! empty( $agent->avatar_image_id ) ? '<div class="ri-avatar" style="background-image: url(' . $agent->get_avatar_url() . ')"></div>' : ''; |
| 208 | $output .= '<div class="ri-name"><h3>' . esc_html($agent->full_name) . '</h3></div>'; |
| 209 | $output .= ! empty( $agent->title ) ? '<div class="ri-title">' . esc_html($agent->title) . '</div>' : ''; |
| 210 | $output .= ! empty( $agent->short_description ) ? '<div class="ri-description">' . wp_kses_post($agent->short_description) . '</div>' : ''; |
| 211 | $output .= '<div class="ri-buttons ' . esc_attr($btn_wrapper_classes) . '"> |
| 212 | <a href="#" ' . $data_atts . ' class="latepoint-book-button os_trigger_booking latepoint-btn-block ' . esc_attr($btn_classes) . '" data-selected-agent="' . esc_attr($agent->id) . '">' . wp_kses_post($atts['button_caption']) . '</a> |
| 213 | </div>'; |
| 214 | $output .= '</div>'; |
| 215 | } |
| 216 | break; |
| 217 | case 'locations': |
| 218 | $locations = new OsLocationModel(); |
| 219 | if ( $atts['limit'] && is_numeric( $atts['limit'] ) ) { |
| 220 | $locations->set_limit( $atts['limit'] ); |
| 221 | } |
| 222 | if ( $clean_item_ids ) { |
| 223 | $locations->where( [ 'id' => $clean_item_ids ] ); |
| 224 | } |
| 225 | if ( $clean_group_ids ) { |
| 226 | $locations->where( [ 'category_id' => $clean_group_ids ] ); |
| 227 | } |
| 228 | $locations = $locations->should_be_active()->order_by( 'order_number asc' )->get_results_as_models(); |
| 229 | foreach ( $locations as $location ) { |
| 230 | $output .= '<div class="resource-item '. esc_attr($resource_item_classes) .'">'; |
| 231 | $output .= ! empty( $location->full_address ) ? '<div class="ri-map">' . $location->get_google_maps_iframe( 200 ) . '</div>' : ''; |
| 232 | $output .= '<div class="ri-name"><h3>' . esc_html($location->name) . '</h3></div>'; |
| 233 | $output .= ! empty( $location->full_address ) ? '<div class="ri-description">' . $location->full_address . '<a href="' . $location->get_google_maps_link() . '" target="_blank" class="ri-external-link"><i class="latepoint-icon latepoint-icon-external-link"></i></a></div>' : ''; |
| 234 | $output .= '<div class="ri-buttons ' . $btn_wrapper_classes . '"> |
| 235 | <a href="#" ' . $data_atts . ' class="latepoint-book-button os_trigger_booking ' . esc_attr($btn_classes) . '" data-selected-location="' . esc_attr($location->id) . '">' . wp_kses_post($atts['button_caption']) . '</a> |
| 236 | </div>'; |
| 237 | $output .= '</div>'; |
| 238 | } |
| 239 | break; |
| 240 | case 'bundles': |
| 241 | $bundles = new OsBundleModel(); |
| 242 | |
| 243 | if ( $clean_item_ids ) { |
| 244 | $bundles->where( [ 'id' => $clean_item_ids ] ); |
| 245 | } |
| 246 | |
| 247 | if ( $atts['limit'] && is_numeric( $atts['limit'] ) ) { |
| 248 | $bundles->set_limit( $atts['limit'] ); |
| 249 | } |
| 250 | |
| 251 | $bundles = $bundles->should_be_active()->should_not_be_hidden()->order_by( 'order_number asc' )->get_results_as_models(); |
| 252 | $bundles = is_array($bundles) ? $bundles : [$bundles]; |
| 253 | |
| 254 | ob_start(); |
| 255 | foreach ( $bundles as $bundle ) { |
| 256 | ?> |
| 257 | <div class="resource-item <?php echo esc_attr($resource_item_classes); ?>"> |
| 258 | <div class="ri-name"> |
| 259 | <h3><?php echo esc_html($bundle->name); ?></h3> |
| 260 | </div> |
| 261 | <?php if ($atts['hide_price'] !== 'yes' && $price = $bundle->get_formatted_charge_amount()) { ?> |
| 262 | <div class="ri-price"><?php echo $price; ?></div> |
| 263 | <?php } ?> |
| 264 | |
| 265 | <?php if ($atts['hide_description'] !== 'yes' && $description = $bundle->short_description ) { ?> |
| 266 | <div class="ri-description"><?php echo $description; ?></div> |
| 267 | <?php } ?> |
| 268 | <div class="ri-buttons <?php echo esc_attr($btn_wrapper_classes) ?>"> |
| 269 | <a href="#" <?php echo $data_atts ?> |
| 270 | class="latepoint-book-button os_trigger_booking latepoint-btn-block <?php echo esc_attr($btn_classes); ?>" |
| 271 | data-selected-bundle="<?php echo $bundle->id; ?>" > |
| 272 | <?php echo $atts['button_caption']; ?> |
| 273 | </a> |
| 274 | </div> |
| 275 | </div> |
| 276 | <?php } |
| 277 | |
| 278 | $output .= ob_get_clean(); |
| 279 | break; |
| 280 | } |
| 281 | $output .= '</div>'; |
| 282 | |
| 283 | return $output; |
| 284 | } |
| 285 | |
| 286 | // [latepoint_book_form] |
| 287 | public static function shortcode_latepoint_book_form( $atts, $content = "" ) { |
| 288 | |
| 289 | $atts = shortcode_atts( self::get_default_booking_atts(), $atts ); |
| 290 | $element_classes = ['latepoint-inline-form']; |
| 291 | $element_classes[] = (empty($atts['hide_side_panel']) || $atts['hide_side_panel'] == 'no') ? 'latepoint-show-side-panel' : 'latepoint-hide-side-panel'; |
| 292 | $output = '<div class="latepoint-book-form-wrapper os-loading os_init_booking_form" id="latepointBookForm_'.esc_attr(uniqid()).'" ' . self::generate_data_atts_string_from_atts($atts) . '> |
| 293 | <div class="latepoint-w '.esc_attr(implode(' ', $element_classes)).'"> |
| 294 | <div class="latepoint-booking-form-element"> |
| 295 | <div class="latepoint-side-panel"></div> |
| 296 | <div class="latepoint-form-w"></div> |
| 297 | </div> |
| 298 | </div> |
| 299 | </div>'; |
| 300 | |
| 301 | return $output; |
| 302 | } |
| 303 | |
| 304 | |
| 305 | // [latepoint_book_button] |
| 306 | public static function shortcode_latepoint_book_button( $atts, $content = "" ) { |
| 307 | $atts = shortcode_atts( array_merge( self::get_default_booking_atts(), [ |
| 308 | 'id' => false, |
| 309 | 'caption' => __( 'Book Appointment', 'latepoint' ), |
| 310 | 'is_inherit' => false, |
| 311 | 'align' => false, |
| 312 | 'bg_color' => false, |
| 313 | 'text_color' => false, |
| 314 | 'font_size' => false, |
| 315 | 'border' => false, |
| 316 | 'border_radius' => false, |
| 317 | 'margin' => false, |
| 318 | 'padding' => false, |
| 319 | 'css' => false, |
| 320 | 'classname' => false, |
| 321 | 'btn_classes' => false, |
| 322 | 'btn_wrapper_classes' => false |
| 323 | ] ), $atts ); |
| 324 | |
| 325 | $btn_wrapper_classes = []; |
| 326 | $btn_wrapper_classes[] = $atts['btn_wrapper_classes'] ?: "wp-block-button"; |
| 327 | if($atts['align']) $btn_wrapper_classes[] = "latepoint-book-button-align-{$atts['align']}"; |
| 328 | if($atts['classname']) $btn_wrapper_classes[] = $atts['classname']; |
| 329 | |
| 330 | $btn_classes = []; |
| 331 | $btn_classes[] = $atts['btn_classes'] ?: "wp-block-button__link"; |
| 332 | if($atts['id']) $btn_classes[] = 'latepoint-book-button-' . $atts['id']; |
| 333 | |
| 334 | $data_atts = self::generate_data_atts_string_from_atts($atts); |
| 335 | |
| 336 | $styles = []; |
| 337 | # if not inherit - show button styles |
| 338 | if (!$atts['is_inherit']) { |
| 339 | if ($atts['bg_color']) $styles[] = "background-color: " . esc_attr($atts['bg_color']); |
| 340 | if ($atts['text_color']) $styles[] = "color: " . esc_attr($atts['text_color']); |
| 341 | if ($atts['font_size']) $styles[] = "font-size: " . esc_attr($atts['font_size']); |
| 342 | if ($atts['border']) $styles[] = "border: " . esc_attr($atts['border']); |
| 343 | if ($atts['border_radius']) $styles[] = "border-radius: " . esc_attr($atts['border_radius']); |
| 344 | if ($atts['margin']) $styles[] = "margin: " . esc_attr($atts['margin']); |
| 345 | if ($atts['padding']) $styles[] = "padding: " . esc_attr($atts['padding']); |
| 346 | if ($atts['css']) $styles[] = $atts['css']; |
| 347 | } |
| 348 | $style_attr = !empty($styles) ? ' style="' . esc_attr(implode('; ', $styles)) . '"' : ''; |
| 349 | |
| 350 | $before_html = '<div class="latepoint-book-button-wrapper ' . esc_attr(implode(' ', $btn_wrapper_classes)) . '">'; |
| 351 | $after_html = '</div>'; |
| 352 | |
| 353 | return $before_html . '<a href="#" class="latepoint-book-button os_trigger_booking ' . |
| 354 | esc_attr(implode(' ', $btn_classes)) . '"' . $style_attr . ' ' . $data_atts . '>' . |
| 355 | esc_html($atts['caption']) . '</a>' . $after_html; |
| 356 | } |
| 357 | |
| 358 | // [latepoint_customer_dashboard] |
| 359 | public static function shortcode_latepoint_customer_dashboard( $atts ) { |
| 360 | $atts = shortcode_atts( array( |
| 361 | 'caption' => __( 'Book Appointment', 'latepoint' ), |
| 362 | 'hide_new_appointment_ui' => false, |
| 363 | ), $atts ); |
| 364 | $atts['hide_new_appointment_ui'] = $atts['hide_new_appointment_ui'] == 'yes' ?? false; |
| 365 | |
| 366 | $customerCabinetController = new OsCustomerCabinetController(); |
| 367 | $output = $customerCabinetController->dashboard($atts); |
| 368 | |
| 369 | return $output; |
| 370 | } |
| 371 | |
| 372 | // [latepoint_customer_login] |
| 373 | public static function shortcode_latepoint_customer_login( $atts ) { |
| 374 | $atts = shortcode_atts( array( |
| 375 | 'caption' => __( 'Book Appointment', 'latepoint' ) |
| 376 | ), $atts ); |
| 377 | |
| 378 | $customerCabinetController = new OsCustomerCabinetController(); |
| 379 | $output = $customerCabinetController->login(); |
| 380 | |
| 381 | return $output; |
| 382 | } |
| 383 | |
| 384 | /** |
| 385 | * List of default booking attributes for booking button and form shortcodes |
| 386 | * |
| 387 | * @return false[] |
| 388 | */ |
| 389 | private static function get_default_booking_atts() : array { |
| 390 | return [ |
| 391 | 'show_locations' => false, |
| 392 | 'show_agents' => false, |
| 393 | 'show_services' => false, |
| 394 | 'show_service_categories' => false, |
| 395 | 'selected_location' => false, |
| 396 | 'selected_agent' => false, |
| 397 | 'selected_service' => false, |
| 398 | 'selected_duration' => false, |
| 399 | 'selected_total_attendees' => false, |
| 400 | 'selected_service_category' => false, |
| 401 | 'selected_bundle' => false, |
| 402 | 'calendar_start_date' => false, |
| 403 | 'selected_start_date' => false, |
| 404 | 'selected_start_time' => false, |
| 405 | 'hide_side_panel' => false, |
| 406 | 'hide_summary' => false, |
| 407 | 'source_id' => false |
| 408 | ]; |
| 409 | } |
| 410 | |
| 411 | private static function generate_data_atts_string_from_atts( array $atts) : string { |
| 412 | $data_atts = ''; |
| 413 | $defaults = self::get_default_booking_atts(); |
| 414 | foreach($defaults as $key => $value) { |
| 415 | if(!empty($atts[$key])) $data_atts.= 'data-'.esc_html(str_replace('_', '-', $key)).'="'.esc_attr($atts[$key]).'" '; |
| 416 | } |
| 417 | return $data_atts; |
| 418 | } |
| 419 | |
| 420 | } |