Sanitizers

Sample documentation (demo only)
This is an incomplete, outdated docs snapshot shipped with the playground — screenshots were removed on purpose.
For the full, current manuals go to voodflow.com/docs.

Voodflow\Voodbuilder\Support\Editor\EditorCssSanitizer

  • File: Support/Editor/EditorCssSanitizer.php
  • Kind: class
  • Responsibility: Editor can persist class-based background rules that match every section layout (shared voodbuilder-editor-section / body-font utilities). Those rules bleed one uploaded image across the whole page.

Methods

  • public static function sanitize(string $css): string
    • Strips dangerous/unsupported CSS constructs from author CSS before store/render.
  • public static function neutralizeStyleBreakout(string $css): string
    • Neutralizes CSS that could break out of the page/chrome scope.
  • public static function stripRedundantTailwindPropertyLayers(string $css): string
    • Removes redundant Tailwind @layer/@property noise from compiled CSS.
  • public static function kebabCaseCamelCssProperties(string $css): string
    • Converts camelCase CSS property names in declarations to kebab-case.

Voodflow\Voodbuilder\Support\Editor\EditorCustomCodeSanitizer

  • File: Support/Editor/EditorCustomCodeSanitizer.php
  • Kind: class
  • Responsibility: Editor Custom Code Sanitizer.

Methods

  • public static function sanitize(string $html): string
    • Strip executable content from grapesjs-custom-code output before persistence.

Voodflow\Voodbuilder\Support\Editor\EditorHtmlSanitizer

  • File: Support/Editor/EditorHtmlSanitizer.php
  • Kind: class
  • Responsibility: Editor Html Sanitizer.

Methods

  • public static function sanitize(string $html): string
    • Full HTML cleanup pipeline for editor content (security + structural repairs).
  • public static function normalizeSameOriginUrls(string $html): string
    • Rewrites same-origin absolute URLs to path-relative forms where appropriate.
  • public static function repairBrokenJsonDataAttributes(string $html): string
    • Repairs malformed JSON in data-* attributes used by editor widgets.
  • public static function repairAnimatedBlocks(string $html): string
    • Repairs animated/counter blocks into the expected DOM shape.
  • public static function syncCounterElementFromValue(\DOMElement $element, string $value): bool
    • Updates a counter element DOM from a numeric/display value.
  • public static function stripLogoScrollRuntimeClones(string $html): string
    • Removes runtime-cloned logo-scroll nodes so only author markup remains.
  • public static function restoreEmptyCtaLabels(string $html): string
    • Restores empty CTA labels that the editor may have stripped.
  • public static function stripInvalidAttributes(string $html): string
    • Removes invalid/unknown attributes from elements.
  • public static function encodeMalformedPercentSequences(string $value): string
    • Encodes broken percent-encoding sequences for safe attribute storage.
  • public static function stripOrphanPageContentText(string $html): string
    • Removes orphan text nodes outside intended page content wrappers.
  • public static function stripEditorOnlyElements(string $html): string
    • Strips elements that exist only in the canvas (not for publish).
  • public static function stripHiddenLayerElements(string $html): string
    • Removes hidden-layer editor scaffolding from HTML.
  • public static function normalizeInlineStyleCamelCase(string $html): string
    • Normalizes camelCase keys inside inline style attributes.
  • public static function stripEditorOnlyAttributes(string $html): string
    • Strips editor-only data/attrs before publish/render.

Voodflow\Voodbuilder\Support\Editor\EditorHtmlSecuritySanitizer

  • File: Support/Editor/EditorHtmlSecuritySanitizer.php
  • Kind: class
  • Responsibility: Strip the executable surface out of builder HTML, over a real DOM parse.

Methods

  • public static function sanitize(string $html, bool $allowAuthorScripts = false): string
    • DOM walk removing unsafe tags/attrs/URLs; optionally keeps author scripts when licensed.

Voodflow\Voodbuilder\Support\Editor\EditorJsSanitizer

  • File: Support/Editor/EditorJsSanitizer.php
  • Kind: class
  • Responsibility: Editor Js Sanitizer.

Methods

  • public static function sanitize(string $js): string
    • Strip obviously dangerous patterns from Editor component scripts before persistence.
Demo resets in 00:29:37