feat(forum): add quick publish, captcha and hidden content
Port the reference inline quick-publish composer to the forum home: title/body inputs, image upload, plate/topic/access/hidden-content dropdowns and save/publish actions. Wire the site captcha into forum publishing through a new `forum_post` scene (admin + REST gate), and turn the hidden-content box into the theme's own visibility shortcodes (login/comment/vip/payshow) so the existing gate renderer unlocks them. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
1 parent
5d3358d844
commit
7a59c65252
11 files changed
+204
-20
No files matched your search
@@ -71,6 +71,12 @@ final class EditView {
|
||||
echo self::term_box('tags', '标签', Core::TAG, $tags, 'fa-tag');
|
||||
echo self::type_box($type);
|
||||
echo self::vote_box($vote_options, $post);
|
||||
echo self::hide_box($post);
|
||||
if (!$post && function_exists('jio_render_captcha') && function_exists('jio_is_captcha_enabled_for') && jio_is_captcha_enabled_for('forum_post')) {
|
||||
echo '<div class="zib-widget mb10-sm mb20 jio-forum__captcha">';
|
||||
jio_render_captcha('forum_post');
|
||||
echo '</div>';
|
||||
}
|
||||
\Jio\WidgetSystem\WidgetAreas::render('forum_edit_sidebar');
|
||||
echo '</div>';
|
||||
self::close();
|
||||
@@ -150,6 +156,18 @@ final class EditView {
|
||||
return '<div class="type-drop zib-widget mb10-sm mb20"><div class="flex ac jsb"><div class="flex ac"><i class="fa fas fa-delicious mr6"></i>发布类型</div><div class="but-average radius em09">' . $list . '</div></div></div>';
|
||||
}
|
||||
|
||||
/** Hidden-content composer: the block becomes a site visibility shortcode on save. */
|
||||
private static function hide_box(?\WP_Post $post): string {
|
||||
$types = '';
|
||||
foreach (['logged' => '登录可见', 'reply' => '评论可见', 'vip1' => '会员可见', 'payshow' => '付费可见'] as $key => $label) {
|
||||
$types .= '<span data-forum-hide-type="' . $key . '" class="mb6 mr6 badg p2-10 pointer' . ($key === 'logged' ? ' active' : '') . '">' . esc_html($label) . '</span>';
|
||||
}
|
||||
return '<div class="hide-type-drop drop-select dropdown zib-widget mb10-sm mb20"><div data-toggle-class="open" data-target=".hide-type-drop" class="flex ac jsb drop-btn"><span class="flex ac"><i class="far fa-eye-slash mr6"></i>隐藏内容</span><i class="ml6 fa fas fa-angle-right em12"></i></div>'
|
||||
. '<input type="hidden" name="hide_type" value="">'
|
||||
. '<div class="dropdown-menu fluid"><div class="mini-scrollbar padding-w10 select-drop-box"><div class="em09 muted-3-color mb10">添加额外的隐藏内容</div><div class="flex hh">' . $types . '</div>'
|
||||
. '<textarea rows="6" name="hide_content" class="form-control input-textarea" placeholder="在此输入需要隐藏的内容"></textarea></div></div></div>';
|
||||
}
|
||||
|
||||
/** @param string[] $options */
|
||||
private static function vote_box(array $options, ?\WP_Post $post): string {
|
||||
$type = $post ? (string) get_post_meta($post->ID, '_jio_forum_type', true) : 'normal';
|
||||
|
||||
Reference in new issue
Block a user