PluginProbe
Bit Form – Contact Form, Payment Forms, Multi Step Forms, Calculator & Custom Form Builder / V3.3.2
Bit Form – Contact Form, Payment Forms, Multi Step Forms, Calculator & Custom Form Builder vV3.3.2
V3.3.2 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 All 139 releases
← All changes | includes/Core/Util/FrontendHelpers.php +66 -0 3.1.1 → V3.3.2 View file →
@@ -271,8 +271,34 @@
271 271 {
272 272 return array_unique(self::getAllFormIdsInPage());
273 273 }
274 274
275 + /**
276 + * URL of a generated stylesheet, carrying the form update version in the src.
277 + *
278 + * WP's own $ver argument is stripped by "remove query strings from static
279 + * resources" hardening (WP Ghost, optimizer snippets), which leaves a
280 + * regenerated stylesheet behind a CDN under its unchanged URL - the markup
281 + * then carries class names the cached CSS has never heard of. bfv rides
282 + * inside the src the way the generated JS bundle already does, so those
283 + * filters leave it alone. Falls back to the plugin version so the URL always
284 + * changes on upgrade, even where the option was never written.
285 + *
286 + * @param string $relativePath path under the bitforms upload dir, e.g. form-styles/bitform-15.css
287 + *
288 + * @return string
289 + */
290 + public static function styleSrc($relativePath)
291 + {
292 + $version = get_option('bitform_form_update_version');
293 + if (!$version) {
294 + $version = BITFORMS_VERSION;
295 + }
296 + $src = BITFORMS_UPLOAD_BASE_URL . '/' . ltrim((string) $relativePath, '/');
297 +
298 + return add_query_arg('bfv', rawurlencode((string) $version), $src);
299 + }
300 +
275 301 public static function hasMultipleForms()
276 302 {
277 303 $bfUniqFormIds = self::getAllFormIdsInPage();
278 304 self::checkIsPageBuilder($_SERVER);
@@ -278,8 +304,48 @@
278 304 self::checkIsPageBuilder($_SERVER);
279 305 $isPageBuilder = self::$isPageBuilder;
280 306 $bfMultipleFormsExists = $isPageBuilder ? true : count($bfUniqFormIds) > 1;
281 307 return $bfMultipleFormsExists;
308 + }
309 +
310 + /**
311 + * Field keys the browser reported as hidden at submit time.
312 + *
313 + * Comma joined, and must be compared key by key: a substring test lets a hidden `b1-175`
314 + * also match `b1-17`.
315 + *
316 + * @param mixed $rawHiddenFields the posted `hidden_fields` value (string or array)
317 + *
318 + * @return string[]
319 + */
320 + public static function parseHiddenFieldKeys($rawHiddenFields)
321 + {
322 + if (is_array($rawHiddenFields)) {
323 + $keys = $rawHiddenFields;
324 + } elseif (is_string($rawHiddenFields)) {
325 + $keys = explode(',', $rawHiddenFields);
326 + } else {
327 + return [];
328 + }
329 +
330 + $keys = array_map(function ($key) {
331 + return is_string($key) || is_numeric($key) ? trim((string) $key) : '';
332 + }, $keys);
333 +
334 + return array_values(array_unique(array_filter($keys, function ($key) {
335 + return '' !== $key;
336 + })));
337 + }
338 +
339 + /**
340 + * @param mixed $hiddenFieldKeys parsed key list; anything else is treated as "nothing hidden"
341 + * @param string $fieldKey
342 + *
343 + * @return bool
344 + */
345 + public static function isFieldHidden($hiddenFieldKeys, $fieldKey)
346 + {
347 + return is_array($hiddenFieldKeys) && in_array($fieldKey, $hiddenFieldKeys, true);
282 348 }
283 349
284 350 public static function getFormPermissions($formId)
285 351 {