| @@ -2,8 +2,9 @@ | ||
| 2 | 2 | |
| 3 | 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 | 4 | |
| 5 | 5 | use BitCode\BitForm\Core\Util\EscapingHelper; |
| 6 | +use BitCode\BitForm\Core\Util\FrontendHelpers; | |
| 6 | 7 | |
| 7 | 8 | if (!defined('ABSPATH')) { |
| 8 | 9 | exit; |
| 9 | 10 | } |
| @@ -20,10 +21,10 @@ | ||
| 20 | 21 | |
| 21 | 22 | $formUpdateVersion = get_option('bitform_form_update_version'); |
| 22 | 23 | $formIdSafe = sanitize_key((string) $formID); |
| 23 | 24 | |
| 24 | -$cssFileUrl = BITFORMS_UPLOAD_BASE_URL . '/form-styles/bitform-' . $formID . '.css'; | |
| 25 | -$cssFileUrlFormId = BITFORMS_UPLOAD_BASE_URL . '/form-styles/bitform-' . $formID . '-formid.css'; | |
| 25 | +$cssFileUrl = FrontendHelpers::styleSrc('form-styles/bitform-' . $formID . '.css'); | |
| 26 | +$cssFileUrlFormId = FrontendHelpers::styleSrc('form-styles/bitform-' . $formID . '-formid.css'); | |
| 26 | 27 | $customCssSubPath = '/form-styles/bitform-custom-' . $formID . '.css'; |
| 27 | 28 | |
| 28 | 29 | wp_register_style('bitform-preview-base-' . $formIdSafe, $cssFileUrl, [], $formUpdateVersion); |
| 29 | 30 | wp_register_style('bitform-preview-formid-' . $formIdSafe, $cssFileUrlFormId, [], $formUpdateVersion); |
| @@ -31,9 +32,9 @@ | ||
| 31 | 32 | wp_enqueue_style('bitform-preview-formid-' . $formIdSafe); |
| 32 | 33 | |
| 33 | 34 | $customCssRegistered = false; |
| 34 | 35 | if (file_exists(BITFORMS_CONTENT_DIR . $customCssSubPath)) { |
| 35 | - wp_register_style('bitform-preview-custom-' . $formIdSafe, BITFORMS_UPLOAD_BASE_URL . $customCssSubPath, [], $formUpdateVersion); | |
| 36 | + wp_register_style('bitform-preview-custom-' . $formIdSafe, FrontendHelpers::styleSrc($customCssSubPath), [], $formUpdateVersion); | |
| 36 | 37 | wp_enqueue_style('bitform-preview-custom-' . $formIdSafe); |
| 37 | 38 | $customCssRegistered = true; |
| 38 | 39 | } |
| 39 | 40 | |
| @@ -533,8 +534,13 @@ | ||
| 533 | 534 | |
| 534 | 535 | <!-- Preview Container --> |
| 535 | 536 | <main class="bf-preview-container"> |
| 536 | 537 | <div class="bf-preview-frame" id="bf-preview-frame"> |
| 538 | + <?php | |
| 539 | + // Fallback config for when an optimizer defers or drops the inline script. | |
| 540 | + // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- built by buildFormConfigTag(), JSON_HEX_* escaped. | |
| 541 | + echo isset($configTag) ? $configTag : ''; | |
| 542 | + ?> | |
| 537 | 543 | <?php echo wp_kses($formHTML, EscapingHelper::getFormAllowedHtml(isset($formContent) ? $formContent : null)); ?> |
| 538 | 544 | </div> |
| 539 | 545 | </main> |
| 540 | 546 | |