PluginProbe
Bit Form – Contact Form, Payment Forms, Multi Step Forms, Calculator & Custom Form Builder / 2.15.3
Bit Form – Contact Form, Payment Forms, Multi Step Forms, Calculator & Custom Form Builder v2.15.3
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 | includes/Admin/Form/FrontEndScriptGenerator.php +201 -149 3.3.12.15.3 View file →
@@ -1,14 +1,20 @@
1 1 <?php
2 2
3 3 namespace BitCode\BitForm\Admin\Form;
4 4
5 -if (!defined('ABSPATH')) {
6 - exit;
7 -}
8 -
5 +use BitCode\BitForm\Admin\Form\InitJs\Paypal;
6 +use BitCode\BitForm\Admin\Form\InitJs\Razorpay;
7 +use BitCode\BitForm\Admin\Form\InitJs\Recaptcha;
8 +use BitCode\BitForm\Admin\Form\InitJs\RecaptchaV3;
9 +use BitCode\BitForm\Admin\Form\InitJs\ScriptLoader;
10 +use BitCode\BitForm\Admin\Form\InitJs\Stripe;
11 +use BitCode\BitForm\Admin\Form\InitJs\Turnstile;
9 12 use BitCode\BitForm\Core\Util\FileHandler;
10 13 use BitCode\BitForm\Core\Util\Log;
14 +use BitCode\BitForm\Core\Util\Utilities;
15 +use BitCode\BitForm\Core\WorkFlow\WorkFlowHandler;
16 +use BitCode\BitFormPro\Admin\FormSettings\FormAbandonment;
11 17 use WP_Error;
12 18
13 19 class FrontEndScriptGenerator
14 20 {
@@ -30,36 +36,30 @@
30 36
31 37 private static function generateBfGlobalObjJS($contentIds = [])
32 38 {
33 39 $contentidArray = wp_json_encode($contentIds);
34 - return ' if(!window.bf_globals){ window.bf_globals = {};}
35 - (function(){
36 - var bfSetupGlobals = function(){
37 - ' . $contentidArray . '.forEach(function(contentId){
38 - const form = document.getElementById(contentId);
39 - if(!form){
40 - delete window.bf_globals[contentId];
41 - return;
42 - }
43 - if(!window.bf_globals[contentId]){
44 - window.bf_globals[contentId] = {inits: {}, contentId: contentId};
45 - }else{
46 - if(!window.bf_globals[contentId].inits) window.bf_globals[contentId].inits = {};
47 - window.bf_globals[contentId].contentId = contentId;
48 - }
49 - });
50 - };
51 - if(document.readyState === "loading"){
52 - document.addEventListener("DOMContentLoaded", bfSetupGlobals, { once: true });
53 - } else {
54 - bfSetupGlobals();
40 + return <<<GLOBALOBJ
41 + if(!window.bf_globals){ window.bf_globals = {};}
42 + $contentidArray.forEach(function(contentId){
43 + const form = document.getElementById(contentId);
44 + if(!form){
45 + delete window.bf_globals[contentId];
46 + return;
47 + }
48 + if(!window.bf_globals[contentId]){
49 + window.bf_globals[contentId] = {inits: {}, contentId: contentId};
50 + }else{
51 + window.bf_globals[contentId].inits = {};
52 + window.bf_globals[contentId].contentId = contentId;
55 53 }
56 - })();';
54 +
55 + });
56 +GLOBALOBJ;
57 57 }
58 58
59 59 private static function isValidationNeeded($fldData)
60 60 {
61 - $validationsToCheck = ['valid->req', 'valid->regexr', 'mn', 'mx', 'opt', 'err->invalid->show', 'err->notVerified->show'];
61 + $validationsToCheck = ['valid->req', 'valid->regexr', 'mn', 'mx', 'opt', 'err->invalid->show'];
62 62 foreach ($validationsToCheck as $property) {
63 63 $needValidation = Helpers::property_exists_nested($fldData, $property);
64 64 if ($needValidation) {
65 65 return true;
@@ -93,11 +93,8 @@
93 93
94 94 // for hidden Field when cache plugin on
95 95 $this->jsHiddenFieldScript();
96 96
97 - // for recaptcha v3 (form-level setting)
98 - $this->jsRecaptchaV3Scripts();
99 -
100 97 // for form abandonment scripts
101 98 $this->jsFormAbandonmentScripts();
102 99
103 100 // multi step form scripts
@@ -110,10 +107,8 @@
110 107 $this->appendJs($this->getScript(), $postId, $preview);
111 108 $this->appendJs($this->generateFieldConfigsJs($contentIds), $postId, $preview);
112 109 // init all js events and functions at last
113 110 $this->appendJs(self::getFileFromAssetsJs('bitform-init.min.js'), $postId, $preview);
114 - // picks up forms injected after load (AJAX, popups, lazy content)
115 - $this->appendJs(self::getFileFromAssetsJs('bitform-observer.min.js'), $postId, $preview);
116 111 if (defined('ELEMENTOR_PRO_VERSION')) {
117 112 $this->appendJs(self::getFileFromAssetsJs('bitform-elementor.min.js'), $postId, $preview);
118 113 }
119 114
@@ -149,24 +144,55 @@
149 144 }
150 145
151 146 private function jsFormAbandonmentScripts()
152 147 {
153 - /**
154 - * Add-ons can inject required script files here.
155 - *
156 - * @param array $files Array of file arrays: ['priority' => int, 'filename' => string]
157 - * @param array $formContents
158 - * @param array $fields
159 - */
160 - $files = apply_filters('bitform_form_abandonment_script_files', [], $this->_formContents, $this->_fields);
161 - if (empty($files) || !is_array($files)) {
148 + if (!Utilities::isPro() || !class_exists('\BitCode\BitFormPro\Admin\FormSettings\FormAbandonment')) {
162 149 return;
163 150 }
164 - foreach ($files as $jsFile) {
165 - if (!empty($jsFile['filename']) && !empty($jsFile['priority'])) {
166 - $this->addScriptInLoadedScriptsList($jsFile);
151 + // check if any of the form has form abandonment enabled
152 + $allFiles = [];
153 + foreach ($this->_formContents as $formContent) {
154 + $formAbandonmentSettings = FormAbandonment::getFormAbandonmentSettings($formContent->formId);
155 + if (!empty($formAbandonmentSettings->saveFormDraft)) {
156 + $neededFiles = ScriptFilePriorityManager::formAbandonmentNeededFiles('autoSave');
157 + $allFiles = array_merge($allFiles, $neededFiles);
158 + break;
167 159 }
160 +
161 + $workflowHandler = new WorkFlowHandler($formContent->formId);
162 + $allWorkflows = $workflowHandler->getAllworkFlow();
163 + foreach ($allWorkflows as $workflow) {
164 + foreach ($workflow['conditions'] as $cond) {
165 + if (!empty($cond->actions) && !empty($cond->actions->fields)) {
166 + foreach ($cond->actions->fields as $fldAction) {
167 + if (empty($fldAction->field) || empty($fldAction->action)) {
168 + continue;
169 + }
170 + if ('_bf_form' === $fldAction->field && 'save_draft' === $fldAction->action) {
171 + $neededFiles = ScriptFilePriorityManager::formAbandonmentNeededFiles();
172 + $allFiles = array_merge($allFiles, $neededFiles);
173 + }
174 + }
175 + }
176 + }
177 + }
168 178 }
179 + if (isset($this->_fields['button'])) {
180 + foreach ($this->_fields['button'] as $button) {
181 + if ('save-draft' === $button['field']->btnTyp) {
182 + $neededFiles = ScriptFilePriorityManager::formAbandonmentNeededFiles();
183 + $allFiles = array_merge($allFiles, $neededFiles);
184 + break;
185 + }
186 + }
187 + }
188 + //
189 + if (empty($allFiles)) {
190 + return;
191 + }
192 + foreach ($allFiles as $jsFile) {
193 + $this->addScriptInLoadedScriptsList($jsFile);
194 + }
169 195 }
170 196
171 197 private function appendJs($script, $postId, $previewMode, $mode = 'a')
172 198 {
@@ -194,12 +220,22 @@
194 220
195 221 $script = '';
196 222 foreach ($this->_loadedScriptsList as $scriptFileArr) {
197 223 $fileNam = $scriptFileArr['filename'];
198 - $fileContent = self::getFileFromAssetsJs($fileNam);
199 - if ($fileContent) {
200 - $script .= $fileContent;
224 + if (!isset($scriptFileArr['scriptTyp']) || 'script' === $scriptFileArr['scriptTyp']) {
225 + if (self::getFileFromAssetsJs($fileNam)) {
226 + $script .= self::getFileFromAssetsJs($fileNam);
227 + continue;
228 + }
229 + continue;
201 230 }
231 + if ('custom' === $scriptFileArr['scriptTyp']) {
232 + $fileInstance = $scriptFileArr['source'] . $fileNam;
233 + if (!class_exists($fileInstance)) {
234 + continue;
235 + } // when class not found, skip load script
236 + $script .= $fileInstance::init($scriptFileArr['fk'], $scriptFileArr['field'], $scriptFileArr['contentId']);
237 + }
202 238 }
203 239 return $script;
204 240 }
205 241
@@ -207,12 +243,8 @@
207 243 {
208 244 foreach ($this->_fields as $flds) {
209 245 foreach ($flds as $fld) {
210 246 $fldData = $fld['field'];
211 - // Corrupt/partial form JSON can produce a null field or one without typ.
212 - if (!is_object($fldData)) {
213 - continue;
214 - }
215 247 // for validation js files
216 248 if (self::isValidationNeeded($fldData)) {
217 249 $validation = $this->_validationJsFilesNeeded['validation'];
218 250 $this->addScriptInLoadedScriptsList($validation);
@@ -232,30 +264,18 @@
232 264
233 265 $validationScriptFileMapping = ScriptFilePriorityManager::validationScriptFileMapping($fldData->typ);
234 266 if ($validationScriptFileMapping) {
235 267 foreach ($validationScriptFileMapping as $key => $value) {
236 - $paths = $value['paths'] ?? [];
237 - $hasMatchingPath = false;
238 - foreach ($paths as $path) {
268 + foreach ($value['paths'] as $path) {
239 269 if (Helpers::property_exists_nested($fldData, $path)) {
240 - $hasMatchingPath = true;
241 - break; // one match is enough
270 + $file = $this->_validationJsFilesNeeded[$key];
271 + $this->addScriptInLoadedScriptsList($file);
242 272 }
243 273 }
244 -
245 - if (!$hasMatchingPath) {
246 - continue;
247 - }
248 -
249 - // Add the main script once
250 - if (!empty($this->_validationJsFilesNeeded[$key])) {
251 - $this->addScriptInLoadedScriptsList($this->_validationJsFilesNeeded[$key]);
252 - }
253 -
254 - // Add dependencies once each
255 - foreach (($value['dependencies'] ?? []) as $dep) {
256 - if (!empty($this->_validationJsFilesNeeded[$dep])) {
257 - $this->addScriptInLoadedScriptsList($this->_validationJsFilesNeeded[$dep]);
274 + if (isset($value['dependencies'])) {
275 + foreach ($value['dependencies'] as $dependency) {
276 + $dependencyFile = $this->_validationJsFilesNeeded[$dependency];
277 + $this->addScriptInLoadedScriptsList($dependencyFile);
258 278 }
259 279 }
260 280 }
261 281 }
@@ -264,9 +284,8 @@
264 284 }
265 285
266 286 private function jsFieldsNeededFile()
267 287 {
268 - $filePondPluginList = apply_filters('bitform_filepond_plugins_list', []);
269 288 foreach ($this->_fields as $typ => $flds) {
270 289 if (!array_key_exists($typ, $this->_jsFilesNeeded)) {
271 290 continue;
272 291 }
@@ -276,30 +295,26 @@
276 295 if ('advanced-file-up' === $typ) {
277 296 $configs = $fld['field']->config;
278 297 foreach ($configs as $configKey => $config) {
279 298 if ($configs->$configKey) {
280 - if (array_key_exists($configKey, $filePondPluginList)) {
281 - $this->addScriptInLoadedScriptsList($filePondPluginList[$configKey]);
299 + $filepondPlugin = ScriptFilePriorityManager::filePondPlugins($configKey);
300 + if ($filepondPlugin) {
301 + $this->addScriptInLoadedScriptsList($filepondPlugin);
282 302 }
283 303 }
284 304 }
285 305 }
286 306 foreach ($fldScriptArr as $scriptFile) {
287 - if (isset($scriptFile['paths']) && is_array($scriptFile['paths'])) {
288 - $pathMatched = false;
289 - foreach ($scriptFile['paths'] as $path) {
290 - if (Helpers::property_exists_nested($fld['field'], $path)) {
291 - $pathMatched = true;
292 - break;
293 - }
294 - }
295 - if (!$pathMatched) {
296 - continue;
297 - }
298 - } elseif (isset($scriptFile['path']) && !Helpers::property_exists_nested($fld['field'], $scriptFile['path'])) {
307 + if (!isset($scriptFile['scriptTyp'])) {
308 + $this->addScriptInLoadedScriptsList($scriptFile);
299 309 continue;
300 310 }
301 - $this->addScriptInLoadedScriptsList($scriptFile);
311 + if ('custom' === $scriptFile['scriptTyp'] && Helpers::property_exists_nested($fld['field'], $scriptFile['path'], true)) {
312 + $scriptFile['field'] = $fld['field'];
313 + $scriptFile['fk'] = $fld['fk'];
314 + $scriptFile['contentId'] = $fld['contentId'];
315 + $this->addScriptInLoadedScriptsList($scriptFile);
316 + }
302 317 }
303 318 }
304 319 }
305 320 }
@@ -343,10 +358,9 @@
343 358 {
344 359 // for js file
345 360 $path = 'form-scripts';
346 361 $fileName = "bitform-custom-$formId.js";
347 - $filteredJs = Helpers::removeJsSingleLineComments($customCodes->JavaScript);
348 - self::customCodeFileSaveOrDelete($filteredJs, $path, $fileName);
362 + self::customCodeFileSaveOrDelete($customCodes->JavaScript, $path, $fileName);
349 363
350 364 // for css file
351 365 $path = 'form-styles';
352 366 $fileName = "bitform-custom-$formId.css";
@@ -379,31 +393,27 @@
379 393 return $customCodes;
380 394 }
381 395
382 396 private $fldContainersByType = [
383 - 'address' => '.__$fk__-parent-fld-wrp',
384 - 'select' => '.__$fk__-dpd-fld-wrp',
385 - 'country' => '.__$fk__-country-fld-wrp',
386 - 'currency' => '.__$fk__-currency-fld-wrp',
387 - 'phone-number' => '.__$fk__-phone-fld-wrp',
388 - 'file-up' => '.__$fk__-file-up-wrpr',
389 - 'advanced-file-up' => '#filepond-__$fk__-container',
390 - 'paypal' => '.__$fk__-paypal-wrp',
391 - 'razorpay' => '.__$fk__-razorpay-wrp',
392 - 'recaptcha' => '.__$fk__-recaptcha-wrp',
393 - 'stripe' => '.__$fk__-stripe-fld',
394 - 'mollie' => '.__$fk__-mollie-wrp',
395 - 'repeater' => '.__$fk__-rpt-fld-wrp',
396 - 'signature' => '.__$fk__-inp-fld-wrp',
397 - 'rating' => '.__$fk__-inp-fld-wrp',
398 - 'email-otp' => '.__$fk__-inp-fld-wrp',
399 - 'hcaptcha' => '.__$fk__-h-captcha-wrp',
400 - 'advanced-datetime' => '.__$fk__-advanced-datetime',
397 + 'select' => '.__$fk__-dpd-fld-wrp',
398 + 'country' => '.__$fk__-country-fld-wrp',
399 + 'currency' => '.__$fk__-currency-fld-wrp',
400 + 'phone-number' => '.__$fk__-phone-fld-wrp',
401 + 'file-up' => '.__$fk__-file-up-wrpr',
402 + 'advanced-file-up' => '#filepond-__$fk__-container',
403 + 'paypal' => '.__$fk__-paypal-wrp',
404 + 'razorpay' => '.__$fk__-razorpay-wrp',
405 + 'recaptcha' => '.__$fk__-recaptcha-wrp',
406 + 'stripe' => '.__$fk__-stripe-fld',
407 + 'mollie' => '.__$fk__-mollie-wrp',
408 + 'repeater' => '.__$fk__-rpt-fld-wrp',
409 + 'signature' => '.__$fk__-inp-fld-wrp',
410 + 'rating' => '.__$fk__-inp-fld-wrp',
401 411 ];
402 412
403 413 private function generateFieldConfigsJs()
404 414 {
405 - $customFlds = ['address', 'select', 'country', 'currency', 'phone-number', 'file-up', 'advanced-file-up', 'paypal', 'razorpay', 'stripe', 'mollie', 'recaptcha', 'repeater', 'signature', 'rating', 'turnstile', 'hcaptcha', 'advanced-datetime', 'email-otp'];
415 + $customFlds = ['select', 'country', 'currency', 'phone-number', 'file-up', 'advanced-file-up', 'paypal', 'razorpay', 'stripe', 'mollie', 'recaptcha', 'repeater', 'signature', 'rating', 'turnstile'];
406 416 $allFieldTypes = array_keys($this->_fields);
407 417 $customFldsInForms = array_intersect($allFieldTypes, $customFlds);
408 418 $formContents = $this->_formContents;
409 419 $recaptchaV3Enabled = false;
@@ -425,10 +435,10 @@
425 435 }
426 436
427 437 $customFldConfigPaths = [];
428 438
429 - $allConfs = ScriptFilePriorityManager::getAllFldConfs();
430 439 foreach ($customFldsInForms as $customFldTyp) {
440 + $allConfs = ScriptFilePriorityManager::getAllFldConfs();
431 441 if (isset($allConfs[$customFldTyp])) {
432 442 $customFldConfigPaths[$customFldTyp] = $allConfs[$customFldTyp];
433 443 } else {
434 444 $customFldConfigPaths[$customFldTyp] = (object) [];
@@ -437,45 +447,95 @@
437 447
438 448 $customFldConfigPaths = wp_json_encode($customFldConfigPaths);
439 449 $containers = wp_json_encode($containers);
440 450
441 - $script = ' const customFldConfigPaths = ' . $customFldConfigPaths . ';
442 - const fldContainers = ' . $containers . ';
451 + $scriptLoaderFields = ['paypal', 'razorpay', 'stripe', 'recaptcha', 'turnstile'];
452 + $scriptLoadedNeeded = array_intersect($scriptLoaderFields, $customFldsInForms) || $recaptchaV3Enabled;
453 + if ($scriptLoadedNeeded) {
454 + $scriptLoaderJs = ScriptLoader::init();
455 + } else {
456 + $scriptLoaderJs = '';
457 + }
458 +
459 + if (in_array('paypal', $customFldsInForms)) {
460 + $paypalInitJs = Paypal::init();
461 + } else {
462 + $paypalInitJs = '';
463 + }
464 +
465 + if (in_array('razorpay', $customFldsInForms)) {
466 + $razorpayInitJs = Razorpay::init();
467 + } else {
468 + $razorpayInitJs = '';
469 + }
470 +
471 + if (in_array('stripe', $customFldsInForms)) {
472 + $stripeInitJs = Stripe::init();
473 + } else {
474 + $stripeInitJs = '';
475 + }
476 +
477 + if (in_array('mollie', $customFldsInForms)) {
478 + $mollieInitJs = Stripe::init();
479 + } else {
480 + $mollieInitJs = '';
481 + }
482 +
483 + if (in_array('recaptcha', $customFldsInForms)) {
484 + $recaptchaInitJs = Recaptcha::init();
485 + } else {
486 + $recaptchaInitJs = '';
487 + }
488 +
489 + if (in_array('turnstile', $customFldsInForms)) {
490 + $turnstileInitJs = Turnstile::init();
491 + } else {
492 + $turnstileInitJs = '';
493 + }
494 +
495 + if ($recaptchaV3Enabled) {
496 + $recaptchaV3InitJs = RecaptchaV3::init();
497 + } else {
498 + $recaptchaV3InitJs = '';
499 + }
500 +
501 + $script = <<<FIELDCONFIGJS
502 + const customFldConfigPaths = $customFldConfigPaths;
503 + const fldContainers = $containers;
443 504
505 + $scriptLoaderJs;
506 +
444 507 function initAllCustomFlds (formContentId = null) {
445 508 const allContendIds = formContentId ? [formContentId] : Object.keys(bf_globals);
446 509 allContendIds.forEach((contentId) => {
447 510 const contentData = bf_globals[contentId];
448 - if(!contentData?.inits) contentData.inits = {};
449 511 const flds = bf_globals[contentId]?.fields || {};
450 512 const fldKeys = Object.keys(flds).reverse();
451 513 fldKeys.forEach((fldKey) => {
452 514 const fldData = flds[fldKey];
453 515 const fldType = fldData.typ;
454 - if(fldType === \'paypal\') {
455 - initPaypalFld(contentId, fldKey, fldData, fldType);
456 - } else if(fldType === \'razorpay\') {
457 - initRazorpayFld(contentId, fldKey, fldType);
458 - } else if(fldType === \'recaptcha\') {
459 - initRecaptchaFld(contentId, fldKey, fldType);
460 - } else if(fldType === \'turnstile\') {
461 - initTurnstileFld(contentId, fldKey);
462 - } else if(fldType === \'hcaptcha\') {
463 - initHCaptchaFld(contentId, fldKey, fldType);
464 - } else if(fldType === \'stripe\' || fldType === \'mollie\') {
465 - initStripeFld(contentId, fldKey, fldType);
516 + if(fldType === 'paypal') {
517 + $paypalInitJs;
518 + } else if(fldType === 'razorpay') {
519 + $razorpayInitJs;
520 + } else if(fldType === 'recaptcha') {
521 + $recaptchaInitJs;
522 + } else if(fldType === 'turnstile') {
523 + $turnstileInitJs;
524 + } else if(fldType === 'stripe') {
525 + $stripeInitJs;
466 526 } else if (customFldConfigPaths[fldType]) {
467 527 contentData.inits[fldKey] = getFldInstance(contentId, fldKey, fldType);
468 528 }
469 529 });
470 - if(contentData.gRecaptchaVersion === \'v3\' && contentData.gRecaptchaSiteKey){
471 - initRecaptchaV3Fld(contentId, contentData);
530 + if(contentData.gRecaptchaVersion === 'v3' && contentData.gRecaptchaSiteKey){
531 + $recaptchaV3InitJs;
472 532 }
473 533 });
474 534 };
475 - function getFldInstance(contentId, fldKey, fldTyp, nestedSelector = \'\') {
476 - const fldClass = this[\'bit_\'+fldTyp.replace(/-/g, \'_\')+\'_field\'];
477 - const selector = \'#form-\'+contentId+\' \'+nestedSelector+fldContainers[fldTyp].replace("__$fk__", fldKey);
535 + function getFldInstance(contentId, fldKey, fldTyp, nestedSelector = '') {
536 + const fldClass = this['bit_'+fldTyp.replace(/-/g, '_')+'_field'];
537 + const selector = '#form-'+contentId+' '+nestedSelector+fldContainers[fldTyp].replace("__\$fk__", fldKey);
478 538 if(!fldClass || !bfSelect(selector)) return;
479 539 return new fldClass(selector, getFldConf(contentId, fldKey, fldTyp));
480 540 };
481 541 function getFldConf(contentId, fieldKey, fldTyp) {
@@ -496,13 +556,13 @@
496 556 } else {
497 557 value = getDataFromNestedPath(fldData, fldPath.path);
498 558 }
499 559 }
500 - if (!value && "val" in fldPath) {
560 + if (!value && fldPath.val) {
501 561 value = fldPath.val;
502 - if(typeof value === \'string\') {
562 + if(typeof value === 'string') {
503 563 Object.entries(varData).forEach(([key, val]) => {
504 - value = value.replace("__$"+key+"__", val);
564 + value = value.replace("__\$"+key+"__", val);
505 565 });
506 566 }
507 567 }
508 568 fldConf = setDataToNestedPath(fldConf, confPath, value);
@@ -528,9 +588,10 @@
528 588 current = current[k];
529 589 });
530 590 current[lastKey] = value;
531 591 return current;
532 - }';
592 + }
593 +FIELDCONFIGJS;
533 594
534 595 return $script;
535 596 }
536 597
@@ -551,10 +612,8 @@
551 612 $fileArr = ScriptFilePriorityManager::validationAndOtherScriptFile()['conditionalLogic'];
552 613 $this->addScriptInLoadedScriptsList($fileArr);
553 614 $fileArr = ScriptFilePriorityManager::validationAndOtherScriptFile()['resetPlaceholders'];
554 615 $this->addScriptInLoadedScriptsList($fileArr);
555 - $fileArr = ScriptFilePriorityManager::validationAndOtherScriptFile()['bfResetDefaultValue'];
556 - $this->addScriptInLoadedScriptsList($fileArr);
557 616 $fileArr = ScriptFilePriorityManager::validationAndOtherScriptFile()['validateFocusLost'];
558 617 $this->addScriptInLoadedScriptsList($fileArr);
559 618 $fileArr = ScriptFilePriorityManager::frontendScriptFile()['observeElm'];
560 619 $this->addScriptInLoadedScriptsList($fileArr);
@@ -568,15 +627,9 @@
568 627
569 628 private function jsHiddenFieldScript()
570 629 {
571 630 $appConfig = get_option('bitform_app_config');
572 - $cacheTokenEnabled = true;
573 - if (is_object($appConfig) && property_exists($appConfig, 'cache_plugin')) {
574 - $cacheTokenEnabled = (bool) $appConfig->cache_plugin;
575 - } elseif (is_array($appConfig) && array_key_exists('cache_plugin', $appConfig)) {
576 - $cacheTokenEnabled = (bool) $appConfig['cache_plugin'];
577 - }
578 - if ($cacheTokenEnabled) {
631 + if (Helpers::property_exists_nested($appConfig, 'cache_plugin', true)) {
579 632 $fileArr = ScriptFilePriorityManager::frontendScriptFile()['hidden-token-field'];
580 633 $this->addScriptInLoadedScriptsList($fileArr);
581 634 return;
582 635 }
@@ -581,15 +634,14 @@
581 634 return;
582 635 }
583 636 }
584 637
585 - private function jsRecaptchaV3Scripts()
638 + public function dd($data, $exit = false)
586 639 {
587 - foreach ($this->_formContents as $content) {
588 - if (isset($content->additional->enabled->recaptchav3) && $content->additional->enabled->recaptchav3) {
589 - $this->addScriptInLoadedScriptsList(['priority' => 302, 'filename' => 'scriptLoader.min.js']);
590 - $this->addScriptInLoadedScriptsList(['priority' => 303, 'filename' => 'initRecaptchaV3Fld.min.js']);
591 - return;
592 - }
593 - }
640 + echo '+++++++++++++';
641 + echo '<pre>';
642 + var_dump($data);
643 + echo '</pre>';
644 + echo '+++++++++++++';
645 + $exit ? exit : '';
594 646 }
595 647 }