| @@ -1,45 +1,8 @@ | ||
| 1 | 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')) { | |
| 2 | +if (!defined('ABSPATH') && !defined('BITFORMS_ASSET_URI')) { | |
| 8 | 3 | exit; |
| 9 | 4 | } |
| 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 | 5 | ?> |
| 43 | 6 | |
| 44 | 7 | <!DOCTYPE html> |
| 45 | 8 | <html lang="en"> |
| @@ -62,31 +25,46 @@ | ||
| 62 | 25 | flex-direction: column; |
| 63 | 26 | /* background-color: #f1f1f1; */ |
| 64 | 27 | } |
| 65 | 28 | |
| 66 | - ._frm-bg-b<?php echo esc_html($formID); ?> { | |
| 29 | + ._frm-bg-b<?php echo esc_html($formID) ?> { | |
| 67 | 30 | width: 600px; |
| 68 | 31 | margin-block: 100px; |
| 69 | 32 | } |
| 70 | 33 | </style> |
| 71 | - <?php if (isset($font) && '' !== $font) : ?> | |
| 34 | + <?php | |
| 35 | + $formUpdateVersion = get_option('bit-form_form_update_version'); | |
| 36 | +$bitformCssUrl = BITFORMS_UPLOAD_BASE_URL . '/form-styles/bitform-' . $formID . '.css?bfv=' . $formUpdateVersion; | |
| 37 | +?> | |
| 38 | + <link rel="stylesheet" href="<?php echo esc_url($bitformCssUrl) ?>" /> | |
| 39 | + <?php | |
| 40 | +$customCssSubPath = "/form-styles/bitform-custom-{$formID}.css"; | |
| 41 | + | |
| 42 | +$customJsPath = BITFORMS_UPLOAD_BASE_URL . $customCssSubPath . '?ver=' . $formUpdateVersion; | |
| 43 | +?> | |
| 44 | + <?php if(file_exists(BITFORMS_CONTENT_DIR . $customCssSubPath)) : ?> | |
| 45 | + <link rel="stylesheet" href="<?php echo esc_url($customJsPath) ?>" /> | |
| 46 | + <?php endif; ?> | |
| 47 | + | |
| 48 | + <?php if (isset($font) && '' !== $font): ?> | |
| 72 | 49 | <link rel="preconnect" href="https://fonts.googleapis.com"> |
| 73 | 50 | <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin> |
| 51 | + <link rel="stylesheet" href="<?php echo esc_url($font)?>" /> | |
| 74 | 52 | <?php endif; ?> |
| 75 | - <?php | |
| 76 | - wp_enqueue_emoji_styles(); | |
| 77 | - wp_print_styles(); | |
| 78 | - ?> | |
| 53 | + | |
| 79 | 54 | </head> |
| 80 | 55 | |
| 81 | 56 | <body> |
| 57 | + <?php echo $formHTML ?> | |
| 58 | + | |
| 59 | + <script> | |
| 60 | + <?php echo $bfGlobals?>; | |
| 61 | + | |
| 82 | 62 | <?php |
| 83 | - // Fallback config for when an optimizer defers or drops the inline script. | |
| 84 | - // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- built by buildFormConfigTag(), JSON_HEX_* escaped. | |
| 85 | - echo isset($configTag) ? $configTag : ''; | |
| 86 | - ?> | |
| 87 | - <?php echo wp_kses($formHTML, EscapingHelper::getFormAllowedHtml(isset($formContent) ? $formContent : null)); ?> | |
| 63 | + $previewJsPath = BITFORMS_UPLOAD_BASE_URL . '/form-scripts/preview-' . $formID . '.js'; | |
| 64 | +?> | |
| 65 | + </script> | |
| 66 | + <script src="<?php echo esc_url($previewJsPath) ?>"></script> | |
| 88 | 67 | |
| 89 | - <?php wp_print_scripts(); ?> | |
| 90 | 68 | </body> |
| 91 | 69 | |
| 92 | -</html> | |
| 70 | +</html> | |