Iconseasy_svg_accept_icon()

easy_svg_accept_icon()

Decides whether submitted icon markup may be stored, and returns the cleaned version.

Function · Easy SVG · Status: Internal · Defined in includes/icons.php

Internal: not part of the promised public surface. It may change without notice.

Usage

easy_svg_accept_icon( string $label, string $markup, callable $sanitize, ?callable $slugger = null, int $max_bytes = 0, ?callable $too_complex = null ): array

Example

$sanitizer = easy_svg_sanitizer();
$decision  = easy_svg_accept_icon( 'Heart', $svg, array( $sanitizer, 'sanitize' ), null, easy_svg_max_bytes(), 'easy_svg_svg_too_complex' );

Description

Pure, with every dependency injected. Order: slug from label (bad_name), empty markup (empty), size (too_large, 0 means unbounded), complexity (too_complex), sanitizer (not_svg on a throw or empty result), svg root present, then easy_svg_harden_icon_markup(). On ok it returns slug and content.

Parameters

body
$labelstring

Typed name.

body
$sanitizecallable

Returns cleaned markup or false.

body
$sluggercallable|null

Label to slug, default sanitize_title.

body
$max_bytesint

Size limit, 0 for none.

Return value

returnarray{state:string, slug?:string, content?:string}

ok, bad_name, empty, too_large, too_complex or not_svg.