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/Core/Integration/IntegrationHandler.php +26 -265 3.3.12.15.3 View file →
@@ -6,17 +6,15 @@
6 6 use BitCode\BitForm\Admin\Form\Helpers;
7 7 use BitCode\BitForm\Core\Database\FormEntryLogModel;
8 8 use BitCode\BitForm\Core\Database\FormEntryModel;
9 9 use BitCode\BitForm\Core\Database\IntegrationModel;
10 -use BitCode\BitForm\Core\Form\FormManager;
11 10 use BitCode\BitForm\Core\Util\FieldValueHandler;
12 -use BitCode\BitForm\Core\Util\Log;
13 11 use BitCode\BitForm\Core\Util\MailNotifier;
14 12 use BitCode\BitForm\Frontend\Form\FrontendFormManager;
15 13
16 14 final class IntegrationHandler
17 15 {
18 - private $_formID;
16 + private static $_formID;
19 17 private static $_integrationModel;
20 18 private $_user_details;
21 19
22 20 /**
@@ -28,9 +26,9 @@
28 26 * @return void
29 27 */
30 28 public function __construct($formID, $user_details = null)
31 29 {
32 - $this->_formID = $formID;
30 + static::$_formID = $formID;
33 31 static::$_integrationModel = new IntegrationModel();
34 32 $this->_user_details = $user_details;
35 33 }
36 34
@@ -36,9 +34,9 @@
36 34
37 35 public function getAIntegration($integrationID, $integrationCategory = null, $integrationType = null)
38 36 {
39 37 $conditions = [
40 - 'form_id' => $this->_formID,
38 + 'form_id' => static::$_formID,
41 39 'id' => $integrationID,
42 40 ];
43 41 if (!is_null($integrationType)) {
44 42 $conditions = array_merge($conditions, ['integration_type' => $integrationType]);
@@ -51,9 +49,8 @@
51 49 'id',
52 50 'integration_name',
53 51 'integration_type',
54 52 'integration_details',
55 - 'status',
56 53 'form_id',
57 54 ],
58 55 $conditions
59 56 );
@@ -61,9 +58,9 @@
61 58
62 59 public function getAllIntegration($integrationCategory = null, $integrationType = null, $status = null, $id = null)
63 60 {
64 61 $conditions = [
65 - 'form_id' => $this->_formID,
62 + 'form_id' => static::$_formID,
66 63 ];
67 64 if (!is_null($integrationType)) {
68 65 $conditions = array_merge($conditions, ['integration_type' => $integrationType]);
69 66 }
@@ -129,9 +126,9 @@
129 126 'integration_name' => $integrationName,
130 127 'integration_type' => $integrationType,
131 128 'integration_details' => $integrationDetails,
132 129 'category' => $integrationCategory,
133 - 'form_id' => $this->_formID,
130 + 'form_id' => static::$_formID,
134 131 'user_id' => $this->_user_details['id'],
135 132 'user_ip' => $this->_user_details['ip'],
136 133 'status' => $status,
137 134 'created_at' => $this->_user_details['time'],
@@ -150,9 +147,9 @@
150 147 'integration_name' => $integrationName,
151 148 'integration_type' => $integrationType,
152 149 'integration_details' => $integrationDetails,
153 150 'category' => $integrationCategory,
154 - 'form_id' => $this->_formID,
151 + 'form_id' => static::$_formID,
155 152 'user_id' => $this->_user_details['id'],
156 153 'user_ip' => $this->_user_details['ip'],
157 154 'status' => $status,
158 155 'updated_at' => $this->_user_details['time'],
@@ -162,44 +159,8 @@
162 159 ]
163 160 );
164 161 }
165 162
166 - /**
167 - * Name-only rename of a connected account row, scoped to
168 - * category=connected_integration_apps and this handler's form id (0).
169 - * updateIntegration() is unusable here: it overwrites details/type/category/status.
170 - */
171 - public function renameConnectedApp($integrationID, $integrationName)
172 - {
173 - $data = ['integration_name' => $integrationName];
174 - if (!empty($this->_user_details['time'])) {
175 - $data['updated_at'] = $this->_user_details['time'];
176 - }
177 - return static::$_integrationModel->update(
178 - $data,
179 - [
180 - 'id' => $integrationID,
181 - 'form_id' => $this->_formID,
182 - 'category' => 'connected_integration_apps',
183 - ]
184 - );
185 - }
186 -
187 - public function updateIntegrationStatus($integrationID, $status)
188 - {
189 - $data = ['status' => (int) $status];
190 - if (!empty($this->_user_details['time'])) {
191 - $data['updated_at'] = $this->_user_details['time'];
192 - }
193 - return static::$_integrationModel->update(
194 - $data,
195 - [
196 - 'id' => $integrationID,
197 - 'form_id' => $this->_formID,
198 - ]
199 - );
200 - }
201 -
202 163 public function duplicateAllInAForm($oldFormId)
203 164 {
204 165 $integCols = ['integration_name', 'integration_type', 'integration_details', 'category', 'form_id', 'user_id', 'user_ip', 'status', 'created_at', 'updated_at'];
205 166 $integDupData = [
@@ -206,9 +167,9 @@
206 167 'integration_name',
207 168 'integration_type',
208 169 'integration_details',
209 170 'category',
210 - $this->_formID,
171 + static::$_formID,
211 172 $this->_user_details['id'],
212 173 $this->_user_details['ip'],
213 174 'status',
214 175 $this->_user_details['time'],
@@ -221,9 +182,9 @@
221 182 {
222 183 return static::$_integrationModel->delete(
223 184 [
224 185 'id' => $integrationID,
225 - 'form_id' => $this->_formID,
186 + 'form_id' => static::$_formID,
226 187 ]
227 188 );
228 189 }
229 190
@@ -255,13 +216,13 @@
255 216 }
256 217 $fieldPattern = '/\${\w[^ ${}]*}/';
257 218 preg_match_all($fieldPattern, $stringToReplaceField, $matchedField);
258 219 $uniqueFieldsInStr = array_unique($matchedField[0]);
259 -
260 - foreach ($uniqueFieldsInStr as $value) {
220 + foreach ($uniqueFieldsInStr as $key => $value) {
261 221 $fieldName = substr($value, 2, strlen($value) - 3);
262 222
263 223 $repeaterArr = explode('.', $fieldName);
224 +
264 225 if (isset($fieldValues[$fieldName])) {
265 226 $stringToReplaceField = is_string($fieldValues[$fieldName])
266 227 ? str_replace($value, $fieldValues[$fieldName], $stringToReplaceField)
267 228 : wp_json_encode($fieldValues[$fieldName]);
@@ -267,8 +228,9 @@
267 228 : wp_json_encode($fieldValues[$fieldName]);
268 229 } elseif (2 === count($repeaterArr) && isset($fieldValues[$repeaterArr[0]])) {
269 230 $repeaterValues = [];
270 231 $repeaterFieldValues = $fieldValues[$repeaterArr[0]];
232 +
271 233 foreach ($repeaterFieldValues as $value) {
272 234 if (isset($value[$repeaterArr[1]])) {
273 235 $repeaterValues[] = $value[$repeaterArr[1]];
274 236 }
@@ -274,10 +236,8 @@
274 236 }
275 237 }
276 238
277 239 $stringToReplaceField = $repeaterValues;
278 - } else {
279 - $stringToReplaceField = FieldValueHandler::replaceSmartTagWithValue($value);
280 240 }
281 241 }
282 242 return $stringToReplaceField;
283 243 }
@@ -284,9 +244,9 @@
284 244
285 245 public static function updatedHiddenFieldValue($formID)
286 246 {
287 247 $hiddenFields = [];
288 - $frontendFormManger = FrontendFormManager::getInstance($formID);
248 + $frontendFormManger = new FrontendFormManager($formID);
289 249
290 250 if ($frontendFormManger->isHoneypotActive()) {
291 251 $str = '_bitform' . '_' . $formID . '_' . time() . '_';
292 252 $honpotToken = Helpers::honeypotEncryptedToken($str);
@@ -319,11 +279,8 @@
319 279 $responseData['msg_id'] = isset($workFlowReturnedData['msg_id']) ? $workFlowReturnedData['msg_id'] : 0;
320 280 if (isset($workFlowReturnedData['msg_duration'])) {
321 281 $responseData['msg_duration'] = $workFlowReturnedData['msg_duration'];
322 282 }
323 - if (isset($workFlowReturnedData['afterSubmit'])) {
324 - $responseData['afterSubmit'] = $workFlowReturnedData['afterSubmit'];
325 - }
326 283 }
327 284 if (isset($workFlowReturnedData['redirectPage'])) {
328 285 $responseData['redirectPage'] = $workFlowReturnedData['redirectPage'];
329 286 }
@@ -329,11 +286,8 @@
329 286 }
330 287 if ('update' === $opType && isset($workFlowReturnedData['updatedData'])) {
331 288 $responseData['updatedData'] = $workFlowReturnedData['updatedData'];
332 289 }
333 - if (isset($workFlowReturnedData['new_nonce'])) {
334 - $responseData['new_nonce'] = $workFlowReturnedData['new_nonce'];
335 - }
336 290 if (!isset($workFlowReturnedData['triggerData'])) {
337 291 return $responseData;
338 292 }
339 293
@@ -338,17 +292,10 @@
338 292 }
339 293
340 294 $triggerData = $workFlowReturnedData['triggerData'];
341 295
342 - if (!isset($workFlowReturnedData['fields'])) {
343 - $workFlowReturnedData['fields'] = isset($workFlowReturnedData['updatedData'])
344 - ? $workFlowReturnedData['updatedData']
345 - : [];
346 - }
347 -
348 296 $trnasientData = get_transient("bitform_trigger_transient_{$entryId}");
349 297 $trnasientData = is_string($trnasientData) ? json_decode($trnasientData) : $trnasientData;
350 -
351 298 if (!empty($trnasientData['fields'])) {
352 299 $workFlowReturnedData['fields'] = array_merge($workFlowReturnedData['fields'], $trnasientData['fields']);
353 300 }
354 301
@@ -372,9 +319,9 @@
372 319 ];
373 320 }
374 321 }
375 322 ob_start();
376 - echo wp_doing_ajax() || defined('REST_REQUEST') ? wp_json_encode($response) : esc_html($workFlowReturnedData['message']);
323 + echo wp_doing_ajax() || defined('REST_REQUEST') ? wp_json_encode($response) : $workFlowReturnedData['message'];
377 324 ob_end_flush();
378 325 flush();
379 326 session_write_close();
380 327
@@ -389,21 +336,15 @@
389 336 'id' => $triggerData['entryID'],
390 337 ]
391 338 );
392 339
393 - $triggerData['fields'] = $workFlowReturnedData['fields'];
394 340 if (!is_wp_error($updatedStatus)) {
395 341 if ($workFlowReturnedData['dflt_template']) {
396 - // $triggerData['fields'] = $workFlowReturnedData['fields'];
397 - do_action('bitform_double_optin_confirmation', $workFlowReturnedData['integrationDetails'], $triggerData);
342 + $triggerData['fields'] = $workFlowReturnedData['fields'];
343 + do_action('bf_double_optin_confirmation', $workFlowReturnedData['integrationDetails'], $triggerData);
398 344 } elseif (isset($triggerData['dblOptin'])) {
399 345 foreach ($triggerData['dblOptin'] as $value) {
400 - try {
401 - MailNotifier::notify($value, $triggerData['formID'], $triggerData['fields'], $triggerData['entryID'], true, $triggerData['logID']);
402 - } catch (\Throwable $mailError) {
403 - // response already flushed — a mail failure here must not kill the rest of the run
404 - Log::debug_log('[+] Double opt-in mail failed: ' . $mailError->getMessage());
405 - }
346 + MailNotifier::notify($value, $triggerData['formID'], $triggerData['fields'], $triggerData['entryID'], true, $triggerData['logID']);
406 347 }
407 348 }
408 349 }
409 350 if (function_exists('fastcgi_finish_request')) {
@@ -414,20 +355,16 @@
414 355 die;
415 356 }
416 357 return $workFlowReturnedData;
417 358 }
418 - if (isset($triggerData['mail']) && !empty($triggerData['mail'])) {
359 +
360 + if (isset($triggerData['mail'])) {
419 361 $formManager = new AdminFormManager($triggerData['formID']);
420 362 $formContent = $formManager->getFormContent();
421 363 $submitted_fields = $formContent->fields;
422 364 $fieldValueForMail = FieldValueHandler::formatFieldValueForMail($submitted_fields, $workFlowReturnedData['fields']);
423 365 foreach ($triggerData['mail'] as $value) {
424 - try {
425 - MailNotifier::notify($value, $triggerData['formID'], $fieldValueForMail, $triggerData['entryID'], false, $triggerData['logID']);
426 - } catch (\Throwable $mailError) {
427 - // response already flushed — a mail failure here must not skip the integrations below
428 - Log::debug_log('[+] Mail notification failed: ' . $mailError->getMessage());
429 - }
366 + MailNotifier::notify($value, $triggerData['formID'], $fieldValueForMail, $triggerData['entryID']);
430 367 }
431 368 }
432 369 do_action('bitforms_exec_integrations', $triggerData['integrations'], $workFlowReturnedData['fields'], $triggerData['formID'], $triggerData['entryID'], $triggerData['logID']);
433 370
@@ -441,9 +378,9 @@
441 378 return $workFlowReturnedData;
442 379 }
443 380
444 381 $entryID = $triggerData['entryID'];
445 - if (isset($workFlowReturnedData['cron']) && $workFlowReturnedData['cron'] && empty($triggerData['mail']) && isset($workFlowReturnedData['integrationRun']) && $workFlowReturnedData['integrationRun']) {
382 + if (isset($workFlowReturnedData['cron']) && $workFlowReturnedData['cron'] && !isset($triggerData['mail']) && isset($workFlowReturnedData['integrationRun']) && $workFlowReturnedData['integrationRun']) {
446 383 $eventScheuled = wp_schedule_single_event(time(), 'bitforms_exec_integrations', [$triggerData['integrations'], $workFlowReturnedData['fields'], $triggerData['formID'], $triggerData['entryID'], $triggerData['logID']]);
447 384 $scheduleTime = wp_next_scheduled('bitforms_exec_integrations', [$triggerData['integrations'], $workFlowReturnedData['fields'], $triggerData['formID'], $triggerData['entryID'], $triggerData['logID']]);
448 385 $responseData['cron'] = get_site_url(null, "/wp-cron.php?doing_wp_cron&{$scheduleTime}");
449 386 } elseif (!empty($triggerData['integrations']) || !empty($triggerData['mail']) || isset($workFlowReturnedData['integrationRun']) && !$workFlowReturnedData['integrationRun']) {
@@ -452,15 +389,9 @@
452 389 $triggerData['dbl_opt_donf'] = $workFlowReturnedData['integrationDetails'];
453 390 $triggerData['dbl_opt_dflt_template'] = $workFlowReturnedData['dflt_template'];
454 391 $triggerData['integrationRun'] = $workFlowReturnedData['integrationRun'];
455 392 }
456 -
457 - // Generate one-time trigger token for security
458 - $triggerToken = wp_hash($triggerData['entryID'] . $triggerData['logID'] . time() . wp_rand(), 'nonce');
459 - $triggerData['trigger_token'] = $triggerToken;
460 -
461 393 set_transient("bitform_trigger_transient_{$entryID}", $triggerData, HOUR_IN_SECONDS);
462 - $queuedAt = current_time('mysql');
463 394 $entryLog = new FormEntryLogModel();
464 395 $queueuEntry = $entryLog->log_history_insert(
465 396 [
466 397 'log_id' => $triggerData['logID'],
@@ -466,32 +397,16 @@
466 397 'log_id' => $triggerData['logID'],
467 398 'integration_id' => 0,
468 399 'api_type' => wp_json_encode(['type' => 'trigger', 'type_name' => 'Workflow', 'on' => $opType]),
469 400 'response_type' => 'queued',
470 - // 'trigger' is a durable copy of the transient payload: object-cache hosts can
471 - // evict the transient (and it expires after 1h), which would otherwise lose the run
472 - 'response_obj' => wp_json_encode(['status' => 'queued', 'queued_at' => $queuedAt, 'trigger' => $triggerData]),
473 - 'created_at' => $queuedAt,
401 + 'response_obj' => wp_json_encode(['status' => 'queued']),
402 + 'created_at' => current_time('mysql'),
474 403 ]
475 404 );
476 - if (\is_int($queueuEntry)) {
477 - // Safety net: the browser-fired bitforms_trigger_workflow request can be lost
478 - // (navigation abort, WAF, network drop). This event re-runs the queued workflow;
479 - // it no-ops if the browser trigger already claimed the run.
480 - wp_schedule_single_event(
481 - time() + 2 * MINUTE_IN_SECONDS,
482 - 'bitforms_reclaim_workflow',
483 - [(int) $entryID, (int) $triggerData['formID'], (int) $triggerData['logID'], $queueuEntry]
484 - );
485 - if (!wp_next_scheduled('bitforms_reclaim_sweep')) {
486 - wp_schedule_event(time() + HOUR_IN_SECONDS, 'hourly', 'bitforms_reclaim_sweep');
487 - }
488 - }
489 405 $responseData['cronNotOk'] = [
490 406 $triggerData['entryID'],
491 407 $triggerData['logID'],
492 408 $queueuEntry,
493 - $triggerToken, // Add one-time token as 4th element
494 409 ];
495 410 }
496 411 return $responseData;
497 412 }
@@ -522,12 +437,11 @@
522 437 /**
523 438 *
524 439 * @param mixed $fieldValues
525 440 * @param mixed $returnRepeaterValue default is array
526 - * @param mixed $formID form ID required for string formatting
527 441 * @return array and repeater field value as array or string
528 442 */
529 - public static function formattedRepeaterValue($fieldValues, $returnRepeaterValue = '', $formID = null)
443 + public static function formattedRepeaterValue($fieldValues, $returnRepeaterValue = '')
530 444 {
531 445 // get the repeater field and store it in an array
532 446 $repeaterField = [];
533 447 foreach ($fieldValues as $key => $value) {
@@ -536,15 +450,14 @@
536 450 }
537 451 $repeaterField[] = $key;
538 452 }
539 453
540 - // put the value of the child key to the parent repeater field\
454 + // put the value of the child key to the parent repeater field
541 455 foreach ($repeaterField as $key) {
542 456 list($parentKey, $childKey) = explode('.', $key);
543 - $repeatValues = isset($fieldValues[$parentKey]) ? $fieldValues[$parentKey] : $key;
457 + $repeatValues = $fieldValues[$parentKey];
544 458
545 459 if (!is_array($repeatValues)) {
546 - $fieldValues[$key] = $fieldValues[$childKey];
547 460 continue;
548 461 }
549 462
550 463 foreach ($repeatValues as $value) {
@@ -560,163 +473,11 @@
560 473 }
561 474
562 475 // convert the array to string repeater field value
563 476 if ('string' === $returnRepeaterValue) {
564 - $form = new FormManager($formID);
565 477 foreach ($repeaterField as $key) {
566 - if (isset($fieldValues[$key]) && is_array($fieldValues[$key])) {
567 - $fieldValues[$key] = implode(', ', self::flattenArray($fieldValues[$key]));
568 - }
478 + $fieldValues[$key] = implode(', ', $fieldValues[$key]);
569 479 }
570 -
571 - foreach ($fieldValues as $key=>$value) {
572 - if (!$form->isRepeaterField($key)) {
573 - continue;
574 - }
575 - $repeaterValues = $fieldValues[$key];
576 -
577 - $newFieldValues = self::constructRepeaterValue($repeaterValues, $formID);
578 -
579 - $fieldValues[$key] = is_array($newFieldValues) ? json_encode(array_values($newFieldValues), JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE) : $fieldValues[$key];
580 - }
581 480 }
582 -
583 481 return $fieldValues;
584 482 }
585 -
586 - private static function flattenArray($array)
587 - {
588 - return array_map(function ($val) {
589 - if (is_array($val)) {
590 - return count($val) > 1 ? ('[' . implode(', ') . ']') : implode(', ', $val);
591 - } else {
592 - return $val;
593 - }
594 - }, $array);
595 - }
596 -
597 - /**
598 - * Replace file field value with web url
599 - * @param mixed $fieldValues
600 - * @param number $formId
601 - * @param number $entryId
602 - * @return mixed $fieldValues
603 - */
604 - public static function handleFileUrl($fieldValues, $formId, $entryId)
605 - {
606 - if (!$formId || !$entryId) {
607 - return $fieldValues;
608 - }
609 - $form = FormManager::getInstance($formId);
610 - $formFields = $form->getFields();
611 -
612 - $fldsIncludeFile = ['file-up', 'advanced-file-up', 'repeater', 'signature'];
613 - foreach ($fieldValues as $key =>$value) {
614 - $fldTyp = $formFields[$key]['type'] ?? null;
615 - if (!in_array($fldTyp, $fldsIncludeFile)) {
616 - continue;
617 - }
618 -
619 - if ('repeater' === $fldTyp && is_array($value)) {
620 - foreach ($value as $rIndex => $rValue) {
621 - foreach ($rValue as $subKey=>$subValue) {
622 - if (!in_array($formFields[$subKey]['type'], $fldsIncludeFile)) {
623 - continue;
624 - }
625 - // for file fields inside repeater
626 - if (is_array($subValue)) {
627 - foreach ($subValue as $fileIndex=>$fileValue) {
628 - $fieldValues[$key][$rIndex][$subKey][$fileIndex] = self::constructFileUrl($formId, $entryId, $fileValue);
629 - }
630 - } else {
631 - // for signature field inside repeater;
632 - $fieldValues[$key][$rIndex][$subKey] = self::constructFileUrl($formId, $entryId, $subValue);
633 - }
634 - }
635 - }
636 - }
637 -
638 - if (in_array($fldTyp, ['file-up', 'advanced-file-up', 'signature'], true)) {
639 - if (is_array($value)) {
640 - foreach ($value as $fldIndex=>$fldValue) {
641 - $fieldValues[$key][$fldIndex] = self::constructFileUrl($formId, $entryId, $fldValue);
642 - }
643 - } else {
644 - $fieldValues[$key] = self::constructFileUrl($formId, $entryId, $value);
645 - }
646 - }
647 - }
648 -
649 - return $fieldValues;
650 - }
651 -
652 - public static function assignRepeaterFieldValue($fieldValues, $formId)
653 - {
654 - if (!$formId) {
655 - return $fieldValues;
656 - }
657 - $form = new FormManager($formId);
658 - $formFields = $form->getFields();
659 -
660 - foreach ($fieldValues as $key=>$value) {
661 - if (!$form->isRepeaterField($key)) {
662 - continue;
663 - }
664 -
665 - if ('repeater' === $formFields[$key]['type']) {
666 - if (is_array($value)) {
667 - foreach ($value as $rIndex=>$rValue) {
668 - foreach ($rValue as $subKey =>$subValue) {
669 - $fieldValues[$subKey] = $subValue;
670 - }
671 - }
672 - }
673 - }
674 - }
675 -
676 - return $fieldValues;
677 - }
678 -
679 - public static function constructRepeaterValue($repeaterValues, $formId)
680 - {
681 - if (!$formId || !is_array($repeaterValues)) {
682 - return $repeaterValues;
683 - }
684 - $form = FormManager::getInstance($formId);
685 - $formFields = $form->getFields();
686 - $newRptrValue = [];
687 - foreach ($repeaterValues as $key=>$value) {
688 - $newRepeatedValue = [];
689 - foreach ($value as $rKey =>$rValue) {
690 - $fldLbl = isset($formFields[$rKey]) ? $formFields[$rKey]['label'] : $rKey;
691 - $newRepeatedValue[$fldLbl] = $rValue;
692 - }
693 - $newRptrValue[$key] = $newRepeatedValue;
694 - }
695 -
696 - return $newRptrValue;
697 - }
698 -
699 - private static function constructFileUrl($formId, $entryId, $fileName)
700 - {
701 - $webPath = Helpers::getWebPathWithEncryptedEntryId($formId, $entryId);
702 -
703 - return rtrim($webPath, '/') . '/' . ltrim($fileName, '/');
704 - }
705 -
706 - // private static function constructFileUrl($formId, $entryId, $fileName)
707 - // {
708 - // $restBaseUrl = get_rest_url();
709 - // if (!$restBaseUrl) {
710 - // return $fileName;
711 - // }
712 - // //http://bitlocal.local/wp-json/bitform/v1/bitform-file-download/?formID=1&entryID=16&fileID=bit-form-1005.pdf
713 - // $queryParam = build_query([
714 - // 'formID' => $formId,
715 - // 'entryID' => $entryId,
716 - // 'fileID' => $fileName
717 - // ]);
718 -
719 - // $path = $restBaseUrl . 'bitform' . '/' . 'v1' . '/' . 'bitform-file-download' . '/' . '?' . $queryParam;
720 - // return rtrim($path, '/');
721 - // }
722 483 }