PluginProbe
Bit Form – Contact Form, Payment Forms, Multi Step Forms, Calculator & Custom Form Builder / 2.16.2
Bit Form – Contact Form, Payment Forms, Multi Step Forms, Calculator & Custom Form Builder v2.16.2
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 2.10.2 All 137 releases
← All changes | includes/Core/Database/FormEntryMetaModel.php +196 -159 2.02.16.2 View file →
@@ -9,12 +9,14 @@
9 9 /**
10 10 * Undocumented class
11 11 */
12 12
13 -class FormEntryMetaModel extends Model {
13 +class FormEntryMetaModel extends Model
14 +{
14 15 protected static $table = 'bitforms_form_entrymeta';
15 16
16 - public function duplicateEntryMeta($data) {
17 + public function duplicateEntryMeta($data)
18 + {
17 19 $values[] = $data['duplicateID'];
18 20 $values[] = $data['entryID'];
19 21 $sql = "INSERT INTO $this->table_name (bitforms_form_entry_id,meta_key,meta_value)"
20 22 . ' SELECT %d as bitforms_form_entry_id,meta_key,meta_value'
@@ -21,9 +23,10 @@
21 23 . " FROM `$this->table_name` WHERE bitforms_form_entry_id = %d";
22 24 return $this->execute($sql, $values)->getResult();
23 25 }
24 26
25 - public function update(array $data, array $condition) {
27 + public function update(array $data, array $condition)
28 + {
26 29 $entryID = $condition['bitforms_form_entry_id'];
27 30 if (empty($entryID)) {
28 31 return false;
29 32 }
@@ -93,9 +96,10 @@
93 96 }
94 97 return $updatedData;
95 98 }
96 99
97 - public function validQueryCondition($conditions) {
100 + public function validQueryCondition($conditions)
101 + {
98 102 foreach ($conditions as $index => $condition) {
99 103 if (is_object($condition)) {
100 104 if (empty($condition->field) || empty($condition->logic) || empty($condition->val) && !in_array($condition->val, ['0', 0, 0.0], true)) {
101 105 unset($conditions[$index], $conditions[$index + 1]);
@@ -104,9 +108,10 @@
104 108 }
105 109 return $conditions;
106 110 }
107 111
108 - public function sqlQryGenerateByFldCondition($conditions) {
112 + public function sqlQryGenerateByFldCondition($conditions)
113 + {
109 114 $dbHelper = new Helper();
110 115 $sql = '';
111 116
112 117 $dateQuery = $dbHelper->dateQueryList();
@@ -121,10 +126,9 @@
121 126 $value = $dbHelper->strValueModifyByLogic($condition->logic, $condition->val);
122 127 }
123 128
124 129 $operator = $dbHelper->convertToSqlOperator($condition->logic);
125 -
126 - if (isset($dateQuery[$condition->val])) {
130 + if (!is_array($condition->val) && isset($dateQuery[$condition->val])) {
127 131 $sql .= $dbHelper->fieldQueryByDate($condition->field, $operator, $value, $condition->logic);
128 132 } else {
129 133 if (!is_int($value)) {
130 134 $value = "'" . $value . "'";
@@ -139,9 +143,10 @@
139 143
140 144 return trim($sql);
141 145 }
142 146
143 - public function queryRecount($selectedMeta, $groupedCondition, $orderCondition, $all_values) {
147 + public function queryRecount($selectedMeta, $groupedCondition, $orderCondition, $all_values)
148 + {
144 149 $entry_table = $this->app_db->prefix . 'bitforms_form_entries';
145 150 $sql = 'SELECT count(*) as count FROM (';
146 151 $sql .= "SELECT $selectedMeta FROM `$this->table_name` em";
147 152 $sql .= " INNER JOIN $entry_table e on e.id = em.bitforms_form_entry_id ";
@@ -150,9 +155,10 @@
150 155 $countResult = $this->execute($sql, $all_values)->getResult();
151 156 return $countResult[0]->count;
152 157 }
153 158
154 - public function selectedEntryMeta($formFields, $fieldCount) {
159 + public function selectedEntryMeta($formFields, $fieldCount)
160 + {
155 161 $all_values = [];
156 162 $formFieldsNames = [];
157 163 $metaChecker = 0;
158 164 $selectedMeta = '`bitforms_form_entry_id` as entry_id,';
@@ -185,13 +191,13 @@
185 191 $selectedMeta .= ',';
186 192 }
187 193 //#unused code commented by me##
188 194 // if ( !empty( $filter['global'] ) ) {
189 - // $globalFilterString .= " `" . $fieldDetails['key'] . "` LIKE '%%" . $this->getFieldFormat( $filter['global'] ) . "%%' ";
190 - // if ( $metaChecker < $fieldCount ) {
191 - // $globalFilterString .= " OR ";
192 - // }
193 - // $globalFilterValues[] = $filter['global'];
195 + // $globalFilterString .= " `" . $fieldDetails['key'] . "` LIKE '%%" . $this->getFieldFormat( $filter['global'] ) . "%%' ";
196 + // if ( $metaChecker < $fieldCount ) {
197 + // $globalFilterString .= " OR ";
198 + // }
199 + // $globalFilterValues[] = $filter['global'];
194 200 // }
195 201 }
196 202
197 203 return [
@@ -200,9 +206,10 @@
200 206 'all_values' => $all_values,
201 207 ];
202 208 }
203 209
204 - public function groupedCondition($condition, $all_values, $fieldConditions) {
210 + public function groupedCondition($condition, $all_values, $fieldConditions)
211 + {
205 212 $isFldCondition = false;
206 213 $formattedCondition = $this->getFormatedCondition($condition);
207 214 if ($formattedCondition) {
208 215 $groupedCondition = $formattedCondition['conditions'] . 'GROUP BY
@@ -214,40 +221,40 @@
214 221 //#unused code commented by me##
215 222 //$isRecount = false;
216 223
217 224 // if ( !empty( $filter['field'] ) ) {
218 - // $isRecount = true;
219 - // $filterFieldCount = count( $filter['field'] );
220 - // $filterFieldChecker = 0;
221 - // if ( $filterFieldCount > 0 ) {
222 - // $groupedCondition .= " HAVING ";
223 - // }
224 - // foreach ( $filter['field'] as $filterFieldKey => $filterFieldDetails ) {
225 - // $groupedCondition .= " `$filterFieldDetails->id` ='%%" . $this->getFieldFormat( $filterFieldDetails->value ) . "%%'";
226 - // $all_values[] = $filterFieldDetails->value;
227 - // if ( $filterFieldChecker < $filterFieldCount ) {
228 - // $groupedCondition .= " AND ";
229 - // }
230 - // }
225 + // $isRecount = true;
226 + // $filterFieldCount = count( $filter['field'] );
227 + // $filterFieldChecker = 0;
228 + // if ( $filterFieldCount > 0 ) {
229 + // $groupedCondition .= " HAVING ";
230 + // }
231 + // foreach ( $filter['field'] as $filterFieldKey => $filterFieldDetails ) {
232 + // $groupedCondition .= " `$filterFieldDetails->id` ='%%" . $this->getFieldFormat( $filterFieldDetails->value ) . "%%'";
233 + // $all_values[] = $filterFieldDetails->value;
234 + // if ( $filterFieldChecker < $filterFieldCount ) {
235 + // $groupedCondition .= " AND ";
236 + // }
237 + // }
231 238 // }
232 239
233 240 // if ( !empty( $filter['global'] ) && !empty( $globalFilterString ) && !empty( $globalFilterValues ) ) {
234 - // $isRecount = true;
235 - // if ( !empty( $filter['field'] ) ) {
236 - // $groupedCondition .= " AND (" . $globalFilterString . ") ";
237 - // } else {
238 - // $groupedCondition .= " HAVING $globalFilterString ";
239 - // }
240 - // $offset = 0;
241 - // $all_values = array_merge( $all_values, $globalFilterValues );
241 + // $isRecount = true;
242 + // if ( !empty( $filter['field'] ) ) {
243 + // $groupedCondition .= " AND (" . $globalFilterString . ") ";
244 + // } else {
245 + // $groupedCondition .= " HAVING $globalFilterString ";
246 + // }
247 + // $offset = 0;
248 + // $all_values = array_merge( $all_values, $globalFilterValues );
242 249 // }
243 250
244 251 // if ( !empty( $dateBetweenFilter ) && !empty( $dateBetweenFilter->start_date ) && !empty( $dateBetweenFilter->end_date ) ) {
245 - // if ( strpos( $groupedCondition, 'HAVING' ) !== false ) {
246 - // $groupedCondition .= " AND `__created_at` BETWEEN '" . $dateBetweenFilter->start_date . "' AND '" . $dateBetweenFilter->end_date . "' ";
247 - // } else {
248 - // $groupedCondition .= " HAVING `__created_at` BETWEEN '" . $dateBetweenFilter->start_date . "' AND '" . $dateBetweenFilter->end_date . "' ";
249 - // }
252 + // if ( strpos( $groupedCondition, 'HAVING' ) !== false ) {
253 + // $groupedCondition .= " AND `__created_at` BETWEEN '" . $dateBetweenFilter->start_date . "' AND '" . $dateBetweenFilter->end_date . "' ";
254 + // } else {
255 + // $groupedCondition .= " HAVING `__created_at` BETWEEN '" . $dateBetweenFilter->start_date . "' AND '" . $dateBetweenFilter->end_date . "' ";
256 + // }
250 257 // }
251 258
252 259 $sqlQryByFldCondtion = $this->sqlQryGenerateByFldCondition($fieldConditions);
253 260
@@ -265,9 +272,10 @@
265 272 'isFldCondition' => $isFldCondition,
266 273 ];
267 274 }
268 275
269 - public function orderCondition($formFieldsNames, $sortBy) {
276 + public function orderCondition($formFieldsNames, $sortBy)
277 + {
270 278 $orderCondition = null;
271 279 if (!empty($sortBy)) {
272 280 $sortableFieldCount = count($sortBy);
273 281 $sortableFieldChecker = 0;
@@ -296,9 +304,10 @@
296 304 $orderCondition .= empty($orderCondition) ? ' ORDER BY `bitforms_form_entry_id` DESC ' : ',`bitforms_form_entry_id` DESC ';
297 305 return $orderCondition;
298 306 }
299 307
300 - public function isEntryMetaExist($conditions) {
308 + public function isEntryMetaExist($conditions)
309 + {
301 310 $existMetaData = $this->get(
302 311 [
303 312 'meta_key',
304 313 'meta_value',
@@ -310,9 +319,10 @@
310 319 }
311 320 return false;
312 321 }
313 322
314 - public function getEntryMeta($formFields, $entries, $limit = null, $offset = null, $filter = null, $sortBy = null, $fieldConditions = null, $dateBetweenFilter = null) {
323 + public function getEntryMeta($formFields, $entries, $limit = null, $offset = null, $filter = null, $sortBy = null, $fieldConditions = null, $dateBetweenFilter = null)
324 + {
315 325 $entry_table = $this->app_db->prefix . 'bitforms_form_entries';
316 326 $fieldCount = count($formFields);
317 327 $getSelectedMetaFldValue = $this->selectedEntryMeta($formFields, $fieldCount);
318 328
@@ -383,144 +393,171 @@
383 393 ];
384 394 return $resultedEntries;
385 395 }
386 396
387 - private function csvInjectionPrevent($value) {
388 - $formula = ['=', '-', '+', '@', "\t", "\r"];
389 - $valueFilter = preg_replace('/[\]["]/i', '', $value);
390 - if (\in_array(substr($value, 0, 1), $formula, true)) {
391 - $valueFilter = "'" . trim($valueFilter);
392 - }
397 + public function getSingleEntryMeta($formFields, $entryId)
398 + {
399 + $entry_table = $this->app_db->prefix . 'bitforms_form_entries';
400 + $fieldCount = count($formFields);
401 + $getSelectedMetaFldValue = $this->selectedEntryMeta($formFields, $fieldCount);
402 + $selectedMeta = $getSelectedMetaFldValue['selected_meta'];
403 + $formFieldsNames = $getSelectedMetaFldValue['form_fields_names'];
404 + $all_values = $getSelectedMetaFldValue['all_values'];
405 + $condition['bitforms_form_entry_id'] = [$entryId];
406 + $group = $this->groupedCondition($condition, $all_values, []);
407 + $groupedCondition = $group['groupedCondition'];
408 + $all_values = $group['all_values'];
409 + $orderCondition = $this->orderCondition($formFieldsNames, null);
410 + $sql = "SELECT $selectedMeta FROM `$this->table_name` em";
411 + $sql .= " INNER JOIN $entry_table e on e.id = em.bitforms_form_entry_id ";
412 + $sql .= $groupedCondition . $orderCondition;
413 + $result = $this->execute($sql, $all_values)->getResult();
393 414
394 - return $valueFilter;
415 + if (is_wp_error($result)) {
416 + return [];
395 417 }
418 + return $result;
419 + }
396 420
397 - public function getExportEntry($formFields, $entries, $formId, $fieldLabels, $limit = null, $sortBy = null, $sortByField = null) {
398 - $entry_table = $this->app_db->prefix . 'bitforms_form_entries';
399 - $selectedEntryMeta = '`bitforms_form_entry_id` as entry_id,';
400 - $selectedEntryMeta .= "e.user_id as '__user_id',";
401 - $selectedEntryMeta .= "e.status as '__entry_status',";
402 - $selectedEntryMeta .= "e.user_ip as '__user_ip',";
403 - $selectedEntryMeta .= "e.user_location as '__user_location',";
404 - $selectedEntryMeta .= "e.user_device as '__user_device',";
405 - $selectedEntryMeta .= "e.referer as '__referer',";
406 - $selectedEntryMeta .= "e.created_at as '__created_at',";
407 - $selectedEntryMeta .= "e.updated_at as '__updated_at',";
408 - $metaChecker = 0;
421 + private function csvInjectionPrevent($value)
422 + {
423 + $formula = ['=', '-', '+', '@', "\t", "\r"];
424 + $valueFilter = preg_replace('/[\]["]/i', '', $value);
425 + if (\in_array(substr($value, 0, 1), $formula, true)) {
426 + $valueFilter = "'" . trim($valueFilter);
427 + }
409 428
410 - $entryInfo = ['__user_id', '__user_ip', /* '__user_location', */'__user_device',
411 - '__referer', '__created_at', '__updated_at'];
412 - $all_values = [];
413 - if ([] === $formFields) {
414 - $data = [
415 - 'count' => 0,
416 - 'entries' => [],
417 - ];
418 - wp_send_json_success($data, 200);
429 + return $valueFilter;
430 + }
431 +
432 + public function getExportEntry($formFields, $entries, $formId, $fieldLabels, $limit = null, $sortBy = null, $sortByField = null)
433 + {
434 + $entry_table = $this->app_db->prefix . 'bitforms_form_entries';
435 + $selectedEntryMeta = '`bitforms_form_entry_id` as entry_id,';
436 + $selectedEntryMeta .= "e.user_id as '__user_id',";
437 + $selectedEntryMeta .= "e.status as '__entry_status',";
438 + $selectedEntryMeta .= "e.user_ip as '__user_ip',";
439 + $selectedEntryMeta .= "e.user_location as '__user_location',";
440 + $selectedEntryMeta .= "e.user_device as '__user_device',";
441 + $selectedEntryMeta .= "e.referer as '__referer',";
442 + $selectedEntryMeta .= "e.created_at as '__created_at',";
443 + $selectedEntryMeta .= "e.updated_at as '__updated_at',";
444 + $metaChecker = 0;
445 +
446 + $entryInfo = ['__user_id', '__user_ip', /* '__user_location', */'__user_device',
447 + '__referer', '__created_at', '__updated_at'];
448 + $all_values = [];
449 + if ([] === $formFields) {
450 + $data = [
451 + 'count' => 0,
452 + 'entries' => [],
453 + ];
454 + wp_send_json_success($data, 200);
455 + }
456 + $fieldCount = count($formFields) - count(array_intersect($formFields, $entryInfo));
457 + $formFieldsNames = [];
458 + foreach ($formFields as $fldKey) {
459 + $formFieldsNames[] = $fldKey;
460 + if (in_array($fldKey, $entryInfo)) {
461 + continue;
419 462 }
420 - $fieldCount = count($formFields) - count(array_intersect($formFields, $entryInfo));
421 - $formFieldsNames = [];
422 - foreach ($formFields as $fldKey) {
423 - $formFieldsNames[] = $fldKey;
424 - if (in_array($fldKey, $entryInfo)) {
425 - continue;
426 - }
427 - $fieldFormat = $this->getFieldFormat($fldKey);
428 - $selectedEntryMeta .= "GROUP_CONCAT(
463 + $fieldFormat = $this->getFieldFormat($fldKey);
464 + $selectedEntryMeta .= "GROUP_CONCAT(
429 465 CASE
430 466 `meta_key`
431 467 WHEN '$fieldFormat' THEN `meta_value`
432 468 END
433 469 ) AS '$fieldFormat'";
434 - $metaChecker += 1;
435 - $all_values[] = $fldKey;
436 - $all_values[] = $fldKey;
437 - if ($metaChecker < $fieldCount) {
438 - $selectedEntryMeta .= ',';
439 - }
470 + $metaChecker += 1;
471 + $all_values[] = $fldKey;
472 + $all_values[] = $fldKey;
473 + if ($metaChecker < $fieldCount) {
474 + $selectedEntryMeta .= ',';
440 475 }
441 - $entryIDs = [];
442 - foreach ($entries as $entryDetail) {
443 - $entryIDs[] = $entryDetail->id;
444 - }
445 - if (empty($entryIDs)) {
446 - return [
447 - 'count' => 0,
448 - 'entries' => [],
449 - ];
450 - }
451 - $condition['bitforms_form_entry_id'] = $entryIDs;
452 - $formattedCondition = $this->getFormatedCondition($condition);
453 - $groupedCondition = null;
454 - if ($formattedCondition) {
455 - $groupedCondition = $formattedCondition['conditions'] . ' GROUP BY
476 + }
477 + $entryIDs = [];
478 + foreach ($entries as $entryDetail) {
479 + $entryIDs[] = $entryDetail->id;
480 + }
481 + if (empty($entryIDs)) {
482 + return [
483 + 'count' => 0,
484 + 'entries' => [],
485 + ];
486 + }
487 + $condition['bitforms_form_entry_id'] = $entryIDs;
488 + $formattedCondition = $this->getFormatedCondition($condition);
489 + $groupedCondition = null;
490 + if ($formattedCondition) {
491 + $groupedCondition = $formattedCondition['conditions'] . ' GROUP BY
456 492 `bitforms_form_entry_id` ';
457 - $all_values = array_merge($all_values, $formattedCondition['values']);
458 - }
459 - $order = \is_null($sortBy) ? 'DESC ' : "$sortBy";
460 - $orderField = \is_null($sortByField) ? 'bitforms_form_entry_id' : "`$sortByField`";
493 + $all_values = array_merge($all_values, $formattedCondition['values']);
494 + }
495 + $order = 'DESC' === $sortBy ? 'DESC ' : 'ASC ';
496 + $orderField = \is_null($sortByField) ? 'bitforms_form_entry_id' : "`$sortByField`";
461 497
462 - $orderCondition = "ORDER BY $orderField $order ";
463 - if (!\is_null($limit)) {
464 - $limitInt = \intval($limit);
465 - $limit = " LIMIT $limitInt ";
466 - }
467 - $sql = "SELECT $selectedEntryMeta FROM `$this->table_name` em";
468 - $sql .= " INNER JOIN $entry_table e on e.id = em.bitforms_form_entry_id ";
469 - $sql .= $groupedCondition . $orderCondition . $limit;
498 + $orderCondition = "ORDER BY $orderField $order ";
499 + if (!\is_null($limit)) {
500 + $limitInt = \intval($limit);
501 + $limit = " LIMIT $limitInt ";
502 + }
503 + $sql = "SELECT $selectedEntryMeta FROM `$this->table_name` em";
504 + $sql .= " INNER JOIN $entry_table e on e.id = em.bitforms_form_entry_id ";
505 + $sql .= $groupedCondition . $orderCondition . $limit;
470 506
471 - $result = $this->execute($sql, $all_values)->getResult();
472 - $allData = [];
473 - $entry_id = 'entry_id';
474 - $users = get_users(['fields' => ['ID', 'display_name']]);
475 - $userNames = [];
476 - foreach ($users as $key => $value) {
477 - $userNames[$value->ID] = $value->display_name;
478 - }
479 - foreach ($result as $key => $value) {
480 - foreach ($formFieldsNames as $formFieldName) {
481 - $allData[$key]['entry_id'] = preg_replace('/[\]["]/i', '', $value->$entry_id);
482 - if ('__user_id' === $formFieldName && intval($value->$formFieldName) > 0) {
483 - $allData[$key][$formFieldName] = $userNames[$value->$formFieldName];
484 - } elseif ('__user_ip' === $formFieldName) {
485 - $allData[$key][$formFieldName] = long2ip($value->$formFieldName);
486 - } else {
487 - $allData[$key][$formFieldName] = preg_replace('/[\]["]/i', '', $value->$formFieldName);
488 - }
507 + $result = $this->execute($sql, $all_values)->getResult();
508 + $allData = [];
509 + $entry_id = 'entry_id';
510 + $users = get_users(['fields' => ['ID', 'display_name']]);
511 + $userNames = [];
512 + foreach ($users as $key => $value) {
513 + $userNames[$value->ID] = $value->display_name;
514 + }
515 + foreach ($result as $key => $value) {
516 + foreach ($formFieldsNames as $formFieldName) {
517 + $allData[$key]['entry_id'] = preg_replace('/[\]["]/i', '', $value->$entry_id);
518 + if ('__user_id' === $formFieldName && intval($value->$formFieldName) > 0) {
519 + $allData[$key][$formFieldName] = $userNames[$value->$formFieldName];
520 + } elseif ('__user_ip' === $formFieldName) {
521 + $allData[$key][$formFieldName] = long2ip((int)$value->$formFieldName);
522 + } else {
523 + $allData[$key][$formFieldName] = preg_replace('/[\]["]/i', '', $value->$formFieldName);
489 524 }
490 525 }
526 + }
491 527
492 - if (is_wp_error($result)) {
493 - wp_send_json_error('Internal server error', 500);
494 - } else {
495 - foreach ($fieldLabels as $field) {
496 - foreach ($allData as $index => $entry) {
497 - if (array_key_exists($field['key'], $entry) && 'file-up' === $field['type']) {
498 - $key = $field['key'];
499 - if (empty($entry[$key])) {
500 - continue;
528 + if (is_wp_error($result)) {
529 + wp_send_json_error('Internal server error', 500);
530 + } else {
531 + $downloadableFieldType = ['file-up', 'signature', 'advanced-file-up'];
532 + foreach ($fieldLabels as $field) {
533 + foreach ($allData as $index => $entry) {
534 + if (array_key_exists($field['key'], $entry) && in_array($field['type'], $downloadableFieldType, true)) {
535 + $key = $field['key'];
536 + if (empty($entry[$key])) {
537 + continue;
538 + }
539 + $_upload_dir = BITFORMS_UPLOAD_DIR . DIRECTORY_SEPARATOR . $formId . DIRECTORY_SEPARATOR . $entry['entry_id'];
540 + $imageArray = explode(',', $entry[$key]);
541 + if (is_array($imageArray)) {
542 + $fileData = [];
543 + foreach ($imageArray as $file) {
544 + $path = "bitforms/bitforms-file-$formId/?formID=$formId&entryID=" . $entry['entry_id'] . "&fileID=$file";
545 + if (file_exists($_upload_dir . DIRECTORY_SEPARATOR . $file)) {
546 + $fileData[] = site_url($path, null);
547 + }
501 548 }
502 - $_upload_dir = BITFORMS_UPLOAD_DIR . DIRECTORY_SEPARATOR . $formId . DIRECTORY_SEPARATOR . $entry['entry_id'];
503 - if (is_array(explode(',', $entry[$key]))) {
504 - $fileData = [];
505 - foreach (explode(',', $entry[$key]) as $file) {
506 - $uploadedFile = explode('_', $file);
507 - $path = "bitforms/bitforms-file/?formID=$formId&entryID=" . $entry['entry_id'] . "&fileID=$uploadedFile[0]";
508 - if (file_exists($_upload_dir . DIRECTORY_SEPARATOR . $uploadedFile[0])) {
509 - $fileData[] = site_url($path, null);
510 - }
511 - }
512 - $allData[$index][$key] = implode(',', $fileData);
513 - } else {
514 - $uploadedFile = explode('_', $entry[$key]);
515 - $path = "bitforms/bitforms-file/?formID=$formId&entryID=" . $entry['entry_id'] . '&fileID=' . $uploadedFile[0];
516 - if (file_exists($_upload_dir . DIRECTORY_SEPARATOR . $uploadedFile[0])) {
517 - $allData[$index][$key] = site_url($path, null);
518 - }
549 + $allData[$index][$key] = implode(',', $fileData);
550 + } else {
551 + $uploadedFile = explode('_', $entry[$key]);
552 + $path = "bitforms/bitforms-file-$formId/?formID=$formId&entryID=" . $entry['entry_id'] . '&fileID=' . $uploadedFile[0];
553 + if (file_exists($_upload_dir . DIRECTORY_SEPARATOR . $uploadedFile[0])) {
554 + $allData[$index][$key] = site_url($path, null);
519 555 }
520 556 }
521 557 }
522 558 }
523 - wp_send_json_success($allData, 200);
524 559 }
560 + wp_send_json_success($allData, 200);
525 561 }
562 + }
526 563 }