| @@ -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 | } |
| @@ -17,18 +18,19 @@ | ||
| 17 | 18 | $baseCSSPath = "/form-styles/bitform-{$formID}.css"; |
| 18 | 19 | $customCSSPath = "/form-styles/bitform-custom-{$formID}.css"; |
| 19 | 20 | $standaloneCSSPath = "/form-styles/bitform-standalone-{$formID}.css"; |
| 20 | 21 | |
| 21 | -wp_register_style('bitform-standalone-base-' . $formIdSafe, BITFORMS_UPLOAD_BASE_URL . $baseCSSPath, [], $formUpdateVersion); | |
| 22 | -wp_enqueue_style('bitform-standalone-base-' . $formIdSafe); | |
| 22 | +// Use the same handles as FrontendFormHandler::loadAssets() so WP dedups instead of printing the file twice. | |
| 23 | +wp_register_style('bitform-style-' . $formIdSafe, FrontendHelpers::styleSrc($baseCSSPath), [], $formUpdateVersion); | |
| 24 | +wp_enqueue_style('bitform-style-' . $formIdSafe); | |
| 23 | 25 | |
| 24 | 26 | if (file_exists(BITFORMS_CONTENT_DIR . $customCSSPath)) { |
| 25 | - wp_register_style('bitform-standalone-custom-' . $formIdSafe, BITFORMS_UPLOAD_BASE_URL . $customCSSPath, [], $formUpdateVersion); | |
| 26 | - wp_enqueue_style('bitform-standalone-custom-' . $formIdSafe); | |
| 27 | + wp_register_style('bitform-style-custom-' . $formIdSafe, FrontendHelpers::styleSrc($customCSSPath), [], $formUpdateVersion); | |
| 28 | + wp_enqueue_style('bitform-style-custom-' . $formIdSafe); | |
| 27 | 29 | } |
| 28 | 30 | |
| 29 | 31 | if (file_exists(BITFORMS_CONTENT_DIR . $standaloneCSSPath)) { |
| 30 | - wp_register_style('bitform-standalone-extra-' . $formIdSafe, BITFORMS_UPLOAD_BASE_URL . $standaloneCSSPath, [], $formUpdateVersion); | |
| 32 | + wp_register_style('bitform-standalone-extra-' . $formIdSafe, FrontendHelpers::styleSrc($standaloneCSSPath), [], $formUpdateVersion); | |
| 31 | 33 | wp_enqueue_style('bitform-standalone-extra-' . $formIdSafe); |
| 32 | 34 | } |
| 33 | 35 | |
| 34 | 36 | if (isset($font) && '' !== $font) { |
| @@ -93,8 +95,13 @@ | ||
| 93 | 95 | |
| 94 | 96 | <body> |
| 95 | 97 | <div class="standalone-form-container"> |
| 96 | 98 | <div class="standalone-form-wrapper"> |
| 99 | + <?php | |
| 100 | + // Fallback config for when an optimizer defers or drops the inline script. | |
| 101 | + // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- built by buildFormConfigTag(), JSON_HEX_* escaped. | |
| 102 | + echo isset($configTag) ? $configTag : ''; | |
| 103 | + ?> | |
| 97 | 104 | <?php echo wp_kses($formHTML, EscapingHelper::getFormAllowedHtml(isset($formContent) ? $formContent : null)); ?> |
| 98 | 105 | </div> |
| 99 | 106 | </div> |
| 100 | 107 | |