| 1 |
<?php |
| 2 |
|
| 3 |
// This file is included via Render::view() using extract(); all variables below are in the calling method's local scope, not global namespace. |
| 4 |
|
| 5 |
use BitCode\BitForm\Core\Util\EscapingHelper; |
| 6 |
|
| 7 |
if (!defined('ABSPATH')) { |
| 8 |
exit; |
| 9 |
} |
| 10 |
if (!defined('BITFORMS_ASSET_URI')) { |
| 11 |
exit; |
| 12 |
} |
| 13 |
|
| 14 |
$formUpdateVersion = get_option('bitform_form_update_version'); |
| 15 |
$formIdSafe = sanitize_key((string) $formID); |
| 16 |
|
| 17 |
$baseCSSPath = "/form-styles/bitform-{$formID}.css"; |
| 18 |
$customCSSPath = "/form-styles/bitform-custom-{$formID}.css"; |
| 19 |
$standaloneCSSPath = "/form-styles/bitform-standalone-{$formID}.css"; |
| 20 |
|
| 21 |
// Use the same handles as FrontendFormHandler::loadAssets() so WP dedups instead of printing the file twice. |
| 22 |
wp_register_style('bitform-style-' . $formIdSafe, BITFORMS_UPLOAD_BASE_URL . $baseCSSPath, [], $formUpdateVersion); |
| 23 |
wp_enqueue_style('bitform-style-' . $formIdSafe); |
| 24 |
|
| 25 |
if (file_exists(BITFORMS_CONTENT_DIR . $customCSSPath)) { |
| 26 |
wp_register_style('bitform-style-custom-' . $formIdSafe, BITFORMS_UPLOAD_BASE_URL . $customCSSPath, [], $formUpdateVersion); |
| 27 |
wp_enqueue_style('bitform-style-custom-' . $formIdSafe); |
| 28 |
} |
| 29 |
|
| 30 |
if (file_exists(BITFORMS_CONTENT_DIR . $standaloneCSSPath)) { |
| 31 |
wp_register_style('bitform-standalone-extra-' . $formIdSafe, BITFORMS_UPLOAD_BASE_URL . $standaloneCSSPath, [], $formUpdateVersion); |
| 32 |
wp_enqueue_style('bitform-standalone-extra-' . $formIdSafe); |
| 33 |
} |
| 34 |
|
| 35 |
if (isset($font) && '' !== $font) { |
| 36 |
wp_register_style('bitform-standalone-font-' . $formIdSafe, $font, [], $formUpdateVersion); |
| 37 |
wp_enqueue_style('bitform-standalone-font-' . $formIdSafe); |
| 38 |
} |
| 39 |
|
| 40 |
$previewJsPath = BITFORMS_UPLOAD_BASE_URL . '/form-scripts/preview-' . $formID . '.js'; |
| 41 |
wp_register_script('bitform-standalone-' . $formIdSafe, $previewJsPath, [], $formUpdateVersion, true); |
| 42 |
wp_enqueue_script('bitform-standalone-' . $formIdSafe); |
| 43 |
if (isset($bfGlobals) && '' !== $bfGlobals) { |
| 44 |
wp_add_inline_script('bitform-standalone-' . $formIdSafe, (string) $bfGlobals, 'before'); |
| 45 |
} |
| 46 |
?> |
| 47 |
|
| 48 |
<!DOCTYPE html> |
| 49 |
<html lang="en"> |
| 50 |
|
| 51 |
<head> |
| 52 |
<meta charset="UTF-8"> |
| 53 |
<meta http-equiv="X-UA-Compatible" content="IE=edge"> |
| 54 |
<meta name="viewport" content="width=device-width, initial-scale=1.0"> |
| 55 |
<title><?php echo isset($title) ? esc_html($title) : ''; ?></title> |
| 56 |
<style> |
| 57 |
* { |
| 58 |
padding: 0; |
| 59 |
margin: 0; |
| 60 |
box-sizing: border-box; |
| 61 |
} |
| 62 |
|
| 63 |
.standalone-form-container { |
| 64 |
min-height: 100vh; |
| 65 |
display: flex; |
| 66 |
justify-content: center; |
| 67 |
align-items: center; |
| 68 |
} |
| 69 |
|
| 70 |
.standalone-form-wrapper { |
| 71 |
width: 40%; |
| 72 |
/* Additional styling for the container, if needed */ |
| 73 |
} |
| 74 |
|
| 75 |
@media (max-width: 575.98px) { |
| 76 |
.standalone-form-wrapper { |
| 77 |
width: 100%; |
| 78 |
} |
| 79 |
} |
| 80 |
|
| 81 |
._frm-bg-b<?php echo esc_html($formID); ?> { |
| 82 |
width: 100%; |
| 83 |
} |
| 84 |
</style> |
| 85 |
<?php if (isset($font) && '' !== $font) : ?> |
| 86 |
<link rel="preconnect" href="https://fonts.googleapis.com"> |
| 87 |
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin> |
| 88 |
<?php endif; ?> |
| 89 |
<?php |
| 90 |
wp_enqueue_emoji_styles(); |
| 91 |
wp_print_styles(); |
| 92 |
?> |
| 93 |
</head> |
| 94 |
|
| 95 |
<body> |
| 96 |
<div class="standalone-form-container"> |
| 97 |
<div class="standalone-form-wrapper"> |
| 98 |
<?php echo wp_kses($formHTML, EscapingHelper::getFormAllowedHtml(isset($formContent) ? $formContent : null)); ?> |
| 99 |
</div> |
| 100 |
</div> |
| 101 |
|
| 102 |
<?php wp_print_scripts(); ?> |
| 103 |
</body> |
| 104 |
|
| 105 |
</html> |
| 106 |
|