# bit-form/2.21.13/includes/Core/Util/EscapingHelper.php

Bit Form – Contact Form, Payment Forms, Multi Step Forms, Calculator &amp; Custom Form Builder, version 2.21.13. 40 lines.

- Page: https://pluginprobe.com/plugins/bit-form/2.21.13/code/includes/Core/Util/EscapingHelper.php
- Raw: https://pluginprobe.com/plugins/bit-form/2.21.13/raw/includes/Core/Util/EscapingHelper.php
- Modified: 2026-03-18T07:22:32+00:00

Line numbers below start at 1. Link to a line or a range by appending a fragment to the
page URL, for example `https://pluginprobe.com/plugins/bit-form/2.21.13/code/includes/Core/Util/EscapingHelper.php#L10-L20`.

```php
<?php

namespace BitCode\BitForm\Core\Util;

if (!defined('ABSPATH')) {
  exit;
}

/**
 * Helper for escaping output with configurable allowed HTML tags.
 */
final class EscapingHelper
{
  /**
   * Returns the default allowed HTML tags for form/shortcode output.
   * Filterable via 'bitforms_allowed_html_tags'.
   *
   * @return array<string, array<string, bool>> wp_kses-compatible allowed tags and attributes
   */
  public static function getAllowedHtmlTags()
  {
    $default = wp_kses_allowed_html('post');
    $default['script'] = array_fill_keys(['type', 'src', 'id', 'async', 'defer'], true);
    $default['style'] = array_fill_keys(['type', 'id'], true);
    $allowed = apply_filters('bitforms_allowed_html_tags', $default);
    return is_array($allowed) ? $allowed : $default;
  }

  /**
   * Sanitizes HTML for form/shortcode output using the filterable allowed tags list.
   *
   * @param string $html Raw HTML to sanitize
   * @return string Sanitized HTML
   */
  public static function ksesFormOutput($html)
  {
    return wp_kses($html, self::getAllowedHtmlTags());
  }
}

```
