refactor(icons): converge every icon render on aksrt_icon_markup
aksrt_get_comment_icon(), aksrt_renderer_svg_icon() and the widget renderer's private icon_markup() all delegate to the unified helper, and the duplicated 24px empty-state SVGs in user-center/user-home now come from one aksrt_empty_state_svgs(). Contract tests follow the delegation (sprite <use> markup asserted in the helper).
This commit is contained in:
@@ -543,17 +543,6 @@ final class GeneralRenderer {
|
||||
}
|
||||
|
||||
private static function icon_markup(string $icon): string {
|
||||
$icon = trim($icon);
|
||||
if ($icon === '') return '';
|
||||
if (str_starts_with($icon, 'customsvg-')) {
|
||||
return wp_kses(substr($icon, 10), [
|
||||
'svg' => ['class' => true, 'viewbox' => true, 'viewBox' => true, 'width' => true, 'height' => true, 'fill' => true, 'xmlns' => true, 'aria-hidden' => true],
|
||||
'use' => ['href' => true, 'xlink:href' => true],
|
||||
'path' => ['d' => true, 'fill' => true, 'stroke' => true, 'stroke-width' => true],
|
||||
]);
|
||||
}
|
||||
if (str_starts_with($icon, 'zibsvg-')) return '<svg class="icon" aria-hidden="true"><use xlink:href="#icon-' . esc_attr(substr($icon, 7)) . '"></use></svg>';
|
||||
if (!str_contains($icon, 'fa ') && str_contains($icon, 'fa-')) $icon = 'fa ' . $icon;
|
||||
return '<i class="' . esc_attr($icon) . '" aria-hidden="true"></i>';
|
||||
return aksrt_icon_markup($icon);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user