115 lines
4.6 KiB
PHP
115 lines
4.6 KiB
PHP
<?php
|
|
/**
|
|
* Sidebar: guest + terms + tags.
|
|
*
|
|
* @var array $ctx
|
|
* @package AKSRT
|
|
*/
|
|
defined('ABSPATH') || exit;
|
|
|
|
$settings = $ctx['settings'];
|
|
$term_helper = get_template_directory() . '/templates/parts/submit/term-checks.php';
|
|
if (file_exists($term_helper)) {
|
|
require_once $term_helper;
|
|
}
|
|
?>
|
|
|
|
<?php if (!empty($ctx['is_guest'])) : ?>
|
|
<div class="aksrt-submit-panel">
|
|
<div class="aksrt-submit-panel__title"><?php esc_html_e('用户信息', 'aksrt'); ?></div>
|
|
<div class="aksrt-submit-panel__body">
|
|
<p class="aksrt-submit-hint"><?php esc_html_e('请输入昵称', 'aksrt'); ?></p>
|
|
<input class="aksrt-form-input" type="text" name="user_name" placeholder="<?php esc_attr_e('请输入昵称', 'aksrt'); ?>" required>
|
|
<p class="aksrt-submit-hint"><?php esc_html_e('请输入您的联系方式', 'aksrt'); ?></p>
|
|
<input class="aksrt-form-input" type="text" name="contact_details" placeholder="<?php esc_attr_e('输入联系方式', 'aksrt'); ?>">
|
|
</div>
|
|
</div>
|
|
<?php endif; ?>
|
|
|
|
<div class="aksrt-submit-panel">
|
|
<div class="aksrt-submit-panel__title"><?php esc_html_e('文章参数', 'aksrt'); ?></div>
|
|
<div class="aksrt-submit-panel__body term-select-box">
|
|
|
|
<?php if (!empty($settings['allow_category'])) : ?>
|
|
<details class="aksrt-submit-drop" open>
|
|
<summary>
|
|
<span><i class="fa fas fa-folder-open"></i> <?php esc_html_e('分类', 'aksrt'); ?></span>
|
|
<i class="fa fas fa-angle-right"></i>
|
|
</summary>
|
|
<div class="aksrt-submit-drop__body">
|
|
<?php
|
|
if (!empty($ctx['categories'])) {
|
|
aksrt_submit_render_term_checks($ctx['categories'], array_map('intval', $ctx['current_cats']), 'category');
|
|
} else {
|
|
echo '<p class="aksrt-submit-hint">' . esc_html__('暂无可选择的分类', 'aksrt') . '</p>';
|
|
}
|
|
?>
|
|
</div>
|
|
</details>
|
|
<?php endif; ?>
|
|
|
|
<?php if (!empty($settings['custom_filter_s']) && !empty($ctx['custom_dimensions'])) : ?>
|
|
<?php foreach ($ctx['custom_dimensions'] as $dim) :
|
|
$key = sanitize_key((string) ($dim['key'] ?? ''));
|
|
if ($key === '') {
|
|
continue;
|
|
}
|
|
$name = (string) ($dim['name'] ?? $key);
|
|
$vals = is_array($dim['vals'] ?? null) ? $dim['vals'] : [];
|
|
$cur = $ctx['current_cf'][$key] ?? [];
|
|
if (!is_array($cur)) {
|
|
$cur = $cur === '' || $cur === null ? [] : [$cur];
|
|
}
|
|
$cur = array_map('strval', $cur);
|
|
?>
|
|
<details class="aksrt-submit-drop">
|
|
<summary>
|
|
<span><i class="fa fas fa-filter"></i> <?php echo esc_html($name); ?></span>
|
|
<i class="fa fas fa-angle-right"></i>
|
|
</summary>
|
|
<div class="aksrt-submit-drop__body aksrt-submit-tags">
|
|
<?php foreach ($vals as $val) :
|
|
$vk = is_array($val) ? (string) ($val['key'] ?? '') : (string) $val;
|
|
$vn = is_array($val) ? (string) ($val['name'] ?? $vk) : (string) $val;
|
|
if ($vk === '') {
|
|
continue;
|
|
}
|
|
$active = in_array($vk, $cur, true);
|
|
?>
|
|
<label class="aksrt-submit-tag <?php echo $active ? 'is-active' : ''; ?>">
|
|
<input type="checkbox" name="cf_<?php echo esc_attr($key); ?>[]" value="<?php echo esc_attr($vk); ?>" <?php checked($active); ?>>
|
|
<span><?php echo esc_html($vn); ?></span>
|
|
</label>
|
|
<?php endforeach; ?>
|
|
</div>
|
|
</details>
|
|
<?php endforeach; ?>
|
|
<?php endif; ?>
|
|
|
|
<?php if (!empty($settings['allow_tags'])) : ?>
|
|
<div class="aksrt-submit-field">
|
|
<div class="aksrt-submit-field__label">
|
|
<?php esc_html_e('标签', 'aksrt'); ?>
|
|
<?php if (!empty($ctx['ai_available'])) : ?>
|
|
<button type="button" class="aksrt-ai-assist-btn" data-ai-action="tags" hidden><?php esc_html_e('AI 建议标签', 'aksrt'); ?></button>
|
|
<?php endif; ?>
|
|
</div>
|
|
<p class="aksrt-submit-hint"><?php esc_html_e('填写文章的标签,每个标签用逗号隔开', 'aksrt'); ?></p>
|
|
<textarea class="aksrt-form-input" rows="3" name="tags" placeholder="<?php esc_attr_e('输入文章标签', 'aksrt'); ?>"><?php echo esc_textarea((string) $ctx['current_tags']); ?></textarea>
|
|
</div>
|
|
<?php endif; ?>
|
|
|
|
<?php if (!empty($settings['allow_excerpt'])) : ?>
|
|
<div class="aksrt-submit-field">
|
|
<div class="aksrt-submit-field__label">
|
|
<?php esc_html_e('摘要', 'aksrt'); ?>
|
|
<?php if (!empty($ctx['ai_available'])) : ?>
|
|
<button type="button" class="aksrt-ai-assist-btn" data-ai-action="summary" hidden><?php esc_html_e('AI 生成摘要', 'aksrt'); ?></button>
|
|
<?php endif; ?>
|
|
</div>
|
|
<textarea class="aksrt-form-input" rows="3" name="excerpt" maxlength="300" placeholder="<?php esc_attr_e('可选:文章摘要', 'aksrt'); ?>"><?php echo esc_textarea((string) $ctx['current_excerpt']); ?></textarea>
|
|
</div>
|
|
<?php endif; ?>
|
|
</div>
|
|
</div>
|