feat(forum): add complete forum workflows
This commit is contained in:
1 parent
a254cbd3e9
commit
ee65fc7fd2
39 files changed
+3425
-4
No files matched your search
@@ -0,0 +1,79 @@
|
||||
<?php
|
||||
|
||||
namespace Jio\Admin\Schema;
|
||||
|
||||
defined('ABSPATH') || exit;
|
||||
|
||||
final class SchemaForum {
|
||||
public static function build(): array {
|
||||
return ['domain' => 'forum', 'title' => '社区论坛', 'sections' => [
|
||||
'general' => self::section('general', '全局设置', [
|
||||
self::field('jio_forum_enabled', '启用论坛', 'switcher', true),
|
||||
self::field('jio_forum_admin_users', '论坛管理员 ID', 'input', ''),
|
||||
self::field('jio_forum_forum_name', '论坛名称', 'input', '论坛'),
|
||||
self::field('jio_forum_plate_name', '版块名称', 'input', '版块'),
|
||||
self::field('jio_forum_post_name', '帖子名称', 'input', '帖子'),
|
||||
self::field('jio_forum_topic_name', '话题名称', 'input', '话题'),
|
||||
]),
|
||||
'home' => self::section('home', '首页与列表', [
|
||||
self::field('jio_forum_page_size', '每页帖子数', 'number', 20, ['min' => 1, 'max' => 50]),
|
||||
self::field('jio_forum_home_tabs', '首页栏目', 'checkbox', ['latest', 'popular', 'essence', 'question', 'vote', 'plates', 'follow'], ['options' => self::options(['latest' => '最新', 'popular' => '热门', 'essence' => '精华', 'question' => '问答', 'vote' => '投票', 'plates' => '版块', 'follow' => '已关注'])]),
|
||||
self::field('jio_forum_show_plate_cover', '显示版块封面', 'switcher', true),
|
||||
self::field('jio_forum_search_enabled', '搜索包含帖子', 'switcher', true),
|
||||
]),
|
||||
'publishing' => self::section('publishing', '发布与审核', [
|
||||
self::field('jio_forum_post_review', '新帖子需要审核', 'switcher', true),
|
||||
self::field('jio_forum_plate_review', '新版块需要审核', 'switcher', true),
|
||||
self::field('jio_forum_user_plates', '允许用户创建版块', 'switcher', true),
|
||||
self::field('jio_forum_user_topics', '允许用户创建话题', 'switcher', true),
|
||||
self::field('jio_forum_daily_post_limit', '每日发帖上限', 'number', 20, ['min' => 0, 'max' => 500]),
|
||||
self::field('jio_forum_vote_max', '投票选项上限', 'number', 10, ['min' => 2, 'max' => 20]),
|
||||
self::field('jio_forum_upload_image', '允许上传图片', 'switcher', true),
|
||||
self::field('jio_forum_upload_video', '允许上传视频', 'switcher', false),
|
||||
self::field('jio_forum_upload_file', '允许上传附件', 'switcher', false),
|
||||
]),
|
||||
'access' => self::section('access', '权限与版主', [
|
||||
self::field('jio_forum_moderator_apply', '允许申请版主', 'switcher', true),
|
||||
self::field('jio_forum_follow_required', '关注后允许发帖', 'switcher', false),
|
||||
self::field('jio_forum_allow_guest_read', '允许游客阅读', 'switcher', true),
|
||||
]),
|
||||
'replies' => self::section('replies', '回复与互动', [
|
||||
self::field('jio_forum_reply_page_size', '每页回复数', 'number', 20, ['min' => 1, 'max' => 100]),
|
||||
self::field('jio_forum_reply_review', '回复需要审核', 'switcher', false),
|
||||
self::field('jio_forum_vote_enabled', '启用投票', 'switcher', true),
|
||||
self::field('jio_forum_vote_number_type', '投票结果显示', 'radio', 'percentage', ['options' => self::options(['percentage' => '百分比', 'number' => '票数', 'hide' => '不显示'])]),
|
||||
self::field('jio_forum_question_enabled', '启用问答采纳', 'switcher', true),
|
||||
self::field('jio_forum_score_enabled', '启用评分', 'switcher', true),
|
||||
self::field('jio_forum_score_up_max', '单人最多加分', 'number', 5, ['min' => 0, 'max' => 100]),
|
||||
self::field('jio_forum_score_down_max', '单人最多减分', 'number', 5, ['min' => 0, 'max' => 100]),
|
||||
]),
|
||||
'payment' => self::section('payment', '付费与积分', [
|
||||
self::field('jio_forum_paid_content', '允许帖子付费解锁', 'switcher', true),
|
||||
self::field('jio_forum_paid_follow', '允许付费关注版块', 'switcher', true),
|
||||
self::field('jio_forum_points_enabled', '允许积分解锁', 'switcher', true),
|
||||
self::field('jio_forum_vip_price_enabled', '启用会员价', 'switcher', true),
|
||||
]),
|
||||
'urls' => self::section('urls', '链接设置', [
|
||||
self::field('jio_forum_slug_plate', '版块路径', 'input', 'forum'),
|
||||
self::field('jio_forum_slug_post', '帖子路径', 'input', 'forum-post'),
|
||||
self::field('jio_forum_slug_edit', '发帖路径', 'input', 'posts-edit'),
|
||||
]),
|
||||
]];
|
||||
}
|
||||
|
||||
private static function section(string $key, string $title, array $fields): array {
|
||||
return ['key' => $key, 'title' => $title, 'version' => '1.0.0', 'option_key' => 'jio_settings', 'groups' => [['key' => $key, 'fields' => $fields]]];
|
||||
}
|
||||
|
||||
private static function field(string $key, string $label, string $type, $default, array $extra = []): array {
|
||||
return array_merge(['key' => $key, 'label' => $label, 'type' => $type, 'default' => $default], $extra);
|
||||
}
|
||||
|
||||
private static function options(array $values): array {
|
||||
$result = [];
|
||||
foreach ($values as $value => $label) {
|
||||
$result[] = ['value' => $value, 'label' => $label];
|
||||
}
|
||||
return $result;
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user