| @@ -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 | } |
| @@ -18,20 +19,20 @@ | ||
| 18 | 19 | $baseConversationalCSSPath = "/form-styles/bitform-conversational-{$formID}.css"; |
| 19 | 20 | $customCSSPath = "/form-styles/bitform-custom-{$formID}.css"; |
| 20 | 21 | $standaloneCSSPath = "/form-styles/bitform-standalone-{$formID}.css"; |
| 21 | 22 | |
| 22 | -wp_register_style('bitform-conversational-base-' . $formIdSafe, BITFORMS_UPLOAD_BASE_URL . $baseCSSPath, [], $formUpdateVersion); | |
| 23 | -wp_register_style('bitform-conversational-' . $formIdSafe, BITFORMS_UPLOAD_BASE_URL . $baseConversationalCSSPath, [], $formUpdateVersion); | |
| 23 | +wp_register_style('bitform-conversational-base-' . $formIdSafe, FrontendHelpers::styleSrc($baseCSSPath), [], $formUpdateVersion); | |
| 24 | +wp_register_style('bitform-conversational-' . $formIdSafe, FrontendHelpers::styleSrc($baseConversationalCSSPath), [], $formUpdateVersion); | |
| 24 | 25 | wp_enqueue_style('bitform-conversational-base-' . $formIdSafe); |
| 25 | 26 | wp_enqueue_style('bitform-conversational-' . $formIdSafe); |
| 26 | 27 | |
| 27 | 28 | if (file_exists(BITFORMS_CONTENT_DIR . $customCSSPath)) { |
| 28 | - wp_register_style('bitform-conversational-custom-' . $formIdSafe, BITFORMS_UPLOAD_BASE_URL . $customCSSPath, [], $formUpdateVersion); | |
| 29 | + wp_register_style('bitform-conversational-custom-' . $formIdSafe, FrontendHelpers::styleSrc($customCSSPath), [], $formUpdateVersion); | |
| 29 | 30 | wp_enqueue_style('bitform-conversational-custom-' . $formIdSafe); |
| 30 | 31 | } |
| 31 | 32 | |
| 32 | 33 | if (file_exists(BITFORMS_CONTENT_DIR . $standaloneCSSPath)) { |
| 33 | - wp_register_style('bitform-conversational-standalone-' . $formIdSafe, BITFORMS_UPLOAD_BASE_URL . $standaloneCSSPath, [], $formUpdateVersion); | |
| 34 | + wp_register_style('bitform-conversational-standalone-' . $formIdSafe, FrontendHelpers::styleSrc($standaloneCSSPath), [], $formUpdateVersion); | |
| 34 | 35 | wp_enqueue_style('bitform-conversational-standalone-' . $formIdSafe); |
| 35 | 36 | } |
| 36 | 37 | |
| 37 | 38 | if (isset($font) && '' !== $font) { |
| @@ -82,8 +83,13 @@ | ||
| 82 | 83 | ?> |
| 83 | 84 | </head> |
| 84 | 85 | |
| 85 | 86 | <body class="bit-conversational-form"> |
| 87 | + <?php | |
| 88 | + // Fallback config for when an optimizer defers or drops the inline script. | |
| 89 | + // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- built by buildFormConfigTag(), JSON_HEX_* escaped. | |
| 90 | + echo isset($configTag) ? $configTag : ''; | |
| 91 | + ?> | |
| 86 | 92 | <?php echo wp_kses($formHTML, EscapingHelper::getFormAllowedHtml(isset($formContent) ? $formContent : null)); ?> |
| 87 | 93 | <?php if (!empty($isPreview)) : ?> |
| 88 | 94 | <style>.bc-live-hidden { display: none !important; }</style> |
| 89 | 95 | <script>window.bf_preview_mode = true;</script> |