feat(ux): forum pay-hide depth, clogin OAuth, ban appeals admin, posts-navs widget
- Forum compose/save/draft: VIP prices, partial hide, coupons + shortcode tools - Rainbow clogin aggregate login (rewrite + schema + CLoginClient) - Native ban appeals tab: approve/reject + lift ban + notify - WidgetPostsNavs + register missing forum widgets - Submit editor shortcodes: login/reply/vip/payshow
This commit is contained in:
1 parent
25aabb71a3
commit
24330653f0
15 files changed
+834
-35
No files matched your search
@@ -0,0 +1,82 @@
|
||||
<?php
|
||||
/**
|
||||
* In-article / topic TOC shell (zibll widget_ui_posts_navs parity).
|
||||
*
|
||||
* Frontend JS fills `.posts-nav-box` from heading outline when present.
|
||||
*
|
||||
* @package AKSRT
|
||||
*/
|
||||
|
||||
namespace AKSRT\Widgets;
|
||||
|
||||
defined('ABSPATH') || exit;
|
||||
|
||||
class WidgetPostsNavs extends \WP_Widget {
|
||||
|
||||
public function __construct() {
|
||||
parent::__construct(
|
||||
'aksrt_posts_navs',
|
||||
esc_html__('AKSRT 文章目录树', 'aksrt'),
|
||||
[
|
||||
'description' => esc_html__('显示当前文章/帖子标题目录,非详情页不输出。标题超过 3 个才显示。', 'aksrt'),
|
||||
'classname' => 'widget_aksrt_posts_navs',
|
||||
]
|
||||
);
|
||||
}
|
||||
|
||||
public function widget($args, $instance): void {
|
||||
if (!is_singular(['post', 'page', 'aksrt_forum_topic', 'aksrt_product'])) {
|
||||
return;
|
||||
}
|
||||
|
||||
$title = sanitize_text_field((string) ($instance['title'] ?? __('文章目录', 'aksrt')));
|
||||
$mini_title = sanitize_text_field((string) ($instance['mini_title'] ?? ''));
|
||||
$in_affix = !empty($instance['in_affix']);
|
||||
|
||||
$data_title = $title;
|
||||
if ($mini_title !== '') {
|
||||
$data_title .= ' · ' . $mini_title;
|
||||
}
|
||||
|
||||
echo $args['before_widget']; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
|
||||
echo '<div class="widget-container">';
|
||||
printf(
|
||||
'<div class="posts-nav-box"%s%s></div>',
|
||||
$in_affix ? ' data-affix="true"' : '',
|
||||
$data_title !== '' ? ' data-title="' . esc_attr($data_title) . '"' : ''
|
||||
);
|
||||
echo '</div>';
|
||||
echo $args['after_widget']; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
|
||||
}
|
||||
|
||||
public function form($instance): void {
|
||||
$title = (string) ($instance['title'] ?? __('文章目录', 'aksrt'));
|
||||
$mini_title = (string) ($instance['mini_title'] ?? '');
|
||||
$in_affix = !empty($instance['in_affix']);
|
||||
?>
|
||||
<p>
|
||||
<label for="<?php echo esc_attr($this->get_field_id('title')); ?>"><?php esc_html_e('标题:', 'aksrt'); ?></label>
|
||||
<input class="widefat" type="text" id="<?php echo esc_attr($this->get_field_id('title')); ?>" name="<?php echo esc_attr($this->get_field_name('title')); ?>" value="<?php echo esc_attr($title); ?>">
|
||||
</p>
|
||||
<p>
|
||||
<label for="<?php echo esc_attr($this->get_field_id('mini_title')); ?>"><?php esc_html_e('副标题:', 'aksrt'); ?></label>
|
||||
<input class="widefat" type="text" id="<?php echo esc_attr($this->get_field_id('mini_title')); ?>" name="<?php echo esc_attr($this->get_field_name('mini_title')); ?>" value="<?php echo esc_attr($mini_title); ?>">
|
||||
</p>
|
||||
<p>
|
||||
<label>
|
||||
<input type="checkbox" id="<?php echo esc_attr($this->get_field_id('in_affix')); ?>" name="<?php echo esc_attr($this->get_field_name('in_affix')); ?>" value="1" <?php checked($in_affix); ?>>
|
||||
<?php esc_html_e('侧栏随动(仅侧边栏)', 'aksrt'); ?>
|
||||
</label>
|
||||
</p>
|
||||
<p class="description"><?php esc_html_e('请添加到文章/帖子侧栏。正文 H2–H4 超过 3 个时前端才会填充目录。', 'aksrt'); ?></p>
|
||||
<?php
|
||||
}
|
||||
|
||||
public function update($new_instance, $old_instance): array {
|
||||
return [
|
||||
'title' => sanitize_text_field((string) ($new_instance['title'] ?? '')),
|
||||
'mini_title' => sanitize_text_field((string) ($new_instance['mini_title'] ?? '')),
|
||||
'in_affix' => !empty($new_instance['in_affix']) ? 1 : 0,
|
||||
];
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user