'; $html .= '
' . $stage_html . '
'; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped $html .= ''; $html .= ''; return (string) apply_filters( 'wpbc_booking_resource_selector_shortcode_html', $html, $config, $result ); } add_shortcode( 'booking_resource_selector', 'wpbc_booking_resource_selector_shortcode' ); /** * Enqueue the Booking Resource selector controller on public pages. * * @param string $where_to_load Booking Calendar asset context. * * @return void */ function wpbc_booking_resource_selector_enqueue_js( $where_to_load ) { if ( ! in_array( $where_to_load, array( 'client', 'both' ), true ) ) { return; } $base_url = trailingslashit( plugins_url( '', __FILE__ ) ); wp_enqueue_script( 'wpbc-booking-resource-selector', $base_url . '_out/booking-resource-selector.js', array( 'jquery', 'wpbc_capacity' ), WP_BK_VERSION_NUM, array( 'in_footer' => WPBC_JS_IN_FOOTER ) ); wp_localize_script( 'wpbc-booking-resource-selector', 'wpbc_booking_resource_selector_config', array( 'ajax_url' => admin_url( 'admin-ajax.php' ), 'action' => 'WPBC_AJX_BOOKING_RESOURCE_SELECTOR_RESOLVE', 'nonce' => wp_create_nonce( 'wpbc_booking_resource_selector_ajax' ), 'error' => __( 'The booking form could not be loaded. Please try again.', 'booking' ), 'initialization_error' => __( 'The booking form could not be initialized. Please start over and try again.', 'booking' ), 'duplicate_resource' => __( 'This Booking Resource already has an open booking form on this page. Complete or restart that booking before opening another form for the same resource.', 'booking' ), ) ); } add_action( 'wpbc_enqueue_js_files', 'wpbc_booking_resource_selector_enqueue_js', 73 ); /** * Enqueue Booking Resource selector styling on public pages. * * @param string $where_to_load Booking Calendar asset context. * * @return void */ function wpbc_booking_resource_selector_enqueue_css( $where_to_load ) { if ( ! in_array( $where_to_load, array( 'client', 'both' ), true ) ) { return; } wp_enqueue_style( 'wpbc-booking-resource-selector', trailingslashit( plugins_url( '', __FILE__ ) ) . '_out/booking-resource-selector.css', array( 'wpbc-all-client' ), WP_BK_VERSION_NUM ); $theme_css = wpbc_booking_resource_selector_build_theme_css(); if ( '' !== $theme_css && class_exists( 'WPBC_FE_Assets' ) ) { WPBC_FE_Assets::add_inline_css_to_wp_style( 'wpbc-booking-resource-selector', $theme_css, 'booking-resource-selector-theme' ); } } add_action( 'wpbc_enqueue_css_files', 'wpbc_booking_resource_selector_enqueue_css', 73 );