';
foreach ((array) $i['plans'] as $plan) {
if (!is_array($plan)) {
continue;
}
$url = '';
$label = __('立即了解', 'jio');
if (($plan['cta_type'] ?? 'link') === 'post' && !empty($plan['post_id'])) {
$url = (string) get_permalink((int) $plan['post_id']);
$label = __('查看付费内容', 'jio');
} elseif (($plan['cta_type'] ?? 'link') === 'vip') {
$url = function_exists('jio_get_user_center_url') ? jio_get_user_center_url('vip') : home_url('/');
$url = add_query_arg('level', (int) ($plan['vip_level'] ?? 1), $url);
$label = __('开通会员', 'jio');
} else {
$link = RendererHelpers::link((array) ($plan['link'] ?? []));
$url = $link['url'];
$label = $link['text'] ?: $label;
}
$html .= '';
if (!empty($plan['featured'])) {
$html .= '' . esc_html__('推荐', 'jio') . '';
}
$html .= '' . esc_html((string) ($plan['title'] ?? '')) . '
' . esc_html((string) ($plan['price'] ?? '')) . '
' . esc_html((string) ($plan['description'] ?? '')) . '
';
foreach (RendererHelpers::lines((string) ($plan['features'] ?? '')) as $feature) {
$html .= '- ' . esc_html($feature) . '
';
}
$html .= '
' . ($url !== '' ? '' . esc_html($label) . '' : '') . '';
}
return $html . '';
}
private static function reviews(array $i): string {
$slides = '';
foreach ((array) $i['items'] as $item) {
if (!is_array($item)) {
continue;
}
$rating = max(1, min(5, (int) ($item['rating'] ?? 5)));
$slides .= '
' . str_repeat('', $rating) . '
' . esc_html((string) ($item['description'] ?? '')) . '
';
}
return '';
}
private static function faq(array $i): string {
$html = '';
if (!empty($i['search'])) {
$html .= '
';
}
$html .= '
';
foreach ((array) $i['items'] as $index => $item) {
$id = 'jio-faq-' . $index . '-' . wp_rand(1000, 9999);
$html .= '
' . wp_kses_post((string) ($item['answer'] ?? '')) . '
';
}
return $html . '
';
}
private static function stats(array $i): string {
$html = '';
}
private static function highlights(array $i): string {
$html = '';
foreach ((array) $i['items'] as $index => $item) {
$html .= RendererHelpers::card_media((array) $item, 'jio-highlight jio-highlight--' . (($index % 5 === 0) ? 'large' : 'normal'));
}
return $html . '
';
}
private static function feature_intro(array $i, array $context): string {
$tabs = $panels = '';
$key = sanitize_html_class((string) ($context['widget_id'] ?? 'preview')) ?: 'preview';
foreach ((array) $i['items'] as $index => $item) {
$tab_id = 'jio-feature-' . $key . '-tab-' . $index;
$panel_id = 'jio-feature-' . $key . '-panel-' . $index;
$tabs .= '';
$features = '';
foreach (RendererHelpers::lines((string) ($item['features'] ?? '')) as $feature) {
$features .= '' . esc_html($feature) . '';
}
$panels .= '' . RendererHelpers::card_media((array) $item) . '
' . esc_html((string) ($item['title'] ?? '')) . '
' . esc_html((string) ($item['description'] ?? '')) . '
';
}
return '' . $tabs . '
' . $panels . '
';
}
private static function tilt(array $i): string {
$html = '';
}
}