> */ final class KsesTags { /** * Inline SVG icons. * * @return array> */ public static function svg(): array { $shape = array( 'fill' => true, 'stroke' => true, 'stroke-width' => true, 'stroke-linecap' => true, 'stroke-linejoin' => true, 'class' => true, ); return array( 'svg' => $shape + array( 'xmlns' => true, 'viewbox' => true, 'width' => true, 'height' => true, 'role' => true, 'focusable' => true, 'aria-hidden' => true, ), 'g' => $shape, 'title' => array(), 'path' => $shape + array( 'd' => true ), 'circle' => $shape + array( 'cx' => true, 'cy' => true, 'r' => true ), 'ellipse' => $shape + array( 'cx' => true, 'cy' => true, 'rx' => true, 'ry' => true ), 'rect' => $shape + array( 'x' => true, 'y' => true, 'width' => true, 'height' => true, 'rx' => true, 'ry' => true ), 'line' => $shape + array( 'x1' => true, 'y1' => true, 'x2' => true, 'y2' => true ), 'polyline' => $shape + array( 'points' => true ), 'polygon' => $shape + array( 'points' => true ), 'text' => $shape + array( 'x' => true, 'y' => true, 'dy' => true, 'font-size' => true, 'text-anchor' => true ), ); } /** * The help-icon trigger: a button wrapping one of the SVG icons above. * * @return array> */ public static function help_icon(): array { return self::svg() + array( 'button' => array( 'type' => true, 'class' => true, 'data-help-key' => true, 'aria-expanded' => true, 'aria-haspopup' => true, 'aria-label' => true, ), ); } /** * A plain inline link, already built from esc_url()/esc_html__() parts — * running it through wp_kses() at the point of output is what lets the * printf() argument carry no suppression. * * @return array> */ public static function link(): array { return array( 'a' => array( 'href' => true, 'class' => true, 'target' => true, 'rel' => true, 'title' => true, ), ); } /** * The collapsible-card toggle: a button wrapping one of the SVG icons. * Kept separate from help_icon() because the attributes differ * (data-card / aria-controls instead of data-help-key). * * @return array> */ public static function card_toggle(): array { return self::svg() + array( 'button' => array( 'type' => true, 'class' => true, 'data-card' => true, 'aria-expanded' => true, 'aria-controls' => true, 'aria-label' => true, ), ); } /** * Attachment markup as returned by wp_get_attachment_image(): an * with the responsive attributes core adds (srcset/sizes/loading/decoding). * * @return array> */ public static function attachment_image(): array { return array( 'img' => array( 'src' => true, 'srcset' => true, 'sizes' => true, 'alt' => true, 'width' => true, 'height' => true, 'class' => true, 'id' => true, 'style' => true, 'loading' => true, 'decoding' => true, 'fetchpriority' => true, 'title' => true, ), ); } /** * The "generate with AI" trigger next to a settings field. Kept separate * from help_icon()/card_toggle() for the same reason those are separate * from each other — the attributes differ (data-field / data-target, read * by the shared meta-box-ai.js click handler). * * @return array> */ public static function ai_button(): array { return array( 'button' => array( 'type' => true, 'class' => true, 'data-field' => true, 'data-target' => true, ), 'p' => array( 'class' => true ), ); } /** * An icon plus a short text label (Pro teaser badges). * * @return array> */ public static function badge(): array { return self::svg() + array( 'span' => array( 'class' => true, 'title' => true ), 'a' => array( 'class' => true, 'href' => true, 'target' => true, 'rel' => true, 'title' => true ), 'em' => array( 'class' => true ), 'strong' => array( 'class' => true ), ); } }