PluginProbe
Bit Form – Contact Form, Payment Forms, Multi Step Forms, Calculator & Custom Form Builder / 3.3.1
Bit Form – Contact Form, Payment Forms, Multi Step Forms, Calculator & Custom Form Builder v3.3.1
3.3.1 V-3.3.0 3.2.2 3.2.1 3.2.0 3.1.4 3.1.3 3.1.2 3.1.1 3.1.0 V3.0.3 V3.0.2 -3.0.1 V_3.0.0 1.1.1 1.1.8 1.2 1.3 1.4 1.4.18 1.5.2 1.9 2.0 2.10.0 2.10.1 All 138 releases
← All changes | views/standalone-form.php +84 -49 2.10.03.3.1 View file →
@@ -1,4 +1,51 @@
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 +$baseCSSPath = "/form-styles/bitform-{$formID}.css";
18 +$customCSSPath = "/form-styles/bitform-custom-{$formID}.css";
19 +$standaloneCSSPath = "/form-styles/bitform-standalone-{$formID}.css";
20 +
21 +// Use the same handles as FrontendFormHandler::loadAssets() so WP dedups instead of printing the file twice.
22 +wp_register_style('bitform-style-' . $formIdSafe, BITFORMS_UPLOAD_BASE_URL . $baseCSSPath, [], $formUpdateVersion);
23 +wp_enqueue_style('bitform-style-' . $formIdSafe);
24 +
25 +if (file_exists(BITFORMS_CONTENT_DIR . $customCSSPath)) {
26 + wp_register_style('bitform-style-custom-' . $formIdSafe, BITFORMS_UPLOAD_BASE_URL . $customCSSPath, [], $formUpdateVersion);
27 + wp_enqueue_style('bitform-style-custom-' . $formIdSafe);
28 +}
29 +
30 +if (file_exists(BITFORMS_CONTENT_DIR . $standaloneCSSPath)) {
31 + wp_register_style('bitform-standalone-extra-' . $formIdSafe, BITFORMS_UPLOAD_BASE_URL . $standaloneCSSPath, [], $formUpdateVersion);
32 + wp_enqueue_style('bitform-standalone-extra-' . $formIdSafe);
33 +}
34 +
35 +if (isset($font) && '' !== $font) {
36 + wp_register_style('bitform-standalone-font-' . $formIdSafe, $font, [], $formUpdateVersion);
37 + wp_enqueue_style('bitform-standalone-font-' . $formIdSafe);
38 +}
39 +
40 +$previewJsPath = BITFORMS_UPLOAD_BASE_URL . '/form-scripts/preview-' . $formID . '.js';
41 +wp_register_script('bitform-standalone-' . $formIdSafe, $previewJsPath, [], $formUpdateVersion, true);
42 +wp_enqueue_script('bitform-standalone-' . $formIdSafe);
43 +if (isset($bfGlobals) && '' !== $bfGlobals) {
44 + wp_add_inline_script('bitform-standalone-' . $formIdSafe, (string) $bfGlobals, 'before');
45 +}
46 +?>
47 +
1 48 <!DOCTYPE html>
2 49 <html lang="en">
3 50
4 51 <head>
@@ -4,72 +51,60 @@
4 51 <head>
5 52 <meta charset="UTF-8">
6 53 <meta http-equiv="X-UA-Compatible" content="IE=edge">
7 54 <meta name="viewport" content="width=device-width, initial-scale=1.0">
8 - <title><?= isset($title) ? $title : ''; ?></title>
55 + <title><?php echo isset($title) ? esc_html($title) : ''; ?></title>
9 56 <style>
10 - * {
11 - padding: 0;
12 - margin: 0;
13 - box-sizing: border-box;
14 - }
57 + * {
58 + padding: 0;
59 + margin: 0;
60 + box-sizing: border-box;
61 + }
15 62
16 - .standalone-form-container {
17 - min-height: 100vh;
18 - display: flex;
19 - justify-content: center;
20 - align-items: center;
21 - }
63 + .standalone-form-container {
64 + min-height: 100vh;
65 + display: flex;
66 + justify-content: center;
67 + align-items: center;
68 + }
22 69
70 + .standalone-form-wrapper {
71 + width: 40%;
72 + /* Additional styling for the container, if needed */
73 + }
74 +
75 + @media (max-width: 575.98px) {
23 76 .standalone-form-wrapper {
24 - width: 40%;
25 - /* Additional styling for the container, if needed */
77 + width: 100%;
26 78 }
79 + }
27 80
28 - @media (max-width: 575.98px) {
29 - .standalone-form-wrapper {
30 - width: 100%;
31 - }
32 - }
33 -
34 - ._frm-bg-b<?= $formID; ?> {
35 - width: 100%;
36 - }
81 + ._frm-bg-b<?php echo esc_html($formID); ?> {
82 + width: 100%;
83 + }
37 84 </style>
38 - <?php
39 - $baseCSSPath = "/form-styles/bitform-{$formID}.css";
40 - $customCSSPath = "/form-styles/bitform-custom-{$formID}.css";
41 - $standaloneCSSPath = "/form-styles/bitform-standalone-{$formID}.css";
42 - ?>
43 - <link rel="stylesheet" href="<?= BITFORMS_UPLOAD_BASE_URL . $baseCSSPath ?>" />
44 -
45 - <?php if (file_exists(BITFORMS_CONTENT_DIR . $customCSSPath)) : ?>
46 - <link rel="stylesheet" href="<?= BITFORMS_UPLOAD_BASE_URL . $customCSSPath ?>" />
47 - <?php endif; ?>
48 -
49 - <?php if (file_exists(BITFORMS_CONTENT_DIR . $standaloneCSSPath)) : ?>
50 - <link rel="stylesheet" href="<?= BITFORMS_UPLOAD_BASE_URL . $standaloneCSSPath ?>" />
51 - <?php endif; ?>
52 -
53 85 <?php if (isset($font) && '' !== $font) : ?>
54 - <link rel="preconnect" href="https://fonts.googleapis.com">
55 - <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
56 - <link rel="stylesheet" href="<?= $font ?>" />
86 + <link rel="preconnect" href="https://fonts.googleapis.com">
87 + <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
57 88 <?php endif; ?>
58 -
89 + <?php
90 + wp_enqueue_emoji_styles();
91 + wp_print_styles();
92 + ?>
59 93 </head>
60 94
61 95 <body>
62 96 <div class="standalone-form-container">
63 97 <div class="standalone-form-wrapper">
64 - <?= $formHTML ?>
98 + <?php
99 + // Fallback config for when an optimizer defers or drops the inline script.
100 + // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- built by buildFormConfigTag(), JSON_HEX_* escaped.
101 + echo isset($configTag) ? $configTag : '';
102 + ?>
103 + <?php echo wp_kses($formHTML, EscapingHelper::getFormAllowedHtml(isset($formContent) ? $formContent : null)); ?>
65 104 </div>
66 105 </div>
67 106
68 - <script>
69 - <?= $bfGlobals ?>;
70 - </script>
71 - <script src="<?= BITFORMS_UPLOAD_BASE_URL ?>/form-scripts/preview-<?= $formID ?>.js"></script>
72 - </div>
107 + <?php wp_print_scripts(); ?>
73 108 </body>
74 109
75 -</html>
110 +</html>