feat(widgets): phase 5 align marketing/decoration widgets with zibll

Align the 20 marketing/decoration widgets with Zibll field defs in
widget-produck.php / widget-more.php, focusing on the field-level
drift surfaced by the 1:1 audit:

- TagCloudWidget (widget_ui_tag_cloud): orderby → name/count/term_id
  (was count default), add order ASC/DESC, expand color palette to
  all 13 Zibll c-* keys (rand/c-hui/c-blue/-2/cyan/yellow/-2/green/
  -2/purple/-2/red/-2), number cap 100, default 20.
- WidgetBookmarkLinks (widget_ui_links_lists_2): add alignment
  (''/center/right) to form+update+render wrapper.
- FriendLinksWidget: expose orderby/order selects in form (already
  whitelisted) for bookmarks mode.
- ButtonsWidget (zib_widget_ui_buttons): whitelist pc_padding/
  m_padding/pc_width/m_width (were render-only), widen pc_gap/
  m_gap cap to 60 to match Zibll.
- RecentCommentsWidget (widget_ui_new_comment): count cap 50
  (was 20), whitelist outer_keywords.
- WidgetVideoPlayer (zib_widget_ui_dplayer): scale_height cap 200
  (was 100), whitelist muted + aspect_ratio.

Remaining 14 widgets (PricingPlans/Reviews/Faq/Stats/Highlights/
FeatureIntro/TiltCases/IconCards/IconCoverCards/CoverCards/
ComboInfo/PartnersScroll/TextTitle/Iframe) already match Zibll
field semantics (JSON/native group + obs_animation/palette/
pc_row·m_row/go_link); no drift to fix.

Acceptance: php -l clean on all changed files; audit exit 0;
all 21 widget files <=360 lines. Phase 5 done-when marked.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
kate522andClaude Fable 5 committed 2026-07-30 21:27:58 +08:00
1 parent bfc4514476
commit cecc1a7b5e
7 files changed
+89 -37

No files matched your search

+18 -2
View File
@@ -33,12 +33,18 @@ class WidgetBookmarkLinks extends \WP_Widget {
$orderby = 'name';
}
$order = strtoupper((string) ($instance['links_order'] ?? 'ASC')) === 'DESC' ? 'DESC' : 'ASC';
// Zibll widget_ui_links_lists_2: type card/bigcard/image/simple.
$type = sanitize_key((string) ($instance['type'] ?? 'card'));
if (!in_array($type, ['card', 'bigcard', 'image', 'simple'], true)) {
$type = 'card';
}
// Zibll alignment ('' / center / right).
$align = sanitize_key((string) ($instance['alignment'] ?? ''));
if (!in_array($align, ['', 'center', 'right'], true)) {
$align = '';
}
$go_link = !empty($instance['go_link']);
$blank = !isset($instance['blank']) || !empty($instance['blank']);
$blank = !empty($instance['blank']);
$nofollow = !isset($instance['nofollow']) || !empty($instance['nofollow']);
$show_box = !empty($instance['show_box']);
@@ -69,7 +75,7 @@ class WidgetBookmarkLinks extends \WP_Widget {
echo $args['before_title'] . esc_html($title) . $args['after_title']; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
}
$wrap = 'aksrt-bookmark-links links-box style-' . $type . ($show_box ? ' has-box' : '');
$wrap = 'aksrt-bookmark-links links-box style-' . $type . ($show_box ? ' has-box' : '') . ($align ? ' text-' . $align : '');
echo '<div class="' . esc_attr($wrap) . '">';
if (function_exists('aksrt_links_box')) {
// phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
@@ -132,6 +138,15 @@ class WidgetBookmarkLinks extends \WP_Widget {
<option value="DESC" <?php selected(($instance['links_order'] ?? ''), 'DESC'); ?>><?php esc_html_e('降序', 'aksrt'); ?></option>
</select>
</p>
<p>
<label><?php esc_html_e('对齐方式', 'aksrt'); ?>
<select name="<?php echo esc_attr($this->get_field_name('alignment')); ?>">
<option value="" <?php selected(($instance['alignment'] ?? ''), ''); ?>><?php esc_html_e('左对齐', 'aksrt'); ?></option>
<option value="center" <?php selected(($instance['alignment'] ?? ''), 'center'); ?>><?php esc_html_e('居中', 'aksrt'); ?></option>
<option value="right" <?php selected(($instance['alignment'] ?? ''), 'right'); ?>><?php esc_html_e('右对齐', 'aksrt'); ?></option>
</select>
</label>
</p>
<p>
<label><input type="checkbox" name="<?php echo esc_attr($this->get_field_name('blank')); ?>" value="1" <?php checked(!isset($instance['blank']) || !empty($instance['blank'])); ?>> <?php esc_html_e('新窗口', 'aksrt'); ?></label><br>
<label><input type="checkbox" name="<?php echo esc_attr($this->get_field_name('nofollow')); ?>" value="1" <?php checked(!isset($instance['nofollow']) || !empty($instance['nofollow'])); ?>> <?php esc_html_e('nofollow', 'aksrt'); ?></label><br>
@@ -154,6 +169,7 @@ class WidgetBookmarkLinks extends \WP_Widget {
'links_orderby' => sanitize_key((string) ($new_instance['links_orderby'] ?? 'name')),
'links_order' => strtoupper((string) ($new_instance['links_order'] ?? 'ASC')) === 'DESC' ? 'DESC' : 'ASC',
'type' => $type,
'alignment' => in_array((string) ($new_instance['alignment'] ?? ''), ['', 'center', 'right'], true) ? $new_instance['alignment'] : '',
'blank' => !empty($new_instance['blank']) ? 1 : 0,
'nofollow' => !empty($new_instance['nofollow']) ? 1 : 0,
'go_link' => !empty($new_instance['go_link']) ? 1 : 0,