| 1 |
<?php |
| 2 |
defined( 'ABSPATH' ) || exit; |
| 3 |
|
| 4 |
/** |
| 5 |
* @var string $title |
| 6 |
* @var string $body |
| 7 |
* @var string $description |
| 8 |
* @var array $author |
| 9 |
* @var string $url |
| 10 |
* @var bool $embedded |
| 11 |
* @var string $theme |
| 12 |
* @var array $back_button |
| 13 |
* @var array $css_files |
| 14 |
* @var array $js_files |
| 15 |
* @var array $js_vars |
| 16 |
*/ |
| 17 |
?> |
| 18 |
|
| 19 |
<!DOCTYPE html> |
| 20 |
<html <?php language_attributes(); ?>> |
| 21 |
<head> |
| 22 |
<title><?php echo esc_attr($title); ?></title> |
| 23 |
<meta charset='utf-8'> |
| 24 |
|
| 25 |
<meta content='width=device-width, initial-scale=1' name='viewport'> |
| 26 |
<meta content='yes' name='apple-mobile-web-app-capable'> |
| 27 |
<meta name="description" content="<?php echo esc_attr($description); ?>"> |
| 28 |
<meta name="robots" content="noindex"> |
| 29 |
|
| 30 |
<link rel="icon" type="image/x-icon" href="<?php echo esc_url($author['avatar']); ?>" /> |
| 31 |
|
| 32 |
<meta property="og:title" content="<?php echo esc_attr($title); ?>"> |
| 33 |
<meta property="og:type" content="website"> |
| 34 |
<meta property="og:url" content="<?php echo esc_url($url); ?>"> |
| 35 |
<meta property="og:description" content="<?php echo esc_attr($description); ?>"> |
| 36 |
<meta property="og:author" content="<?php echo esc_attr($author['name']); ?>"> |
| 37 |
|
| 38 |
<?php foreach ($css_files as $fluentBookingCssFile): ?> |
| 39 |
<?php // phpcs:ignore WordPress.WP.EnqueuedResources.NonEnqueuedStylesheet ?> |
| 40 |
<link rel="stylesheet" href="<?php echo esc_url($fluentBookingCssFile); ?>?version=<?php echo esc_attr(FLUENT_BOOKING_ASSETS_VERSION); ?>" media="all" /> |
| 41 |
<?php endforeach; ?> |
| 42 |
</head> |
| 43 |
<body class="booking-confirmation-page"> |
| 44 |
|
| 45 |
<div class="confirmation_page <?php echo esc_attr($embedded ? 'fcal_booking_iframe' : ''); ?>"> |
| 46 |
<div class="fcal_conf_wrap"> |
| 47 |
<?php echo $body; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?> |
| 48 |
</div> |
| 49 |
<?php if (!empty($back_button['show'])): ?> |
| 50 |
<div class="fcal_back_btn"> |
| 51 |
<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-chevron-left h-5 w-5 rtl:rotate-180"> |
| 52 |
<path d="m15 18-6-6 6-6"></path> |
| 53 |
</svg> |
| 54 |
<a href="<?php echo esc_url($back_button['url']); ?>"><?php echo esc_html($back_button['text']); ?></a> |
| 55 |
</div> |
| 56 |
<?php endif; ?> |
| 57 |
</div> |
| 58 |
|
| 59 |
<script> |
| 60 |
<?php foreach ($js_vars as $fluentBookingVarKey => $fluentBookingValues): ?> |
| 61 |
var <?php echo esc_attr($fluentBookingVarKey); ?> = <?php echo wp_json_encode($fluentBookingValues); ?>; |
| 62 |
<?php endforeach; ?> |
| 63 |
</script> |
| 64 |
|
| 65 |
<?php foreach ($js_files as $fluentBookingFileKey => $fluentBookingFile): ?> |
| 66 |
<script id="<?php echo esc_attr($fluentBookingFileKey); ?>"<?php echo \FluentBooking\App\Vite::isDev() ? ' type="module"' : ''; ?> src="<?php echo esc_url($fluentBookingFile); ?>" defer="defer"></script> |
| 67 |
<?php endforeach; ?> |
| 68 |
|
| 69 |
<script> |
| 70 |
const theme = '<?php echo esc_attr($theme); ?>'; |
| 71 |
|
| 72 |
const confirmationPage = document.querySelector('.confirmation_page'); |
| 73 |
function applyModeClasses(element, darkMode) { |
| 74 |
const darkClass = 'fcal-dark-mode'; |
| 75 |
const lightClass = 'fcal-light-mode'; |
| 76 |
|
| 77 |
if (element) { |
| 78 |
if (darkMode) { |
| 79 |
element.classList.add(darkClass); |
| 80 |
element.classList.remove(lightClass); |
| 81 |
} else { |
| 82 |
element.classList.add(lightClass); |
| 83 |
element.classList.remove(darkClass); |
| 84 |
} |
| 85 |
} |
| 86 |
} |
| 87 |
|
| 88 |
if (confirmationPage) { |
| 89 |
if (theme === 'system-default') { |
| 90 |
const runColorMode = (fn) => { |
| 91 |
if (!window.matchMedia) { |
| 92 |
return; |
| 93 |
} |
| 94 |
const query = window.matchMedia('(prefers-color-scheme: dark)'); |
| 95 |
fn(query.matches); |
| 96 |
query.addEventListener('change', (event) => fn(event.matches)); |
| 97 |
}; |
| 98 |
|
| 99 |
runColorMode((isDarkMode) => { |
| 100 |
applyModeClasses(confirmationPage, isDarkMode); |
| 101 |
}); |
| 102 |
} else if (theme === 'dark-mode') { |
| 103 |
applyModeClasses(confirmationPage, true); |
| 104 |
} else { |
| 105 |
applyModeClasses(confirmationPage, false); |
| 106 |
} |
| 107 |
} |
| 108 |
|
| 109 |
</script> |
| 110 |
</body> |
| 111 |
</html> |
| 112 |
|