true, 'class' => true, 'style' => true, 'title' => true, 'role' => true, 'tabindex' => true, 'hidden' => true, 'contenteditable' => true, 'inert' => true, 'dir' => true, 'lang' => true, ]; } /** * data-* keys actually emitted by the renderer (free + Pro). * wp_kses has no wildcard support, so we enumerate. */ private static function dataAttrs() { return array_fill_keys([ 'data-cl', 'data-step', 'data-list', 'data-list-index', 'data-index', 'data-value', 'data-oopt', 'data-bf-other-inp', 'data-num-value', 'data-indx', 'data-parent-field-name', 'data-sitekey', 'data-theme', 'data-size', 'data-appearance', 'data-language', 'data-before-interactive-callback', 'data-after-interactive-callback', 'data-bf-show-picker', 'data-bx', 'data-ck-icn', 'data-field-key', ], true); } /** * aria-* keys actually emitted by the renderer. */ private static function ariaAttrs() { return array_fill_keys([ 'aria-label', 'aria-labelledby', 'aria-describedby', 'aria-hidden', 'aria-live', 'aria-required', 'aria-invalid', 'aria-expanded', 'aria-controls', 'aria-checked', 'aria-selected', 'aria-disabled', 'aria-pressed', 'aria-current', 'aria-owns', 'aria-haspopup', ], true); } /** * Form-specific tags + attributes layered on top of wp_kses_allowed_html('post'). */ private static function formExtras() { $common = self::commonAttrs(); $data = self::dataAttrs(); $aria = self::ariaAttrs(); $shared = array_merge($common, $data, $aria); $svgChildAttrs = array_merge($common, [ 'd' => true, 'points' => true, 'x' => true, 'y' => true, 'x1' => true, 'y1' => true, 'x2' => true, 'y2' => true, 'cx' => true, 'cy' => true, 'r' => true, 'rx' => true, 'ry' => true, 'fill' => true, 'fill-rule' => true, 'fillrule' => true, 'stroke' => true, 'stroke-width' => true, 'stroke-linecap' => true, 'stroke-linejoin' => true, 'stroke-dasharray'=> true, 'href' => true, 'xlink:href' => true, 'transform' => true, 'viewbox' => true, 'data-ck-icn' => true, ]); return [ // Form tags 'form' => array_merge($shared, [ 'action' => true, 'method' => true, 'enctype' => true, 'novalidate' => true, 'target' => true, 'name' => true, 'autocomplete' => true, ]), 'input' => array_merge($shared, [ 'name' => true, 'type' => true, 'value' => true, 'required' => true, 'disabled' => true, 'readonly' => true, 'placeholder' => true, 'min' => true, 'max' => true, 'step' => true, 'inputmode' => true, 'list' => true, 'accept' => true, 'multiple' => true, 'checked' => true, 'autocomplete' => true, 'autofocus' => true, 'maxlength' => true, 'minlength' => true, 'pattern' => true, 'size' => true, 'src' => true, 'alt' => true, 'width' => true, 'height' => true, 'capture' => true, 'form' => true, 'formaction' => true, 'formmethod' => true, 'formnovalidate' => true, 'formtarget' => true, 'dirname' => true, ]), 'textarea' => array_merge($shared, [ 'name' => true, 'placeholder' => true, 'required' => true, 'disabled' => true, 'readonly' => true, 'rows' => true, 'cols' => true, 'autocomplete'=> true, 'maxlength' => true, 'minlength' => true, 'wrap' => true, ]), 'select' => array_merge($shared, [ 'name' => true, 'disabled' => true, 'readonly' => true, 'multiple' => true, 'required' => true, 'size' => true, 'autocomplete' => true, ]), 'option' => array_merge($shared, [ 'value' => true, 'selected' => true, 'disabled' => true, 'label' => true, ]), 'optgroup' => array_merge($shared, [ 'label' => true, 'disabled' => true, ]), 'datalist' => $shared, 'fieldset' => array_merge($shared, ['disabled' => true, 'name' => true, 'form' => true]), 'legend' => $shared, 'output' => array_merge($shared, ['for' => true, 'name' => true, 'form' => true]), 'progress' => array_merge($shared, ['value' => true, 'max' => true]), 'meter' => array_merge($shared, ['value' => true, 'min' => true, 'max' => true, 'low' => true, 'high' => true, 'optimum' => true]), 'button' => array_merge($shared, [ 'type' => true, 'name' => true, 'value' => true, 'disabled' => true, 'autofocus' => true, 'form' => true, 'formaction' => true, 'formmethod' => true, 'formnovalidate' => true, 'formtarget' => true, ]), 'label' => array_merge($shared, [ 'for' => true, ]), // SVG 'svg' => array_merge($shared, [ 'xmlns' => true, 'xmlns:xlink' => true, 'viewbox' => true, 'width' => true, 'height' => true, 'fill' => true, 'stroke' => true, 'stroke-width' => true, 'stroke-linecap' => true, 'stroke-linejoin' => true, 'enable-background' => true, 'xml:space' => true, 'preserveaspectratio' => true, 'version' => true, 'baseprofile' => true, ]), 'g' => $svgChildAttrs, 'path' => $svgChildAttrs, 'polyline' => $svgChildAttrs, 'polygon' => $svgChildAttrs, 'line' => $svgChildAttrs, 'circle' => $svgChildAttrs, 'ellipse' => $svgChildAttrs, 'rect' => array_merge($svgChildAttrs, ['width' => true, 'height' => true]), 'use' => $svgChildAttrs, 'symbol' => $svgChildAttrs, 'defs' => $svgChildAttrs, 'desc' => $svgChildAttrs, 'animatetransform' => array_merge($common, [ 'attributename' => true, 'attributetype' => true, 'type' => true, 'dur' => true, 'from' => true, 'to' => true, 'repeatcount' => true, 'begin' => true, 'end' => true, 'values' => true, 'keytimes' => true, 'calcmode' => true, 'additive' => true, 'fill' => true, ]), 'animate' => array_merge($common, [ 'attributename' => true, 'attributetype' => true, 'dur' => true, 'from' => true, 'to' => true, 'repeatcount' => true, 'begin' => true, 'end' => true, 'values' => true, 'keytimes' => true, 'calcmode' => true, 'fill' => true, ]), // Media + structural extras (override 'post' attrs to add data-*/aria-* + extras) 'div' => $shared, 'span' => $shared, 'section' => $shared, 'ul' => $shared, 'ol' => $shared, 'li' => $shared, 'p' => $shared, 'a' => array_merge($shared, [ 'href' => true, 'target' => true, 'rel' => true, 'download' => true, 'name' => true, ]), 'img' => array_merge($shared, [ 'src' => true, 'alt' => true, 'width' => true, 'height' => true, 'srcset' => true, 'sizes' => true, 'loading' => true, 'decoding' => true, ]), 'picture' => $shared, 'source' => array_merge($common, ['src' => true, 'srcset' => true, 'media' => true, 'type' => true, 'sizes' => true]), 'iframe' => array_merge($shared, ['src' => true, 'name' => true, 'width' => true, 'height' => true, 'allow' => true, 'allowfullscreen' => true, 'sandbox' => true, 'referrerpolicy' => true, 'loading' => true]), 'canvas' => array_merge($shared, ['width' => true, 'height' => true]), 'h1' => $shared, 'h2' => $shared, 'h3' => $shared, 'h4' => $shared, 'h5' => $shared, 'h6' => $shared, 'br' => $common, 'hr' => $common, // bf_globals + show-picker bridge are emitted via wp_add_inline_script, // so they never travel through kses. The remaining inline