PluginProbe
Bit Form – Contact Form, Payment Forms, Multi Step Forms, Calculator & Custom Form Builder / 3.3.1
Bit Form – Contact Form, Payment Forms, Multi Step Forms, Calculator & Custom Form Builder v3.3.1
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/Util/FrontendHelpers.php +40 -0 3.2.23.3.1 View file →
@@ -280,8 +280,48 @@
280 280 $bfMultipleFormsExists = $isPageBuilder ? true : count($bfUniqFormIds) > 1;
281 281 return $bfMultipleFormsExists;
282 282 }
283 283
284 + /**
285 + * Field keys the browser reported as hidden at submit time.
286 + *
287 + * Comma joined, and must be compared key by key: a substring test lets a hidden `b1-175`
288 + * also match `b1-17`.
289 + *
290 + * @param mixed $rawHiddenFields the posted `hidden_fields` value (string or array)
291 + *
292 + * @return string[]
293 + */
294 + public static function parseHiddenFieldKeys($rawHiddenFields)
295 + {
296 + if (is_array($rawHiddenFields)) {
297 + $keys = $rawHiddenFields;
298 + } elseif (is_string($rawHiddenFields)) {
299 + $keys = explode(',', $rawHiddenFields);
300 + } else {
301 + return [];
302 + }
303 +
304 + $keys = array_map(function ($key) {
305 + return is_string($key) || is_numeric($key) ? trim((string) $key) : '';
306 + }, $keys);
307 +
308 + return array_values(array_unique(array_filter($keys, function ($key) {
309 + return '' !== $key;
310 + })));
311 + }
312 +
313 + /**
314 + * @param mixed $hiddenFieldKeys parsed key list; anything else is treated as "nothing hidden"
315 + * @param string $fieldKey
316 + *
317 + * @return bool
318 + */
319 + public static function isFieldHidden($hiddenFieldKeys, $fieldKey)
320 + {
321 + return is_array($hiddenFieldKeys) && in_array($fieldKey, $hiddenFieldKeys, true);
322 + }
323 +
284 324 public static function getFormPermissions($formId)
285 325 {
286 326 if (!isset(self::$formsPermissions[$formId])) {
287 327 $formManager = FormManager::getInstance($formId);