PluginProbe
Fluent Forms – Customizable Contact Forms, Survey, Quiz, & Conversational Form Builder / 6.2.7
Fluent Forms – Customizable Contact Forms, Survey, Quiz, & Conversational Form Builder v6.2.7
6.2.14 6.2.13 6.2.12 6.2.10 6.2.11 6.2.9 6.2.8 6.2.7 6.2.6 6.2.5 6.2.4 6.2.3 6.2.2 3.6.22 3.6.31 3.6.40 3.6.41 3.6.42 3.6.50 3.6.51 3.6.60 3.6.61 3.6.62 3.6.64 3.6.65 All 196 releases
fluentform / app / Services / FormBuilder / ShortCodeParser.php

ShortCodeParser.php in Fluent Forms – Customizable Contact Forms, Survey, Quiz, & Conversational Form Builder 6.2.7, at app/Services/FormBuilder/ShortCodeParser.php

693 lines 25.7 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 namespace FluentForm\App\Services\FormBuilder;
4
5 use FluentForm\App\Models\SubmissionMeta;
6 use FluentForm\App\Modules\Form\FormDataParser;
7 use FluentForm\App\Modules\Form\FormFieldsParser;
8 use FluentForm\App\Services\Browser\Browser;
9 use FluentForm\Framework\Helpers\ArrayHelper;
10 use FluentForm\App\Helpers\Helper;
11
12 class ShortCodeParser
13 {
14 protected static $form = null;
15
16 protected static $entry = null;
17
18 protected static $browser = null;
19
20 protected static $formFields = null;
21
22 protected static $provider = null;
23
24 protected static $store = [
25 'inputs' => null,
26 'original_inputs' => null,
27 'user' => null,
28 'post' => null,
29 'other' => null,
30 'submission' => null,
31 ];
32
33 public static function parse($parsable, $entryId, $data = [], $form = null, $isUrl = false, $providerOrIsHTML = false, $htmlSanitized = false)
34 {
35 try {
36 static::setDependencies($entryId, $data, $form, $providerOrIsHTML);
37
38 if (is_array($parsable)) {
39 return static::parseShortCodeFromArray($parsable, $isUrl, $providerOrIsHTML, $htmlSanitized);
40 }
41
42 return static::parseShortCodeFromString($parsable, $isUrl, $providerOrIsHTML, $htmlSanitized);
43 } catch (\Exception $e) {
44 if (defined('WP_DEBUG') && WP_DEBUG) {
45 // phpcs:ignore WordPress.PHP.DevelopmentFunctions.error_log_error_log -- Debug logging only when WP_DEBUG is enabled, helps developers troubleshoot shortcode parsing issues
46 error_log($e->getTraceAsString());
47 }
48 return '';
49 }
50 }
51
52 protected static function setDependencies($entry, $data, $form, $provider)
53 {
54 static::setEntry($entry);
55 static::setData($data);
56 static::setForm($form);
57 static::$provider = $provider;
58 }
59
60 protected static function setEntry($entry)
61 {
62 static::$entry = $entry;
63 }
64
65 protected static function setdata($data)
66 {
67 if (!is_null($data)) {
68 static::$store['inputs'] = $data;
69 static::$store['original_inputs'] = $data;
70 } else {
71 $data = json_decode(static::getEntry()->response, true);
72 static::$store['inputs'] = $data;
73 static::$store['original_inputs'] = $data;
74 }
75 }
76
77 protected static function setForm($form)
78 {
79 if (!is_null($form)) {
80 static::$form = $form;
81 } else {
82 static::$form = static::getEntry()->form_id;
83 }
84 }
85
86 protected static function parseShortCodeFromArray($parsable, $isUrl = false, $provider = false, $htmlSanitized = false)
87 {
88 foreach ($parsable as $key => $value) {
89 if (is_array($value)) {
90 $parsable[$key] = static::parseShortCodeFromArray($value, $isUrl, $provider, $htmlSanitized);
91 } else {
92 $isHtml = false;
93 if ($provider) {
94 $isHtml = apply_filters_deprecated(
95 'ff_will_return_html',
96 [
97 false,
98 $provider,
99 $key
100 ],
101 FLUENTFORM_FRAMEWORK_UPGRADE,
102 'fluentform/will_return_html',
103 'Use fluentform/will_return_html instead of ff_will_return_html.'
104 );
105 $isHtml = apply_filters('fluentform/will_return_html', $isHtml, $provider, $key);
106 }
107 $parsable[$key] = static::parseShortCodeFromString($value, $isUrl, $isHtml, $htmlSanitized);
108 }
109 }
110
111 return $parsable;
112 }
113
114 protected static function parseShortCodeFromString($parsable, $isUrl = false, $isHtml = false, $htmlSanitized = false)
115 {
116 if ('0' === $parsable) {
117 return $parsable;
118 }
119
120 if (!$parsable) {
121 return '';
122 }
123 return preg_replace_callback('/{+(.*?)}/', function ($matches) use ($isUrl, $isHtml, $htmlSanitized) {
124 $value = '';
125 if (false !== strpos($matches[1], 'inputs.')) {
126 $formProperty = substr($matches[1], strlen('inputs.'));
127 $value = static::getFormData($formProperty, $isHtml);
128 } else if (false !== strpos($matches[1], 'labels.')) {
129 $formLabelProperty = substr($matches[1], strlen('labels.'));
130 $value = static::getFormLabelData($formLabelProperty);
131 } elseif (false !== strpos($matches[1], 'user.')) {
132 $userProperty = substr($matches[1], strlen('user.'));
133 $value = static::getUserData($userProperty);
134 } elseif (false !== strpos($matches[1], 'embed_post.')) {
135 $postProperty = substr($matches[1], strlen('embed_post.'));
136 $value = static::getPostData($postProperty);
137 } elseif (false !== strpos($matches[1], 'wp.')) {
138 $wpProperty = substr($matches[1], strlen('wp.'));
139 $value = static::getWPData($wpProperty);
140 } elseif (false !== strpos($matches[1], 'submission.')) {
141 $submissionProperty = substr($matches[1], strlen('submission.'));
142 $value = static::getSubmissionData($submissionProperty);
143 } elseif (false !== strpos($matches[1], 'cookie.')) {
144 $scookieProperty = substr($matches[1], strlen('cookie.'));
145 $value = array_key_exists($scookieProperty, $_COOKIE) ? wp_unslash($_COOKIE[$scookieProperty]) : '';
146 } elseif (false !== strpos($matches[1], 'payment.')) {
147 $property = substr($matches[1], strlen('payment.'));
148 $deprecatedValue = apply_filters_deprecated(
149 'fluentform_payment_smartcode', [
150 '',
151 $property,
152 self::getInstance()
153 ],
154 FLUENTFORM_FRAMEWORK_UPGRADE,
155 'fluentform/payment_smartcode',
156 'Use fluentform/payment_smartcode instead of fluentform_payment_smartcode.'
157 );
158
159 $value = apply_filters('fluentform/payment_smartcode', $deprecatedValue, $property, self::getInstance());
160 } else {
161 $value = static::getOtherData($matches[1]);
162 }
163
164 if (is_array($value)) {
165 $value = fluentImplodeRecursive(', ', $value);
166 }
167
168 if ($isUrl) {
169 // Don't encode values that are already complete URLs like {wp.site_url}
170 if (!preg_match('#^https?://#i', (string) $value)) {
171 $value = rawurlencode($value);
172 }
173 } else if ($htmlSanitized) {
174 $value = fluentform_sanitize_html($value);
175 }
176
177 return $value;
178 }, $parsable);
179 }
180
181 protected static function getFormData($key, $isHtml = false)
182 {
183 if (strpos($key, '.label')) {
184 $key = str_replace('.label', '', $key);
185 $isHtml = true;
186 }
187
188 if (strpos($key, '.value')) {
189 $key = str_replace('.value', '', $key);
190 return ArrayHelper::get(static::$store['original_inputs'], $key);
191 }
192
193 if (strpos($key, '.') && !isset(static::$store['inputs'][$key])) {
194 return ArrayHelper::get(
195 static::$store['original_inputs'],
196 $key,
197 ''
198 );
199 }
200
201 if (!isset(static::$store['inputs'][$key])) {
202 static::$store['inputs'][$key] = ArrayHelper::get(
203 static::$store['inputs'],
204 $key,
205 ''
206 );
207 }
208
209 if (is_null(static::$formFields)) {
210 static::$formFields = FormFieldsParser::getShortCodeInputs(
211 static::getForm(),
212 ['admin_label', 'attributes', 'options', 'raw']
213 );
214 }
215
216 $field = ArrayHelper::get(static::$formFields, $key, '');
217
218 if (!$field) {
219 return '';
220 }
221
222 if ($isHtml) {
223 $originalInput = ArrayHelper::get(static::$store['original_inputs'], $key, '');
224 $originalInput = apply_filters_deprecated(
225 'fluentform_response_render_' . $field['element'],
226 [
227 $originalInput,
228 $field,
229 static::getForm()->id,
230 $isHtml
231 ],
232 FLUENTFORM_FRAMEWORK_UPGRADE,
233 'fluentform/response_render_' . $field['element'],
234 'Use fluentform/response_render_' . $field['element'] . ' instead of fluentform_response_render_' . $field['element']
235 );
236 return apply_filters(
237 'fluentform/response_render_' . $field['element'],
238 $originalInput,
239 $field,
240 static::getForm()->id,
241 $isHtml
242 );
243 }
244
245 static::$store['inputs'][$key] = apply_filters_deprecated(
246 'fluentform_response_render_' . $field['element'],
247 [
248 static::$store['inputs'][$key],
249 $field,
250 static::getForm()->id,
251 $isHtml
252 ],
253 FLUENTFORM_FRAMEWORK_UPGRADE,
254 'fluentform/response_render_' . $field['element'],
255 'Use fluentform/response_render_' . $field['element'] . ' instead of fluentform_response_render_' . $field['element']
256 );
257
258 return static::$store['inputs'][$key] = apply_filters(
259 'fluentform/response_render_' . $field['element'],
260 static::$store['inputs'][$key],
261 $field,
262 static::getForm()->id,
263 $isHtml
264 );
265 }
266
267 protected static function getFormLabelData($key)
268 {
269 if (is_null(static::$formFields)) {
270 static::$formFields = FormFieldsParser::getShortCodeInputs(
271 static::getForm(),
272 ['admin_label', 'attributes', 'options', 'raw', 'label']
273 );
274 }
275
276 // Resolve global validation messages {labels.current_field} shortcode.
277 // Current field name attribute was setted as inputs data key 'current_field'.
278 if ('current_field' === $key && $currentFieldName = ArrayHelper::get(static::$store['inputs'], $key)) {
279 $currentFieldName = str_replace(['[', ']'], ['.', ''], $currentFieldName);
280 $key = $currentFieldName;
281 }
282 $inputLabel = ArrayHelper::get(ArrayHelper::get(static::$formFields, $key, []), 'label', '');
283 $inputLabel = str_replace(['[', ']'], '', $inputLabel);
284 $keys = explode(".", $key);
285 if (count($keys) > 1) {
286 $parentKey = array_shift($keys);
287 $inputLabel = str_replace($parentKey, '', $inputLabel);
288 }
289 if (empty($inputLabel)) {
290 $inputLabel = ArrayHelper::get(ArrayHelper::get(static::$formFields, $key, []), 'admin_label', '');
291 }
292 if (empty($inputLabel) && isset($parentKey) && $parentKey) {
293 $inputLabel = ArrayHelper::get(ArrayHelper::get(static::$formFields, $parentKey, []), 'label', '');
294 $key = $parentKey;
295 }
296
297 return apply_filters('fluentform/input_label_shortcode', $inputLabel, $key, static::getForm());
298 }
299
300 protected static function getUserData($key)
301 {
302 if (is_null(static::$store['user'])) {
303 static::$store['user'] = wp_get_current_user();
304 }
305 return static::$store['user']->{$key};
306 }
307
308 protected static function getPostData($key)
309 {
310 if (is_null(static::$store['post'])) {
311 $postId = static::$store['inputs']['__fluent_form_embded_post_id'];
312 static::$store['post'] = get_post($postId);
313 if (is_null(static::$store['post'])) {
314 return '';
315 }
316 static::$store['post']->permalink = get_the_permalink(static::$store['post']);
317 }
318
319 if (false !== strpos($key, 'author.')) {
320 $authorProperty = substr($key, strlen('author.'));
321 $authorId = static::$store['post']->post_author;
322 if ($authorId) {
323 $data = get_the_author_meta($authorProperty, $authorId);
324 if (!is_array($data)) {
325 return $data;
326 }
327 }
328 return '';
329 } elseif (false !== strpos($key, 'meta.')) {
330 $metaKey = substr($key, strlen('meta.'));
331 $postId = static::$store['post']->ID;
332 $data = get_post_meta($postId, $metaKey, true);
333 if (!is_array($data)) {
334 return $data;
335 }
336 return '';
337 } elseif (false !== strpos($key, 'acf.')) {
338 $metaKey = substr($key, strlen('acf.'));
339 $postId = static::$store['post']->ID;
340 if (function_exists('get_field')) {
341 $data = get_field($metaKey, $postId, true);
342 if (!is_array($data)) {
343 return $data;
344 }
345 return '';
346 }
347 }
348
349 return static::$store['post']->{$key};
350 }
351
352 protected static function getWPData($key)
353 {
354 if ('admin_email' == $key) {
355 return get_option('admin_email');
356 }
357 if ('site_url' == $key) {
358 return site_url();
359 }
360 if ('site_title' == $key) {
361 return get_option('blogname');
362 }
363 return $key;
364 }
365
366 protected static function getSubmissionData($key)
367 {
368 $entry = static::getEntry();
369
370 if (empty($entry->id)) {
371 return '';
372 }
373
374 $columns = Helper::getEntryColumns($entry);
375
376 if (array_key_exists($key, $columns)) {
377 if ('total_paid' == $key || 'payment_total' == $key) {
378 return round($entry->{$key} / 100, 2);
379 }
380 if ('payment_method' == $key && 'test' == $entry->{$key}) {
381 return __('Offline', 'fluentform');
382 }
383 return $entry->{$key};
384 }
385 if ('admin_view_url' == $key) {
386 return admin_url('admin.php?page=fluent_forms&route=entries&form_id=' . $entry->form_id . '#/entries/' . $entry->id);
387 } elseif ('entry_uid' == $key) {
388 return static::getShortEntryUid($entry);
389 } elseif ('entry_uid_link' == $key) {
390 return static::getEntryUidLink($entry);
391 } elseif (false !== strpos($key, 'meta.')) {
392 $metaKey = substr($key, strlen('meta.'));
393 $data = Helper::getSubmissionMeta($entry->id, $metaKey);
394 if (!is_array($data)) {
395 return $data;
396 }
397 return '';
398 }
399
400 return '';
401 }
402
403 protected static function getOtherData($key)
404 {
405 if (0 === strpos($key, 'date.')) {
406 $format = str_replace('date.', '', $key);
407 return date($format, strtotime(current_time('mysql')));
408 } elseif ('admin_email' == $key) {
409 return get_option('admin_email', false);
410 } elseif ('ip' == $key) {
411 return static::getRequest()->getIp();
412 } elseif ('browser.platform' == $key) {
413 return static::getUserAgent()->getPlatform();
414 } elseif ('browser.name' == $key) {
415 return static::getUserAgent()->getBrowser();
416 } elseif (in_array($key, ['all_data', 'all_data_without_hidden_fields'])) {
417 $formFields = FormFieldsParser::getEntryInputs(static::getForm());
418 $inputLabels = FormFieldsParser::getAdminLabels(static::getForm(), $formFields);
419 $response = FormDataParser::parseFormSubmission(static::getEntry(), static::getForm(), $formFields, true);
420
421 $status = apply_filters_deprecated(
422 'fluentform_all_data_skip_password_field',
423 [
424 __return_true()
425 ],
426 FLUENTFORM_FRAMEWORK_UPGRADE,
427 'fluentform/all_data_skip_password_field',
428 'Use fluentform/all_data_skip_password_field instead of fluentform_all_data_skip_password_field.'
429 );
430
431 if (apply_filters('fluentform/all_data_skip_password_field', $status)) {
432 $passwords = FormFieldsParser::getInputsByElementTypes(static::getForm(), ['input_password']);
433 if (is_array($passwords) && !empty($passwords)) {
434 $user_inputs = $response->user_inputs;
435 ArrayHelper::forget($user_inputs, array_keys($passwords));
436 $response->user_inputs = $user_inputs;
437 }
438 }
439
440 $hideHiddenField = true;
441 $hideHiddenField = apply_filters_deprecated(
442 'fluentform_all_data_without_hidden_fields',
443 [
444 $hideHiddenField
445 ],
446 FLUENTFORM_FRAMEWORK_UPGRADE,
447 'fluentform/all_data_without_hidden_fields',
448 'Use fluentform/all_data_without_hidden_fields instead of fluentform_all_data_without_hidden_fields.'
449 );
450 $skipHiddenFields = ('all_data_without_hidden_fields' == $key) &&
451 apply_filters('fluentform/all_data_without_hidden_fields', $hideHiddenField);
452
453 if ($skipHiddenFields) {
454 $hiddenFields = FormFieldsParser::getInputsByElementTypes(static::getForm(), ['input_hidden']);
455 if (is_array($hiddenFields) && !empty($hiddenFields)) {
456 ArrayHelper::forget($response->user_inputs, array_keys($hiddenFields));
457 }
458 }
459
460 $html = '<table class="ff_all_data" width="600" cellpadding="0" cellspacing="0"><tbody>';
461 foreach ($inputLabels as $inputKey => $label) {
462 if (array_key_exists($inputKey, $response->user_inputs) && '' !== ArrayHelper::get($response->user_inputs, $inputKey)) {
463 $data = ArrayHelper::get($response->user_inputs, $inputKey);
464 if (is_array($data) || is_object($data)) {
465 continue;
466 }
467 // $label is admin-set, $data is already sanitized via fluentFormSanitizer() on submission insert
468 $html .= '<tr class="field-label"><th style="padding: 6px 12px; background-color: #f8f8f8; text-align: left;"><strong>' . $label . '</strong></th></tr><tr class="field-value"><td style="padding: 6px 12px 12px 12px;">' . $data . '</td></tr>';
469 }
470 }
471
472 $html .= '</tbody></table>';
473 $html = apply_filters_deprecated(
474 'fluentform_all_data_shortcode_html',
475 [
476 $html,
477 $formFields,
478 $inputLabels,
479 $response
480 ],
481 FLUENTFORM_FRAMEWORK_UPGRADE,
482 'fluentform/all_data_shortcode_html',
483 'Use fluentform/all_data_shortcode_html instead of fluentform_all_data_shortcode_html.'
484 );
485 return apply_filters('fluentform/all_data_shortcode_html', $html, $formFields, $inputLabels, $response);
486 } elseif ('http_referer' === $key) {
487 return wp_get_referer();
488 } elseif (0 === strpos($key, 'pdf.download_link.')) {
489 $key = apply_filters_deprecated(
490 'fluentform_shortcode_parser_callback_pdf.download_link.public',
491 [
492 $key, static::getInstance()
493 ],
494 FLUENTFORM_FRAMEWORK_UPGRADE,
495 'fluentform/shortcode_parser_callback_pdf.download_link.public',
496 'Use fluentform/shortcode_parser_callback_pdf.download_link.public instead of fluentform_shortcode_parser_callback_pdf.download_link.public.'
497 );
498 return apply_filters('fluentform/shortcode_parser_callback_pdf.download_link.public', $key, static::getInstance());
499 } elseif (false !== strpos($key, 'random_string.')) {
500 $exploded = explode('.', $key);
501 $prefix = array_pop($exploded);
502 $value = $prefix . uniqid();
503
504 return apply_filters('fluentform/shortcode_parser_callback_random_string', $value, $prefix, static::getInstance());
505 } elseif ('form_title' == $key) {
506 return static::getForm()->title;
507 } elseif (false !== strpos($key, 'chat_gpt_response.')) {
508 if (defined('FLUENTFORMPRO') && class_exists('\FluentFormPro\classes\Chat\ChatFieldController')) {
509 $exploded = explode('.', $key);
510 $prefix = array_pop($exploded);
511 if (!$prefix) {
512 return '';
513 }
514 $exploded = explode('_', $prefix);
515 $formId = reset($exploded);
516 $feedId = end($exploded);
517 $chatGPT = new \FluentFormPro\classes\Chat\ChatFieldController(wpFluentForm());
518 if ($chatGPT->api->isApiEnabled()) {
519 $entry = static::getEntry();
520 $lastResponse = SubmissionMeta::retrieve("chat_gpt_response_{$feedId}", $entry->id);
521 if (!$lastResponse) {
522 $response = $chatGPT->chatGPTSubmissionMessageHandler($formId, $feedId, static::getInstance());
523 SubmissionMeta::persist($entry->id, "chat_gpt_response_{$feedId}", $response, $formId);
524 return $response;
525 }
526 return $lastResponse;
527 }
528 }
529 return '';
530 }
531
532
533 // if it's multi line then just return
534 if (false !== strpos($key, PHP_EOL)) { // most probably it's a css
535 return '{' . $key . '}';
536 }
537
538
539 $groups = explode('.', $key);
540 if (count($groups) > 1) {
541 $group = array_shift($groups);
542 $property = implode('.', $groups);
543 $handlerValue = apply_filters_deprecated(
544 'fluentform_smartcode_group_' . $group,
545 [
546 $property,
547 static::getInstance()
548 ],
549 FLUENTFORM_FRAMEWORK_UPGRADE,
550 'fluentform/smartcode_group_' . $group,
551 'Use fluentform/smartcode_group_' . $group . ' instead of fluentform_smartcode_group_' . $group
552 );
553
554 $handlerValue = apply_filters('fluentform/smartcode_group_' . $group, $handlerValue, static::getInstance());
555 if ($handlerValue != $property) {
556 return $handlerValue;
557 }
558 }
559
560 // This fallback actually
561 $handlerValue = apply_filters_deprecated(
562 'fluentform_shortcode_parser_callback_' . $key,
563 [
564 '{' . $key . '}',
565 static::getInstance()
566 ],
567 FLUENTFORM_FRAMEWORK_UPGRADE,
568 'fluentform/shortcode_parser_callback_' . $key,
569 'Use fluentform/shortcode_parser_callback_' . $key . ' instead of fluentform_shortcode_parser_callback_' . $key
570 );
571
572
573 $handlerValue = apply_filters('fluentform/shortcode_parser_callback_' . $key, $handlerValue, static::getInstance());
574
575 if ($handlerValue) {
576 return $handlerValue;
577 }
578
579 return '';
580 }
581
582 public static function getForm()
583 {
584 if (!is_object(static::$form)) {
585 static::$form = wpFluent()->table('fluentform_forms')->find(static::$form);
586 }
587
588 return static::$form;
589 }
590
591 public static function getProvider()
592 {
593 return static::$provider;
594 }
595
596 public static function getEntry()
597 {
598 if (!is_object(static::$entry)) {
599 static::$entry = wpFluent()->table('fluentform_submissions')->find(static::$entry);
600 }
601
602 return static::$entry;
603 }
604
605 protected static function getRequest()
606 {
607 return wpFluentForm('request');
608 }
609
610 protected static function getUserAgent()
611 {
612 if (is_null(static::$browser)) {
613 static::$browser = new Browser();
614 }
615 return static::$browser;
616 }
617
618 public static function getInstance()
619 {
620 static $instance;
621 if ($instance) {
622 return $instance;
623 }
624 $instance = new static();
625 return $instance;
626 }
627
628 public static function getInputs()
629 {
630 return static::$store['original_inputs'];
631 }
632
633 /**
634 * Get the entry UID link for a submission
635 *
636 * @param object $entry
637 * @return string
638 */
639 protected static function getEntryUidLink($entry)
640 {
641 // Check if entry already has the entry_uid_link property
642 if (isset($entry->entry_uid_link)) {
643 return $entry->entry_uid_link;
644 }
645
646 // Check if front-end entry view is enabled for this form
647 $frontEndSettings = Helper::getFormMeta($entry->form_id, 'front_end_entry_view', []);
648 if (ArrayHelper::get($frontEndSettings, 'status') !== 'yes') {
649 return '';
650 }
651
652 // Get the UID hash from submission meta
653 $meta = wpFluent()->table('fluentform_submission_meta')
654 ->where('response_id', $entry->id)
655 ->where('meta_key', '_entry_uid_hash')
656 ->first();
657
658 if (!$meta || !$meta->value) {
659 return '';
660 }
661
662 // Generate the link
663 return site_url('?ff_entry=1&hash=' . $meta->value);
664 }
665
666 protected static function getShortEntryUid($entry)
667 {
668 if (empty($entry->id)) {
669 return '';
670 }
671
672 $entryId = strtoupper(base_convert((string) absint($entry->id), 10, 36));
673 $entryHash = SubmissionMeta::retrieve('_entry_uid_hash', $entry->id);
674
675 if (!$entryHash) {
676 return $entryId;
677 }
678
679 return $entryId . '-' . strtoupper(substr($entryHash, 0, 4));
680 }
681
682 public static function resetData()
683 {
684 self::$form = null;
685 self::$entry = null;
686 self::$browser = null;
687 self::$formFields = null;
688
689 FormFieldsParser::resetData();
690 FormDataParser::resetData();
691 }
692 }
693