| @@ -10,8 +10,9 @@ | ||
| 10 | 10 | use BitCode\BitForm\Core\Integration\IntegrationHandler; |
| 11 | 11 | use BitCode\BitForm\Core\Util\FieldValueHandler; |
| 12 | 12 | use BitCode\BitForm\Core\Util\FileDownloadProvider; |
| 13 | 13 | use BitCode\BitForm\Core\Util\FrontendHelpers; |
| 14 | +use BitCode\BitForm\Core\Util\SmartTags; | |
| 14 | 15 | use BitCode\BitForm\Core\Util\Utilities; |
| 15 | 16 | use BitCode\BitForm\Core\WorkFlow\WorkFlow; |
| 16 | 17 | use BitCode\BitFormPro\Admin\FormSettings\FormAbandonment; |
| 17 | 18 | |
| @@ -283,11 +284,11 @@ | ||
| 283 | 284 | } |
| 284 | 285 | |
| 285 | 286 | private function getValuesFromQueryParams() |
| 286 | 287 | { |
| 287 | - $reqField = $_SERVER['QUERY_STRING']; | |
| 288 | 288 | $queryParamsValue = []; |
| 289 | - if (!empty($reqField)) { | |
| 289 | + if (isset($_SERVER['QUERY_STRING']) && !empty($_SERVER['QUERY_STRING'])) { | |
| 290 | + $reqField = $_SERVER['QUERY_STRING']; | |
| 290 | 291 | foreach (explode('&', $reqField) as $keyValue) { |
| 291 | 292 | // $pattern = '/([a-zA-Z0-9])([a-zA-Z])\=+/'; |
| 292 | 293 | $pattern = '/([^.]+)=(.*?)([^.]+)/'; |
| 293 | 294 | $matches = preg_match($pattern, $keyValue, $matchFormat); |
| @@ -314,8 +315,10 @@ | ||
| 314 | 315 | $formID = intval($atts['form_id']); |
| 315 | 316 | } |
| 316 | 317 | if (isset($atts['entry_id'])) { |
| 317 | 318 | $entryId = intval($atts['entry_id']); |
| 319 | + } elseif (isset($_GET['bf_entry_id'])) { | |
| 320 | + $entryId = $_GET['bf_entry_id']; | |
| 318 | 321 | } else { |
| 319 | 322 | $entryId = false; |
| 320 | 323 | } |
| 321 | 324 | if (isset($atts['id'])) { |
| @@ -373,13 +376,21 @@ | ||
| 373 | 376 | $nestedLayout = isset($formContent->nestedLayout) ? $formContent->nestedLayout : (object) []; |
| 374 | 377 | $buttons = !empty($formContent->buttons) ? $formContent->buttons : ''; |
| 375 | 378 | $additional = $formContent->additional; |
| 376 | 379 | |
| 377 | - $workFlowRunType = $entryId ? 'edit' : 'create'; | |
| 378 | - if ($entryId) { | |
| 380 | + // $workFlowRunType = $entryId ? 'edit' : 'create'; | |
| 381 | + if ($entryId && (get_current_user_id() || is_admin())) { | |
| 382 | + // return sprintf(__('Sorry!, You cannot edit #%s no form.', 'bit-form'), $formID); | |
| 383 | + $workFlowRunType = 'edit'; | |
| 379 | 384 | $fields = $this->setFieldsValue($fields, $formID, $entryId); |
| 385 | + } else { | |
| 386 | + $workFlowRunType = 'create'; | |
| 380 | 387 | } |
| 381 | 388 | |
| 389 | + // if ($entryId) { | |
| 390 | + // $fields = $this->setFieldsValue($fields, $formID, $entryId); | |
| 391 | + // } | |
| 392 | + | |
| 382 | 393 | $fields = apply_filters('bitform_filter_before_workflow_onload_fields', $fields, $formID); |
| 383 | 394 | $fields = $this->triggerWorkflowOnLoad($formID, $shortCodeCounter, $fields, $workFlowRunType); |
| 384 | 395 | $fields = apply_filters('bitform_filter_after_workflow_onload_fields', $fields, $formID); |
| 385 | 396 | do_action('bitform_onload_fields', $fields, $formID); |
| @@ -385,9 +396,9 @@ | ||
| 385 | 396 | do_action('bitform_onload_fields', $fields, $formID); |
| 386 | 397 | $workFlowreturnedOnUserInput = $this->executeOnUserInput($formID, $shortCodeCounter, $fields); |
| 387 | 398 | |
| 388 | 399 | // test for form before remove |
| 389 | - $noLabel = ['decision-box', 'html', 'button', 'paypal', 'razorpay', 'recaptcha']; | |
| 400 | + $noLabel = ['decision-box', 'html', 'shortcode', 'button', 'paypal', 'razorpay', 'recaptcha']; | |
| 390 | 401 | foreach ($fields as $fldKey => $field) { |
| 391 | 402 | if (!in_array($field->typ, $noLabel) && isset($field->lbl)) { |
| 392 | 403 | $lblReplaceToBackslash = str_replace('$_bf_$', '\\', $field->lbl); |
| 393 | 404 | $fields->{$fldKey}->lbl = FieldValueHandler::replaceSmartTagWithValue($lblReplaceToBackslash); |
| @@ -455,9 +466,9 @@ | ||
| 455 | 466 | if (!empty($paymentFieldData)) { |
| 456 | 467 | $integrationHandler = new IntegrationHandler(0); |
| 457 | 468 | foreach ($paymentFieldData as $fldKey => $fldData) { |
| 458 | 469 | $paymentIntegration = $integrationHandler->getAIntegration($fldData->payIntegID); |
| 459 | - if(is_wp_error($paymentIntegration)) { | |
| 470 | + if (is_wp_error($paymentIntegration)) { | |
| 460 | 471 | continue; |
| 461 | 472 | } |
| 462 | 473 | if ('paypal' === $fldData->typ) { |
| 463 | 474 | $integrationDetails = json_decode($paymentIntegration[0]->integration_details); |
| @@ -490,9 +501,9 @@ | ||
| 490 | 501 | 'appID' => "bitforms_{$formID}", |
| 491 | 502 | 'GCLID' => $FrontendFormManager->isGCLIDEnabled(), |
| 492 | 503 | 'assetUrl' => BITFORMS_ASSET_URI, |
| 493 | 504 | 'onfieldCondition' => !empty($workFlowreturnedOnUserInput['onfield_input_conditions']) ? $workFlowreturnedOnUserInput['onfield_input_conditions'] : false, |
| 494 | - 'smartTags' => !empty($workFlowreturnedOnUserInput['smart_tags']) ? $workFlowreturnedOnUserInput['smart_tags'] : [], | |
| 505 | + 'smartTags' => SmartTags::smartTags(SmartTags::getPostUserData()), | |
| 495 | 506 | 'paymentCallbackUrl' => get_rest_url() . 'bitform/v1/payments/razorpay', |
| 496 | 507 | 'gRecaptchaSiteKey' => !empty($reCAPTCHA->siteKey) ? $reCAPTCHA->siteKey : null, |
| 497 | 508 | 'gRecaptchaVersion' => !empty($reCAPTCHAVersion) ? $reCAPTCHAVersion : null, |
| 498 | 509 | 'turnstileSiteKey' => !empty($turnstileSiteKey) ? $turnstileSiteKey : null |
| @@ -533,8 +544,15 @@ | ||
| 533 | 544 | } |
| 534 | 545 | $bitFormFrontArr['formInfo']->conversationalSettings = $formInfo->conversationalSettings; |
| 535 | 546 | } |
| 536 | 547 | |
| 548 | + $formAbandonmentSettings = $FrontendFormManager->getFormAbandonmentSettings(); | |
| 549 | + if (Helpers::property_exists_nested($formAbandonmentSettings, 'active', true)) { | |
| 550 | + $bitFormFrontArr['formSettings'] = (object)[ | |
| 551 | + 'formAbandonment' => $formAbandonmentSettings | |
| 552 | + ]; | |
| 553 | + } | |
| 554 | + | |
| 537 | 555 | $bitFormsFront = apply_filters( |
| 538 | 556 | 'bitforms_localized_script', |
| 539 | 557 | $bitFormFrontArr |
| 540 | 558 | ); |
| @@ -670,9 +688,8 @@ | ||
| 670 | 688 | } |
| 671 | 689 | } |
| 672 | 690 | } |
| 673 | 691 | } |
| 674 | - | |
| 675 | 692 | return $fields; |
| 676 | 693 | } |
| 677 | 694 | |
| 678 | 695 | public function loadAssets($formID = 0, $fromType = 'classic') |