>
+ */
+ function aksrt_icon_card_kses_tags(): array {
+ return [
+ 'a' => ['href' => true, 'target' => true, 'rel' => true, 'class' => true],
+ 'badge' => ['class' => true],
+ 'span' => ['class' => true],
+ 'i' => ['class' => true, 'aria-hidden' => true],
+ 'em' => ['class' => true],
+ 'strong' => ['class' => true],
+ 'b' => ['class' => true],
+ 'small' => ['class' => true],
+ 'br' => [],
+ ];
+ }
+endif;
+
+if (!function_exists('aksrt_icon_card_kses')) :
+ /**
+ * KSES with the shared inline whitelist; falls back to wp_kses_post()
+ * when the tag helper is unavailable (e.g. file not yet loaded).
+ *
+ * @param string $value Raw admin-authored markup.
+ * @return string
+ */
+ function aksrt_icon_card_kses(string $value): string {
+ $tags = aksrt_icon_card_kses_tags();
+ return $tags ? wp_kses($value, $tags) : wp_kses_post($value);
+ }
+endif;
+
if (!function_exists('aksrt_card_icon_inner')) :
/**
* Resolve a card's stored `icon` value to renderable inner markup.
@@ -154,9 +195,9 @@ if (!function_exists('aksrt_icon_card')) :
$title = trim((string) $args['title']);
$desc = trim((string) $args['desc']);
if ($url !== '' && $title !== '') {
- $title_html = '' . wp_kses_post($title) . '';
+ $title_html = '' . aksrt_icon_card_kses($title) . '';
} else {
- $title_html = $title !== '' ? wp_kses_post($title) : '';
+ $title_html = $title !== '' ? aksrt_icon_card_kses($title) : '';
}
$body = '';
@@ -164,7 +205,7 @@ if (!function_exists('aksrt_icon_card')) :
$body .= '' . $title_html . '
';
}
if ($desc !== '') {
- $body .= '' . wp_kses_post($desc) . '
';
+ $body .= '' . aksrt_icon_card_kses($desc) . '
';
}
$class = trim((string) $args['class'] . ' ' . (string) $args['type']);
@@ -302,25 +343,17 @@ if (!function_exists('aksrt_icon_cover_card')) :
}
$icon = '' . $icon_inner . '
';
- // legacy allows HTML in title/desc (admin stores badges etc.).
+ // legacy stores/echoes title/desc raw (admin authors badge markup
+ // such as GO), so these fields go
+ // through the shared inline whitelist instead of wp_kses_post().
$title = (string) $args['title'];
$desc = (string) $args['desc'];
- $allow = [
- 'badge' => ['class' => true],
- 'span' => ['class' => true],
- 'i' => ['class' => true, 'aria-hidden' => true],
- 'em' => ['class' => true],
- 'strong' => ['class' => true],
- 'b' => [],
- 'small' => ['class' => true],
- 'br' => [],
- ];
$text = '';
if (trim(wp_strip_all_tags($title)) !== '' || str_contains($title, '<')) {
- $text .= ' ' . wp_kses_post($title) . '
';
+ $text .= ' ' . aksrt_icon_card_kses($title) . '
';
}
if (trim(wp_strip_all_tags($desc)) !== '' || str_contains($desc, '<')) {
- $text .= ' ' . wp_kses_post($desc) . '
';
+ $text .= ' ' . aksrt_icon_card_kses($desc) . '
';
}
$html = '';
diff --git a/inc/helpers/homepage/header-components.php b/inc/helpers/homepage/header-components.php
index 05f94644..2b0ffc2b 100644
--- a/inc/helpers/homepage/header-components.php
+++ b/inc/helpers/homepage/header-components.php
@@ -421,24 +421,30 @@ if (!function_exists('aksrt_header_slide')) {
$card_count = 0;
if (aksrt_header_slider_device_is_visible($args['header_slider_card_s'] ?? [])) {
$card_options = wp_parse_args((array) ($args['header_slider_card_option'] ?? []), [
- 'icon_radius4' => false, 'cards' => [],
+ 'icon_radius4' => false, 'show_widget_bg' => false, 'cards' => [],
]);
+ // legacy (Zibll): with module background the card shrinks to
+ // padding-10 inside a .zib-widget wrapper (.aksrt-panel here); the
+ // bg-less variant stretches each card in a .flex1 column.
+ $show_bg = !empty($card_options['show_widget_bg']);
$items = '';
foreach ((array) $card_options['cards'] as $card) {
if (!is_array($card) || (empty($card['icon']) && empty($card['customize_icon']) && empty($card['custom_icon']) && empty($card['icon_image']))) {
continue;
}
+ $card['class'] = $show_bg ? 'padding-10' : 'aksrt-panel';
$card['icon_class'] = trim((string) ($card['icon_class'] ?? '') . (!empty($card_options['icon_radius4']) ? ' radius4' : ''));
$inner = function_exists('aksrt_icon_cover_card') ? aksrt_icon_cover_card($card) : '';
if ($inner === '') {
continue;
}
- $items .= '' . $inner . '
';
+ $items .= '' . $inner . '
';
$card_count++;
}
if ($items !== '') {
$cards_html = '';
+ . ($show_bg ? '';
}
}
diff --git a/inc/helpers/template-tags/media-brand.php b/inc/helpers/template-tags/media-brand.php
index 541ebc71..07f96f90 100644
--- a/inc/helpers/template-tags/media-brand.php
+++ b/inc/helpers/template-tags/media-brand.php
@@ -53,14 +53,14 @@ function aksrt_render_icon_cover_card(array $card): string {
$icon_container = '' . $icon_html . '
';
- $text_html = '';
- if ($title !== '') {
- $text_html .= '
' . wp_kses_post((string) $title) . '
';
- }
- if ($desc !== '') {
- $text_html .= '
' . wp_kses_post((string) $desc) . '
';
- }
- $text_html .= '
';
+ $text_html = '';
+ if ($title !== '') {
+ $text_html .= '
' . aksrt_icon_card_kses((string) $title) . '
';
+ }
+ if ($desc !== '') {
+ $text_html .= '
' . aksrt_icon_card_kses((string) $desc) . '
';
+ }
+ $text_html .= '
';
$card_inner = $icon_container . $text_html;
$cls = 'icon-cover-card flex ac ' . esc_attr((string) ($card['class'] ?? 'aksrt-panel'));
diff --git a/src/Admin/PageConfigMetaBox.php b/src/Admin/PageConfigMetaBox.php
index 89a121e5..b14ff517 100644
--- a/src/Admin/PageConfigMetaBox.php
+++ b/src/Admin/PageConfigMetaBox.php
@@ -250,8 +250,10 @@ final class PageConfigMetaBox {
}
$link = is_array($card['link'] ?? null) ? $card['link'] : [];
$cards[] = [
- 'title' => wp_kses_post((string) ($card['title'] ?? '')),
- 'desc' => wp_kses_post((string) ($card['desc'] ?? '')),
+ // legacy echoes card title/desc raw (admin authors etc.);
+ // wp_kses_post() would strip the custom badge element.
+ 'title' => aksrt_icon_card_kses((string) ($card['title'] ?? '')),
+ 'desc' => aksrt_icon_card_kses((string) ($card['desc'] ?? '')),
// Icon picker values may carry an inline "customsvg-