410 lines
26 KiB
PHP
410 lines
26 KiB
PHP
<?php
|
|
/**
|
|
* Template Name: 论坛发帖
|
|
* Template Post Type: page
|
|
*
|
|
* §7.4 — wp_editor rich editor + sidebar panels + server-side draft + capability gates.
|
|
*
|
|
* @package AKSRT
|
|
*/
|
|
|
|
defined('ABSPATH') || exit;
|
|
|
|
get_header();
|
|
|
|
if (!is_user_logged_in()) {
|
|
$login_url = function_exists('aksrt_get_login_url') ? aksrt_get_login_url() : wp_login_url(get_permalink());
|
|
wp_safe_redirect($login_url);
|
|
exit;
|
|
}
|
|
|
|
$forum = class_exists('AKSRT_Forum') ? AKSRT_Forum::get_instance() : null;
|
|
$current_user_id = get_current_user_id();
|
|
$board_id = isset($_GET['board']) ? (int) $_GET['board'] : 0;
|
|
$draft_id = isset($_GET['draft']) ? (int) $_GET['draft'] : 0;
|
|
|
|
$view = $forum ? $forum->get_compose_view($current_user_id, ['board_id' => $board_id]) : [
|
|
'boards' => [],
|
|
'selected_board_id' => 0,
|
|
'visibility_options' => [],
|
|
'publish_mode' => 'pending',
|
|
'draft_count' => 0,
|
|
'drafts' => [],
|
|
'capabilities' => [],
|
|
];
|
|
|
|
$forum_settings = class_exists('AKSRT_Settings') ? AKSRT_Settings::get_forum_settings() : [];
|
|
$title_placeholder = $forum_settings['other']['t_placeholder'] ?? __('请输入标题', 'aksrt');
|
|
$content_placeholder = $forum_settings['other']['c_placeholder'] ?? __('请输入内容', 'aksrt');
|
|
$title_maxlen = max(5, min(100, (int) ($forum_settings['other']['title_strlen_limit'] ?? 30)));
|
|
$vote_max = (int) ($forum_settings['other']['vote_max'] ?? 8);
|
|
$forum_name = $forum_settings['names']['forum'] ?? __('论坛', 'aksrt');
|
|
|
|
$boards = $view['boards'] ?? [];
|
|
$visibility_options = $view['visibility_options'] ?? [];
|
|
$publish_mode = (string) ($view['publish_mode'] ?? 'pending');
|
|
$draft_count = (int) ($view['draft_count'] ?? 0);
|
|
$drafts = $view['drafts'] ?? [];
|
|
$caps = $view['capabilities'] ?? [];
|
|
$nonce = wp_create_nonce('aksrt_forum_compose');
|
|
|
|
// Load draft data if resuming
|
|
$draft_data = null;
|
|
if ($draft_id > 0 && $forum) {
|
|
$draft_data = $forum->load_draft_data($current_user_id, $draft_id);
|
|
if ($draft_data) {
|
|
$board_id = (int) ($draft_data['board_id'] ?? 0);
|
|
}
|
|
}
|
|
|
|
$initial_content = $draft_data ? $draft_data['content'] : '';
|
|
?>
|
|
|
|
<main id="main-content" class="site-main container" tabindex="-1">
|
|
|
|
<div class="aksrt-forum-compose container">
|
|
<div class="aksrt-forum-compose__header">
|
|
<div>
|
|
<h1><i class="fas fa-pen-fancy"></i> <?php esc_html_e('发布新主题', 'aksrt'); ?></h1>
|
|
<p class="aksrt-forum-compose__notice">
|
|
<?php
|
|
echo $publish_mode === 'publish'
|
|
? esc_html__('你在当前版块具备直接发布权限。', 'aksrt')
|
|
: esc_html__('普通用户发帖将进入审核流程,审核通过后才会公开展示。', 'aksrt');
|
|
?>
|
|
</p>
|
|
</div>
|
|
<a href="<?php echo esc_url(home_url('/forums/')); ?>" class="aksrt-forum-compose__back">
|
|
<i class="fas fa-arrow-left"></i> <?php printf(esc_html__('返回%s', 'aksrt'), esc_html($forum_name)); ?>
|
|
</a>
|
|
</div>
|
|
|
|
<?php if ($draft_count > 0) : ?>
|
|
<div class="aksrt-forum-compose__draft-notice">
|
|
<i class="fas fa-file-alt"></i>
|
|
<?php printf(
|
|
esc_html__('您有 %d 篇草稿。', 'aksrt'),
|
|
$draft_count
|
|
); ?>
|
|
<button type="button" class="aksrt-forum-compose__draft-toggle js-aksrt-draft-toggle">
|
|
<?php esc_html_e('查看草稿', 'aksrt'); ?>
|
|
<i class="fas fa-chevron-down"></i>
|
|
</button>
|
|
<div class="aksrt-forum-compose__draft-list" id="compose-draft-list" hidden>
|
|
<?php foreach ($drafts as $d) : ?>
|
|
<div class="aksrt-forum-compose__draft-item" data-draft-id="<?php echo esc_attr((string) $d['id']); ?>">
|
|
<a href="<?php echo esc_url(add_query_arg('draft', $d['id'], get_permalink())); ?>" class="aksrt-forum-compose__draft-title">
|
|
<?php echo esc_html($d['title']); ?>
|
|
</a>
|
|
<span class="aksrt-forum-compose__draft-meta">
|
|
<?php echo esc_html($d['board_name'] ?: __('未选版块', 'aksrt')); ?> ·
|
|
<?php echo esc_html(human_time_diff(strtotime($d['date']), current_time('timestamp'))); ?><?php esc_html_e('前', 'aksrt'); ?>
|
|
</span>
|
|
<button type="button" class="aksrt-forum-compose__draft-delete js-aksrt-delete-draft" data-draft-id="<?php echo esc_attr((string) $d['id']); ?>" title="<?php esc_attr_e('删除草稿', 'aksrt'); ?>">
|
|
<i class="fas fa-trash-alt"></i>
|
|
</button>
|
|
</div>
|
|
<?php endforeach; ?>
|
|
</div>
|
|
</div>
|
|
<?php endif; ?>
|
|
|
|
<form
|
|
id="aksrt-forum-compose-form"
|
|
class="aksrt-forum-compose__form aksrt-forum-compose__layout js-aksrt-forum-compose-form"
|
|
data-ajax="<?php echo esc_url(admin_url('admin-ajax.php')); ?>"
|
|
data-nonce="<?php echo esc_attr($nonce); ?>"
|
|
data-publish-mode="<?php echo esc_attr($publish_mode); ?>"
|
|
data-vote-max="<?php echo esc_attr((string) $vote_max); ?>"
|
|
data-draft-id="<?php echo esc_attr((string) ($draft_data['draft_id'] ?? 0)); ?>"
|
|
>
|
|
<!-- ═══ Main content area ═══ -->
|
|
<div class="aksrt-forum-compose__main">
|
|
<div class="aksrt-forum-compose__field">
|
|
<label for="compose-title"><?php esc_html_e('主题标题', 'aksrt'); ?> <span class="required">*</span></label>
|
|
<input type="text" id="compose-title" name="title" required
|
|
maxlength="<?php echo esc_attr((string) $title_maxlen); ?>"
|
|
placeholder="<?php echo esc_attr($title_placeholder); ?>"
|
|
value="<?php echo esc_attr($draft_data['title'] ?? ''); ?>"
|
|
data-aksrt-maxlength="<?php echo esc_attr((string) $title_maxlen); ?>">
|
|
<span class="aksrt-forum-compose__char-counter" id="compose-title-counter">
|
|
<span class="js-aksrt-counter-current"><?php echo esc_html((string) mb_strlen($draft_data['title'] ?? '')); ?></span> / <?php echo esc_html((string) $title_maxlen); ?>
|
|
</span>
|
|
</div>
|
|
|
|
<div class="aksrt-forum-compose__field aksrt-forum-compose__editor-wrap">
|
|
<label><?php esc_html_e('主题内容', 'aksrt'); ?> <span class="required">*</span></label>
|
|
<?php
|
|
$editor_settings = [
|
|
'textarea_name' => 'content',
|
|
'textarea_rows' => 18,
|
|
'media_buttons' => !empty($caps['can_upload_image']) || !empty($caps['can_upload_video']) || !empty($caps['can_upload_file']),
|
|
'teeny' => false,
|
|
'quicktags' => true,
|
|
'tinymce' => [
|
|
'toolbar1' => 'formatselect,bold,italic,underline,strikethrough,blockquote,bullist,numlist,alignleft,aligncenter,alignright,link,unlink,wp_more,fullscreen',
|
|
'toolbar2' => 'pastetext,removeformat,charmap,outdent,indent,undo,redo,wp_help',
|
|
'plugins' => 'paste,link,lists,fullscreen,wordpress,wplink,charmap',
|
|
],
|
|
];
|
|
|
|
if (empty($caps['can_upload_image']) && empty($caps['can_upload_video']) && empty($caps['can_upload_file'])) {
|
|
$editor_settings['tinymce']['toolbar1'] = str_replace(',wp_more', '', $editor_settings['tinymce']['toolbar1']);
|
|
}
|
|
|
|
wp_editor($initial_content, 'compose-content', $editor_settings);
|
|
?>
|
|
</div>
|
|
</div>
|
|
|
|
<!-- ═══ Sidebar panels ═══ -->
|
|
<div class="aksrt-forum-compose__sidebar">
|
|
|
|
<!-- Panel: Submit / Status -->
|
|
<div class="aksrt-forum-compose__panel">
|
|
<h3 class="aksrt-forum-compose__panel-title"><i class="fas fa-paper-plane"></i> <?php esc_html_e('发布', 'aksrt'); ?></h3>
|
|
<div class="aksrt-forum-compose__panel-body">
|
|
<p class="aksrt-forum-compose__status-line">
|
|
<i class="fas fa-info-circle"></i>
|
|
<span id="compose-status-text">
|
|
<?php echo $publish_mode === 'publish'
|
|
? esc_html__('状态:直接发布', 'aksrt')
|
|
: esc_html__('状态:待审核', 'aksrt'); ?>
|
|
</span>
|
|
</p>
|
|
<div class="aksrt-forum-compose__actions">
|
|
<button type="submit" class="aksrt-forum-compose__submit" id="compose-submit">
|
|
<i class="fas fa-paper-plane"></i> <?php esc_html_e('提交主题', 'aksrt'); ?>
|
|
</button>
|
|
<button type="button" class="aksrt-forum-compose__draft" id="compose-draft">
|
|
<i class="fas fa-save"></i> <?php esc_html_e('保存草稿', 'aksrt'); ?>
|
|
</button>
|
|
</div>
|
|
<span class="aksrt-forum-compose__feedback js-aksrt-action-feedback" aria-live="polite"></span>
|
|
</div>
|
|
</div>
|
|
|
|
<!-- Panel: Board selector -->
|
|
<div class="aksrt-forum-compose__panel">
|
|
<h3 class="aksrt-forum-compose__panel-title"><i class="fas fa-th-large"></i> <?php esc_html_e('版块', 'aksrt'); ?></h3>
|
|
<div class="aksrt-forum-compose__panel-body">
|
|
<div class="aksrt-forum-compose__field aksrt-remote-select" data-search-action="aksrt_forum_search_boards">
|
|
<input type="hidden" id="compose-board" name="board_id" value="<?php echo esc_attr((string) $board_id); ?>">
|
|
<input type="text" class="aksrt-remote-select__input js-aksrt-remote-input"
|
|
placeholder="<?php esc_attr_e('搜索版块…', 'aksrt'); ?>"
|
|
autocomplete="off"
|
|
value="<?php
|
|
if ($board_id > 0) {
|
|
foreach ($boards as $b) {
|
|
if (((int) ($b['id'] ?? 0)) === $board_id) {
|
|
echo esc_attr((string) ($b['name'] ?? ''));
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
?>">
|
|
<div class="aksrt-remote-select__dropdown" hidden></div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<!-- Panel: Post type -->
|
|
<div class="aksrt-forum-compose__panel">
|
|
<h3 class="aksrt-forum-compose__panel-title"><i class="fas fa-tag"></i> <?php esc_html_e('类型 & 分类', 'aksrt'); ?></h3>
|
|
<div class="aksrt-forum-compose__panel-body">
|
|
<div class="aksrt-forum-compose__field">
|
|
<label for="compose-bbs-type"><?php esc_html_e('帖子类型', 'aksrt'); ?></label>
|
|
<select id="compose-bbs-type" name="bbs_type">
|
|
<option value="standard" <?php selected($draft_data['bbs_type'] ?? '', 'standard'); ?>><?php esc_html_e('标准帖子', 'aksrt'); ?></option>
|
|
<option value="question" <?php selected($draft_data['bbs_type'] ?? '', 'question'); ?>><?php esc_html_e('提问', 'aksrt'); ?></option>
|
|
</select>
|
|
</div>
|
|
|
|
<div class="aksrt-forum-compose__field">
|
|
<label for="compose-special"><?php esc_html_e('专题/系列', 'aksrt'); ?></label>
|
|
<input type="text" id="compose-special" name="special_topic" maxlength="80"
|
|
placeholder="<?php esc_attr_e('例如:站点重构周报', 'aksrt'); ?>"
|
|
value="<?php echo esc_attr($draft_data['special_topic'] ?? ''); ?>">
|
|
</div>
|
|
|
|
<?php if (taxonomy_exists('aksrt_forum_topic_cat')) : ?>
|
|
<div class="aksrt-forum-compose__field aksrt-remote-select" data-search-action="aksrt_forum_search_topics">
|
|
<label><?php esc_html_e('话题', 'aksrt'); ?></label>
|
|
<input type="hidden" name="topic_cat" value="<?php echo esc_attr($draft_data['topic_cat'] ?? ''); ?>">
|
|
<input type="text" class="aksrt-remote-select__input js-aksrt-remote-input"
|
|
placeholder="<?php esc_attr_e('搜索话题…', 'aksrt'); ?>"
|
|
autocomplete="off"
|
|
value="<?php echo esc_attr($draft_data['topic_cat'] ?? ''); ?>">
|
|
<div class="aksrt-remote-select__dropdown" hidden></div>
|
|
</div>
|
|
<?php endif; ?>
|
|
</div>
|
|
</div>
|
|
|
|
<!-- Panel: Tags -->
|
|
<div class="aksrt-forum-compose__panel">
|
|
<h3 class="aksrt-forum-compose__panel-title"><i class="fas fa-tags"></i> <?php esc_html_e('标签', 'aksrt'); ?></h3>
|
|
<div class="aksrt-forum-compose__panel-body">
|
|
<div class="aksrt-forum-compose__field aksrt-tag-input" data-search-action="aksrt_forum_search_tags" data-max="5">
|
|
<input type="hidden" id="compose-tags" name="tags" value="<?php echo esc_attr($draft_data['tags'] ?? ''); ?>">
|
|
<div class="aksrt-tag-input__tokens" id="compose-tag-tokens"></div>
|
|
<input type="text" class="aksrt-tag-input__input js-aksrt-tag-search"
|
|
placeholder="<?php esc_attr_e('输入标签名,回车添加', 'aksrt'); ?>"
|
|
autocomplete="off" maxlength="30">
|
|
<div class="aksrt-tag-input__dropdown" hidden></div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<!-- Panel: Visibility -->
|
|
<div class="aksrt-forum-compose__panel">
|
|
<h3 class="aksrt-forum-compose__panel-title"><i class="fas fa-eye"></i> <?php esc_html_e('可见性', 'aksrt'); ?></h3>
|
|
<div class="aksrt-forum-compose__panel-body">
|
|
<div class="aksrt-forum-compose__field">
|
|
<select id="compose-visibility" name="visibility">
|
|
<?php foreach ($visibility_options as $option) : ?>
|
|
<option value="<?php echo esc_attr((string) ($option['value'] ?? '')); ?>"
|
|
<?php selected($draft_data['visibility'] ?? 'public', $option['value'] ?? ''); ?>>
|
|
<?php echo esc_html((string) ($option['label'] ?? '')); ?>
|
|
</option>
|
|
<?php endforeach; ?>
|
|
</select>
|
|
</div>
|
|
|
|
<div class="aksrt-forum-compose__visibility-extra" id="compose-credits-cost-field" style="display:none;">
|
|
<label for="compose-credits-cost"><?php esc_html_e('积分价格', 'aksrt'); ?></label>
|
|
<input type="number" id="compose-credits-cost" name="credits_cost" min="1" max="99999"
|
|
value="<?php echo esc_attr((string) ($draft_data['credits_cost'] ?? '')); ?>"
|
|
placeholder="<?php esc_attr_e('查看需要的积分数', 'aksrt'); ?>">
|
|
</div>
|
|
|
|
<div class="aksrt-forum-compose__visibility-extra" id="compose-pay-price-field" style="display:none;">
|
|
<label for="compose-pay-price"><?php esc_html_e('付费价格(¥)', 'aksrt'); ?></label>
|
|
<input type="number" id="compose-pay-price" name="pay_price" min="0.01" step="0.01" max="99999"
|
|
value="<?php echo esc_attr((string) ($draft_data['pay_price'] ?? '')); ?>"
|
|
placeholder="<?php esc_attr_e('查看需要的金额', 'aksrt'); ?>">
|
|
</div>
|
|
|
|
<div class="aksrt-forum-compose__visibility-extra" id="compose-role-field" style="display:none;">
|
|
<label for="compose-visibility-roles"><?php esc_html_e('允许的角色', 'aksrt'); ?></label>
|
|
<?php $selected_roles = $draft_data['visibility_roles'] ?? []; ?>
|
|
<select id="compose-visibility-roles" name="visibility_roles[]" multiple>
|
|
<?php foreach (wp_roles()->get_names() as $role_slug => $role_name) : ?>
|
|
<option value="<?php echo esc_attr($role_slug); ?>"
|
|
<?php echo in_array($role_slug, $selected_roles, true) ? 'selected' : ''; ?>>
|
|
<?php echo esc_html(translate_user_role($role_name)); ?>
|
|
</option>
|
|
<?php endforeach; ?>
|
|
</select>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<!-- Panel: Cover -->
|
|
<?php if (!empty($caps['can_set_cover'])) : ?>
|
|
<div class="aksrt-forum-compose__panel">
|
|
<h3 class="aksrt-forum-compose__panel-title"><i class="fas fa-image"></i> <?php esc_html_e('封面', 'aksrt'); ?></h3>
|
|
<div class="aksrt-forum-compose__panel-body">
|
|
<div class="aksrt-forum-compose__field">
|
|
<select id="compose-cover-type" name="cover_type">
|
|
<option value="" <?php selected($draft_data['cover_type'] ?? '', ''); ?>><?php esc_html_e('无封面', 'aksrt'); ?></option>
|
|
<?php if (!empty($caps['can_set_cover_image'])) : ?>
|
|
<option value="image" <?php selected($draft_data['cover_type'] ?? '', 'image'); ?>><?php esc_html_e('图片封面', 'aksrt'); ?></option>
|
|
<?php endif; ?>
|
|
<?php if (!empty($caps['can_set_cover_slide'])) : ?>
|
|
<option value="slide" <?php selected($draft_data['cover_type'] ?? '', 'slide'); ?>><?php esc_html_e('幻灯片封面', 'aksrt'); ?></option>
|
|
<?php endif; ?>
|
|
<?php if (!empty($caps['can_set_cover_video'])) : ?>
|
|
<option value="video" <?php selected($draft_data['cover_type'] ?? '', 'video'); ?>><?php esc_html_e('视频封面', 'aksrt'); ?></option>
|
|
<?php endif; ?>
|
|
</select>
|
|
</div>
|
|
|
|
<div class="aksrt-forum-compose__cover-upload" id="compose-cover-image-field" style="display:none;">
|
|
<input type="hidden" name="cover_image" id="compose-cover-image" value="<?php echo esc_attr($draft_data['cover_image'] ?? ''); ?>">
|
|
<div class="aksrt-forum-compose__cover-preview" id="compose-cover-preview">
|
|
<?php if (!empty($draft_data['cover_image'])) : ?>
|
|
<img src="<?php echo esc_url($draft_data['cover_image']); ?>" alt="">
|
|
<?php endif; ?>
|
|
</div>
|
|
<button type="button" class="aksrt-forum-compose__cover-btn" id="compose-cover-upload-btn"><?php esc_html_e('选择图片', 'aksrt'); ?></button>
|
|
</div>
|
|
|
|
<div class="aksrt-forum-compose__cover-upload" id="compose-cover-slide-field" style="display:none;">
|
|
<input type="hidden" name="featured_slide" id="compose-featured-slide"
|
|
value="<?php echo esc_attr(!empty($draft_data['featured_slide']) ? wp_json_encode($draft_data['featured_slide']) : ''); ?>">
|
|
<div class="aksrt-forum-compose__cover-preview" id="compose-slide-preview">
|
|
<?php if (!empty($draft_data['featured_slide'])) : foreach ($draft_data['featured_slide'] as $su) : ?>
|
|
<img src="<?php echo esc_url($su); ?>" alt="">
|
|
<?php endforeach; endif; ?>
|
|
</div>
|
|
<button type="button" class="aksrt-forum-compose__cover-btn" id="compose-slide-upload-btn"><?php esc_html_e('选择图片', 'aksrt'); ?></button>
|
|
</div>
|
|
|
|
<div class="aksrt-forum-compose__cover-upload" id="compose-cover-video-field" style="display:none;">
|
|
<input type="url" name="featured_video" id="compose-featured-video"
|
|
value="<?php echo esc_attr($draft_data['featured_video'] ?? ''); ?>"
|
|
placeholder="<?php esc_attr_e('https://...mp4', 'aksrt'); ?>">
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<?php endif; ?>
|
|
|
|
<!-- Panel: Vote -->
|
|
<div class="aksrt-forum-compose__panel">
|
|
<h3 class="aksrt-forum-compose__panel-title">
|
|
<label class="aksrt-forum-compose__checkbox">
|
|
<input type="checkbox" id="compose-vote-enabled" name="vote_enabled" value="1"
|
|
<?php checked(!empty($draft_data['vote_enabled'])); ?>>
|
|
<span><i class="fas fa-poll"></i> <?php esc_html_e('投票', 'aksrt'); ?></span>
|
|
</label>
|
|
</h3>
|
|
<div class="aksrt-forum-compose__panel-body aksrt-forum-compose__vote-fields" <?php echo empty($draft_data['vote_enabled']) ? 'hidden' : ''; ?>>
|
|
<div class="aksrt-forum-compose__field">
|
|
<label for="compose-vote-title"><?php esc_html_e('投票标题', 'aksrt'); ?></label>
|
|
<input type="text" id="compose-vote-title" name="vote_title" maxlength="120"
|
|
value="<?php echo esc_attr($draft_data['vote_title'] ?? ''); ?>"
|
|
placeholder="<?php esc_attr_e('你更希望改造哪个模块?', 'aksrt'); ?>">
|
|
</div>
|
|
|
|
<div class="aksrt-forum-compose__field">
|
|
<label class="aksrt-forum-compose__checkbox">
|
|
<input type="checkbox" id="compose-vote-multiple" name="vote_multiple" value="1"
|
|
<?php checked(!empty($draft_data['vote_multiple'])); ?>>
|
|
<span><?php esc_html_e('允许多选', 'aksrt'); ?></span>
|
|
</label>
|
|
</div>
|
|
|
|
<div class="aksrt-forum-compose__field">
|
|
<label for="compose-vote-type"><?php esc_html_e('投票类型', 'aksrt'); ?></label>
|
|
<select id="compose-vote-type" name="vote_type">
|
|
<option value="standard" <?php selected($draft_data['vote_type'] ?? '', 'standard'); ?>><?php esc_html_e('标准投票', 'aksrt'); ?></option>
|
|
<option value="pk" <?php selected($draft_data['vote_type'] ?? '', 'pk'); ?>><?php esc_html_e('PK 双选', 'aksrt'); ?></option>
|
|
</select>
|
|
</div>
|
|
|
|
<div class="aksrt-forum-compose__field">
|
|
<label for="compose-vote-expiry"><?php esc_html_e('投票有效期', 'aksrt'); ?></label>
|
|
<select id="compose-vote-expiry" name="vote_expiry_days">
|
|
<option value="0" <?php selected((int) ($draft_data['vote_expiry_days'] ?? 0), 0); ?>><?php esc_html_e('永久', 'aksrt'); ?></option>
|
|
<option value="1" <?php selected((int) ($draft_data['vote_expiry_days'] ?? 0), 1); ?>><?php esc_html_e('1 天', 'aksrt'); ?></option>
|
|
<option value="7" <?php selected((int) ($draft_data['vote_expiry_days'] ?? 0), 7); ?>><?php esc_html_e('7 天', 'aksrt'); ?></option>
|
|
<option value="30" <?php selected((int) ($draft_data['vote_expiry_days'] ?? 0), 30); ?>><?php esc_html_e('30 天', 'aksrt'); ?></option>
|
|
</select>
|
|
</div>
|
|
|
|
<div class="aksrt-forum-compose__field">
|
|
<label for="compose-vote-options"><?php printf(esc_html__('选项(最多 %d 项)', 'aksrt'), (int) $vote_max); ?></label>
|
|
<textarea id="compose-vote-options" name="vote_options" rows="4"
|
|
placeholder="<?php esc_attr_e("每行一个选项", 'aksrt'); ?>"><?php echo esc_textarea($draft_data['vote_options'] ?? ''); ?></textarea>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
</div><!-- /.aksrt-forum-compose__sidebar -->
|
|
</form>
|
|
</div>
|
|
</main>
|
|
|
|
<?php get_footer(); ?>
|