feat(widgets): search affix, mod apply, blur_bg, iframe null
Wire search sidebar affix, plate moderator apply entry, user-lists REST blur_bg, and iframe empty via aksrt_get_widget_null.
This commit is contained in:
@@ -73,10 +73,29 @@ class WidgetForumPlateModerator extends \WP_Widget {
|
||||
$style = 'list';
|
||||
}
|
||||
|
||||
$show_apply = !isset($instance['apply_btn']) || !empty($instance['apply_btn']);
|
||||
$apply_html = '';
|
||||
if ($show_apply && is_user_logged_in()) {
|
||||
$forum = class_exists('\AKSRT\Forum\Forum') ? \AKSRT\Forum\Forum::get_instance() : null;
|
||||
$cuid = get_current_user_id();
|
||||
$can_apply = $forum && method_exists($forum, 'forum_user_can')
|
||||
? $forum->forum_user_can($cuid, 'moderator_apply')
|
||||
: true;
|
||||
$is_mod = $forum && method_exists($forum, 'is_board_moderator')
|
||||
? $forum->is_board_moderator($cuid, $id)
|
||||
: in_array($cuid, array_merge([$author_id], $mods, $super), true);
|
||||
if ($can_apply && !$is_mod) {
|
||||
$apply_url = add_query_arg(['aksrt_apply_moderator' => 1, 'plate' => $id], get_permalink($id));
|
||||
$apply_html = '<a class="but hollow c-blue p2-10 em09" href="' . esc_url($apply_url) . '">' . esc_html__('申请版主', 'aksrt') . '</a>';
|
||||
}
|
||||
}
|
||||
ob_start();
|
||||
echo '<div class="zib-widget moderator-box aksrt-plate-mods style-' . esc_attr($style) . ' ajax-item">';
|
||||
if ($title_text !== '') {
|
||||
echo '<div class="mb10 flex jsb ac aksrt-plate-mods__head"><div class="title-theme">' . esc_html($title_text) . '</div></div>';
|
||||
if ($title_text !== '' || $apply_html !== '') {
|
||||
echo '<div class="mb10 flex jsb ac aksrt-plate-mods__head">';
|
||||
echo $title_text !== '' ? '<div class="title-theme">' . esc_html($title_text) . '</div>' : '<div></div>';
|
||||
echo $apply_html; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
|
||||
echo '</div>';
|
||||
}
|
||||
echo '<div class="aksrt-plate-mods__list">';
|
||||
foreach ($people as $row) {
|
||||
@@ -144,7 +163,8 @@ class WidgetForumPlateModerator extends \WP_Widget {
|
||||
</label>
|
||||
</p>
|
||||
<p>
|
||||
<label><input type="checkbox" name="<?php echo esc_attr($this->get_field_name('show_avatar')); ?>" value="1" <?php checked(!isset($instance['show_avatar']) || !empty($instance['show_avatar'])); ?>> <?php esc_html_e('显示头像', 'aksrt'); ?></label>
|
||||
<label><input type="checkbox" name="<?php echo esc_attr($this->get_field_name('show_avatar')); ?>" value="1" <?php checked(!isset($instance['show_avatar']) || !empty($instance['show_avatar'])); ?>> <?php esc_html_e('显示头像', 'aksrt'); ?></label><br>
|
||||
<label><input type="checkbox" name="<?php echo esc_attr($this->get_field_name('apply_btn')); ?>" value="1" <?php checked(!isset($instance['apply_btn']) || !empty($instance['apply_btn'])); ?>> <?php esc_html_e('显示申请版主入口', 'aksrt'); ?></label>
|
||||
</p>
|
||||
<p class="description"><?php esc_html_e('仅在版块/帖子页显示。', 'aksrt'); ?></p>
|
||||
<?php
|
||||
@@ -155,6 +175,7 @@ class WidgetForumPlateModerator extends \WP_Widget {
|
||||
'title_text' => sanitize_text_field((string) ($new_instance['title_text'] ?? '')),
|
||||
'style' => ($new_instance['style'] ?? '') === 'grid' ? 'grid' : 'list',
|
||||
'show_avatar' => !empty($new_instance['show_avatar']) ? 1 : 0,
|
||||
'apply_btn' => !empty($new_instance['apply_btn']) ? 1 : 0,
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user