| 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 |
$bitformCssUrl = BITFORMS_UPLOAD_BASE_URL . '/form-styles/bitform-' . $formID . '.css'; |
| 18 |
$bitformFormIdCssUrl = BITFORMS_UPLOAD_BASE_URL . '/form-styles/bitform-' . $formID . '-formid.css'; |
| 19 |
$customCssSubPath = "/form-styles/bitform-custom-{$formID}.css"; |
| 20 |
|
| 21 |
wp_register_style('bitform-entry-edit-base-' . $formIdSafe, $bitformCssUrl, [], $formUpdateVersion); |
| 22 |
wp_register_style('bitform-entry-edit-formid-' . $formIdSafe, $bitformFormIdCssUrl, [], $formUpdateVersion); |
| 23 |
wp_enqueue_style('bitform-entry-edit-base-' . $formIdSafe); |
| 24 |
wp_enqueue_style('bitform-entry-edit-formid-' . $formIdSafe); |
| 25 |
|
| 26 |
if (file_exists(BITFORMS_CONTENT_DIR . $customCssSubPath)) { |
| 27 |
wp_register_style('bitform-entry-edit-custom-' . $formIdSafe, BITFORMS_UPLOAD_BASE_URL . $customCssSubPath, [], $formUpdateVersion); |
| 28 |
wp_enqueue_style('bitform-entry-edit-custom-' . $formIdSafe); |
| 29 |
} |
| 30 |
|
| 31 |
if (isset($font) && '' !== $font) { |
| 32 |
wp_register_style('bitform-entry-edit-font-' . $formIdSafe, $font, [], $formUpdateVersion); |
| 33 |
wp_enqueue_style('bitform-entry-edit-font-' . $formIdSafe); |
| 34 |
} |
| 35 |
|
| 36 |
$previewJsPath = BITFORMS_UPLOAD_BASE_URL . '/form-scripts/preview-' . $formID . '.js'; |
| 37 |
wp_register_script('bitform-entry-edit-' . $formIdSafe, $previewJsPath, [], $formUpdateVersion, true); |
| 38 |
wp_enqueue_script('bitform-entry-edit-' . $formIdSafe); |
| 39 |
if (isset($bfGlobals) && '' !== $bfGlobals) { |
| 40 |
wp_add_inline_script('bitform-entry-edit-' . $formIdSafe, (string) $bfGlobals, 'before'); |
| 41 |
} |
| 42 |
?> |
| 43 |
|
| 44 |
<!DOCTYPE html> |
| 45 |
<html lang="en"> |
| 46 |
|
| 47 |
<head> |
| 48 |
<meta charset="UTF-8"> |
| 49 |
<meta http-equiv="X-UA-Compatible" content="IE=edge"> |
| 50 |
<meta name="viewport" content="width=device-width, initial-scale=1.0"> |
| 51 |
<title><?php echo isset($title) ? esc_html($title) : ''; ?></title> |
| 52 |
<style> |
| 53 |
html, |
| 54 |
body { |
| 55 |
min-height: 100%; |
| 56 |
} |
| 57 |
|
| 58 |
body { |
| 59 |
display: flex; |
| 60 |
justify-content: center; |
| 61 |
align-items: center; |
| 62 |
flex-direction: column; |
| 63 |
/* background-color: #f1f1f1; */ |
| 64 |
} |
| 65 |
|
| 66 |
._frm-bg-b<?php echo esc_html($formID); ?> { |
| 67 |
width: 600px; |
| 68 |
margin-block: 100px; |
| 69 |
} |
| 70 |
</style> |
| 71 |
<?php if (isset($font) && '' !== $font) : ?> |
| 72 |
<link rel="preconnect" href="https://fonts.googleapis.com"> |
| 73 |
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin> |
| 74 |
<?php endif; ?> |
| 75 |
<?php |
| 76 |
wp_enqueue_emoji_styles(); |
| 77 |
wp_print_styles(); |
| 78 |
?> |
| 79 |
</head> |
| 80 |
|
| 81 |
<body> |
| 82 |
<?php echo wp_kses($formHTML, EscapingHelper::getFormAllowedHtml(isset($formContent) ? $formContent : null)); ?> |
| 83 |
|
| 84 |
<?php wp_print_scripts(); ?> |
| 85 |
</body> |
| 86 |
|
| 87 |
</html> |
| 88 |
|